;;; artist.el --- draw ascii graphics with your mouse
-;; Copyright (C) 2000-2015 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2016 Free Software Foundation, Inc.
;; Author: Tomas Abrahamsson <tab@lysator.liu.se>
;; Maintainer: Tomas Abrahamsson <tab@lysator.liu.se>
(defcustom artist-ellipse-right-char ?\)
"Character to use at the rightmost position when drawing narrow ellipses.
-In this figure, it is the right parenthesis (the ``)'' character):
+In this figure, it is the right parenthesis (the \")\" character):
-----
( )
-----"
(defcustom artist-ellipse-left-char ?\(
"Character to use at the leftmost position when drawing narrow ellipses.
-In this figure, it is the left parenthesis (the ``('' character):
+In this figure, it is the left parenthesis (the \"(\" character):
-----
( )
-----"
it as one line.
Example:
If `artist-vaporize-fuzziness' is 2, then those will be recognized as
- lines from A to B (provided you start vaporizing them at the ``*''):
+ lines from A to B (provided you start vaporizing them at the \"*\"):
/
A----*------/-----------B
\\/
\\/ /
A----*----/\\/----------B
/ /\\
- (in fact, only the left part [between the A and the leftmost ``/''
+ (in fact, only the left part [between the A and the leftmost \"/\"
crossing the line] will be vaporized)."
:group 'artist
:type 'integer)
;; This is a defvar, not a defcustom, since the custom
;; package shows lists of characters as a lists of integers,
;; which is confusing
- "Characters (``color'') to use when spraying.
-They should be ordered from the ``lightest'' to the ``heaviest''
+ "Characters (\"color\") to use when spraying.
+They should be ordered from the \"lightest\" to the \"heaviest\"
since spraying replaces a light character with the next heavier one.")
* Cut copies, then clears the rectangle/square.
* When drawing lines or poly-lines, you can set arrows.
- See below under ``Arrows'' for more info.
+ See below under \"Arrows\" for more info.
* The mode line shows the currently selected drawing operation.
In addition, if it has an asterisk (*) at the end, you
artist-vaporize-fuzziness Tolerance when recognizing lines
artist-spray-interval Seconds between repeated sprayings
artist-spray-radius Size of the spray-area
- artist-spray-chars The spray-``color''
- artist-spray-new-chars Initial spray-``color''
+ artist-spray-chars The spray-\"color\"
+ artist-spray-new-chars Initial spray-\"color\"
Hooks
(defsubst artist-replace-string (string &optional see-thru)
"Replace contents at point with STRING.
With optional argument SEE-THRU set to non-nil, text in the buffer
-``shines thru'' blanks in the STRING."
+\"shines thru\" blanks in the STRING."
(let ((char-list (append string nil)) ; convert the string to a list
(overwrite-mode 'overwrite-mode-textual)
(fill-column 32765) ; Large :-)
;; Pretend we are plotting a pixel. Instead we just list it
;;
(defmacro artist-put-pixel (point-list x y)
- "In POINT-LIST, store a ``pixel'' at coord X,Y."
+ "In POINT-LIST, store a \"pixel\" at coord X,Y."
`(setq ,point-list
(append ,point-list (list (artist-new-coord ,x ,y)))))
(error "Failed to read available fonts: %s (%d)" stderr exit-code))
(artist-string-split stdout ".flf\n")))
+(defun artist-figlet-get-font-list-windows ()
+ "Read in fonts on MS-Windows by collecting output of the `figlet' program.
+Returns a list of strings."
+ (let* ((ls-cmd "figlet -I2")
+ (result (artist-system shell-file-name nil
+ (list shell-command-switch ls-cmd)))
+ (exit-code (elt result 0))
+ (stdout (elt result 1))
+ (stderr (elt result 2)))
+ (if (not (= exit-code 0))
+ (error "Failed to read available fonts: %s (%d)" stderr exit-code))
+ (let ((dir-list (artist-string-split stdout "\n"))
+ result)
+ (mapc
+ (lambda (dir)
+ (let ((default-directory dir))
+ (setq result (append (file-expand-wildcards "*.flf") result))))
+ dir-list)
+ (mapcar
+ (lambda (file)
+ (replace-regexp-in-string "\.flf\\'" "" file))
+ result))))
+
(defun artist-figlet-choose-font ()
"Read any extra arguments for figlet."
(interactive)
- (let* ((avail-fonts (artist-figlet-get-font-list))
+ (let* ((avail-fonts
+ (if (memq system-type '(windows-nt ms-dos))
+ (artist-figlet-get-font-list-windows)
+ (artist-figlet-get-font-list)))
(font (completing-read (concat "Select font (default "
artist-figlet-default-font
"): ")
`artist-text-renderer-function', which must return a list of strings,
to be inserted in the buffer.
-Text already in the buffer ``shines thru'' blanks in the rendered text."
+Text already in the buffer \"shines thru\" blanks in the rendered text."
(let* ((input-text (read-string "Type text to render: "))
(rendered-text (artist-funcall artist-text-renderer-function input-text)))
(artist-text-insert-see-thru x y rendered-text)))
(artist-no-rb-set-point1 x1 y1))
(unwind-protect
(track-mouse
+ ;; We don't want flickering of mouse pointer shape while we
+ ;; drag the mouse.
+ (setq track-mouse 'dragging)
(while (or (mouse-movement-p ev)
(member 'down (event-modifiers ev)))
(setq ev-start-pos (artist-coord-win-to-buf