diff options
| -rw-r--r-- | lisp/ChangeLog | 21 | ||||
| -rw-r--r-- | lisp/textmodes/artist.el | 124 |
2 files changed, 81 insertions, 64 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 641c99f9aad..7e70fd52e23 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,24 @@ | |||
| 1 | 2008-11-24 Juanma Barranquero <lekktu@gmail.com> | ||
| 2 | |||
| 3 | * textmodes/artist.el (artist-charlist-to-string): Simplify. | ||
| 4 | (artist-mode-name, artist-mt, artist-vaporize-fuzziness) | ||
| 5 | (artist-prev-next-op-alist, artist-mode-line-show-curr-operation) | ||
| 6 | (artist-replace-string, artist-draw-rect, artist-draw-line) | ||
| 7 | (artist-undraw-line, artist-draw-sline, artist-undraw-rect) | ||
| 8 | (artist-rect-corners-squarify, artist-undraw-square, artist-fill-square) | ||
| 9 | (artist-pen, artist-pen-line, artist-text-insert-common) | ||
| 10 | (artist-text-overwrite, artist-spray-get-interval) | ||
| 11 | (artist-spray-clear-circle, artist-erase-char) | ||
| 12 | (artist-ellipse-generate-quadrant, artist-copy-square, artist-paste) | ||
| 13 | (artist-flood-fill, artist-key-draw-continously, artist-key-draw-poly) | ||
| 14 | (artist-key-draw-1point, artist-key-draw-2points) | ||
| 15 | (artist-mouse-draw-continously): Fix typos in docstrings. | ||
| 16 | (artist-aspect-ratio, artist-mode, artist-go-get-symbol-shift) | ||
| 17 | (artist-go-get-symbol-shift-sub, artist-previous-line, artist-next-line) | ||
| 18 | (artist-backward-char, artist-forward-char): Doc fixes. | ||
| 19 | (artist-vaporize-line, artist-spray-chars, artist-spray-new-char): | ||
| 20 | Reflow docstrings. | ||
| 21 | |||
| 1 | 2008-11-24 Stefan Monnier <monnier@iro.umontreal.ca> | 22 | 2008-11-24 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 23 | ||
| 3 | * international/quail.el (quail-vunion): New function. | 24 | * international/quail.el (quail-vunion): New function. |
diff --git a/lisp/textmodes/artist.el b/lisp/textmodes/artist.el index 29ecd403748..61ca6607809 100644 --- a/lisp/textmodes/artist.el +++ b/lisp/textmodes/artist.el | |||
| @@ -263,7 +263,7 @@ The directions are as follows: | |||
| 263 | 263 | ||
| 264 | (defcustom artist-aspect-ratio 1 | 264 | (defcustom artist-aspect-ratio 1 |
| 265 | "Defines the character height-to-width aspect ratio. | 265 | "Defines the character height-to-width aspect ratio. |
| 266 | This is used when drawing squares and circles. If the height of the" | 266 | This is used when drawing squares and circles." |
| 267 | :group 'artist | 267 | :group 'artist |
| 268 | :type 'number) | 268 | :type 'number) |
| 269 | 269 | ||
| @@ -343,8 +343,8 @@ Example: | |||
| 343 | \\/ / | 343 | \\/ / |
| 344 | A----*----/\\/----------B | 344 | A----*----/\\/----------B |
| 345 | / /\\ | 345 | / /\\ |
| 346 | (in fact, only the left part (between the A and the leftmost ``/'' | 346 | (in fact, only the left part [between the A and the leftmost ``/'' |
| 347 | crossing the line) will be vaporized)" | 347 | crossing the line] will be vaporized)." |
| 348 | :group 'artist | 348 | :group 'artist |
| 349 | :type 'integer) | 349 | :type 'integer) |
| 350 | 350 | ||
| @@ -399,17 +399,15 @@ Example: | |||
| 399 | ;; package shows lists of characters as a lists of integers, | 399 | ;; package shows lists of characters as a lists of integers, |
| 400 | ;; which is confusing | 400 | ;; which is confusing |
| 401 | "*Characters (``color'') to use when spraying. | 401 | "*Characters (``color'') to use when spraying. |
| 402 | They should be ordered | 402 | They should be ordered from the ``lightest'' to the ``heaviest'' |
| 403 | from the ``lightest'' to the ``heaviest'' since spraying replaces a | 403 | since spraying replaces a light character with the next heavier one.") |
| 404 | light character with the next heavier one.") | ||
| 405 | 404 | ||
| 406 | 405 | ||
| 407 | (defvar artist-spray-new-char ?. | 406 | (defvar artist-spray-new-char ?. |
| 408 | "*Initial character to use when spraying. | 407 | "*Initial character to use when spraying. |
| 409 | This character is used if spraying upon a character that is | 408 | This character is used if spraying upon a character that is not in |
| 410 | not in `artist-spray-chars'. The character defined by this variable | 409 | `artist-spray-chars'. The character defined by this variable should |
| 411 | should be in `artist-spray-chars', or spraying will behave | 410 | be in `artist-spray-chars', or spraying will behave strangely.") |
| 412 | strangely.") | ||
| 413 | 411 | ||
| 414 | 412 | ||
| 415 | ;; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | 413 | ;; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| @@ -423,7 +421,7 @@ strangely.") | |||
| 423 | (make-variable-buffer-local 'artist-mode) | 421 | (make-variable-buffer-local 'artist-mode) |
| 424 | 422 | ||
| 425 | (defvar artist-mode-name " Artist" | 423 | (defvar artist-mode-name " Artist" |
| 426 | "Name of artist mode beginning with a space (appears in the mode-line).") | 424 | "Name of Artist mode beginning with a space (appears in the mode-line).") |
| 427 | 425 | ||
| 428 | (defvar artist-curr-go 'pen-char | 426 | (defvar artist-curr-go 'pen-char |
| 429 | "Current selected graphics operation.") | 427 | "Current selected graphics operation.") |
| @@ -477,7 +475,7 @@ where the elements are as follows: | |||
| 477 | * OP is an atom: the KEY-SYMBOL in the `artist-mt' structure | 475 | * OP is an atom: the KEY-SYMBOL in the `artist-mt' structure |
| 478 | * PREV-OP and NEXT-OP are strings: the KEYWORD in the `artist-mt' structure | 476 | * PREV-OP and NEXT-OP are strings: the KEYWORD in the `artist-mt' structure |
| 479 | 477 | ||
| 480 | This variable is initialized by the artist-make-prev-next-op-alist function.") | 478 | This variable is initialized by the `artist-make-prev-next-op-alist' function.") |
| 481 | 479 | ||
| 482 | (eval-when-compile | 480 | (eval-when-compile |
| 483 | ;; Make rect available at compile-time | 481 | ;; Make rect available at compile-time |
| @@ -803,7 +801,7 @@ This variable is initialized by the artist-make-prev-next-op-alist function.") | |||
| 803 | 801 | ||
| 804 | "Master Table for `artist-mode'. | 802 | "Master Table for `artist-mode'. |
| 805 | This table is primarily a table over the different graphics operations | 803 | This table is primarily a table over the different graphics operations |
| 806 | available in artist mode, but it also holds layout information for the | 804 | available in Artist mode, but it also holds layout information for the |
| 807 | popup menu. | 805 | popup menu. |
| 808 | 806 | ||
| 809 | The master table is a list of table elements. The elements of this table | 807 | The master table is a list of table elements. The elements of this table |
| @@ -935,7 +933,7 @@ If DRAW-HOW is 2: | |||
| 935 | 933 | ||
| 936 | ENDPOINT-1 and ENDPOINT-2 are endpoints which are created with | 934 | ENDPOINT-1 and ENDPOINT-2 are endpoints which are created with |
| 937 | `artist-make-endpoint' | 935 | `artist-make-endpoint' |
| 938 | SHAPE is an opaque structure, created by the DRAW-FN and intented | 936 | SHAPE is an opaque structure, created by the DRAW-FN and intended |
| 939 | to be used only by the UNDRAW-FN. | 937 | to be used only by the UNDRAW-FN. |
| 940 | 938 | ||
| 941 | If DRAW-HOW is `artist-do-poly': | 939 | If DRAW-HOW is `artist-do-poly': |
| @@ -950,7 +948,7 @@ If DRAW-HOW is `artist-do-poly': | |||
| 950 | 948 | ||
| 951 | ENDPOINT-1 and ENDPOINT-2 are endpoints which are created with | 949 | ENDPOINT-1 and ENDPOINT-2 are endpoints which are created with |
| 952 | `artist-make-endpoint'. | 950 | `artist-make-endpoint'. |
| 953 | SHAPE is an opaque structure, created by the DRAW-FN and intented | 951 | SHAPE is an opaque structure, created by the DRAW-FN and intended |
| 954 | to be used only by the UNDRAW-FN. | 952 | to be used only by the UNDRAW-FN. |
| 955 | POINT-LIST is a list of vectors [X Y].") | 953 | POINT-LIST is a list of vectors [X Y].") |
| 956 | 954 | ||
| @@ -1156,11 +1154,12 @@ PREV-OP-ARG are used when invoked recursively during the build-up." | |||
| 1156 | 1154 | ||
| 1157 | ;;;###autoload | 1155 | ;;;###autoload |
| 1158 | (defun artist-mode (&optional state) | 1156 | (defun artist-mode (&optional state) |
| 1159 | "Toggle artist mode. With arg, turn artist mode on if arg is positive. | 1157 | "Toggle Artist mode. |
| 1160 | Artist lets you draw lines, squares, rectangles and poly-lines, ellipses | 1158 | With argument STATE, turn Artist mode on if STATE is positive. |
| 1161 | and circles with your mouse and/or keyboard. | 1159 | Artist lets you draw lines, squares, rectangles and poly-lines, |
| 1160 | ellipses and circles with your mouse and/or keyboard. | ||
| 1162 | 1161 | ||
| 1163 | How to quit artist mode | 1162 | How to quit Artist mode |
| 1164 | 1163 | ||
| 1165 | Type \\[artist-mode-off] to quit artist-mode. | 1164 | Type \\[artist-mode-off] to quit artist-mode. |
| 1166 | 1165 | ||
| @@ -1215,10 +1214,10 @@ Drawing with the mouse: | |||
| 1215 | * Straight lines can only go horizontally, vertically | 1214 | * Straight lines can only go horizontally, vertically |
| 1216 | or diagonally. | 1215 | or diagonally. |
| 1217 | 1216 | ||
| 1218 | * Poly-lines are drawn while holding mouse-1 down. When you | 1217 | * Poly-lines are drawn while holding mouse-1 down. When you |
| 1219 | release the button, the point is set. If you want a segment | 1218 | release the button, the point is set. If you want a segment |
| 1220 | to be straight, hold down shift before pressing the | 1219 | to be straight, hold down shift before pressing the |
| 1221 | mouse-1 button. Click mouse-2 or mouse-3 to stop drawing | 1220 | mouse-1 button. Click mouse-2 or mouse-3 to stop drawing |
| 1222 | poly-lines. | 1221 | poly-lines. |
| 1223 | 1222 | ||
| 1224 | * See thru for text means that text already in the buffer | 1223 | * See thru for text means that text already in the buffer |
| @@ -1226,7 +1225,7 @@ Drawing with the mouse: | |||
| 1226 | overwrite means the opposite. | 1225 | overwrite means the opposite. |
| 1227 | 1226 | ||
| 1228 | * Vaporizing connected lines only vaporizes lines whose | 1227 | * Vaporizing connected lines only vaporizes lines whose |
| 1229 | _endpoints_ are connected. See also the variable | 1228 | _endpoints_ are connected. See also the variable |
| 1230 | `artist-vaporize-fuzziness'. | 1229 | `artist-vaporize-fuzziness'. |
| 1231 | 1230 | ||
| 1232 | * Cut copies, then clears the rectangle/square. | 1231 | * Cut copies, then clears the rectangle/square. |
| @@ -1259,7 +1258,7 @@ Settings | |||
| 1259 | Trimming Toggles trimming of line-endings (that is: when the shape | 1258 | Trimming Toggles trimming of line-endings (that is: when the shape |
| 1260 | is drawn, extraneous white-space at end of lines is removed) | 1259 | is drawn, extraneous white-space at end of lines is removed) |
| 1261 | 1260 | ||
| 1262 | Borders Toggles the drawing of line borders around filled shapes. | 1261 | Borders Toggles the drawing of line borders around filled shapes |
| 1263 | 1262 | ||
| 1264 | 1263 | ||
| 1265 | Drawing with keys | 1264 | Drawing with keys |
| @@ -1441,7 +1440,7 @@ Keymap summary | |||
| 1441 | (sit-for 0)) | 1440 | (sit-for 0)) |
| 1442 | 1441 | ||
| 1443 | (defun artist-mode-line-show-curr-operation (is-drawing) | 1442 | (defun artist-mode-line-show-curr-operation (is-drawing) |
| 1444 | "Show current operation in mode-line. If IS-DRAWING, show that." | 1443 | "Show current operation in mode-line. If IS-DRAWING, show that." |
| 1445 | (let ((mtext (concat artist-mode-name "/" | 1444 | (let ((mtext (concat artist-mode-name "/" |
| 1446 | (artist-go-get-mode-line-from-symbol artist-curr-go) | 1445 | (artist-go-get-mode-line-from-symbol artist-curr-go) |
| 1447 | (if is-drawing "/*" "")))) | 1446 | (if is-drawing "/*" "")))) |
| @@ -1684,13 +1683,13 @@ info-variant-part." | |||
| 1684 | (defun artist-go-get-symbol-shift (symbol is-shifted) | 1683 | (defun artist-go-get-symbol-shift (symbol is-shifted) |
| 1685 | "Search for (shifted or unshifted) graphics operation SYMBOL. | 1684 | "Search for (shifted or unshifted) graphics operation SYMBOL. |
| 1686 | If IS-SHIFTED is non-nil, return the shifted symbol, | 1685 | If IS-SHIFTED is non-nil, return the shifted symbol, |
| 1687 | otherwise the shifted symbol." | 1686 | otherwise the unshifted symbol." |
| 1688 | (artist-go-get-symbol-shift-sub artist-mt symbol is-shifted)) | 1687 | (artist-go-get-symbol-shift-sub artist-mt symbol is-shifted)) |
| 1689 | 1688 | ||
| 1690 | (defun artist-go-get-symbol-shift-sub (table symbol is-shifted) | 1689 | (defun artist-go-get-symbol-shift-sub (table symbol is-shifted) |
| 1691 | "Search TABLE for (shifted or unshifted) graphics SYMBOL. | 1690 | "Search TABLE for (shifted or unshifted) graphics SYMBOL. |
| 1692 | If IS-SHIFTED is non-nil, return the shifted symbol, | 1691 | If IS-SHIFTED is non-nil, return the shifted symbol, |
| 1693 | otherwise the shifted symbol." | 1692 | otherwise the unshifted symbol." |
| 1694 | (catch 'found | 1693 | (catch 'found |
| 1695 | (mapc | 1694 | (mapc |
| 1696 | (lambda (element) | 1695 | (lambda (element) |
| @@ -2010,7 +2009,7 @@ The replacement is used to convert tabs and new-lines to spaces." | |||
| 2010 | 2009 | ||
| 2011 | (defsubst artist-replace-string (string &optional see-thru) | 2010 | (defsubst artist-replace-string (string &optional see-thru) |
| 2012 | "Replace contents at point with STRING. | 2011 | "Replace contents at point with STRING. |
| 2013 | With optional argument SEE-THRU, set to non-nil, text in the buffer | 2012 | With optional argument SEE-THRU set to non-nil, text in the buffer |
| 2014 | ``shines thru'' blanks in the STRING." | 2013 | ``shines thru'' blanks in the STRING." |
| 2015 | (let ((char-list (append string nil)) ; convert the string to a list | 2014 | (let ((char-list (append string nil)) ; convert the string to a list |
| 2016 | (overwrite-mode 'overwrite-mode-textual) | 2015 | (overwrite-mode 'overwrite-mode-textual) |
| @@ -2321,6 +2320,7 @@ Octant are numbered 1--8, anti-clockwise as: | |||
| 2321 | ;; Some inline funtions for creating, setting and reading | 2320 | ;; Some inline funtions for creating, setting and reading |
| 2322 | ;; members of a coordinate | 2321 | ;; members of a coordinate |
| 2323 | ;; | 2322 | ;; |
| 2323 | |||
| 2324 | (defsubst artist-new-coord (x y &optional new-char) | 2324 | (defsubst artist-new-coord (x y &optional new-char) |
| 2325 | "Create a new coordinate at X,Y for use in a line. | 2325 | "Create a new coordinate at X,Y for use in a line. |
| 2326 | Optional argument NEW-CHAR can be used for setting the new-char component | 2326 | Optional argument NEW-CHAR can be used for setting the new-char component |
| @@ -2533,7 +2533,7 @@ This function returns a point-list." | |||
| 2533 | ;; | 2533 | ;; |
| 2534 | 2534 | ||
| 2535 | (defun artist-draw-line (x1 y1 x2 y2) | 2535 | (defun artist-draw-line (x1 y1 x2 y2) |
| 2536 | "Draws a line from X1, Y1 to X2, Y2. | 2536 | "Draw a line from X1, Y1 to X2, Y2. |
| 2537 | 2537 | ||
| 2538 | Output is a line, which is a list (END-POINT-1 END-POINT-2 SHAPE-INFO). | 2538 | Output is a line, which is a list (END-POINT-1 END-POINT-2 SHAPE-INFO). |
| 2539 | 2539 | ||
| @@ -2558,7 +2558,7 @@ SHAPE-INFO is a list of vectors [X Y SAVED-CHAR NEW-CHAR]." | |||
| 2558 | (artist-eight-point x1 y1 x2 y2)))))))) | 2558 | (artist-eight-point x1 y1 x2 y2)))))))) |
| 2559 | 2559 | ||
| 2560 | (defun artist-undraw-line (line) | 2560 | (defun artist-undraw-line (line) |
| 2561 | "Undraws LINE." | 2561 | "Undraw LINE." |
| 2562 | (mapcar | 2562 | (mapcar |
| 2563 | (lambda (coord) | 2563 | (lambda (coord) |
| 2564 | (artist-move-to-xy (artist-coord-get-x coord) | 2564 | (artist-move-to-xy (artist-coord-get-x coord) |
| @@ -2572,7 +2572,7 @@ SHAPE-INFO is a list of vectors [X Y SAVED-CHAR NEW-CHAR]." | |||
| 2572 | ;; | 2572 | ;; |
| 2573 | 2573 | ||
| 2574 | (defun artist-draw-sline (x1 y1 x2 y2) | 2574 | (defun artist-draw-sline (x1 y1 x2 y2) |
| 2575 | "Draw a strait line from X1, Y1 to X2, Y2. | 2575 | "Draw a straight line from X1, Y1 to X2, Y2. |
| 2576 | Straight lines are vertical, horizontal or diagonal lines. | 2576 | Straight lines are vertical, horizontal or diagonal lines. |
| 2577 | They are faster to draw and most often they are what you need | 2577 | They are faster to draw and most often they are what you need |
| 2578 | when drawing a simple image. | 2578 | when drawing a simple image. |
| @@ -2630,7 +2630,7 @@ SHAPE-INFO is a vector [START-X START-Y LENGTH-OF-LINE DIRECTION | |||
| 2630 | ;; | 2630 | ;; |
| 2631 | 2631 | ||
| 2632 | (defun artist-draw-rect (x1 y1 x2 y2) | 2632 | (defun artist-draw-rect (x1 y1 x2 y2) |
| 2633 | "Draws a rectangle with corners at X1, Y1 and X2, Y2. | 2633 | "Draw a rectangle with corners at X1, Y1 and X2, Y2. |
| 2634 | 2634 | ||
| 2635 | Output is a rectangle, which is a list on the form | 2635 | Output is a rectangle, which is a list on the form |
| 2636 | \(END-POINT-1 END-POINT-2 SHAPE-INFO). | 2636 | \(END-POINT-1 END-POINT-2 SHAPE-INFO). |
| @@ -2650,7 +2650,7 @@ SHAPE-INFO is a list of four straight lines." | |||
| 2650 | (list line1 line2 line3 line4)))) | 2650 | (list line1 line2 line3 line4)))) |
| 2651 | 2651 | ||
| 2652 | (defun artist-undraw-rect (rectangle) | 2652 | (defun artist-undraw-rect (rectangle) |
| 2653 | "Undraws RECTANGLE." | 2653 | "Undraw RECTANGLE." |
| 2654 | (if rectangle | 2654 | (if rectangle |
| 2655 | (let ((shape-info (artist-2point-get-shapeinfo rectangle))) | 2655 | (let ((shape-info (artist-2point-get-shapeinfo rectangle))) |
| 2656 | (artist-undraw-sline (elt shape-info 3)) | 2656 | (artist-undraw-sline (elt shape-info 3)) |
| @@ -2661,8 +2661,8 @@ SHAPE-INFO is a list of four straight lines." | |||
| 2661 | 2661 | ||
| 2662 | (defun artist-rect-corners-squarify (x1 y1 x2 y2) | 2662 | (defun artist-rect-corners-squarify (x1 y1 x2 y2) |
| 2663 | "Compute square corners from rectangle corners at X1, Y1 and X2, Y2. | 2663 | "Compute square corners from rectangle corners at X1, Y1 and X2, Y2. |
| 2664 | The square's first corner will be X1, Y1. The position of the second corner | 2664 | The square's first corner will be X1, Y1. The position of the second |
| 2665 | depends on which of X2 and Y2 is most far away from X1, Y1." | 2665 | corner depends on which of X2 and Y2 is most far away from X1, Y1." |
| 2666 | (let* ((delta-x (- x2 x1)) | 2666 | (let* ((delta-x (- x2 x1)) |
| 2667 | (delta-y (- y2 y1)) | 2667 | (delta-y (- y2 y1)) |
| 2668 | (delta-x-sign (if (< delta-x 0) -1 1)) | 2668 | (delta-x-sign (if (< delta-x 0) -1 1)) |
| @@ -2716,7 +2716,7 @@ SHAPE-INFO is a list of four straight lines." | |||
| 2716 | (list line1 line2 line3 line4)))) | 2716 | (list line1 line2 line3 line4)))) |
| 2717 | 2717 | ||
| 2718 | (defun artist-undraw-square (square) | 2718 | (defun artist-undraw-square (square) |
| 2719 | "Undraws SQUARE." | 2719 | "Undraw SQUARE." |
| 2720 | (if square | 2720 | (if square |
| 2721 | (let ((shape-info (artist-2point-get-shapeinfo square))) | 2721 | (let ((shape-info (artist-2point-get-shapeinfo square))) |
| 2722 | (artist-undraw-sline (elt shape-info 3)) | 2722 | (artist-undraw-sline (elt shape-info 3)) |
| @@ -2741,7 +2741,7 @@ SHAPE-INFO is a list of four straight lines." | |||
| 2741 | (setq y (1+ y)))))) | 2741 | (setq y (1+ y)))))) |
| 2742 | 2742 | ||
| 2743 | (defun artist-fill-square (square x1 y1 x2 y2) | 2743 | (defun artist-fill-square (square x1 y1 x2 y2) |
| 2744 | "Fills a SQUARE from X1,Y1 to X2,Y2." | 2744 | "Fill a SQUARE from X1,Y1 to X2,Y2." |
| 2745 | (let* ((square-corners (artist-rect-corners-squarify x1 y1 x2 y2)) | 2745 | (let* ((square-corners (artist-rect-corners-squarify x1 y1 x2 y2)) |
| 2746 | (new-x1 (elt square-corners 0)) | 2746 | (new-x1 (elt square-corners 0)) |
| 2747 | (new-y1 (elt square-corners 1)) | 2747 | (new-y1 (elt square-corners 1)) |
| @@ -2763,7 +2763,7 @@ SHAPE-INFO is a list of four straight lines." | |||
| 2763 | ;; | 2763 | ;; |
| 2764 | 2764 | ||
| 2765 | (defun artist-pen (x1 y1) | 2765 | (defun artist-pen (x1 y1) |
| 2766 | "Draws a character at X1, Y1. | 2766 | "Draw a character at X1, Y1. |
| 2767 | The character is replaced with the character in `artist-fill-char'." | 2767 | The character is replaced with the character in `artist-fill-char'." |
| 2768 | (artist-move-to-xy x1 y1) | 2768 | (artist-move-to-xy x1 y1) |
| 2769 | (artist-replace-char (if artist-line-char-set | 2769 | (artist-replace-char (if artist-line-char-set |
| @@ -2774,7 +2774,7 @@ The character is replaced with the character in `artist-fill-char'." | |||
| 2774 | 2774 | ||
| 2775 | 2775 | ||
| 2776 | (defun artist-pen-line (x1 y1) | 2776 | (defun artist-pen-line (x1 y1) |
| 2777 | "Draws a line from last pen position to X1, Y1. | 2777 | "Draw a line from last pen position to X1, Y1. |
| 2778 | The character is replaced with the character in `artist-fill-char'. | 2778 | The character is replaced with the character in `artist-fill-char'. |
| 2779 | This will store all points in `artist-key-poly-point-list' in reversed | 2779 | This will store all points in `artist-key-poly-point-list' in reversed |
| 2780 | order (I assume it is faster to cons to the beginning of the list than | 2780 | order (I assume it is faster to cons to the beginning of the list than |
| @@ -2891,7 +2891,7 @@ Returns a list of strings." | |||
| 2891 | 2891 | ||
| 2892 | (defun artist-text-insert-common (x y text see-thru) | 2892 | (defun artist-text-insert-common (x y text see-thru) |
| 2893 | "At position X, Y, insert text TEXT. | 2893 | "At position X, Y, insert text TEXT. |
| 2894 | If SEE-THRU is non-nil, then blanks in TEXT does not replace text | 2894 | If SEE-THRU is non-nil, then blanks in TEXT do not replace text |
| 2895 | in the buffer." | 2895 | in the buffer." |
| 2896 | (let* ((string-list (artist-string-split text "\n")) | 2896 | (let* ((string-list (artist-string-split text "\n")) |
| 2897 | (i 0) | 2897 | (i 0) |
| @@ -2930,7 +2930,7 @@ This is done by calling the function specified by | |||
| 2930 | `artist-text-renderer-function', which must return a list of strings, | 2930 | `artist-text-renderer-function', which must return a list of strings, |
| 2931 | to be inserted in the buffer. | 2931 | to be inserted in the buffer. |
| 2932 | 2932 | ||
| 2933 | Blanks in the rendered text overwrites any text in the buffer." | 2933 | Blanks in the rendered text overwrite any text in the buffer." |
| 2934 | (let* ((input-text (read-string "Type text to render: ")) | 2934 | (let* ((input-text (read-string "Type text to render: ")) |
| 2935 | (rendered-text (artist-funcall artist-text-renderer-function input-text))) | 2935 | (rendered-text (artist-funcall artist-text-renderer-function input-text))) |
| 2936 | (artist-text-insert-overwrite x y rendered-text))) | 2936 | (artist-text-insert-overwrite x y rendered-text))) |
| @@ -2940,7 +2940,7 @@ Blanks in the rendered text overwrites any text in the buffer." | |||
| 2940 | ;; | 2940 | ;; |
| 2941 | 2941 | ||
| 2942 | (defun artist-spray-get-interval () | 2942 | (defun artist-spray-get-interval () |
| 2943 | "Retrieves the interval for repeated spray." | 2943 | "Retrieve the interval for repeated spray." |
| 2944 | artist-spray-interval) | 2944 | artist-spray-interval) |
| 2945 | 2945 | ||
| 2946 | (defun artist-spray-random-points (n radius) | 2946 | (defun artist-spray-random-points (n radius) |
| @@ -2978,7 +2978,7 @@ Returns a list of points. Each point is on the form (X1 . Y1)." | |||
| 2978 | (setq spray-points (cdr spray-points))))) | 2978 | (setq spray-points (cdr spray-points))))) |
| 2979 | 2979 | ||
| 2980 | (defun artist-spray-clear-circle (circle x1 y1 x2 y2) | 2980 | (defun artist-spray-clear-circle (circle x1 y1 x2 y2) |
| 2981 | "Clears circle CIRCLE at X1, Y1 through X2, Y2." | 2981 | "Clear circle CIRCLE at X1, Y1 through X2, Y2." |
| 2982 | (artist-undraw-circle circle)) | 2982 | (artist-undraw-circle circle)) |
| 2983 | 2983 | ||
| 2984 | (defun artist-spray-set-radius (circle x1 y1 x2 y2) | 2984 | (defun artist-spray-set-radius (circle x1 y1 x2 y2) |
| @@ -2994,7 +2994,7 @@ Returns a list of points. Each point is on the form (X1 . Y1)." | |||
| 2994 | ;; | 2994 | ;; |
| 2995 | 2995 | ||
| 2996 | (defun artist-erase-char (x1 y1) | 2996 | (defun artist-erase-char (x1 y1) |
| 2997 | "Erases a character at X1, Y1. | 2997 | "Erase a character at X1, Y1. |
| 2998 | The character is replaced with the character in `artist-erase-char'." | 2998 | The character is replaced with the character in `artist-erase-char'." |
| 2999 | (artist-move-to-xy x1 y1) | 2999 | (artist-move-to-xy x1 y1) |
| 3000 | (artist-replace-char artist-erase-char)) | 3000 | (artist-replace-char artist-erase-char)) |
| @@ -3160,8 +3160,8 @@ An endpoint is a pair (X . Y)." | |||
| 3160 | (defun artist-vaporize-line (x1 y1) | 3160 | (defun artist-vaporize-line (x1 y1) |
| 3161 | "Vaporize (erase) the straight line through X1, Y1. | 3161 | "Vaporize (erase) the straight line through X1, Y1. |
| 3162 | Do this by replacing the characters that forms the line with | 3162 | Do this by replacing the characters that forms the line with |
| 3163 | `artist-erase-char'. Output is a list of endpoints for lines | 3163 | `artist-erase-char'. Output is a list of endpoints for lines through |
| 3164 | through X1, Y1. An endpoint is a cons pair, (ENDPOINT-X . ENDPOINT-Y)." | 3164 | X1, Y1. An endpoint is a cons pair, (ENDPOINT-X . ENDPOINT-Y)." |
| 3165 | (let ((endpoints (artist-vap-find-endpoints x1 y1))) | 3165 | (let ((endpoints (artist-vap-find-endpoints x1 y1))) |
| 3166 | (mapc | 3166 | (mapc |
| 3167 | (lambda (endpoints) | 3167 | (lambda (endpoints) |
| @@ -3234,7 +3234,7 @@ through X1, Y1. An endpoint is a cons pair, (ENDPOINT-X . ENDPOINT-Y)." | |||
| 3234 | (defun artist-ellipse-generate-quadrant (x-radius y-radius) | 3234 | (defun artist-ellipse-generate-quadrant (x-radius y-radius) |
| 3235 | "Create a point-list for first quadrant. | 3235 | "Create a point-list for first quadrant. |
| 3236 | Points go from (X-RADIUS, 0) to (0, Y-RADIUS). | 3236 | Points go from (X-RADIUS, 0) to (0, Y-RADIUS). |
| 3237 | Quadrant is generated around origo." | 3237 | Quadrant is generated around origin." |
| 3238 | (let* ((rx2 (* x-radius x-radius)) | 3238 | (let* ((rx2 (* x-radius x-radius)) |
| 3239 | (ry2 (* y-radius y-radius)) | 3239 | (ry2 (* y-radius y-radius)) |
| 3240 | (2rx2 (* 2 rx2)) | 3240 | (2rx2 (* 2 rx2)) |
| @@ -3655,7 +3655,7 @@ original contents of that area in the buffer." | |||
| 3655 | (artist-copy-generic x1 y1 x2 y2)) | 3655 | (artist-copy-generic x1 y1 x2 y2)) |
| 3656 | 3656 | ||
| 3657 | (defun artist-copy-square (square x1 y1 x2 y2) | 3657 | (defun artist-copy-square (square x1 y1 x2 y2) |
| 3658 | "Copies a SQUARE drawn from X1, Y1 to X2, Y2 (but made square)." | 3658 | "Copy a SQUARE drawn from X1, Y1 to X2, Y2 (but made square)." |
| 3659 | (artist-undraw-square square) | 3659 | (artist-undraw-square square) |
| 3660 | (let* ((square-corners (artist-rect-corners-squarify x1 y1 x2 y2)) | 3660 | (let* ((square-corners (artist-rect-corners-squarify x1 y1 x2 y2)) |
| 3661 | (new-x1 (elt square-corners 0)) | 3661 | (new-x1 (elt square-corners 0)) |
| @@ -3665,7 +3665,7 @@ original contents of that area in the buffer." | |||
| 3665 | (artist-copy-generic new-x1 new-y1 new-x2 new-y2))) | 3665 | (artist-copy-generic new-x1 new-y1 new-x2 new-y2))) |
| 3666 | 3666 | ||
| 3667 | (defun artist-paste (x y) | 3667 | (defun artist-paste (x y) |
| 3668 | "Pastes the contents of the copy-buffer at X,Y." | 3668 | "Paste the contents of the copy-buffer at X,Y." |
| 3669 | (let ((copy-buf (if artist-interface-with-rect | 3669 | (let ((copy-buf (if artist-interface-with-rect |
| 3670 | killed-rectangle | 3670 | killed-rectangle |
| 3671 | artist-copy-buffer))) | 3671 | artist-copy-buffer))) |
| @@ -3721,7 +3721,7 @@ original contents of that area in the buffer." | |||
| 3721 | (>= y last-line))))) | 3721 | (>= y last-line))))) |
| 3722 | 3722 | ||
| 3723 | (defun artist-flood-fill (x1 y1) | 3723 | (defun artist-flood-fill (x1 y1) |
| 3724 | "Flood-fill starting at X1, Y1. Fill with the char in `artist-fill-char'." | 3724 | "Flood-fill starting at X1, Y1. Fill with the char in `artist-fill-char'." |
| 3725 | (let ((stack nil) | 3725 | (let ((stack nil) |
| 3726 | (input-queue nil) | 3726 | (input-queue nil) |
| 3727 | ;; We are flood-filling the area that has this character. | 3727 | ;; We are flood-filling the area that has this character. |
| @@ -3946,25 +3946,25 @@ The 2-point shape SHAPE is drawn from X1, Y1 to X2, Y2." | |||
| 3946 | ;; user has released the button, so the timer will always be cancelled | 3946 | ;; user has released the button, so the timer will always be cancelled |
| 3947 | ;; at that point. | 3947 | ;; at that point. |
| 3948 | (defun artist-key-draw-continously (x y) | 3948 | (defun artist-key-draw-continously (x y) |
| 3949 | "Draws current continous shape at X,Y." | 3949 | "Draw current continous shape at X,Y." |
| 3950 | (let ((draw-fn (artist-go-get-draw-fn-from-symbol artist-curr-go))) | 3950 | (let ((draw-fn (artist-go-get-draw-fn-from-symbol artist-curr-go))) |
| 3951 | (setq artist-key-shape (artist-funcall draw-fn x y)))) | 3951 | (setq artist-key-shape (artist-funcall draw-fn x y)))) |
| 3952 | 3952 | ||
| 3953 | (defun artist-key-draw-poly (x y) | 3953 | (defun artist-key-draw-poly (x y) |
| 3954 | "Draws current poly-point shape with nth point at X,Y." | 3954 | "Draw current poly-point shape with nth point at X,Y." |
| 3955 | (let ((draw-fn (artist-go-get-draw-fn-from-symbol artist-curr-go)) | 3955 | (let ((draw-fn (artist-go-get-draw-fn-from-symbol artist-curr-go)) |
| 3956 | (x1 (artist-endpoint-get-x artist-key-endpoint1)) | 3956 | (x1 (artist-endpoint-get-x artist-key-endpoint1)) |
| 3957 | (y1 (artist-endpoint-get-y artist-key-endpoint1))) | 3957 | (y1 (artist-endpoint-get-y artist-key-endpoint1))) |
| 3958 | (setq artist-key-shape (artist-funcall draw-fn x1 y1 x y)))) | 3958 | (setq artist-key-shape (artist-funcall draw-fn x1 y1 x y)))) |
| 3959 | 3959 | ||
| 3960 | (defun artist-key-draw-1point (x y) | 3960 | (defun artist-key-draw-1point (x y) |
| 3961 | "Draws current 1-point shape at X,Y." | 3961 | "Draw current 1-point shape at X,Y." |
| 3962 | (let ((draw-fn (artist-go-get-draw-fn-from-symbol artist-curr-go))) | 3962 | (let ((draw-fn (artist-go-get-draw-fn-from-symbol artist-curr-go))) |
| 3963 | (setq artist-key-shape (artist-funcall draw-fn x y)))) | 3963 | (setq artist-key-shape (artist-funcall draw-fn x y)))) |
| 3964 | 3964 | ||
| 3965 | 3965 | ||
| 3966 | (defun artist-key-draw-2points (x y) | 3966 | (defun artist-key-draw-2points (x y) |
| 3967 | "Draws current 2-point shape at X,Y." | 3967 | "Draw current 2-point shape at X,Y." |
| 3968 | (let ((draw-fn (artist-go-get-draw-fn-from-symbol artist-curr-go)) | 3968 | (let ((draw-fn (artist-go-get-draw-fn-from-symbol artist-curr-go)) |
| 3969 | (x1 (artist-endpoint-get-x artist-key-endpoint1)) | 3969 | (x1 (artist-endpoint-get-x artist-key-endpoint1)) |
| 3970 | (y1 (artist-endpoint-get-y artist-key-endpoint1))) | 3970 | (y1 (artist-endpoint-get-y artist-key-endpoint1))) |
| @@ -4382,7 +4382,7 @@ With non-nil ARG, set the last point." | |||
| 4382 | ;; | 4382 | ;; |
| 4383 | 4383 | ||
| 4384 | (defun artist-previous-line (&optional n) | 4384 | (defun artist-previous-line (&optional n) |
| 4385 | "Move cursor up optional N lines (default is 1), updating current shape. | 4385 | "Move cursor up N lines (default is 1), updating current shape. |
| 4386 | If N is negative, move cursor down." | 4386 | If N is negative, move cursor down." |
| 4387 | (interactive "p") | 4387 | (interactive "p") |
| 4388 | (let ((col (artist-current-column))) | 4388 | (let ((col (artist-current-column))) |
| @@ -4393,7 +4393,7 @@ If N is negative, move cursor down." | |||
| 4393 | 4393 | ||
| 4394 | 4394 | ||
| 4395 | (defun artist-next-line (&optional n) | 4395 | (defun artist-next-line (&optional n) |
| 4396 | "Move cursor down optional N lines (default is 1), updating current shape. | 4396 | "Move cursor down N lines (default is 1), updating current shape. |
| 4397 | If N is negative, move cursor up." | 4397 | If N is negative, move cursor up." |
| 4398 | (interactive "p") | 4398 | (interactive "p") |
| 4399 | (let ((col (artist-current-column))) | 4399 | (let ((col (artist-current-column))) |
| @@ -4403,7 +4403,7 @@ If N is negative, move cursor up." | |||
| 4403 | (artist-key-do-continously-common))) | 4403 | (artist-key-do-continously-common))) |
| 4404 | 4404 | ||
| 4405 | (defun artist-backward-char (&optional n) | 4405 | (defun artist-backward-char (&optional n) |
| 4406 | "Move cursor backward optional N chars (default is 1), updating curr shape. | 4406 | "Move cursor backward N chars (default is 1), updating current shape. |
| 4407 | If N is negative, move forward." | 4407 | If N is negative, move forward." |
| 4408 | (interactive "p") | 4408 | (interactive "p") |
| 4409 | (if (> n 0) | 4409 | (if (> n 0) |
| @@ -4411,7 +4411,7 @@ If N is negative, move forward." | |||
| 4411 | (artist-forward-char n))) | 4411 | (artist-forward-char n))) |
| 4412 | 4412 | ||
| 4413 | (defun artist-forward-char (&optional n) | 4413 | (defun artist-forward-char (&optional n) |
| 4414 | "Move cursor forward optional N chars (default is 1), updating curr shape. | 4414 | "Move cursor forward N chars (default is 1), updating current shape. |
| 4415 | If N is negative, move backward." | 4415 | If N is negative, move backward." |
| 4416 | (interactive "p") | 4416 | (interactive "p") |
| 4417 | (let* ((step-x (if (>= n 0) 1 -1)) | 4417 | (let* ((step-x (if (>= n 0) 1 -1)) |
| @@ -4464,11 +4464,7 @@ If N is negative, move backward." | |||
| 4464 | 4464 | ||
| 4465 | (defun artist-charlist-to-string (char-list) | 4465 | (defun artist-charlist-to-string (char-list) |
| 4466 | "Convert a list of characters, CHAR-LIST, to a string." | 4466 | "Convert a list of characters, CHAR-LIST, to a string." |
| 4467 | (let ((result "")) | 4467 | (concat char-list)) |
| 4468 | (while (not (null char-list)) | ||
| 4469 | (setq result (concat result (char-to-string (car char-list)))) | ||
| 4470 | (setq char-list (cdr char-list))) | ||
| 4471 | result)) | ||
| 4472 | 4468 | ||
| 4473 | (defun artist-string-to-charlist (str) | 4469 | (defun artist-string-to-charlist (str) |
| 4474 | "Convert a string, STR, to list of characters." | 4470 | "Convert a string, STR, to list of characters." |
| @@ -4908,7 +4904,7 @@ If optional argument STATE is positive, turn borders on." | |||
| 4908 | 4904 | ||
| 4909 | 4905 | ||
| 4910 | (defun artist-mouse-draw-continously (ev) | 4906 | (defun artist-mouse-draw-continously (ev) |
| 4911 | "Generic function for shapes that requires 1 point as input. | 4907 | "Generic function for shapes that require 1 point as input. |
| 4912 | Operation is done continously while the mouse button is hold down. | 4908 | Operation is done continously while the mouse button is hold down. |
| 4913 | The event, EV, is the mouse event." | 4909 | The event, EV, is the mouse event." |
| 4914 | (let* ((unshifted (artist-go-get-symbol-shift artist-curr-go nil)) | 4910 | (let* ((unshifted (artist-go-get-symbol-shift artist-curr-go nil)) |