aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Moellmann2001-04-26 09:30:00 +0000
committerGerd Moellmann2001-04-26 09:30:00 +0000
commitefa89c1f70d954363eaae1201a5b2b41d3398d92 (patch)
tree57a5db86dd7f3efc78e3db21fd50c19246943752
parentd3111e5aa98ca874c2aaaad9047868707b7faa43 (diff)
downloademacs-efa89c1f70d954363eaae1201a5b2b41d3398d92.tar.gz
emacs-efa89c1f70d954363eaae1201a5b2b41d3398d92.zip
Color specified by number is forced to be float number.
(ps-print-version): New version number (6.5.1.1). (ps-header-frame-alist, ps-footer-frame-alist): Adjust color initialization. (ps-prefix-quote): New internal var. (ps-print-quote): New fun. (ps-setup, ps-output-frame-properties, ps-float-format) (ps-format-color): Code fix. (ps-plot-region): Eliminate redundant foreground color text setting.
-rw-r--r--lisp/ChangeLog13
-rw-r--r--lisp/ps-print.el131
2 files changed, 82 insertions, 62 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 2a5394adc7a..06b679a80b4 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,16 @@
12001-04-26 Vinicius Jose Latorre <vinicius@cpqd.com.br>
2
3 * ps-print.el: Color specified by number is forced to be float number.
4 (ps-print-version): New version number (6.5.1.1).
5 (ps-header-frame-alist, ps-footer-frame-alist): Adjust color
6 initialization.
7 (ps-prefix-quote): New internal var.
8 (ps-print-quote): New fun.
9 (ps-setup, ps-output-frame-properties, ps-float-format)
10 (ps-format-color): Code fix.
11 (ps-plot-region): Eliminate redundant foreground color text
12 setting.
13
12001-04-26 Eli Zaretskii <eliz@is.elta.co.il> 142001-04-26 Eli Zaretskii <eliz@is.elta.co.il>
2 15
3 * dabbrev.el (dabbrev--select-buffers): Add a doc string. 16 * dabbrev.el (dabbrev--select-buffers): Add a doc string.
diff --git a/lisp/ps-print.el b/lisp/ps-print.el
index 30ceb3fc9bf..2763d55f0f4 100644
--- a/lisp/ps-print.el
+++ b/lisp/ps-print.el
@@ -10,12 +10,12 @@
10;; Maintainer: Kenichi Handa <handa@etl.go.jp> (multi-byte characters) 10;; Maintainer: Kenichi Handa <handa@etl.go.jp> (multi-byte characters)
11;; Maintainer: Vinicius Jose Latorre <vinicius@cpqd.com.br> 11;; Maintainer: Vinicius Jose Latorre <vinicius@cpqd.com.br>
12;; Keywords: wp, print, PostScript 12;; Keywords: wp, print, PostScript
13;; Time-stamp: <2001/04/07 13:41:03 Vinicius> 13;; Time-stamp: <2001/04/24 15:31:37 vinicius>
14;; Version: 6.5.1 14;; Version: 6.5.1.1
15;; X-URL: http://www.cpqd.com.br/~vinicius/emacs/ 15;; X-URL: http://www.cpqd.com.br/~vinicius/emacs/
16 16
17(defconst ps-print-version "6.5.1" 17(defconst ps-print-version "6.5.1.1"
18 "ps-print.el, v 6.5.1 <2001/04/07 vinicius> 18 "ps-print.el, v 6.5.1.1 <2001/04/24 vinicius>
19 19
20Vinicius's last change version -- this file may have been edited as part of 20Vinicius's last change version -- this file may have been edited as part of
21Emacs without changes to the version number. When reporting bugs, please also 21Emacs without changes to the version number. When reporting bugs, please also
@@ -2338,11 +2338,11 @@ changing variables `ps-left-header' and `ps-right-header'."
2338 :group 'ps-print-headers) 2338 :group 'ps-print-headers)
2339 2339
2340(defcustom ps-header-frame-alist 2340(defcustom ps-header-frame-alist
2341 '((fore-color . 0) 2341 '((fore-color . 0.0)
2342 (back-color . 0.9) 2342 (back-color . 0.9)
2343 (border-width . 0.4) 2343 (border-width . 0.4)
2344 (border-color . 0) 2344 (border-color . 0.0)
2345 (shadow-color . 0)) 2345 (shadow-color . 0.0))
2346 "*Specify header frame properties alist. 2346 "*Specify header frame properties alist.
2347 2347
2348Valid frame properties are: 2348Valid frame properties are:
@@ -2375,9 +2375,9 @@ Don't change this alist directly, instead use customization, or `ps-value',
2375 (const :format "" fore-color) 2375 (const :format "" fore-color)
2376 (choice :menu-tag "Foreground Color" 2376 (choice :menu-tag "Foreground Color"
2377 :tag "Foreground Color" 2377 :tag "Foreground Color"
2378 (number :tag "Gray Scale" :value 0) 2378 (number :tag "Gray Scale" :value 0.0)
2379 (string :tag "Color Name" :value "black") 2379 (string :tag "Color Name" :value "black")
2380 (list :tag "RGB Color" :value (0 0 0) 2380 (list :tag "RGB Color" :value (0.0 0.0 0.0)
2381 (number :tag "Red") 2381 (number :tag "Red")
2382 (number :tag "Green") 2382 (number :tag "Green")
2383 (number :tag "Blue")))) 2383 (number :tag "Blue"))))
@@ -2398,9 +2398,9 @@ Don't change this alist directly, instead use customization, or `ps-value',
2398 (const :format "" border-color) 2398 (const :format "" border-color)
2399 (choice :menu-tag "Border Color" 2399 (choice :menu-tag "Border Color"
2400 :tag "Border Color" 2400 :tag "Border Color"
2401 (number :tag "Gray Scale" :value 0) 2401 (number :tag "Gray Scale" :value 0.0)
2402 (string :tag "Color Name" :value "black") 2402 (string :tag "Color Name" :value "black")
2403 (list :tag "RGB Color" :value (0 0 0) 2403 (list :tag "RGB Color" :value (0.0 0.0 0.0)
2404 (number :tag "Red") 2404 (number :tag "Red")
2405 (number :tag "Green") 2405 (number :tag "Green")
2406 (number :tag "Blue")))) 2406 (number :tag "Blue"))))
@@ -2408,9 +2408,9 @@ Don't change this alist directly, instead use customization, or `ps-value',
2408 (const :format "" shadow-color) 2408 (const :format "" shadow-color)
2409 (choice :menu-tag "Shadow Color" 2409 (choice :menu-tag "Shadow Color"
2410 :tag "Shadow Color" 2410 :tag "Shadow Color"
2411 (number :tag "Gray Scale" :value 0) 2411 (number :tag "Gray Scale" :value 0.0)
2412 (string :tag "Color Name" :value "black") 2412 (string :tag "Color Name" :value "black")
2413 (list :tag "RGB Color" :value (0 0 0) 2413 (list :tag "RGB Color" :value (0.0 0.0 0.0)
2414 (number :tag "Red") 2414 (number :tag "Red")
2415 (number :tag "Green") 2415 (number :tag "Green")
2416 (number :tag "Blue")))))) 2416 (number :tag "Blue"))))))
@@ -2437,11 +2437,11 @@ Footers are customizable by changing variables `ps-left-footer' and
2437 :group 'ps-print-headers) 2437 :group 'ps-print-headers)
2438 2438
2439(defcustom ps-footer-frame-alist 2439(defcustom ps-footer-frame-alist
2440 '((fore-color . 0) 2440 '((fore-color . 0.0)
2441 (back-color . 0.9) 2441 (back-color . 0.9)
2442 (border-width . 0.4) 2442 (border-width . 0.4)
2443 (border-color . 0) 2443 (border-color . 0.0)
2444 (shadow-color . 0)) 2444 (shadow-color . 0.0))
2445 "*Specify footer frame properties alist. 2445 "*Specify footer frame properties alist.
2446 2446
2447Don't change this alist directly, instead use customization, or `ps-value', 2447Don't change this alist directly, instead use customization, or `ps-value',
@@ -2456,9 +2456,9 @@ See also `ps-header-frame-alist' for documentation."
2456 (const :format "" fore-color) 2456 (const :format "" fore-color)
2457 (choice :menu-tag "Foreground Color" 2457 (choice :menu-tag "Foreground Color"
2458 :tag "Foreground Color" 2458 :tag "Foreground Color"
2459 (number :tag "Gray Scale" :value 0) 2459 (number :tag "Gray Scale" :value 0.0)
2460 (string :tag "Color Name" :value "black") 2460 (string :tag "Color Name" :value "black")
2461 (list :tag "RGB Color" :value (0 0 0) 2461 (list :tag "RGB Color" :value (0.0 0.0 0.0)
2462 (number :tag "Red") 2462 (number :tag "Red")
2463 (number :tag "Green") 2463 (number :tag "Green")
2464 (number :tag "Blue")))) 2464 (number :tag "Blue"))))
@@ -2479,9 +2479,9 @@ See also `ps-header-frame-alist' for documentation."
2479 (const :format "" border-color) 2479 (const :format "" border-color)
2480 (choice :menu-tag "Border Color" 2480 (choice :menu-tag "Border Color"
2481 :tag "Border Color" 2481 :tag "Border Color"
2482 (number :tag "Gray Scale" :value 0) 2482 (number :tag "Gray Scale" :value 0.0)
2483 (string :tag "Color Name" :value "black") 2483 (string :tag "Color Name" :value "black")
2484 (list :tag "RGB Color" :value (0 0 0) 2484 (list :tag "RGB Color" :value (0.0 0.0 0.0)
2485 (number :tag "Red") 2485 (number :tag "Red")
2486 (number :tag "Green") 2486 (number :tag "Green")
2487 (number :tag "Blue")))) 2487 (number :tag "Blue"))))
@@ -2489,9 +2489,9 @@ See also `ps-header-frame-alist' for documentation."
2489 (const :format "" shadow-color) 2489 (const :format "" shadow-color)
2490 (choice :menu-tag "Shadow Color" 2490 (choice :menu-tag "Shadow Color"
2491 :tag "Shadow Color" 2491 :tag "Shadow Color"
2492 (number :tag "Gray Scale" :value 0) 2492 (number :tag "Gray Scale" :value 0.0)
2493 (string :tag "Color Name" :value "black") 2493 (string :tag "Color Name" :value "black")
2494 (list :tag "RGB Color" :value (0 0 0) 2494 (list :tag "RGB Color" :value (0.0 0.0 0.0)
2495 (number :tag "Red") 2495 (number :tag "Red")
2496 (number :tag "Green") 2496 (number :tag "Green")
2497 (number :tag "Blue")))))) 2497 (number :tag "Blue"))))))
@@ -3274,34 +3274,14 @@ The table depends on the current ps-print setup."
3274 (interactive (list (count-lines (mark) (point)))) 3274 (interactive (list (count-lines (mark) (point))))
3275 (ps-nb-pages nb-lines)) 3275 (ps-nb-pages nb-lines))
3276 3276
3277(defvar ps-prefix-quote nil)
3278
3277;;;###autoload 3279;;;###autoload
3278(defun ps-setup () 3280(defun ps-setup ()
3279 "Return the current PostScript-generation setup." 3281 "Return the current PostScript-generation setup."
3280 (let (prefix) 3282 (let (ps-prefix-quote)
3281 (mapconcat 3283 (mapconcat
3282 #'(lambda (elt) 3284 #'ps-print-quote
3283 (cond
3284 ((null elt) "")
3285 ((stringp elt) elt)
3286 (t
3287 (let* ((col (car elt))
3288 (sym (cdr elt))
3289 (key (symbol-name sym))
3290 (len (length key))
3291 (val (symbol-value sym)))
3292 (concat (if prefix
3293 prefix
3294 (setq prefix " ")
3295 "(setq ")
3296 key
3297 (if (> col len)
3298 (make-string (- col len) ?\ )
3299 " ")
3300 (cond ((null val) "nil")
3301 ((eq val t) "t")
3302 ((or (symbolp val) (listp val)) (format "'%S" val))
3303 (t (format "%S" val))))))
3304 ))
3305 (list 3285 (list
3306 (concat "\n;;; ps-print version " ps-print-version "\n") 3286 (concat "\n;;; ps-print version " ps-print-version "\n")
3307 '(25 . ps-print-color-p) 3287 '(25 . ps-print-color-p)
@@ -3420,6 +3400,31 @@ The table depends on the current ps-print setup."
3420;; Utility functions and variables: 3400;; Utility functions and variables:
3421 3401
3422 3402
3403(defun ps-print-quote (elt)
3404 (cond
3405 ((null elt) "")
3406 ((stringp elt) elt)
3407 (t
3408 (let* ((col (car elt))
3409 (sym (cdr elt))
3410 (key (symbol-name sym))
3411 (len (length key))
3412 (val (symbol-value sym)))
3413 (concat (if ps-prefix-quote
3414 ps-prefix-quote
3415 (setq ps-prefix-quote " ")
3416 "(setq ")
3417 key
3418 (if (> col len)
3419 (make-string (- col len) ?\ )
3420 " ")
3421 (cond ((null val) "nil")
3422 ((eq val t) "t")
3423 ((or (symbolp val) (listp val)) (format "'%S" val))
3424 (t (format "%S" val))))))
3425 ))
3426
3427
3423(defun ps-value (alist-sym key) 3428(defun ps-value (alist-sym key)
3424 "Return value from association list ALIST-SYM which car is `eq' to KEY." 3429 "Return value from association list ALIST-SYM which car is `eq' to KEY."
3425 (cdr (assq key (symbol-value alist-sym)))) 3430 (cdr (assq key (symbol-value alist-sym))))
@@ -4455,11 +4460,11 @@ page-height == ((floor print-height ((th + ls) * zh)) * ((th + ls) * zh)) - th
4455 4460
4456(defun ps-output-frame-properties (name alist) 4461(defun ps-output-frame-properties (name alist)
4457 (ps-output "/" name " [" 4462 (ps-output "/" name " ["
4458 (ps-format-color (cdr (assq 'fore-color alist)) 0) 4463 (ps-format-color (cdr (assq 'fore-color alist)) 0.0)
4459 (ps-format-color (cdr (assq 'back-color alist)) 0.9) 4464 (ps-format-color (cdr (assq 'back-color alist)) 0.9)
4460 (ps-float-format (or (cdr (assq 'border-width alist)) 0.4)) 4465 (ps-float-format (or (cdr (assq 'border-width alist)) 0.4))
4461 (ps-format-color (cdr (assq 'border-color alist)) 0) 4466 (ps-format-color (cdr (assq 'border-color alist)) 0.0)
4462 (ps-format-color (cdr (assq 'shadow-color alist)) 0) 4467 (ps-format-color (cdr (assq 'shadow-color alist)) 0.0)
4463 "]def\n")) 4468 "]def\n"))
4464 4469
4465 4470
@@ -4507,12 +4512,13 @@ page-height == ((floor print-height ((th + ls) * zh)) * ((th + ls) * zh)) - th
4507 4512
4508(defun ps-float-format (value &optional default) 4513(defun ps-float-format (value &optional default)
4509 (let ((literal (or value default))) 4514 (let ((literal (or value default)))
4510 (if literal 4515 (cond ((null literal)
4511 (format (if (numberp literal) 4516 " ")
4512 ps-float-format 4517 ((numberp literal)
4513 "%s ") 4518 (format ps-float-format (* literal 1.0))) ; force float number
4514 literal) 4519 (t
4515 " "))) 4520 (format "%s " literal))
4521 )))
4516 4522
4517 4523
4518(defun ps-background-text () 4524(defun ps-background-text ()
@@ -5297,9 +5303,9 @@ XSTART YSTART are the relative position for the first page in a sheet.")
5297 (if (and the-color (listp the-color)) 5303 (if (and the-color (listp the-color))
5298 (concat "[" 5304 (concat "["
5299 (format ps-color-format 5305 (format ps-color-format
5300 (nth 0 the-color) 5306 (* (nth 0 the-color) 1.0) ; force float number
5301 (nth 1 the-color) 5307 (* (nth 1 the-color) 1.0) ; force float number
5302 (nth 2 the-color)) 5308 (* (nth 2 the-color) 1.0)) ; force float number
5303 "] ") 5309 "] ")
5304 (ps-float-format (if (numberp the-color) the-color default))))) 5310 (ps-float-format (if (numberp the-color) the-color default)))))
5305 5311
@@ -5644,15 +5650,16 @@ XSTART YSTART are the relative position for the first page in a sheet.")
5644 5650
5645 5651
5646(defun ps-plot-region (from to font &optional fg-color bg-color effects) 5652(defun ps-plot-region (from to font &optional fg-color bg-color effects)
5647 (if (not (equal font ps-current-font)) 5653 (or (equal font ps-current-font)
5648 (ps-set-font font)) 5654 (ps-set-font font))
5649 5655
5650 ;; Specify a foreground color only if one's specified and it's 5656 ;; Specify a foreground color only if one's specified and it's
5651 ;; different than the current. 5657 ;; different than the current.
5652 (if (not (equal fg-color ps-current-color)) 5658 (let ((fg (or fg-color ps-default-foreground)))
5653 (ps-set-color fg-color)) 5659 (or (equal fg ps-current-color)
5660 (ps-set-color fg)))
5654 5661
5655 (if (not (equal bg-color ps-current-bg)) 5662 (or (equal bg-color ps-current-bg)
5656 (ps-set-bg bg-color)) 5663 (ps-set-bg bg-color))
5657 5664
5658 ;; Specify effects (underline, overline, box, etc) 5665 ;; Specify effects (underline, overline, box, etc)