1 |
;;; artist.el --- draw ascii graphics with your mouse |
;;; artist.el --- draw ascii graphics with your mouse |
2 |
|
|
3 |
;; Copyright (C) 2000 Free Software Foundation, Inc. |
;; Copyright (C) 2000, 2001 Free Software Foundation, Inc. |
4 |
|
|
5 |
;; Author: Tomas Abrahamsson <tab@lysator.liu.se> |
;; Author: Tomas Abrahamsson <tab@lysator.liu.se> |
6 |
;; Maintainer: Tomas Abrahamsson <tab@lysator.liu.se> |
;; Maintainer: Tomas Abrahamsson <tab@lysator.liu.se> |
7 |
;; Keywords: mouse |
;; Keywords: mouse |
8 |
;; Version: 1.2.2 |
;; Version: 1.2.4 |
9 |
;; Release-date: 22-Oct-2000 |
;; Release-date: 25-Oct-2001 |
10 |
;; Location: http://www.lysator.liu.se/~tab/artist/ |
;; Location: http://www.lysator.liu.se/~tab/artist/ |
11 |
|
|
12 |
;; This file is part of GNU Emacs. |
;; This file is part of GNU Emacs. |
136 |
|
|
137 |
;;; ChangeLog: |
;;; ChangeLog: |
138 |
|
|
139 |
|
;; 1.2.4 25-Oct-2001 |
140 |
|
;; Bugfix: Some operations (the edit menu) got hidden |
141 |
|
;; Bugfix: The first arrow for poly-lines was always pointing |
142 |
|
;; to the right |
143 |
|
;; Changed: Updated with changes made for Emacs 21.1 |
144 |
|
;; |
145 |
|
;; 1.2.3 20-Nov-2000 |
146 |
|
;; Bugfix: Autoload cookie corrected |
147 |
|
;; |
148 |
;; 1.2.2 19-Nov-2000 |
;; 1.2.2 19-Nov-2000 |
149 |
;; Changed: More documentation fixes. |
;; Changed: More documentation fixes. |
150 |
;; Bugfix: The arrow characters (`artist-arrows'), which |
;; Bugfix: The arrow characters (`artist-arrows'), which |
187 |
|
|
188 |
;; Variables |
;; Variables |
189 |
|
|
190 |
(defconst artist-version "1.2.2") |
(defconst artist-version "1.2.4") |
191 |
(defconst artist-maintainer-address "tab@lysator.liu.se") |
(defconst artist-maintainer-address "tab@lysator.liu.se") |
192 |
|
|
193 |
|
|
710 |
2 |
2 |
711 |
artist-draw-square |
artist-draw-square |
712 |
(artist-undraw-square |
(artist-undraw-square |
713 |
artist-t artist-cut-square))))) |
artist-t artist-cut-square)))))) |
714 |
|
|
715 |
(graphics-operation |
(graphics-operation |
716 |
("Copy" (("copy rectangle" copy-r "copy-r" |
("Copy" (("copy rectangle" copy-r "copy-r" |
726 |
2 |
2 |
727 |
artist-draw-square |
artist-draw-square |
728 |
(artist-undraw-square |
(artist-undraw-square |
729 |
artist-t artist-copy-square))))) |
artist-t artist-copy-square)))))) |
730 |
|
|
731 |
(graphics-operation |
(graphics-operation |
732 |
("Paste" (("paste" paste "paste" |
("Paste" (("paste" paste "paste" |
754 |
nil nil nil |
nil nil nil |
755 |
1 |
1 |
756 |
artist-flood-fill |
artist-flood-fill |
757 |
nil))))))))) |
nil))))))) |
758 |
|
|
759 |
(menu |
(menu |
760 |
("Settings" |
("Settings" |
1684 |
"Call function FN with ARGS iff FN is not nil." |
"Call function FN with ARGS iff FN is not nil." |
1685 |
(list 'if fn (cons 'funcall (cons fn args)))) |
(list 'if fn (cons 'funcall (cons fn args)))) |
1686 |
|
|
1687 |
|
(defvar artist-butlast-fn 'artist-butlast |
1688 |
|
"The butlast function") |
1689 |
|
|
1690 |
|
(if (fboundp 'butlast) |
1691 |
|
(setq artist-butlast-fn 'butlast) |
1692 |
|
(setq artist-butlast-fn 'artist-butlast)) |
1693 |
|
|
1694 |
|
(defun artist-butlast (l) |
1695 |
|
"Return the list L with all elements but the last." |
1696 |
|
(cond ((null l) nil) |
1697 |
|
((null (cdr l)) nil) |
1698 |
|
(t (cons (car l) (artist-butlast (cdr l)))))) |
1699 |
|
|
1700 |
|
|
1701 |
(defun artist-last (seq &optional n) |
(defun artist-last (seq &optional n) |
1702 |
"Return the last link in the list SEQ. |
"Return the last link in the list SEQ. |
1703 |
With optional argument N, returns Nth-to-last link (default 1)." |
With optional argument N, returns Nth-to-last link (default 1)." |
3364 |
(t c))))) |
(t c))))) |
3365 |
;; The cdr and butlast below is so we don't draw the middle top |
;; The cdr and butlast below is so we don't draw the middle top |
3366 |
;; and middle bottom char twice. |
;; and middle bottom char twice. |
3367 |
(butlast (cdr (reverse right-half))))) |
(funcall artist-butlast-fn (cdr (reverse right-half))))) |
3368 |
(append right-half left-half))) |
(append right-half left-half))) |
3369 |
|
|
3370 |
|
|
4975 |
(y2 y1-last) |
(y2 y1-last) |
4976 |
(is-down t) |
(is-down t) |
4977 |
(shape nil) |
(shape nil) |
4978 |
(point-list (list (artist-make-endpoint x1-last y1-last))) |
(point-list nil) |
4979 |
(done nil)) |
(done nil)) |
4980 |
(select-window (posn-window ev-start)) |
(select-window (posn-window ev-start)) |
4981 |
(artist-funcall init-fn x1-last y1-last) |
(artist-funcall init-fn x1-last y1-last) |
5148 |
(artist-funcall fill-fn point-list)) |
(artist-funcall fill-fn point-list)) |
5149 |
|
|
5150 |
;; Maybe set arrow points |
;; Maybe set arrow points |
5151 |
(if (artist-funcall arrow-pred) |
(if (and point-list (artist-funcall arrow-pred)) |
5152 |
(artist-funcall arrow-set-fn point-list) |
(artist-funcall arrow-set-fn point-list) |
5153 |
(artist-clear-arrow-points)) |
(artist-clear-arrow-points)) |
5154 |
|
|