• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.9.5/emacs-92/emacs/lisp/textmodes/

Lines Matching +refs:artist +refs:key +refs:endpoint1

0 ;;; artist.el --- draw ascii graphics with your mouse
11 ;; Location: http://www.lysator.liu.se/~tab/artist/
32 ;; What is artist?
66 ;; the right column are accessed by holding down the shift key while
80 ;; artist can be yanked with C-x r y and vice versa.
88 ;; * Aspect-ratio: You can set the variable artist-aspect-ratio to
97 ;; See the documentation for the function artist-mode for a detailed
98 ;; description on how to use artist.
111 ;; To use artist, put this in your .emacs:
113 ;; (autoload 'artist-mode "artist" "Enter artist-mode" t)
121 ;; loadable, unless the variable `artist-interface-with-rect' is set
125 ;; to be loadable, unless the variable `artist-picture-compatibility'
135 ;; artist-shift-has-changed for further details.)
141 ;; New: Coerced with the artist.el that's in Emacs-21.3.
159 ;; Bugfix: The arrow characters (`artist-arrows'), which
164 ;; Bugfix: Sets next-line-add-newlines to t while in artist-mode.
199 (defconst artist-version "1.2.6")
200 (defconst artist-maintainer-address "tab@lysator.liu.se")
221 (defgroup artist nil
225 (defgroup artist-text nil
227 :group 'artist)
229 (defcustom artist-rubber-banding t
231 :group 'artist
234 (defcustom artist-first-char ?1
236 :group 'artist
239 (defcustom artist-second-char ?2
241 :group 'artist
244 (defcustom artist-interface-with-rect t
249 that you can insert a rectangle which is copied using the artist package
254 artist package will use its own copy buffer."
255 :group 'artist
258 (defvar artist-arrows [ ?> nil ?v ?L ?< nil ?^ nil ]
276 (defcustom artist-aspect-ratio 1
279 :group 'artist
282 (defcustom artist-trim-line-endings t
287 :group 'artist
291 (defcustom artist-flood-fill-right-border 'window-width
297 :group 'artist
301 (defcustom artist-flood-fill-show-incrementally t
307 :group 'artist
311 (defcustom artist-ellipse-right-char ?\)
318 :group 'artist
322 (defcustom artist-ellipse-left-char ?\(
329 :group 'artist
332 (defcustom artist-picture-compatibility t
334 :group 'artist
340 (defcustom artist-vaporize-fuzziness 1
346 If `artist-vaporize-fuzziness' is 2, then those will be recognized as
360 :group 'artist
364 (defvar artist-pointer-shape (if (eq window-system 'x) x-pointer-crosshair nil)
368 (defcustom artist-text-renderer-function 'artist-figlet
370 :group 'artist-text
372 (defvaralias 'artist-text-renderer 'artist-text-renderer-function)
375 (defcustom artist-figlet-program "figlet"
377 :group 'artist-text
381 (defcustom artist-figlet-default-font "standard"
383 :group 'artist-text
387 (defcustom artist-figlet-list-fonts-command
393 :group 'artist-text
397 (defcustom artist-spray-interval 0.2
399 :group 'artist
403 (defcustom artist-spray-radius 4
405 :group 'artist
409 (defvar artist-spray-chars '(?\s ?. ?- ?+ ?m ?% ?* ?#)
419 (defvar artist-spray-new-char ?.
422 not in `artist-spray-chars'. The character defined by this variable
423 should be in `artist-spray-chars', or spraying will behave
433 (defvar artist-mode nil
434 "Non-nil to enable `artist-mode' and nil to disable.")
435 (make-variable-buffer-local 'artist-mode)
437 (defvar artist-mode-name " Artist"
438 "Name of artist mode beginning with a space (appears in the mode-line).")
440 (defvar artist-curr-go 'pen-char
442 (make-variable-buffer-local 'artist-curr-go)
444 (defvar artist-line-char-set nil
446 (make-variable-buffer-local 'artist-line-char-set)
448 (defvar artist-line-char nil
450 (make-variable-buffer-local 'artist-line-char)
452 (defvar artist-fill-char-set nil
454 (make-variable-buffer-local 'artist-fill-char-set)
456 (defvar artist-fill-char nil
458 (make-variable-buffer-local 'artist-fill-char)
460 (defvar artist-erase-char ?\s
462 (make-variable-buffer-local 'artist-erase-char)
464 (defvar artist-default-fill-char ?.
466 (make-variable-buffer-local 'artist-default-fill-char)
469 (defvar artist-copy-buffer nil
472 (defvar artist-draw-region-min-y 0
474 (make-variable-buffer-local 'artist-draw-region-min-y)
476 (defvar artist-draw-region-max-y 0
478 (make-variable-buffer-local 'artist-draw-region-max-y)
480 (defvar artist-borderless-shapes nil
483 (make-variable-buffer-local 'artist-borderless-shapes)
485 (defvar artist-prev-next-op-alist nil
489 * OP is an atom: the KEY-SYMBOL in the `artist-mt' structure
490 * PREV-OP and NEXT-OP are strings: the KEYWORD in the `artist-mt' structure
492 This variable is initialized by the artist-make-prev-next-op-alist function.")
500 (if artist-interface-with-rect
505 (if artist-picture-compatibility
508 ;; Variables that are made local in artist-mode-init
509 (defvar artist-key-is-drawing nil)
510 (defvar artist-key-endpoint1 nil)
511 (defvar artist-key-poly-point-list nil)
512 (defvar artist-key-shape nil)
513 (defvar artist-key-draw-how nil)
514 (defvar artist-popup-menu-table nil)
515 (defvar artist-key-compl-table nil)
516 (defvar artist-rb-save-data nil)
517 (defvar artist-arrow-point-1 nil)
518 (defvar artist-arrow-point-2 nil)
521 (defvar artist-mode-map
523 (setq artist-mode-map (make-sparse-keymap))
524 (define-key map [down-mouse-1] 'artist-down-mouse-1)
525 (define-key map [S-down-mouse-1] 'artist-down-mouse-1)
526 (define-key map [down-mouse-2] 'artist-mouse-choose-operation)
527 (define-key map [S-down-mouse-2] 'artist-mouse-choose-operation)
528 (define-key map [down-mouse-3] 'artist-down-mouse-3)
529 (define-key map [S-down-mouse-3] 'artist-down-mouse-3)
530 (define-key map [C-mouse-4] 'artist-select-prev-op-in-list)
531 (define-key map [C-mouse-5] 'artist-select-next-op-in-list)
532 (define-key map "\r" 'artist-key-set-point) ; return
533 (define-key map [up] 'artist-previous-line)
534 (define-key map "\C-p" 'artist-previous-line)
535 (define-key map [down] 'artist-next-line)
536 (define-key map "\C-n" 'artist-next-line)
537 (define-key map [left] 'artist-backward-char)
538 (define-key map "\C-b" 'artist-backward-char)
539 (define-key map [right] 'artist-forward-char)
540 (define-key map "\C-f" 'artist-forward-char)
541 (define-key map "<" 'artist-toggle-first-arrow)
542 (define-key map ">" 'artist-toggle-second-arrow)
543 (define-key map "\C-c\C-a\C-e" 'artist-select-erase-char)
544 (define-key map "\C-c\C-a\C-f" 'artist-select-fill-char)
545 (define-key map "\C-c\C-a\C-l" 'artist-select-line-char)
546 (define-key map "\C-c\C-a\C-o" 'artist-select-operation)
547 (define-key map "\C-c\C-a\C-r" 'artist-toggle-rubber-banding)
548 (define-key map "\C-c\C-a\C-t" 'artist-toggle-trim-line-endings)
549 (define-key map "\C-c\C-a\C-s" 'artist-toggle-borderless-shapes)
550 (define-key map "\C-c\C-c" 'artist-mode-off)
551 (define-key map "\C-c\C-al" 'artist-select-op-line)
552 (define-key map "\C-c\C-aL" 'artist-select-op-straight-line)
553 (define-key map "\C-c\C-ar" 'artist-select-op-rectangle)
554 (define-key map "\C-c\C-aR" 'artist-select-op-square)
555 (define-key map "\C-c\C-as" 'artist-select-op-square)
556 (define-key map "\C-c\C-ap" 'artist-select-op-poly-line)
557 (define-key map "\C-c\C-aP" 'artist-select-op-straight-poly-line)
558 (define-key map "\C-c\C-ae" 'artist-select-op-ellipse)
559 (define-key map "\C-c\C-ac" 'artist-select-op-circle)
560 (define-key map "\C-c\C-at" 'artist-select-op-text-see-thru)
561 (define-key map "\C-c\C-aT" 'artist-select-op-text-overwrite)
562 (define-key map "\C-c\C-aS" 'artist-select-op-spray-can)
563 (define-key map "\C-c\C-az" 'artist-select-op-spray-set-size)
564 (define-key map "\C-c\C-a\C-d" 'artist-select-op-erase-char)
565 (define-key map "\C-c\C-aE" 'artist-select-op-erase-rectangle)
566 (define-key map "\C-c\C-av" 'artist-select-op-vaporize-line)
567 (define-key map "\C-c\C-aV" 'artist-select-op-vaporize-lines)
568 (define-key map "\C-c\C-a\C-k" 'artist-select-op-cut-rectangle)
569 (define-key map "\C-c\C-a\M-w" 'artist-select-op-copy-rectangle)
570 (define-key map "\C-c\C-a\C-y" 'artist-select-op-paste)
571 (define-key map "\C-c\C-af" 'artist-select-op-flood-fill)
572 (define-key map "\C-c\C-a\C-b" 'artist-submit-bug-report)
574 "Keymap for `artist-minor-mode'.")
576 (defvar artist-replacement-table (make-vector 256 0)
577 "Replacement table for `artist-replace-char'.")
583 (defvar artist-mt
596 artist-no-arrows nil
598 artist-do-continously
599 artist-pen
602 artist-arrows artist-pen-set-arrow-points
603 artist-pen-reset-last-xy nil nil
604 artist-do-continously
605 artist-pen-line
610 artist-arrows artist-set-arrow-points-for-2points
613 artist-draw-line
614 (artist-undraw-line
615 artist-nil nil))
617 artist-arrows artist-set-arrow-points-for-2points
620 artist-draw-sline
621 (artist-undraw-sline
622 artist-nil nil)))))
626 artist-no-arrows nil
629 artist-draw-rect
630 (artist-undraw-rect
631 artist-t-if-fill-char-set artist-fill-rect))
633 artist-no-arrows nil
636 artist-draw-square
637 (artist-undraw-square
638 artist-t-if-fill-char-set artist-fill-square)))))
642 artist-arrows artist-set-arrow-points-for-poly
644 artist-do-poly
645 artist-draw-line
646 (artist-undraw-line
647 artist-nil nil))
649 artist-arrows artist-set-arrow-points-for-poly
651 artist-do-poly
652 artist-draw-sline
653 (artist-undraw-sline
654 artist-nil nil)))))
658 artist-no-arrows nil
661 artist-draw-ellipse
662 (artist-undraw-ellipse
663 artist-t-if-fill-char-set artist-fill-ellipse))
665 artist-no-arrows nil
668 artist-draw-circle
669 (artist-undraw-circle
670 artist-t-if-fill-char-set artist-fill-circle)))))
674 artist-no-arrows nil
677 artist-text-see-thru
680 artist-no-arrows nil
683 artist-text-overwrite
688 artist-no-arrows nil
690 artist-do-continously
691 artist-spray
692 (artist-spray-get-interval))
694 artist-no-arrows nil
695 nil artist-spray-clear-circle artist-spray-set-radius
697 artist-draw-circle
698 (artist-undraw-circle
699 artist-nil nil)))))
703 artist-no-arrows nil
705 artist-do-continously
706 artist-erase-char
709 artist-no-arrows nil
712 artist-draw-rect
713 (artist-undraw-rect
714 artist-t artist-erase-rect)))))
718 artist-no-arrows nil
721 artist-vaporize-line
724 artist-no-arrows nil
727 artist-vaporize-lines
734 artist-no-arrows nil
737 artist-draw-rect
738 (artist-undraw-rect
739 artist-t artist-cut-rect)
741 artist-no-arrows nil
744 artist-draw-square
745 (artist-undraw-square
746 artist-t artist-cut-square))))))
750 artist-no-arrows nil
753 artist-draw-rect
754 (artist-undraw-rect
755 artist-t artist-copy-rect)
757 artist-no-arrows nil
760 artist-draw-square
761 (artist-undraw-square
762 artist-t artist-copy-square))))))
766 artist-no-arrows nil
769 artist-paste
772 artist-no-arrows nil
775 artist-paste
780 artist-no-arrows nil
783 artist-flood-fill
786 artist-no-arrows nil
789 artist-flood-fill
795 ("Set Fill" set-fill artist-select-fill-char))
798 ("Set Line" set-line artist-select-line-char))
801 ("Set Erase" set-erase artist-select-erase-char))
804 ("Rubber-banding" rubber-band artist-toggle-rubber-banding))
807 ("Trimming" trimming artist-toggle-trim-line-endings))
810 ("Borders" borders artist-toggle-borderless-shapes))
813 ("Spray-chars" spray-chars artist-select-spray-chars)))))
817 "Master Table for `artist-mode'.
819 available in artist mode, but it also holds layout information for the
868 KEY-SYMBOL is the key which is used when looking up members
869 through the functions `artist-go-get-MEMBER-from-symbol'
870 and `artist-fc-get-MEMBER-from-symbol'.
888 `artist-do-continously' -- Do drawing operation continously,
890 `artist-do-poly' -- Do drawing operation many times.
896 If DRAW-HOW is `artist-do-continously':
907 If DRAW-HOW is either `artist-do-poly' or 2:
931 If DRAW-HOW is either `artist-do-continously' or 1:
950 `artist-make-endpoint'
954 If DRAW-HOW is `artist-do-poly':
965 `artist-make-endpoint'.
975 (defun artist-mt-get-tag (element)
979 (defun artist-mt-get-info-part (element)
985 (defsubst artist-go-get-desc (info-part)
989 (defsubst artist-go-get-unshifted (info-part)
993 (defsubst artist-go-get-shifted (info-part)
997 (defsubst artist-go-get-keyword (info-variant-part)
1002 (defsubst artist-go-get-symbol (info-variant-part)
1007 (defsubst artist-go-get-mode-line (info-variant-part)
1012 (defsubst artist-go-get-arrow-pred (info-variant-part)
1017 (defsubst artist-go-get-arrow-set-fn (info-variant-part)
1022 (defsubst artist-go-get-init-fn (info-variant-part)
1027 (defsubst artist-go-get-prep-fill-fn (info-variant-part)
1032 (defsubst artist-go-get-exit-fn (info-variant-part)
1037 (defsubst artist-go-get-draw-how (info-variant-part)
1042 (defsubst artist-go-get-draw-fn (info-variant-part)
1047 (defsubst artist-go-get-undraw-fn (info-variant-part)
1051 component is other than `artist-do-continously' or 1."
1054 (defsubst artist-go-get-interval-fn (info-variant-part)
1058 component is `artist-do-continously'."
1061 (defsubst artist-go-get-fill-pred (info-variant-part)
1065 component is other than `artist-do-continously' or 1."
1068 (defsubst artist-go-get-fill-fn (info-variant-part)
1072 component is other than `artist-do-continously' or 1."
1077 (defsubst artist-fc-get-keyword (info-part)
1081 (defsubst artist-fc-get-symbol (info-part)
1085 (defsubst artist-fc-get-fn (info-part)
1091 (defsubst artist-mn-get-title (info-part)
1095 (defsubst artist-mn-get-items (info-part)
1102 (defun artist-get-last-non-nil-op (op-list &optional last-non-nil)
1106 (artist-get-last-non-nil-op (cdr op-list)
1110 (defun artist-get-first-non-nil-op (op-list)
1112 (or (car (car op-list)) (artist-get-first-non-nil-op (cdr op-list))))
1114 (defun artist-is-in-op-list-p (op op-list)
1118 (artist-is-in-op-list-p op (cdr op-list)))))
1120 (defun artist-make-prev-next-op-alist (op-list
1128 (artist-get-last-non-nil-op
1129 artist-key-compl-table)))
1131 (artist-get-first-non-nil-op
1132 artist-key-compl-table)))
1135 (opsym (artist-mt-get-symbol-from-keyword op))
1138 (artist-is-in-op-list-p op (cdr op-list)))
1139 (artist-make-prev-next-op-alist (cdr op-list)
1144 (cons entry (artist-make-prev-next-op-alist
1150 (defun artist-select-next-op-in-list ()
1153 (let ((next-op (cdr (cdr (assoc artist-curr-go artist-prev-next-op-alist)))))
1154 (artist-select-operation next-op)
1157 (defun artist-select-prev-op-in-list ()
1160 (let ((prev-op (car (cdr (assoc artist-curr-go artist-prev-next-op-alist)))))
1161 (artist-select-operation prev-op)
1167 ;;; The artist-mode
1171 (defun artist-mode (&optional state)
1172 "Toggle artist mode. With arg, turn artist mode on if arg is positive.
1176 How to quit artist mode
1178 Type \\[artist-mode-off] to quit artist-mode.
1183 Type \\[artist-submit-bug-report] to submit a bug report.
1243 `artist-vaporize-fuzziness'.
1280 \\[artist-key-set-point] Does one of the following:
1282 For poly-lines: sets a point (use C-u \\[artist-key-set-point] to set last point)
1287 \\[artist-select-operation] Selects what to draw
1289 Move around with \\[artist-next-line], \\[artist-previous-line], \\[artist-forward-char] and \\[artist-backward-char].
1291 \\[artist-select-fill-char] Sets the charater to use when filling
1292 \\[artist-select-line-char] Sets the charater to use when drawing
1293 \\[artist-select-erase-char] Sets the charater to use when erasing
1294 \\[artist-toggle-rubber-banding] Toggles rubber-banding
1295 \\[artist-toggle-trim-line-endings] Toggles trimming of line-endings
1296 \\[artist-toggle-borderless-shapes] Toggles borders on drawn shapes
1301 \\[artist-toggle-first-arrow] Sets/unsets an arrow at the beginning
1304 \\[artist-toggle-second-arrow] Sets/unsets an arrow at the end
1312 \\[artist-select-op-line] Selects drawing lines
1313 \\[artist-select-op-straight-line] Selects drawing straight lines
1314 \\[artist-select-op-rectangle] Selects drawing rectangles
1315 \\[artist-select-op-square] Selects drawing squares
1316 \\[artist-select-op-poly-line] Selects drawing poly-lines
1317 \\[artist-select-op-straight-poly-line] Selects drawing straight poly-lines
1318 \\[artist-select-op-ellipse] Selects drawing ellipses
1319 \\[artist-select-op-circle] Selects drawing circles
1320 \\[artist-select-op-text-see-thru] Selects rendering text (see thru)
1321 \\[artist-select-op-text-overwrite] Selects rendering text (overwrite)
1322 \\[artist-select-op-spray-can] Spray with spray-can
1323 \\[artist-select-op-spray-set-size] Set size for the spray-can
1324 \\[artist-select-op-erase-char] Selects erasing characters
1325 \\[artist-select-op-erase-rectangle] Selects erasing rectangles
1326 \\[artist-select-op-vaporize-line] Selects vaporizing single lines
1327 \\[artist-select-op-vaporize-lines] Selects vaporizing connected lines
1328 \\[artist-select-op-cut-rectangle] Selects cutting rectangles
1329 \\[artist-select-op-copy-rectangle] Selects copying rectangles
1330 \\[artist-select-op-paste] Selects pasting
1331 \\[artist-select-op-flood-fill] Selects flood-filling
1339 artist-rubber-banding Interactively do rubber-banding or not
1340 artist-first-char What to set at first/second point...
1341 artist-second-char ...when not rubber-banding
1342 artist-interface-with-rect If cut/copy/paste should interface with rect
1343 artist-arrows The arrows to use when drawing arrows
1344 artist-aspect-ratio Character height-to-width for squares
1345 artist-trim-line-endings Trimming of line endings
1346 artist-flood-fill-right-border Right border when flood-filling
1347 artist-flood-fill-show-incrementally Update display while filling
1348 artist-pointer-shape Pointer shape to use while drawing
1349 artist-ellipse-left-char Character to use for narrow ellipses
1350 artist-ellipse-right-char Character to use for narrow ellipses
1351 artist-borderless-shapes If shapes should have borders
1352 artist-picture-compatibility Whether or not to be picture mode compatible
1353 artist-vaporize-fuzziness Tolerance when recognizing lines
1354 artist-spray-interval Seconds between repeated sprayings
1355 artist-spray-radius Size of the spray-area
1356 artist-spray-chars The spray-``color''
1357 artist-spray-new-chars Initial spray-``color''
1361 When entering artist-mode, the hook `artist-mode-init-hook' is called.
1362 When quitting artist-mode, the hook `artist-mode-exit-hook' is called.
1367 \\{artist-mode-map}"
1369 (if (setq artist-mode
1370 (if (null state) (not artist-mode)
1372 (artist-mode-init)
1373 (artist-mode-exit)))
1376 (or (assq 'artist-mode minor-mode-alist)
1378 (cons '(artist-mode artist-mode-name)
1382 (or (assq 'artist-mode minor-mode-map-alist)
1384 (cons (cons 'artist-mode artist-mode-map)
1389 (defun artist-mode-init ()
1390 "Init Artist mode. This will call the hook `artist-mode-init-hook'."
1393 (aset artist-replacement-table i i)
1395 (aset artist-replacement-table ?\n ?\s)
1396 (aset artist-replacement-table ?\t ?\s)
1397 (aset artist-replacement-table 0 ?\s)
1398 (make-local-variable 'artist-key-is-drawing)
1399 (make-local-variable 'artist-key-endpoint1)
1400 (make-local-variable 'artist-key-poly-point-list)
1401 (make-local-variable 'artist-key-shape)
1402 (make-local-variable 'artist-key-draw-how)
1403 (make-local-variable 'artist-popup-menu-table)
1404 (make-local-variable 'artist-key-compl-table)
1405 (make-local-variable 'artist-prev-next-op-alist)
1406 (make-local-variable 'artist-rb-save-data)
1407 (make-local-variable 'artist-arrow-point-1)
1408 (make-local-variable 'artist-arrow-point-2)
1409 (setq artist-key-is-drawing nil)
1410 (setq artist-key-endpoint1 nil)
1411 (setq artist-key-poly-point-list nil)
1412 (setq artist-key-shape nil)
1413 (setq artist-popup-menu-table (artist-compute-popup-menu-table artist-mt))
1414 (setq artist-key-compl-table (artist-compute-key-compl-table artist-mt))
1415 (setq artist-prev-next-op-alist
1416 (artist-make-prev-next-op-alist artist-key-compl-table))
1417 (setq artist-rb-save-data (make-vector 7 0))
1418 (setq artist-arrow-point-1 nil)
1419 (setq artist-arrow-point-2 nil)
1422 (setq artist-key-draw-how
1423 (artist-go-get-draw-how-from-symbol artist-curr-go))
1424 (if (and artist-picture-compatibility (not (eq major-mode 'picture-mode)))
1428 (run-hooks 'artist-mode-init-hook)
1429 (artist-mode-line-show-curr-operation artist-key-is-drawing))
1431 (defun artist-mode-exit ()
1432 "Exit Artist mode. This will call the hook `artist-mode-exit-hook'."
1433 (if (and artist-picture-compatibility (eq major-mode 'picture-mode))
1436 (run-hooks 'artist-mode-exit-hook))
1438 (defun artist-mode-off ()
1441 (artist-mode -1)
1448 (defun artist-update-display ()
1452 (defun artist-mode-line-show-curr-operation (is-drawing)
1454 (let ((mtext (concat artist-mode-name "/"
1455 (artist-go-get-mode-line-from-symbol artist-curr-go)
1457 (setcdr (assq 'artist-mode minor-mode-alist) (list mtext)))
1461 (defun artist-t-if-fill-char-set ()
1462 "Return the value of the variable `artist-fill-char-set'."
1463 artist-fill-char-set)
1465 (defun artist-t ()
1469 (defun artist-nil ()
1473 (defun artist-arrows ()
1477 (defun artist-no-arrows ()
1489 (defun artist-compute-popup-menu-table (menu-table)
1493 (artist-compute-popup-menu-table-sub menu-table)))
1495 (defun artist-compute-popup-menu-table-sub (menu-table)
1499 (let ((element-tag (artist-mt-get-tag element)))
1501 (let* ((info-part (artist-mt-get-info-part element))
1502 (descr (artist-go-get-desc info-part))
1503 (unshifted (artist-go-get-unshifted info-part))
1504 (symbol (artist-go-get-symbol unshifted)))
1508 (let* ((info-part (artist-mt-get-info-part element))
1509 (keyword (artist-fc-get-keyword info-part))
1510 (symbol (artist-fc-get-symbol info-part)))
1517 (let* ((info-part (artist-mt-get-info-part element))
1518 (title (artist-mn-get-title info-part))
1519 (items (artist-mn-get-items info-part)))
1520 (cons title (artist-compute-popup-menu-table-sub items))))
1531 (defun artist-compute-key-compl-table (menu-table)
1538 (let ((element-tag (artist-mt-get-tag element)))
1540 (let* ((info-part (artist-mt-get-info-part element))
1541 (unshifted (artist-go-get-unshifted info-part))
1542 (shifted (artist-go-get-shifted info-part))
1543 (unshifted-kwd (artist-go-get-keyword unshifted))
1544 (shifted-kwd (artist-go-get-keyword shifted)))
1547 (let* ((info-part (artist-mt-get-info-part element))
1548 (items (artist-mn-get-items info-part)))
1549 (artist-compute-key-compl-table items)))
1559 (defun artist-mt-get-symbol-from-keyword (kwd)
1561 (artist-mt-get-symbol-from-keyword-sub artist-mt kwd))
1563 (defun artist-mt-get-symbol-from-keyword-sub (table kwd)
1568 (let ((element-tag (artist-mt-get-tag element)))
1570 (let* ((info-part (artist-mt-get-info-part element))
1571 (unshifted (artist-go-get-unshifted info-part))
1572 (shifted (artist-go-get-shifted info-part))
1573 (unshifted-kwd (artist-go-get-keyword unshifted))
1574 (shifted-kwd (artist-go-get-keyword shifted))
1575 (unshifted-sym (artist-go-get-symbol unshifted))
1576 (shifted-sym (artist-go-get-symbol shifted)))
1583 (let* ((info-part (artist-mt-get-info-part element))
1584 (keyword (artist-fc-get-keyword info-part))
1585 (symbol (artist-fc-get-symbol info-part)))
1589 (let* ((info-part (artist-mt-get-info-part element))
1590 (items (artist-mn-get-items info-part))
1591 (answer (artist-mt-get-symbol-from-keyword-sub
1604 (defun artist-go-retrieve-from-symbol (symbol retrieve-fn)
1608 (artist-go-retrieve-from-symbol-sub artist-mt symbol retrieve-fn))
1610 (defun artist-go-retrieve-from-symbol-sub (table symbol retrieve-fn)
1617 (let ((element-tag (artist-mt-get-tag element)))
1619 (let* ((info-part (artist-mt-get-info-part element))
1620 (unshifted (artist-go-get-unshifted info-part))
1621 (shifted (artist-go-get-shifted info-part))
1622 (unshifted-sym (artist-go-get-symbol unshifted))
1623 (shifted-sym (artist-go-get-symbol shifted))
1632 (let* ((info-part (artist-mt-get-info-part element))
1633 (items (artist-mn-get-items info-part))
1634 (answer (artist-go-retrieve-from-symbol-sub
1641 (defun artist-go-get-keyword-from-symbol (symbol)
1643 (artist-go-retrieve-from-symbol symbol 'artist-go-get-keyword))
1645 (defun artist-go-get-mode-line-from-symbol (symbol)
1647 (artist-go-retrieve-from-symbol symbol 'artist-go-get-mode-line))
1649 (defun artist-go-get-arrow-pred-from-symbol (symbol)
1651 (artist-go-retrieve-from-symbol symbol 'artist-go-get-arrow-pred))
1653 (defun artist-go-get-arrow-set-fn-from-symbol (symbol)
1655 (artist-go-retrieve-from-symbol symbol 'artist-go-get-arrow-set-fn))
1657 (defun artist-go-get-init-fn-from-symbol (symbol)
1659 (artist-go-retrieve-from-symbol symbol 'artist-go-get-init-fn))
1661 (defun artist-go-get-prep-fill-fn-from-symbol (symbol)
1663 (artist-go-retrieve-from-symbol symbol 'artist-go-get-prep-fill-fn))
1665 (defun artist-go-get-exit-fn-from-symbol (symbol)
1667 (artist-go-retrieve-from-symbol symbol 'artist-go-get-exit-fn))
1669 (defun artist-go-get-draw-fn-from-symbol (symbol)
1671 (artist-go-retrieve-from-symbol symbol 'artist-go-get-draw-fn))
1673 (defun artist-go-get-draw-how-from-symbol (symbol)
1675 (artist-go-retrieve-from-symbol symbol 'artist-go-get-draw-how))
1677 (defun artist-go-get-undraw-fn-from-symbol (symbol)
1679 (artist-go-retrieve-from-symbol symbol 'artist-go-get-undraw-fn))
1681 (defun artist-go-get-interval-fn-from-symbol (symbol)
1683 (artist-go-retrieve-from-symbol symbol 'artist-go-get-interval-fn))
1685 (defun artist-go-get-fill-pred-from-symbol (symbol)
1687 (artist-go-retrieve-from-symbol symbol 'artist-go-get-fill-pred))
1689 (defun artist-go-get-fill-fn-from-symbol (symbol)
1691 (artist-go-retrieve-from-symbol symbol 'artist-go-get-fill-fn))
1693 (defun artist-go-get-symbol-shift (symbol is-shifted)
1697 (artist-go-get-symbol-shift-sub artist-mt symbol is-shifted))
1699 (defun artist-go-get-symbol-shift-sub (table symbol is-shifted)
1706 (let ((element-tag (artist-mt-get-tag element)))
1708 (let* ((info-part (artist-mt-get-info-part element))
1709 (unshift-variant (artist-go-get-unshifted info-part))
1710 (shift-variant (artist-go-get-shifted info-part))
1711 (unshift-sym (artist-go-get-symbol unshift-variant))
1712 (shift-sym (artist-go-get-symbol shift-variant)))
1717 (let* ((info-part (artist-mt-get-info-part element))
1718 (items (artist-mn-get-items info-part))
1719 (answer (artist-go-get-symbol-shift-sub
1730 (defun artist-fc-retrieve-from-symbol (symbol retrieve-fn)
1734 (artist-fc-retrieve-from-symbol-sub artist-mt symbol retrieve-fn))
1736 (defun artist-fc-retrieve-from-symbol-sub (table symbol retrieve-fn)
1743 (let ((element-tag (artist-mt-get-tag element)))
1745 (let* ((info-part (artist-mt-get-info-part element))
1746 (fc-symbol (artist-fc-get-symbol info-part)))
1751 (let* ((info-part (artist-mt-get-info-part element))
1752 (items (artist-mn-get-items info-part))
1753 (answer (artist-fc-retrieve-from-symbol-sub
1760 (defun artist-fc-get-fn-from-symbol (symbol)
1762 (artist-fc-retrieve-from-symbol symbol 'artist-fc-get-fn))
1771 (defmacro artist-funcall (fn &rest args)
1775 (defun artist-uniq (l)
1779 ((equal (car l) (car (cdr l))) (artist-uniq (cdr l))) ; first 2 equal
1780 (t (cons (car l) (artist-uniq (cdr l)))))) ; first 2 are different
1782 (defun artist-string-split (str r)
1796 (defun artist-string-to-file (str file-name)
1800 (defun artist-file-to-string (file-name)
1803 (let ((tmp-buffer (get-buffer-create (concat "*artist-" file-name "*"))))
1812 (defun artist-clear-buffer (buf)
1820 (defun artist-system (program stdin &optional program-args)
1829 "artist-stdin."))
1832 (concat "*artist-" program "*")))
1836 "artist-stdout.")))
1841 (if stdin (artist-string-to-file stdin tmp-stdin-file-name))
1844 (artist-clear-buffer tmp-stdout-buffer)
1871 (artist-file-to-string tmp-stderr-file-name)))
1883 ;; artist-current-line get line number (top of buffer is 0)
1885 ;; artist-move-to-xy move to (x,y) (0,0) is beg-of-buffer
1887 ;; artist-get-char-at-xy get char in at (x,y)
1889 ;; artist-replace-char overwrite (replace) char at point
1890 ;; artist-replace-chars overwrite (replace) chars at point
1893 (defsubst artist-current-column ()
1897 (defsubst artist-current-line ()
1903 (defsubst artist-move-to-xy (x y)
1943 (forward-line (- y (artist-current-line)))
1944 (insert-char ?\n (forward-line (- y (artist-current-line))))
1946 (let ((curr-y (artist-current-line)))
1947 (setq artist-draw-region-min-y (min curr-y artist-draw-region-min-y))
1948 (setq artist-draw-region-max-y (max curr-y artist-draw-region-max-y))))
1950 (defsubst artist-get-char-at-xy (x y)
1952 Also updates the variables `artist-draw-min-y' and `artist-draw-max-y'."
1953 (artist-move-to-xy x y)
1954 (let ((curr-y (artist-current-line)))
1955 (setq artist-draw-region-min-y (min curr-y artist-draw-region-min-y))
1956 (setq artist-draw-region-max-y (max curr-y artist-draw-region-max-y)))
1960 (defun artist-get-char-at-xy-conv (x y)
1963 (aref artist-replacement-table (artist-get-char-at-xy x y))))
1966 (defun artist-replace-char (new-char)
1976 (artist-move-to-xy (1+ (artist-current-column))
1977 (artist-current-line))
1979 (insert (aref artist-replacement-table new-char)))
1984 (setq last-command-event (aref artist-replacement-table new-char))
1987 (defun artist-replace-chars (new-char count)
1996 (let* ((replaced-c (aref artist-replacement-table new-char))
1998 (artist-move-to-xy (+ (artist-current-column) count)
1999 (artist-current-line))
2006 (setq last-command-event (aref artist-replacement-table new-char))
2009 (defsubst artist-replace-string (string &optional see-thru)
2019 (if (and see-thru (= (aref artist-replacement-table c) ?\s))
2020 (artist-move-to-xy (1+ (artist-current-column))
2021 (artist-current-line))
2022 (artist-replace-char c)))
2029 (defun artist-no-rb-unset-point1 ()
2031 (let ((x-now (artist-current-column))
2032 (y-now (artist-current-line))
2033 (x (aref artist-rb-save-data 0))
2034 (y (aref artist-rb-save-data 1)))
2035 (artist-move-to-xy x y)
2036 (artist-replace-char (aref artist-rb-save-data 2))
2037 (artist-move-to-xy x-now y-now)))
2039 (defun artist-no-rb-set-point1 (x y)
2041 (let ((x-now (artist-current-column))
2042 (y-now (artist-current-line)))
2043 (aset artist-rb-save-data 0 x)
2044 (aset artist-rb-save-data 1 y)
2045 (aset artist-rb-save-data 2 (artist-get-char-at-xy x y))
2046 (artist-move-to-xy x y)
2047 (artist-replace-char artist-first-char)
2048 (artist-move-to-xy x-now y-now)
2049 (aset artist-rb-save-data 6 0)))
2051 (defun artist-no-rb-unset-point2 ()
2053 (if (= (aref artist-rb-save-data 6) 1)
2054 (let ((x-now (artist-current-column))
2055 (y-now (artist-current-line))
2056 (x (aref artist-rb-save-data 3))
2057 (y (aref artist-rb-save-data 4)))
2058 (artist-move-to-xy x y)
2059 (artist-replace-char (aref artist-rb-save-data 5))
2060 (artist-move-to-xy x-now y-now))))
2062 (defun artist-no-rb-set-point2 (x y)
2064 (let ((x-now (artist-current-column))
2065 (y-now (artist-current-line)))
2066 (aset artist-rb-save-data 3 x)
2067 (aset artist-rb-save-data 4 y)
2068 (aset artist-rb-save-data 5 (artist-get-char-at-xy x y))
2069 (artist-move-to-xy x y)
2070 (artist-replace-char artist-second-char)
2071 (artist-move-to-xy x-now y-now)
2072 (aset artist-rb-save-data 6 1)))
2074 (defun artist-no-rb-unset-points ()
2076 (artist-no-rb-unset-point1)
2077 (artist-no-rb-unset-point2))
2080 ;; artist-intersection-char
2082 ;; Note: If changing this, see the notes for artist-unintersection-char
2083 ;; and artist-vaporize-lines
2085 (defun artist-intersection-char (new-c old-c)
2110 ;; artist-unintersection-char
2112 ;; Note: If changing this, see the note for artist-vaporize-lines
2114 (defun artist-unintersection-char (line-c buffer-c)
2123 other combinations `artist-erase-char'."
2129 ((= line-c buffer-c) artist-erase-char)
2136 (defsubst artist-compute-line-char ()
2139 a character chosen depending on the variables `artist-borderless-shapes',
2140 `artist-fill-char-set', `artist-fill-char' and
2141 `artist-line-char-set' and `artist-line-char'."
2142 (if (and artist-borderless-shapes artist-fill-char-set)
2143 artist-fill-char
2144 (if artist-line-char-set
2145 artist-line-char
2155 (defvar artist-direction-info
2168 (defsubst artist-direction-step-x (direction)
2169 "Return the x-step for DIRECTION from the `artist-direction-info' table."
2170 (aref (aref artist-direction-info direction) 0))
2172 (defsubst artist-direction-step-y (direction)
2173 "Return the y-step for DIRECTION from the `artist-direction-info' table."
2174 (aref (aref artist-direction-info direction) 1))
2176 (defun artist-direction-char (direction)
2177 "Return the character for DIRECTION from the `artist-direction-info' table."
2178 (aref (aref artist-direction-info direction) 2))
2180 ;; artist-find-direction
2184 (defun artist-find-direction (x1 y1 x2 y2)
2204 (defun artist-straight-calculate-length (direction x1 y1 x2 y2)
2214 (defun artist-sline (x1 y1 x2 y2)
2216 (let* ((direction (artist-find-direction x1 y1 x2 y2))
2217 (length (artist-straight-calculate-length direction x1 y1 x2 y2))
2227 (defun artist-save-chars-under-sline (line)
2235 (aset line i (artist-get-char-at-xy x y))
2236 (setq x (+ x (artist-direction-step-x direction)))
2237 (setq y (+ y (artist-direction-step-y direction)))
2248 (defvar artist-octant-info
2263 ;; Primitives for the artist-octant-info.
2266 (defsubst artist-get-dfdx-init-coeff (octant)
2268 (aref (aref artist-octant-info (- octant 1)) 0))
2270 (defsubst artist-get-dfdy-init-coeff (octant)
2272 (aref (aref artist-octant-info (- octant 1)) 1))
2274 (defsubst artist-get-x-step-q>=0 (octant)
2276 (aref (aref artist-octant-info (- octant 1)) 2))
2278 (defsubst artist-get-y-step-q>=0 (octant)
2280 (aref (aref artist-octant-info (- octant 1)) 3))
2282 (defsubst artist-get-x-step-q<0 (octant)
2284 (aref (aref artist-octant-info (- octant 1)) 4))
2286 (defsubst artist-get-y-step-q<0 (octant)
2288 (aref (aref artist-octant-info (- octant 1)) 5))
2293 (defun artist-find-octant (x1 y1 x2 y2)
2322 (defsubst artist-new-coord (x y &optional new-char)
2331 (defsubst artist-coord-get-x (coord)
2335 (defsubst artist-coord-get-y (coord)
2339 (defsubst artist-coord-set-x (coord new-x)
2344 (defsubst artist-coord-set-y (coord new-y)
2349 (defsubst artist-coord-get-saved-char (coord)
2353 (defsubst artist-coord-get-new-char (coord)
2357 (defsubst artist-coord-add-saved-char (coord saved-char)
2362 (defsubst artist-coord-add-new-char (coord new-char)
2367 (defsubst artist-coord-set-new-char (coord new-char)
2375 (defmacro artist-put-pixel (point-list x y)
2378 (list 'append point-list (list 'list (list 'artist-new-coord x y)))))
2383 (defun artist-eight-point (x1 y1 x2 y2)
2386 (octant (artist-find-octant x1 y1 x2 y2))
2387 (dfdx-coeff (artist-get-dfdx-init-coeff octant))
2388 (dfdy-coeff (artist-get-dfdy-init-coeff octant))
2389 (x-step-q>=0 (artist-get-x-step-q>=0 octant))
2390 (y-step-q>=0 (artist-get-y-step-q>=0 octant))
2391 (x-step-q<0 (artist-get-x-step-q<0 octant))
2392 (y-step-q<0 (artist-get-y-step-q<0 octant))
2401 (artist-put-pixel point-list x y)
2413 (artist-put-pixel point-list x y))
2416 ;; artist-save-chars-under-point-list
2420 (defun artist-save-chars-under-point-list (point-list)
2424 (artist-coord-add-saved-char
2426 (artist-get-char-at-xy (artist-coord-get-x coord)
2427 (artist-coord-get-y coord))))
2430 ;; artist-calculate-new-char, artist-calculate-new-chars
2440 ;; artist-calculate-new-char works on one coordinate, returns char.
2441 ;; artist-calculate-new-chars works on a point-list, returns point-list.
2443 (defun artist-calculate-new-char (last-coord new-coord)
2445 (let ((last-x (artist-coord-get-x last-coord))
2446 (last-y (artist-coord-get-y last-coord))
2447 (new-x (artist-coord-get-x new-coord))
2448 (new-y (artist-coord-get-y new-coord)))
2458 (defun artist-calculate-new-chars (point-list)
2461 (list (artist-coord-add-new-char (car point-list) ?o ))
2463 (cons (artist-coord-add-new-char
2465 (artist-calculate-new-char (car (cdr point-list))
2470 (artist-coord-add-new-char
2472 (artist-calculate-new-char last-coord this-coord))
2476 ;; artist-modify-new-chars
2479 ;; artist-modify-new-chars works on a point-list, returns point-list.
2481 (defun artist-modify-new-chars (point-list)
2486 (let* ((new-c (artist-coord-get-new-char coord))
2487 (saved-c (artist-coord-get-saved-char coord))
2488 (modified-c (artist-intersection-char new-c saved-c)))
2489 (artist-coord-set-new-char coord modified-c)))
2498 (defun artist-make-endpoint (x y)
2504 (defun artist-endpoint-get-x (endpoint)
2508 (defun artist-endpoint-get-y (endpoint)
2512 (defun artist-make-2point-object (endpoint1 endpoint2 shapeinfo)
2514 (list endpoint1 endpoint2 shapeinfo))
2516 (defun artist-2point-get-endpoint1 (obj)
2520 (defun artist-2point-get-endpoint2 (obj)
2524 (defun artist-2point-get-shapeinfo (obj)
2533 (defun artist-draw-line (x1 y1 x2 y2)
2540 (let ((endpoint1 (artist-make-endpoint x1 y1))
2541 (endpoint2 (artist-make-endpoint x2 y2)))
2542 (artist-make-2point-object
2543 endpoint1
2547 (artist-move-to-xy (artist-coord-get-x coord)
2548 (artist-coord-get-y coord))
2549 (if artist-line-char-set
2550 (artist-replace-char artist-line-char)
2551 (artist-replace-char (artist-coord-get-new-char coord)))
2553 (artist-modify-new-chars
2554 (artist-calculate-new-chars
2555 (artist-save-chars-under-point-list
2556 (artist-eight-point x1 y1 x2 y2))))))))
2558 (defun artist-undraw-line (line)
2562 (artist-move-to-xy (artist-coord-get-x coord)
2563 (artist-coord-get-y coord))
2564 (artist-replace-char (artist-coord-get-saved-char coord))
2566 (artist-2point-get-shapeinfo line)))
2572 (defun artist-draw-sline (x1 y1 x2 y2)
2584 (let* ((line (artist-save-chars-under-sline (artist-sline x1 y1 x2 y2)))
2589 (line-char (artist-direction-char direction))
2591 (endpoint1 (artist-make-endpoint x y))
2594 (artist-move-to-xy x y)
2595 (if artist-line-char-set
2596 (artist-replace-char artist-line-char)
2597 (artist-replace-char (artist-intersection-char
2602 (setq endpoint2 (artist-make-endpoint x y)))
2603 (setq x (+ x (artist-direction-step-x direction)))
2604 (setq y (+ y (artist-direction-step-y direction)))
2606 (artist-make-2point-object endpoint1 endpoint2 line)))
2609 (defun artist-undraw-sline (line)
2612 (let* ((shape-info (artist-2point-get-shapeinfo line))
2619 (artist-move-to-xy x y)
2620 (artist-replace-char (aref shape-info i))
2621 (setq x (+ x (artist-direction-step-x direction)))
2622 (setq y (+ y (artist-direction-step-y direction)))
2630 (defun artist-draw-rect (x1 y1 x2 y2)
2638 (let* ((artist-line-char (artist-compute-line-char))
2639 (artist-line-char-set artist-line-char)
2640 (line1 (artist-draw-sline x1 y1 x2 y1))
2641 (line2 (artist-draw-sline x2 y1 x2 y2))
2642 (line3 (artist-draw-sline x2 y2 x1 y2))
2643 (line4 (artist-draw-sline x1 y2 x1 y1))
2644 (endpoint1 (artist-make-endpoint x1 y1))
2645 (endpoint2 (artist-make-endpoint x2 y2)))
2646 (artist-make-2point-object endpoint1
2650 (defun artist-undraw-rect (rectangle)
2653 (let ((shape-info (artist-2point-get-shapeinfo rectangle)))
2654 (artist-undraw-sline (elt shape-info 3))
2655 (artist-undraw-sline (elt shape-info 2))
2656 (artist-undraw-sline (elt shape-info 1))
2657 (artist-undraw-sline (elt shape-info 0)))))
2660 (defun artist-rect-corners-squarify (x1 y1 x2 y2)
2679 artist-aspect-ratio)))))
2684 artist-aspect-ratio))))
2691 (defun artist-draw-square (x1 y1 x2 y2)
2699 (let* ((artist-line-char (artist-compute-line-char))
2700 (artist-line-char-set artist-line-char)
2701 (square-corners (artist-rect-corners-squarify x1 y1 x2 y2))
2706 (endpoint1 (artist-make-endpoint new-x1 new-y1))
2707 (endpoint2 (artist-make-endpoint new-x2 new-y2))
2708 (line1 (artist-draw-sline new-x1 new-y1 new-x2 new-y1))
2709 (line2 (artist-draw-sline new-x2 new-y1 new-x2 new-y2))
2710 (line3 (artist-draw-sline new-x2 new-y2 new-x1 new-y2))
2711 (line4 (artist-draw-sline new-x1 new-y2 new-x1 new-y1)))
2712 (artist-make-2point-object endpoint1
2716 (defun artist-undraw-square (square)
2719 (let ((shape-info (artist-2point-get-shapeinfo square)))
2720 (artist-undraw-sline (elt shape-info 3))
2721 (artist-undraw-sline (elt shape-info 2))
2722 (artist-undraw-sline (elt shape-info 1))
2723 (artist-undraw-sline (elt shape-info 0)))))
2729 (defun artist-fill-rect (rect x1 y1 x2 y2)
2737 (artist-move-to-xy x y)
2738 (artist-replace-chars artist-fill-char w)
2741 (defun artist-fill-square (square x1 y1 x2 y2)
2743 (let* ((square-corners (artist-rect-corners-squarify x1 y1 x2 y2))
2754 (artist-move-to-xy x y)
2755 (artist-replace-chars artist-fill-char w)
2763 (defun artist-pen (x1 y1)
2765 The character is replaced with the character in `artist-fill-char'."
2766 (artist-move-to-xy x1 y1)
2767 (artist-replace-char (if artist-line-char-set
2768 artist-line-char
2769 (if artist-fill-char-set
2770 artist-fill-char
2771 artist-default-fill-char))))
2774 (defun artist-pen-line (x1 y1)
2776 The character is replaced with the character in `artist-fill-char'.
2777 This will store all points in `artist-key-poly-point-list' in reversed
2780 (let ((artist-line-char (if artist-line-char-set
2781 artist-line-char
2782 (if artist-fill-char-set
2783 artist-fill-char
2784 artist-default-fill-char))))
2787 (let ((x-last (car (car artist-key-poly-point-list)))
2788 (y-last (cdr (car artist-key-poly-point-list))))
2789 (artist-move-to-xy x-last y-last)
2790 (artist-replace-char artist-line-char)
2791 (artist-draw-line x-last y-last x1 y1))
2794 (setq artist-key-poly-point-list
2795 (cons (cons x1 y1) artist-key-poly-point-list))))
2797 (defun artist-pen-reset-last-xy (x1 y1)
2799 (artist-clear-arrow-points)
2800 (setq artist-key-poly-point-list (list (cons x1 y1))))
2803 (defun artist-pen-set-arrow-points (x1 y1)
2805 Also, the `artist-key-poly-point-list' is reversed."
2807 (setq artist-key-poly-point-list
2808 (artist-uniq artist-key-poly-point-list))
2810 (if (>= (length artist-key-poly-point-list) 2)
2813 (let ((xn (car (car artist-key-poly-point-list)))
2814 (yn (cdr (car artist-key-poly-point-list)))
2815 (xn-1 (car (car (cdr artist-key-poly-point-list))))
2816 (yn-1 (cdr (car (cdr artist-key-poly-point-list))))
2818 (setq artist-key-poly-point-list (reverse artist-key-poly-point-list))
2819 (let ((x0 (car (car artist-key-poly-point-list)))
2820 (y0 (cdr (car artist-key-poly-point-list)))
2821 (x1 (car (car (cdr artist-key-poly-point-list))))
2822 (y1 (cdr (car (cdr artist-key-poly-point-list))))
2824 (setq dir0 (artist-find-direction x1 y1 x0 y0))
2825 (setq dirn (artist-find-direction xn-1 yn-1 xn yn))
2826 (setq artist-arrow-point-1 (artist-make-arrow-point x0 y0 dir0))
2827 (setq artist-arrow-point-2 (artist-make-arrow-point xn yn dirn))))))
2833 (defun artist-figlet-run (text font extra-args)
2838 (artist-string-split extra-args "[ \t]+")))
2841 (artist-string-split extra-args "[ \t]+"))
2843 (figlet-output (artist-system artist-figlet-program text figlet-args))
2851 (defun artist-figlet-get-font-list ()
2855 (ls-cmd artist-figlet-list-fonts-command)
2856 (result (artist-system cmd-interpreter ls-cmd nil))
2862 (artist-string-split stdout ".flf\n")))
2864 (defun artist-figlet-choose-font ()
2867 (let* ((avail-fonts (artist-figlet-get-font-list))
2869 artist-figlet-default-font
2874 (if (string= font "") artist-figlet-default-font font)))
2876 (defun artist-figlet-get-extra-args ()
2883 (defun artist-figlet (text)
2885 (let* ((figlet-font (artist-figlet-choose-font))
2886 (figlet-extra-args (artist-figlet-get-extra-args)))
2887 (artist-figlet-run text figlet-font figlet-extra-args)))
2890 (defun artist-text-insert-common (x y text see-thru)
2894 (let* ((string-list (artist-string-split text "\n"))
2898 (artist-move-to-xy x (+ y i))
2899 (artist-replace-string (car string-list) see-thru)
2903 (defun artist-text-insert-see-thru (x y text)
2906 (artist-text-insert-common x y text t))
2908 (defun artist-text-insert-overwrite (x y text)
2911 (artist-text-insert-common x y text nil))
2913 (defun artist-text-see-thru (x y)
2916 `artist-text-renderer-function', which must return a list of strings,
2921 (rendered-text (artist-funcall artist-text-renderer-function input-text)))
2922 (artist-text-insert-see-thru x y rendered-text)))
2925 (defun artist-text-overwrite (x y)
2928 `artist-text-renderer-function', which must return a list of strings,
2933 (rendered-text (artist-funcall artist-text-renderer-function input-text)))
2934 (artist-text-insert-overwrite x y rendered-text)))
2940 (defun artist-spray-get-interval ()
2942 artist-spray-interval)
2944 (defun artist-spray-random-points (n radius)
2957 (defun artist-spray (x1 y1)
2959 (let* ((num-points (* artist-spray-radius artist-spray-radius))
2960 (spray-points (artist-spray-random-points num-points
2961 artist-spray-radius)))
2967 (buf-c (artist-get-char-at-xy-conv x y))
2968 (this-c (memq buf-c artist-spray-chars))
2969 (next-c (cond ((null this-c) artist-spray-new-char)
2972 (artist-move-to-xy x y)
2973 (artist-replace-char next-c))
2978 (defun artist-spray-clear-circle (circle x1 y1 x2 y2)
2980 (artist-undraw-circle circle))
2982 (defun artist-spray-set-radius (circle x1 y1 x2 y2)
2986 (setq artist-spray-radius (round (sqrt (+ (* dx dx) (* dy dy)))))
2987 (if (= 0 artist-spray-radius)
2988 (setq artist-spray-radius 1))))
2994 (defun artist-erase-char (x1 y1)
2996 The character is replaced with the character in `artist-erase-char'."
2997 (artist-move-to-xy x1 y1)
2998 (artist-replace-char artist-erase-char))
3000 (defun artist-erase-rect (rect x1 y1 x2 y2)
3002 (let ((artist-line-char-set t)
3003 (artist-fill-char-set t)
3004 (artist-line-char artist-erase-char)
3005 (artist-fill-char artist-erase-char))
3006 (artist-draw-rect x1 y1 x2 y2)
3007 (artist-fill-rect rect x1 y1 x2 y2)))
3015 (defun artist-vap-find-endpoint (x1 y1 step-x step-y accept-set reject-set)
3021 part of the line, is determined by the variable `artist-vaporize-fuzziness'.
3029 (let ((c (artist-get-char-at-xy-conv x y)))
3044 ;; the line Search `artist-vaporize-fuzziness'
3049 (let ((fuzziness artist-vaporize-fuzziness)
3059 (setq c (artist-get-char-at-xy-conv x-tmp y-tmp))
3074 (defun artist-vap-find-endpoints-horiz (x y)
3077 (list (artist-vap-find-endpoint x y 1 0 '(?- ?+) '(?\s))
3078 (artist-vap-find-endpoint x y -1 0 '(?- ?+) '(?\s))))
3080 (defun artist-vap-find-endpoints-vert (x y)
3083 (list (artist-vap-find-endpoint x y 0 1 '(?| ?+) '(?\s))
3084 (artist-vap-find-endpoint x y 0 -1 '(?| ?+) '(?\s))))
3086 (defun artist-vap-find-endpoints-swne (x y)
3089 (list (artist-vap-find-endpoint x y 1 -1 '(?/ ?X) '(?\s))
3090 (artist-vap-find-endpoint x y -1 1 '(?/ ?X) '(?\s))))
3092 (defun artist-vap-find-endpoints-nwse (x y)
3095 (list (artist-vap-find-endpoint x y 1 1 '(?\\ ?X) '(?\s))
3096 (artist-vap-find-endpoint x y -1 -1 '(?\\ ?X) '(?\s))))
3099 (defun artist-vap-find-endpoints (x y)
3102 (if artist-line-char-set
3104 (let ((c (artist-get-char-at-xy-conv x y)))
3105 (cond ((eq c ?-) (artist-vap-find-endpoints-horiz x y))
3106 ((eq c ?|) (artist-vap-find-endpoints-vert x y))
3107 ((eq c ?/) (artist-vap-find-endpoints-swne x y))
3108 ((eq c ?\\) (artist-vap-find-endpoints-nwse x y))
3109 ((eq c ?+) (append (artist-vap-find-endpoints-horiz x y)
3110 (artist-vap-find-endpoints-vert x y)))
3111 ((eq c ?X) (append (artist-vap-find-endpoints-swne x y)
3112 (artist-vap-find-endpoints-nwse x y)))
3119 (defun artist-vap-group-in-pairs (l)
3124 (artist-vap-group-in-pairs (cdr (cdr l)))))))
3126 (defun artist-vaporize-by-endpoints (endpoint1 endpoint2)
3129 (let* ((x1 (car endpoint1))
3130 (y1 (cdr endpoint1))
3133 (dir (artist-find-direction x1 y1 x2 y2))
3149 (let* ((buffer-c (artist-get-char-at-xy-conv x y))
3150 (new-c (artist-unintersection-char line-c buffer-c)))
3151 (artist-move-to-xy x y)
3152 (artist-replace-char new-c))
3158 (defun artist-vaporize-line (x1 y1)
3161 `artist-erase-char'. Output is a list of endpoints for lines
3163 (let ((endpoints (artist-vap-find-endpoints x1 y1)))
3168 (artist-vaporize-by-endpoints ep1 ep2)))
3169 (artist-vap-group-in-pairs endpoints))
3173 ;; Implementation note: This depends on artist-vaporize-line doing
3210 ;; That's why we depend on artist-vaporize-line doing unintersecting
3214 (defun artist-vaporize-lines (x1 y1)
3219 (artist-vap-find-endpoints x1 y1))
3222 (new-endpoints (artist-vaporize-line (car vaporize-point)
3232 (defun artist-ellipse-generate-quadrant (x-radius y-radius)
3246 (artist-put-pixel point-list x y)
3256 (artist-put-pixel point-list x y))
3268 (artist-put-pixel point-list x y))
3271 (defsubst artist-new-fill-item (x y width)
3279 (defsubst artist-fill-item-get-x (fill-item)
3283 (defsubst artist-fill-item-set-x (fill-item new-x)
3288 (defsubst artist-fill-item-get-y (fill-item)
3292 (defsubst artist-fill-item-set-y (fill-item new-y)
3297 (defsubst artist-fill-item-get-width (fill-item)
3301 (defsubst artist-fill-item-set-width (fill-item new-width)
3307 (defun artist-ellipse-point-list-add-center (x-center y-center point-list)
3311 (artist-coord-set-x p (+ x-center (artist-coord-get-x p)))
3312 (artist-coord-set-y p (+ y-center (artist-coord-get-y p))))
3316 (defun artist-ellipse-fill-info-add-center (x-center y-center fill-info)
3320 (artist-fill-item-set-x p (+ x-center (artist-fill-item-get-x p)))
3321 (artist-fill-item-set-y p (+ y-center (artist-fill-item-get-y p))))
3324 (defun artist-ellipse-remove-0-fills (fill-info)
3328 ((= 0 (artist-fill-item-get-width (car fill-info)))
3329 (artist-ellipse-remove-0-fills (cdr fill-info)))
3332 (artist-ellipse-remove-0-fills (cdr fill-info))))))
3335 (defun artist-ellipse-compute-fill-info (point-list)
3346 (let* ((x (artist-coord-get-x coord))
3347 (y (artist-coord-get-y coord))
3356 (list (artist-new-fill-item left-edge y width)))))
3365 (artist-new-fill-item (artist-fill-item-get-x i)
3366 (- (artist-fill-item-get-y i))
3367 (artist-fill-item-get-width i)))
3371 (artist-ellipse-remove-0-fills both-halves)))
3374 (defun artist-ellipse-mirror-quadrant (point-list)
3387 (if (= (artist-coord-get-new-char last-coord) ?/)
3388 (artist-coord-set-new-char last-coord artist-ellipse-right-char)))
3396 (let ((c (artist-coord-get-new-char coord)))
3397 (artist-new-coord (artist-coord-get-x coord)
3398 (- (artist-coord-get-y coord))
3409 (let ((c (artist-coord-get-new-char coord)))
3410 (artist-new-coord (- (artist-coord-get-x coord))
3411 (artist-coord-get-y coord)
3414 ((= c artist-ellipse-right-char)
3415 artist-ellipse-left-char)
3423 (defun artist-draw-ellipse-general (x1 y1 x-radius y-radius)
3435 (let* ((point-list (artist-ellipse-generate-quadrant x-radius y-radius))
3436 (fill-info (artist-ellipse-compute-fill-info point-list))
3439 (setq point-list (artist-calculate-new-chars point-list))
3440 (setq point-list (artist-ellipse-mirror-quadrant point-list))
3441 (setq point-list (artist-ellipse-point-list-add-center x1 y1 point-list))
3442 (setq fill-info (artist-ellipse-fill-info-add-center x1 y1 fill-info))
3448 (artist-move-to-xy (artist-coord-get-x coord)
3449 (artist-coord-get-y coord))
3450 (if artist-line-char-set
3451 (artist-replace-char artist-line-char)
3452 (artist-replace-char (artist-coord-get-new-char coord)))
3454 (artist-modify-new-chars
3455 (artist-save-chars-under-point-list point-list))))
3459 (artist-make-2point-object (artist-make-endpoint x1 y1)
3460 (artist-make-endpoint x-radius y-radius)
3463 (defun artist-draw-ellipse-with-0-height (x1 y1 x-radius y-radius)
3478 (line-char (if artist-line-char-set artist-line-char ?-))
3486 (new-coord (artist-new-coord line-x line-y)))
3487 (artist-coord-add-saved-char new-coord
3488 (artist-get-char-at-xy line-x line-y))
3489 (artist-move-to-xy line-x line-y)
3490 (artist-replace-char line-char)
3495 (artist-make-2point-object (artist-make-endpoint x1 y1)
3496 (artist-make-endpoint x-radius y-radius)
3499 (defun artist-draw-ellipse (x1 y1 x2 y2)
3509 (let* ((artist-line-char (artist-compute-line-char))
3510 (artist-line-char-set artist-line-char)
3530 (artist-draw-ellipse-with-0-height x y x-radius y-radius)
3531 (artist-draw-ellipse-general x y x-radius y-radius))))
3534 (defun artist-undraw-ellipse (ellipse)
3537 (let ((point-list (aref (artist-2point-get-shapeinfo ellipse) 0)))
3540 (artist-move-to-xy (artist-coord-get-x coord)
3541 (artist-coord-get-y coord))
3542 (artist-replace-char (artist-coord-get-saved-char coord))
3547 (defun artist-draw-circle (x1 y1 x2 y2)
3557 (let* ((artist-line-char (artist-compute-line-char))
3558 (artist-line-char-set artist-line-char)
3573 (* (* artist-aspect-ratio height)
3574 (* artist-aspect-ratio height))))))
3575 (y-radius (round (/ x-radius artist-aspect-ratio))))
3576 (artist-draw-ellipse-general x1 y1 x-radius y-radius)))
3578 (defalias 'artist-undraw-circle 'artist-undraw-ellipse)
3584 (defun artist-fill-ellipse (ellipse x y x-radius y-radius)
3586 (let ((fill-info (aref (artist-2point-get-shapeinfo ellipse) 1)))
3589 (artist-move-to-xy (artist-fill-item-get-x fill-item)
3590 (artist-fill-item-get-y fill-item))
3591 (artist-replace-chars artist-fill-char
3592 (artist-fill-item-get-width fill-item))
3596 (defalias 'artist-fill-circle 'artist-fill-ellipse)
3604 (defun artist-cut-rect (rect x1 y1 x2 y2)
3606 (artist-undraw-rect rect)
3607 (artist-copy-generic x1 y1 x2 y2)
3608 (artist-erase-rect rect x1 y1 x2 y2))
3610 (defun artist-cut-square (square x1 y1 x2 y2)
3612 (artist-undraw-square square)
3613 (let* ((square-corners (artist-rect-corners-squarify x1 y1 x2 y2))
3618 (artist-copy-generic new-x1 new-y1 new-x2 new-y2)
3619 (artist-erase-rect square new-x1 new-y1 new-x2 new-y2)))
3622 (defun artist-get-buffer-contents-at-xy (x y width)
3624 (artist-move-to-xy x y)
3626 (there (save-excursion (artist-move-to-xy (+ x width) y) (point))))
3628 (setq there (save-excursion (artist-move-to-xy (+ x width) y) (point)))
3632 (defun artist-copy-generic (x1 y1 x2 y2)
3643 (setq l (cons (artist-get-buffer-contents-at-xy x y w) l))
3645 (if artist-interface-with-rect
3647 (setq artist-copy-buffer (reverse l)))))
3650 (defun artist-copy-rect (rect x1 y1 x2 y2)
3652 (artist-undraw-rect rect)
3653 (artist-copy-generic x1 y1 x2 y2))
3655 (defun artist-copy-square (square x1 y1 x2 y2)
3657 (artist-undraw-square square)
3658 (let* ((square-corners (artist-rect-corners-squarify x1 y1 x2 y2))
3663 (artist-copy-generic new-x1 new-y1 new-x2 new-y2)))
3665 (defun artist-paste (x y)
3667 (let ((copy-buf (if artist-interface-with-rect
3669 artist-copy-buffer)))
3672 (artist-move-to-xy x y)
3673 (artist-replace-string (car copy-buf))
3682 (defun artist-ff-too-far-right (x)
3684 (cond ((numberp artist-flood-fill-right-border)
3685 (> x artist-flood-fill-right-border))
3686 ((eq artist-flood-fill-right-border 'window-width)
3688 ((eq artist-flood-fill-right-border 'fill-column)
3690 (t (error "Invalid value for `artist-flood-fill-right-border'"))))
3692 (defun artist-ff-get-rightmost-from-xy (x y)
3695 (let ((char-at-xy (artist-get-char-at-xy-conv x y))
3698 (while (and (not (artist-ff-too-far-right x))
3699 (= char-at-xy (artist-get-char-at-xy-conv x y)))
3704 (defun artist-ff-is-topmost-line (x y)
3708 (defun artist-ff-is-bottommost-line (x y)
3713 (let ((last-line (artist-current-line)))
3721 (defun artist-flood-fill (x1 y1)
3722 "Flood-fill starting at X1, Y1. Fill with the char in `artist-fill-char'."
3726 (c (artist-get-char-at-xy-conv x1 y1))
3727 (artist-fill-char (if artist-fill-char-set
3728 artist-fill-char
3729 artist-default-fill-char)))
3734 (if (not (= c artist-fill-char))
3735 (push (artist-new-coord x1 y1) stack))
3739 (x (artist-coord-get-x coord))
3740 (y (artist-coord-get-y coord))
3759 (setq x-rightmost (artist-ff-get-rightmost-from-xy x y))
3760 (setq lines-above (not (artist-ff-is-topmost-line x y)))
3761 (setq lines-below (not (artist-ff-is-bottommost-line x y)))
3766 (while (and (>= x 0) (= c (artist-get-char-at-xy-conv x y)))
3768 (let ((c-above (artist-get-char-at-xy-conv x (- y 1))))
3770 (push (artist-new-coord x (- y 1)) stack))
3782 (let ((c-below (artist-get-char-at-xy-conv x (1+ y))))
3784 (push (artist-new-coord x (1+ y)) stack))
3788 (artist-move-to-xy x-leftmost y)
3789 (artist-replace-chars artist-fill-char (1+ (- x-rightmost x-leftmost)))
3796 (if artist-flood-fill-show-incrementally
3800 (artist-update-display)))))))
3806 (defun artist-make-arrow-point (x y direction &optional state)
3812 (artist-move-to-xy x y)
3815 (aset arrow-point 1 (artist-get-char-at-xy x y))
3820 (defsubst artist-arrow-point-get-marker (arrow-point)
3824 (defsubst artist-arrow-point-get-orig-char (arrow-point)
3828 (defsubst artist-arrow-point-get-direction (arrow-point)
3832 (defsubst artist-arrow-point-get-state (arrow-point)
3836 (defsubst artist-arrow-point-set-state (arrow-point new-state)
3841 (defun artist-clear-arrow-points ()
3843 (setq artist-arrow-point-1 nil)
3844 (setq artist-arrow-point-2 nil))
3846 (defun artist-set-arrow-points-for-poly (point-list)
3850 (x1 (artist-endpoint-get-x ep1))
3851 (y1 (artist-endpoint-get-y ep1))
3852 (x2 (artist-endpoint-get-x ep2))
3853 (y2 (artist-endpoint-get-y ep2))
3854 (dir1 (artist-find-direction x2 y2 x1 y1))
3857 (xn (artist-endpoint-get-x epn))
3858 (yn (artist-endpoint-get-y epn))
3859 (xn-1 (artist-endpoint-get-x epn-1))
3860 (yn-1 (artist-endpoint-get-y epn-1))
3861 (dirn (artist-find-direction xn-1 yn-1 xn yn)))
3862 (setq artist-arrow-point-1 (artist-make-arrow-point x1 y1 dir1))
3863 (setq artist-arrow-point-2 (artist-make-arrow-point xn yn dirn))))
3866 (defun artist-set-arrow-points-for-2points (shape x1 y1 x2 y2)
3869 (let* ((endpoint1 (artist-2point-get-endpoint1 shape))
3870 (endpoint2 (artist-2point-get-endpoint2 shape))
3871 (x1 (artist-endpoint-get-x endpoint1))
3872 (y1 (artist-endpoint-get-y endpoint1))
3873 (x2 (artist-endpoint-get-x endpoint2))
3874 (y2 (artist-endpoint-get-y endpoint2)))
3875 (setq artist-arrow-point-1
3876 (artist-make-arrow-point x1 y1
3877 (artist-find-direction x2 y2 x1 y1)))
3878 (setq artist-arrow-point-2
3879 (artist-make-arrow-point x2 y2
3880 (artist-find-direction x1 y1 x2 y2)))))
3888 (defun artist-key-undraw-continously (x y)
3893 (defun artist-key-undraw-poly (x y)
3895 (let ((undraw-fn (artist-go-get-undraw-fn-from-symbol artist-curr-go))
3896 (x1 (artist-endpoint-get-x artist-key-endpoint1))
3897 (y1 (artist-endpoint-get-y artist-key-endpoint1)))
3898 (artist-funcall undraw-fn artist-key-shape)))
3900 (defun artist-key-undraw-1point (x y)
3905 (defun artist-key-undraw-2points (x y)
3907 (let ((undraw-fn (artist-go-get-undraw-fn-from-symbol artist-curr-go))
3908 (x1 (artist-endpoint-get-x artist-key-endpoint1))
3909 (y1 (artist-endpoint-get-y artist-key-endpoint1)))
3910 (artist-funcall undraw-fn artist-key-shape)))
3912 (defun artist-key-undraw-common ()
3914 (let ((draw-how (artist-go-get-draw-how-from-symbol artist-curr-go))
3915 (col (artist-current-column))
3916 (row (artist-current-line)))
3921 (cond ((eq draw-how 'artist-do-continously)
3922 (artist-key-undraw-continously col row))
3923 ((eq draw-how 'artist-do-poly)
3924 (artist-key-undraw-poly col row))
3926 (artist-key-undraw-1point col row))
3928 (artist-key-undraw-2points col row))
3933 (artist-move-to-xy col row)))
3938 ;; in the master table, `artist-mt', which would mean leaving a timer
3943 ;; simpler: when at the end of `artist-mouse-draw-continously', the
3946 (defun artist-key-draw-continously (x y)
3948 (let ((draw-fn (artist-go-get-draw-fn-from-symbol artist-curr-go)))
3949 (setq artist-key-shape (artist-funcall draw-fn x y))))
3951 (defun artist-key-draw-poly (x y)
3953 (let ((draw-fn (artist-go-get-draw-fn-from-symbol artist-curr-go))
3954 (x1 (artist-endpoint-get-x artist-key-endpoint1))
3955 (y1 (artist-endpoint-get-y artist-key-endpoint1)))
3956 (setq artist-key-shape (artist-funcall draw-fn x1 y1 x y))))
3958 (defun artist-key-draw-1point (x y)
3960 (let ((draw-fn (artist-go-get-draw-fn-from-symbol artist-curr-go)))
3961 (setq artist-key-shape (artist-funcall draw-fn x y))))
3964 (defun artist-key-draw-2points (x y)
3966 (let ((draw-fn (artist-go-get-draw-fn-from-symbol artist-curr-go))
3967 (x1 (artist-endpoint-get-x artist-key-endpoint1))
3968 (y1 (artist-endpoint-get-y artist-key-endpoint1)))
3969 (setq artist-key-shape (artist-funcall draw-fn x1 y1 x y))))
3971 (defun artist-key-draw-common ()
3973 (let ((draw-how (artist-go-get-draw-how-from-symbol artist-curr-go))
3974 (col (artist-current-column))
3975 (row (artist-current-line)))
3980 (cond ((eq draw-how 'artist-do-continously)
3981 (artist-key-draw-continously col row))
3982 ((eq draw-how 'artist-do-poly)
3983 (artist-key-draw-poly col row))
3985 (artist-key-draw-1point col row))
3987 (artist-key-draw-2points col row))
3992 (artist-move-to-xy col row)))
4002 (defun artist-draw-region-reset ()
4004 (setq artist-draw-region-max-y 0)
4005 (setq artist-draw-region-min-y 1000000))
4007 (defun artist-draw-region-trim-line-endings (min-y max-y)
4018 (artist-move-to-xy 0 curr-y)
4027 (defun artist-key-do-continously-continously (x y)
4029 (let ((draw-fn (artist-go-get-draw-fn-from-symbol artist-curr-go)))
4030 (artist-funcall draw-fn x y)))
4033 (defun artist-key-do-continously-poly (x y)
4035 (let ((draw-fn (artist-go-get-draw-fn-from-symbol artist-curr-go))
4036 (undraw-fn (artist-go-get-undraw-fn-from-symbol artist-curr-go))
4037 (x1 (artist-endpoint-get-x artist-key-endpoint1))
4038 (y1 (artist-endpoint-get-y artist-key-endpoint1))
4044 (if (not artist-rubber-banding)
4046 (artist-no-rb-unset-point2)
4047 (artist-no-rb-set-point2 x y))
4049 (artist-funcall undraw-fn artist-key-shape)
4050 (setq artist-key-shape (artist-funcall draw-fn x1 y1 x2 y2))))))
4053 (defun artist-key-do-continously-1point (x y)
4059 (defun artist-key-do-continously-2points (x y)
4061 (let ((draw-fn (artist-go-get-draw-fn-from-symbol artist-curr-go))
4062 (undraw-fn (artist-go-get-undraw-fn-from-symbol artist-curr-go))
4063 (x1 (artist-endpoint-get-x artist-key-endpoint1))
4064 (y1 (artist-endpoint-get-y artist-key-endpoint1))
4070 (if (not artist-rubber-banding)
4072 (artist-no-rb-unset-point2)
4073 (artist-no-rb-set-point2 x y))
4075 (artist-funcall undraw-fn artist-key-shape)
4076 (setq artist-key-shape (artist-funcall draw-fn x1 y1 x2 y2))))))
4079 (defun artist-key-do-continously-common ()
4081 (let ((draw-how (artist-go-get-draw-how-from-symbol artist-curr-go))
4082 (col (artist-current-column))
4083 (row (artist-current-line)))
4088 (cond ((eq draw-how 'artist-do-continously)
4089 (artist-key-do-continously-continously col row))
4090 ((eq draw-how 'artist-do-poly)
4091 (artist-key-do-continously-poly col row))
4093 (artist-key-do-continously-1point col row))
4095 (artist-key-do-continously-2points col row))
4100 (artist-move-to-xy col row)))
4103 (defun artist-key-set-point-continously (x y)
4106 (let ((arrow-pred (artist-go-get-arrow-pred-from-symbol artist-curr-go))
4107 (arrow-set-fn (artist-go-get-arrow-set-fn-from-symbol artist-curr-go))
4108 (init-fn (artist-go-get-init-fn-from-symbol artist-curr-go))
4109 (prep-fill-fn (artist-go-get-prep-fill-fn-from-symbol artist-curr-go))
4110 (exit-fn (artist-go-get-exit-fn-from-symbol artist-curr-go)))
4112 (if (not artist-key-is-drawing)
4115 (artist-funcall init-fn x y))
4120 (artist-funcall prep-fill-fn x y)
4121 (if (artist-funcall arrow-pred)
4122 (artist-funcall arrow-set-fn x y)
4123 (artist-clear-arrow-points))
4124 (artist-funcall exit-fn x y))))
4127 (setq artist-key-is-drawing (not artist-key-is-drawing)))
4131 (defun artist-key-set-point-poly (x y &optional this-is-last-point)
4134 (let ((draw-fn (artist-go-get-draw-fn-from-symbol artist-curr-go))
4135 (init-fn (artist-go-get-init-fn-from-symbol artist-curr-go))
4136 (prep-fill-fn (artist-go-get-prep-fill-fn-from-symbol artist-curr-go))
4137 (exit-fn (artist-go-get-exit-fn-from-symbol artist-curr-go))
4138 (fill-pred (artist-go-get-fill-pred-from-symbol artist-curr-go))
4139 (fill-fn (artist-go-get-fill-fn-from-symbol artist-curr-go))
4140 (arrow-pred (artist-go-get-arrow-pred-from-symbol artist-curr-go))
4141 (arrow-set-fn (artist-go-get-arrow-set-fn-from-symbol artist-curr-go)))
4143 (if (not artist-key-is-drawing)
4148 (artist-funcall init-fn x y)
4152 (if (not artist-rubber-banding)
4153 (artist-no-rb-set-point1 x y)
4154 (setq artist-key-shape (artist-funcall draw-fn x y x y)))
4157 (setq artist-key-endpoint1 (artist-make-endpoint x y))
4160 (setq artist-key-poly-point-list (list (artist-make-endpoint x y)))
4163 (artist-clear-arrow-points)
4166 (setq artist-key-is-drawing t)
4171 "Set next with \\[artist-key-set-point], "
4172 "set last with C-u \\[artist-key-set-point]"))))
4178 (let ((x1 (artist-endpoint-get-x artist-key-endpoint1))
4179 (y1 (artist-endpoint-get-y artist-key-endpoint1))
4185 ;; shape is already drawn in artist-key-do-continously-2points.)
4187 (if (not artist-rubber-banding)
4189 (artist-no-rb-unset-points)
4190 (setq artist-key-shape (artist-funcall draw-fn x1 y1 x2 y2))))
4196 (if (not (null artist-key-shape))
4197 (let ((endpoint2 (artist-2point-get-endpoint2 artist-key-shape)))
4198 (setq x2 (artist-endpoint-get-x endpoint2))
4199 (setq y2 (artist-endpoint-get-y endpoint2))))
4202 (setq artist-key-poly-point-list
4203 (append artist-key-poly-point-list
4204 (list (artist-make-endpoint x2 y2))))
4217 (setq artist-key-endpoint1 (artist-make-endpoint x1 y1))
4221 (if (not artist-rubber-banding)
4222 (artist-no-rb-set-point1 x1 y1)
4223 (setq artist-key-shape (artist-funcall draw-fn x1 y1 x1 y1)))
4231 (artist-funcall prep-fill-fn artist-key-poly-point-list)
4234 (if (artist-funcall fill-pred)
4235 (artist-funcall fill-fn artist-key-shape
4236 artist-key-poly-point-list))
4239 (if (artist-funcall arrow-pred)
4240 (artist-funcall arrow-set-fn artist-key-poly-point-list)
4241 (artist-clear-arrow-points))
4243 (artist-funcall exit-fn artist-key-poly-point-list)
4246 (setq artist-key-shape nil)
4247 (setq artist-key-endpoint1 nil)
4248 (setq artist-key-is-drawing nil)))))))
4251 (defun artist-key-set-point-1point (x y)
4253 (let ((draw-fn (artist-go-get-draw-fn-from-symbol artist-curr-go))
4254 (init-fn (artist-go-get-init-fn-from-symbol artist-curr-go))
4255 (prep-fill-fn (artist-go-get-prep-fill-fn-from-symbol artist-curr-go))
4256 (exit-fn (artist-go-get-exit-fn-from-symbol artist-curr-go))
4257 (draw-fn (artist-go-get-draw-fn-from-symbol artist-curr-go))
4258 (arrow-pred (artist-go-get-arrow-pred-from-symbol artist-curr-go))
4259 (arrow-set-fn (artist-go-get-arrow-set-fn-from-symbol artist-curr-go)))
4260 (artist-funcall init-fn x y)
4261 (artist-funcall draw-fn x y)
4262 (artist-funcall prep-fill-fn x y)
4263 (if (artist-funcall arrow-pred)
4264 (artist-funcall arrow-set-fn x y)
4265 (artist-clear-arrow-points))
4266 (artist-funcall exit-fn x y))
4267 (setq artist-key-shape nil)
4268 (setq artist-key-is-drawing nil))
4271 (defun artist-key-set-point-2points (x y)
4273 (let ((draw-fn (artist-go-get-draw-fn-from-symbol artist-curr-go))
4274 (init-fn (artist-go-get-init-fn-from-symbol artist-curr-go))
4275 (prep-fill-fn (artist-go-get-prep-fill-fn-from-symbol artist-curr-go))
4276 (exit-fn (artist-go-get-exit-fn-from-symbol artist-curr-go))
4277 (fill-pred (artist-go-get-fill-pred-from-symbol artist-curr-go))
4278 (fill-fn (artist-go-get-fill-fn-from-symbol artist-curr-go))
4279 (arrow-pred (artist-go-get-arrow-pred-from-symbol artist-curr-go))
4280 (arrow-set-fn (artist-go-get-arrow-set-fn-from-symbol artist-curr-go)))
4281 (if (not artist-key-is-drawing)
4286 (artist-funcall init-fn x y)
4290 (if (not artist-rubber-banding)
4291 (artist-no-rb-set-point1 x y)
4292 (setq artist-key-shape (artist-funcall draw-fn x y x y)))
4295 (setq artist-key-endpoint1 (artist-make-endpoint x y))
4298 (artist-clear-arrow-points)
4301 (setq artist-key-is-drawing t))
4306 (let ((x1 (artist-endpoint-get-x artist-key-endpoint1))
4307 (y1 (artist-endpoint-get-y artist-key-endpoint1))
4313 ;; shape is already drawn in artist-key-do-continously-2points.)
4315 (if (not artist-rubber-banding)
4317 (artist-no-rb-unset-points)
4318 (setq artist-key-shape (artist-funcall draw-fn x1 y1 x2 y2))))
4320 (artist-funcall prep-fill-fn artist-key-shape x1 y1 x2 y2)
4324 (if (artist-funcall fill-pred)
4325 (artist-funcall fill-fn artist-key-shape x1 y1 x2 y2))
4329 (if (artist-funcall arrow-pred)
4330 (artist-funcall arrow-set-fn artist-key-shape x1 y1 x2 y2)
4331 (artist-clear-arrow-points))
4333 (artist-funcall exit-fn artist-key-shape x1 y1 x2 y2)
4336 (setq artist-key-is-drawing nil)))))
4339 (defun artist-key-set-point-common (arg)
4342 (let ((draw-how (artist-go-get-draw-how-from-symbol artist-curr-go))
4343 (col (artist-current-column))
4344 (row (artist-current-line))
4345 (was-drawing artist-key-is-drawing))
4348 (if (not artist-key-is-drawing)
4349 (artist-draw-region-reset))
4354 (cond ((eq draw-how 'artist-do-continously)
4355 (artist-key-set-point-continously col row)
4357 (artist-key-do-continously-continously col row))
4358 ((eq draw-how 'artist-do-poly)
4359 (artist-key-set-point-poly col row arg))
4361 (artist-key-set-point-1point col row))
4363 (artist-key-set-point-2points col row))
4367 (if (and artist-trim-line-endings
4369 (not artist-key-is-drawing))
4370 (artist-draw-region-trim-line-endings artist-draw-region-min-y
4371 artist-draw-region-max-y))
4375 (artist-move-to-xy col row)
4376 (artist-mode-line-show-curr-operation artist-key-is-drawing)))
4382 (defun artist-previous-line (&optional n)
4386 (let ((col (artist-current-column)))
4387 (if (not artist-key-is-drawing)
4393 (artist-key-do-continously-common))))
4396 (defun artist-next-line (&optional n)
4400 (let ((col (artist-current-column)))
4401 (if (not artist-key-is-drawing)
4407 (artist-key-do-continously-common))))
4409 (defun artist-backward-char (&optional n)
4414 (artist-forward-char (- n))
4415 (artist-forward-char n)))
4417 (defun artist-forward-char (&optional n)
4423 (curr-col (artist-current-column))
4425 (if (not artist-key-is-drawing)
4428 (artist-key-do-continously-common))))
4431 (defun artist-key-set-point (&optional arg)
4434 (artist-key-set-point-common arg))
4437 (defun artist-select-fill-char (c)
4440 (cond ((eq c ?\r) (setq artist-fill-char-set nil)
4442 (t (setq artist-fill-char-set t)
4443 (setq artist-fill-char c)
4447 (defun artist-select-line-char (c)
4450 (cond ((eq c ?\r) (setq artist-line-char-set nil)
4452 (t (setq artist-line-char-set t)
4453 (setq artist-line-char c)
4455 (if artist-key-is-drawing
4456 (artist-key-do-continously-common)))
4459 (defun artist-select-erase-char (c)
4462 (cond ((eq c ?\r) (setq artist-erase-char ?\s)
4464 (t (setq artist-erase-char c)
4466 (if artist-key-is-drawing
4467 (artist-key-do-continously-common)))
4469 (defun artist-charlist-to-string (char-list)
4477 (defun artist-string-to-charlist (str)
4481 (defun artist-select-spray-chars (chars initial-char)
4489 (artist-charlist-to-string artist-spray-chars)))
4490 (char-list (artist-string-to-charlist str))
4503 (setq first-c (car (artist-string-to-charlist first-s)))
4511 (setq artist-spray-chars chars)
4512 (setq artist-spray-new-char initial-char)
4514 (artist-charlist-to-string chars) (char-to-string initial-char)))
4517 (defun artist-select-operation (op-str)
4520 artist-key-compl-table)))
4521 (let* ((op-symbol (artist-mt-get-symbol-from-keyword op-str))
4523 (artist-go-get-draw-how-from-symbol op-symbol)
4532 (if (and artist-key-is-drawing
4533 (not (equal artist-key-draw-how draw-how)))
4537 (if (and artist-key-is-drawing
4538 artist-rubber-banding)
4539 (artist-key-undraw-common))
4542 (setq artist-curr-go op-symbol)
4543 (setq artist-key-draw-how draw-how)
4547 (if (and artist-key-is-drawing
4548 artist-rubber-banding
4549 (not (eq artist-key-draw-how 1)))
4550 (artist-key-draw-common)))
4553 (artist-mode-line-show-curr-operation artist-key-is-drawing))
4556 (defun artist-toggle-rubber-banding (&optional state)
4560 (if artist-key-is-drawing
4562 (if (setq artist-rubber-banding
4563 (if (null state) (not artist-rubber-banding)
4569 (defun artist-toggle-trim-line-endings (&optional state)
4573 (if (setq artist-trim-line-endings
4574 (if (null state) (not artist-trim-line-endings)
4580 (defun artist-toggle-borderless-shapes (&optional state)
4584 (if (setq artist-borderless-shapes
4585 (if (null state) (not artist-borderless-shapes)
4591 (defun artist-toggle-first-arrow ()
4595 (if (not (null artist-arrow-point-1))
4596 (let* ((arrow-point artist-arrow-point-1)
4597 (arrow-state (artist-arrow-point-get-state arrow-point))
4598 (arrow-marker (artist-arrow-point-get-marker arrow-point))
4599 (direction (artist-arrow-point-get-direction arrow-point))
4600 (orig-char (artist-arrow-point-get-orig-char arrow-point))
4601 (arrow-char (aref artist-arrows direction))
4608 (artist-replace-char arrow-char))
4609 (artist-replace-char orig-char))
4611 (artist-arrow-point-set-state artist-arrow-point-1 new-state)))))
4613 (defun artist-toggle-second-arrow ()
4617 (if (not (null artist-arrow-point-2))
4618 (let* ((arrow-point artist-arrow-point-2)
4619 (arrow-state (artist-arrow-point-get-state arrow-point))
4620 (arrow-marker (artist-arrow-point-get-marker arrow-point))
4621 (direction (artist-arrow-point-get-direction arrow-point))
4622 (orig-char (artist-arrow-point-get-orig-char arrow-point))
4623 (arrow-char (aref artist-arrows direction))
4630 (artist-replace-char arrow-char))
4631 (artist-replace-char orig-char))
4633 (artist-arrow-point-set-state artist-arrow-point-2 new-state)))))
4636 (defun artist-select-op-line ()
4639 (artist-select-operation "line"))
4641 (defun artist-select-op-straight-line ()
4644 (artist-select-operation "straight line"))
4646 (defun artist-select-op-rectangle ()
4649 (artist-select-operation "rectangle"))
4651 (defun artist-select-op-square ()
4654 (artist-select-operation "square"))
4656 (defun artist-select-op-poly-line ()
4659 (artist-select-operation "poly-line"))
4661 (defun artist-select-op-straight-poly-line ()
4664 (artist-select-operation "straight poly-line"))
4666 (defun artist-select-op-ellipse ()
4669 (artist-select-operation "ellipse"))
4671 (defun artist-select-op-circle ()
4674 (artist-select-operation "circle"))
4676 (defun artist-select-op-text-see-thru ()
4679 (artist-select-operation "text see-thru"))
4681 (defun artist-select-op-text-overwrite ()
4684 (artist-select-operation "text overwrite"))
4686 (defun artist-select-op-spray-can ()
4689 (artist-select-operation "spray-can"))
4691 (defun artist-select-op-spray-set-size ()
4694 (artist-select-operation "spray set size"))
4696 (defun artist-select-op-erase-char ()
4699 (artist-select-operation "erase char"))
4701 (defun artist-select-op-erase-rectangle ()
4704 (artist-select-operation "erase rectangle"))
4706 (defun artist-select-op-vaporize-line ()
4709 (artist-select-operation "vaporize line"))
4711 (defun artist-select-op-vaporize-lines ()
4714 (artist-select-operation "vaporize lines"))
4716 (defun artist-select-op-cut-rectangle ()
4719 (artist-select-operation "cut rectangle"))
4721 (defun artist-select-op-cut-square ()
4724 (artist-select-operation "cut square"))
4726 (defun artist-select-op-copy-rectangle ()
4729 (artist-select-operation "copy rectangle"))
4731 (defun artist-select-op-copy-square ()
4734 (artist-select-operation "cut square"))
4736 (defun artist-select-op-paste ()
4739 (artist-select-operation "paste"))
4741 (defun artist-select-op-flood-fill ()
4744 (artist-select-operation "flood-fill"))
4751 (defun artist-update-pointer-shape ()
4755 (defun artist-set-pointer-shape (new-pointer-shape)
4758 (artist-update-pointer-shape))
4760 (defsubst artist-event-is-shifted (ev)
4761 "Check whether the shift-key is pressed in event EV."
4764 (defun artist-do-nothing ()
4768 (defun artist-down-mouse-1 (ev)
4771 (let* ((real (artist-go-get-symbol-shift
4772 artist-curr-go (artist-event-is-shifted ev)))
4773 (draw-how (artist-go-get-draw-how-from-symbol real))
4775 ;; in case we are interrupting a key-draw operation.
4776 (orig-draw-region-min-y artist-draw-region-min-y)
4777 (orig-draw-region-max-y artist-draw-region-max-y)
4782 (key (let* ((basic (event-basic-type ev))
4785 (if (artist-event-is-shifted ev)
4788 (orig-button-up-binding (lookup-key (current-global-map) key)))
4793 (artist-set-pointer-shape artist-pointer-shape))
4814 (define-key (current-global-map) key 'artist-do-nothing)
4816 (artist-draw-region-reset)
4818 (artist-mode-line-show-curr-operation t)
4820 (cond ((eq draw-how 'artist-do-continously)
4821 (artist-mouse-draw-continously ev))
4822 ((eq draw-how 'artist-do-poly)
4823 (artist-mouse-draw-poly ev))
4825 (artist-mouse-draw-1point ev))
4827 (artist-mouse-draw-2points ev))
4831 (if artist-trim-line-endings
4832 (artist-draw-region-trim-line-endings artist-draw-region-min-y
4833 artist-draw-region-max-y))
4834 (setq artist-draw-region-min-y orig-draw-region-min-y)
4835 (setq artist-draw-region-max-y orig-draw-region-max-y))
4839 (artist-set-pointer-shape orig-pointer-shape))
4842 (define-key (current-global-map) key orig-button-up-binding))
4844 (artist-mode-line-show-curr-operation artist-key-is-drawing))))
4847 (defun artist-mouse-choose-operation (ev op)
4853 (x-popup-menu last-nonmenu-event artist-popup-menu-table))))
4855 (let ((draw-fn (artist-go-get-draw-fn-from-symbol (car op)))
4856 (set-fn (artist-fc-get-fn-from-symbol (car op))))
4861 (let* ((unshifted (artist-go-get-symbol-shift (car op) nil))
4862 (shifted (artist-go-get-symbol-shift (car op) t))
4863 (shift-state (artist-event-is-shifted ev))
4865 (keyword (artist-go-get-keyword-from-symbol selected-op)))
4866 (artist-select-operation keyword)))
4873 (defun artist-down-mouse-3 (ev)
4876 (let ((artist-curr-go 'erase-char))
4877 (artist-down-mouse-1 ev))
4879 (artist-mode-line-show-curr-operation artist-key-is-drawing))
4886 (defsubst artist-shift-has-changed (shift-state ev)
4896 ;; (cond ((and shift-state (not (artist-event-is-shifted ev))) t)
4897 ;; ((and (not shift-state) (artist-event-is-shifted ev)) t)
4901 (defun artist-coord-win-to-buf (coord)
4907 (artist-current-line))))
4912 (defun artist-mouse-draw-continously (ev)
4916 (let* ((unshifted (artist-go-get-symbol-shift artist-curr-go nil))
4917 (shifted (artist-go-get-symbol-shift artist-curr-go t))
4918 (shift-state (artist-event-is-shifted ev))
4920 (draw-how (artist-go-get-draw-how-from-symbol op))
4921 (init-fn (artist-go-get-init-fn-from-symbol op))
4922 (prep-fill-fn (artist-go-get-prep-fill-fn-from-symbol op))
4923 (exit-fn (artist-go-get-exit-fn-from-symbol op))
4924 (draw-fn (artist-go-get-draw-fn-from-symbol op))
4925 (interval-fn (artist-go-get-interval-fn-from-symbol op))
4926 (interval (artist-funcall interval-fn))
4927 (arrow-pred (artist-go-get-arrow-pred-from-symbol op))
4928 (arrow-set-fn (artist-go-get-arrow-set-fn-from-symbol op))
4931 (ev-start-pos (artist-coord-win-to-buf (posn-col-row ev-start)))
4937 (artist-funcall init-fn x1 y1)
4938 (if (not artist-rubber-banding)
4939 (artist-no-rb-set-point1 x1 y1))
4943 (setq ev-start-pos (artist-coord-win-to-buf
4958 ;; Check if user presses or releases shift key
4959 (if (artist-shift-has-changed shift-state ev)
4964 (artist-go-get-draw-how-from-symbol
4971 (setq draw-how (artist-go-get-draw-how-from-symbol op))
4972 (setq draw-fn (artist-go-get-draw-fn-from-symbol op))))
4975 (setq shape (artist-funcall draw-fn x1 y1))
4976 (artist-move-to-xy x1 y1)
4990 (artist-funcall prep-fill-fn x1 y1)
4992 (if (artist-funcall arrow-pred)
4993 (artist-funcall arrow-set-fn x1 y1)
4994 (artist-clear-arrow-points))
4996 (artist-funcall exit-fn x1 y1)
4997 (artist-move-to-xy x1 y1)))
5001 (defun artist-mouse-draw-poly (ev)
5006 (let* ((unshifted (artist-go-get-symbol-shift artist-curr-go nil))
5007 (shifted (artist-go-get-symbol-shift artist-curr-go t))
5008 (shift-state (artist-event-is-shifted ev))
5010 (draw-how (artist-go-get-draw-how-from-symbol op))
5011 (init-fn (artist-go-get-init-fn-from-symbol op))
5012 (prep-fill-fn (artist-go-get-prep-fill-fn-from-symbol op))
5013 (exit-fn (artist-go-get-exit-fn-from-symbol op))
5014 (draw-fn (artist-go-get-draw-fn-from-symbol op))
5015 (undraw-fn (artist-go-get-undraw-fn-from-symbol op))
5016 (fill-pred (artist-go-get-fill-pred-from-symbol op))
5017 (fill-fn (artist-go-get-fill-fn-from-symbol op))
5018 (arrow-pred (artist-go-get-arrow-pred-from-symbol op))
5019 (arrow-set-fn (artist-go-get-arrow-set-fn-from-symbol op))
5022 (ev-start-pos (artist-coord-win-to-buf (posn-col-row ev-start)))
5032 (artist-funcall init-fn x1-last y1-last)
5033 (if (not artist-rubber-banding)
5034 (artist-no-rb-set-point1 x1-last y1-last))
5046 (if (not artist-rubber-banding)
5048 (artist-no-rb-unset-points)
5049 (setq shape (artist-funcall draw-fn x1-last y1-last x2 y2))))
5056 (let ((endpoint2 (artist-2point-get-endpoint2 shape)))
5057 (setq x1-last (artist-endpoint-get-x endpoint2))
5058 (setq y1-last (artist-endpoint-get-y endpoint2))))
5059 (setq point-list (cons (artist-make-endpoint x1-last y1-last)
5091 (artist-go-get-draw-how-from-symbol
5098 (artist-go-get-symbol-shift artist-curr-go nil)
5100 (artist-go-get-symbol-shift artist-curr-go t)
5101 shift-state (artist-event-is-shifted ev)
5103 draw-how (artist-go-get-draw-how-from-symbol op)
5104 draw-fn (artist-go-get-draw-fn-from-symbol op)
5105 undraw-fn (artist-go-get-undraw-fn-from-symbol op)
5106 fill-pred (artist-go-get-fill-pred-from-symbol op)
5107 fill-fn (artist-go-get-fill-fn-from-symbol op))
5113 (setq ev-start-pos (artist-coord-win-to-buf
5120 (if artist-rubber-banding
5121 (setq shape (artist-funcall draw-fn x1-last y1-last x2 y2))
5123 (artist-no-rb-set-point1 x1-last y1-last)
5124 (artist-no-rb-set-point2 x2 y2)))
5127 (let ((artist-curr-go op))
5128 (artist-mode-line-show-curr-operation t))))
5140 (setq ev-start-pos (artist-coord-win-to-buf
5148 (artist-funcall undraw-fn shape)
5152 (if artist-rubber-banding
5153 (setq shape (artist-funcall draw-fn x1-last y1-last x2 y2))
5155 (artist-no-rb-unset-point2)
5156 (artist-no-rb-set-point2 x2 y2)))
5158 (artist-move-to-xy x2 y2))
5195 (artist-funcall prep-fill-fn point-list)
5198 (if (artist-funcall fill-pred)
5199 (artist-funcall fill-fn point-list))
5202 (if (and point-list (artist-funcall arrow-pred))
5203 (artist-funcall arrow-set-fn point-list)
5204 (artist-clear-arrow-points))
5206 (artist-funcall exit-fn point-list)
5207 (artist-move-to-xy x2 y2)))
5210 (defun artist-mouse-draw-1point (ev)
5214 (let* ((unshifted (artist-go-get-symbol-shift artist-curr-go nil))
5215 (shifted (artist-go-get-symbol-shift artist-curr-go t))
5216 (shift-state (artist-event-is-shifted ev))
5218 (draw-how (artist-go-get-draw-how-from-symbol op))
5219 (init-fn (artist-go-get-init-fn-from-symbol op))
5220 (prep-fill-fn (artist-go-get-prep-fill-fn-from-symbol op))
5221 (exit-fn (artist-go-get-exit-fn-from-symbol op))
5222 (draw-fn (artist-go-get-draw-fn-from-symbol op))
5223 (arrow-pred (artist-go-get-arrow-pred-from-symbol op))
5224 (arrow-set-fn (artist-go-get-arrow-set-fn-from-symbol op))
5226 (ev-start-pos (artist-coord-win-to-buf (posn-col-row ev-start)))
5230 (artist-funcall init-fn x1 y1)
5231 (artist-funcall draw-fn x1 y1)
5232 (artist-funcall prep-fill-fn x1 y1)
5233 (if (artist-funcall arrow-pred)
5234 (artist-funcall arrow-set-fn x1 y1)
5235 (artist-clear-arrow-points))
5236 (artist-funcall exit-fn x1 y1)
5237 (artist-move-to-xy x1 y1)))
5240 (defun artist-mouse-draw-2points (ev)
5244 (let* ((unshifted (artist-go-get-symbol-shift artist-curr-go nil))
5245 (shifted (artist-go-get-symbol-shift artist-curr-go t))
5246 (shift-state (artist-event-is-shifted ev))
5248 (draw-how (artist-go-get-draw-how-from-symbol op))
5249 (init-fn (artist-go-get-init-fn-from-symbol op))
5250 (prep-fill-fn (artist-go-get-prep-fill-fn-from-symbol op))
5251 (exit-fn (artist-go-get-exit-fn-from-symbol op))
5252 (draw-fn (artist-go-get-draw-fn-from-symbol op))
5253 (undraw-fn (artist-go-get-undraw-fn-from-symbol op))
5254 (fill-pred (artist-go-get-fill-pred-from-symbol op))
5255 (fill-fn (artist-go-get-fill-fn-from-symbol op))
5256 (arrow-pred (artist-go-get-arrow-pred-from-symbol op))
5257 (arrow-set-fn (artist-go-get-arrow-set-fn-from-symbol op))
5260 (ev-start-pos (artist-coord-win-to-buf (posn-col-row ev-start)))
5267 (artist-funcall init-fn x1 y1)
5268 (if (not artist-rubber-banding)
5269 (artist-no-rb-set-point1 x1 y1))
5273 (setq ev-start-pos (artist-coord-win-to-buf
5285 (if artist-rubber-banding
5286 (artist-funcall undraw-fn shape)
5287 (artist-no-rb-unset-point2))
5289 ;; Check if user presses or releases shift key
5290 (if (artist-shift-has-changed shift-state ev)
5295 (artist-go-get-draw-how-from-symbol
5303 (setq draw-how (artist-go-get-draw-how-from-symbol op))
5304 (setq draw-fn (artist-go-get-draw-fn-from-symbol op))
5305 (setq undraw-fn (artist-go-get-undraw-fn-from-symbol op))
5306 (setq fill-pred (artist-go-get-fill-pred-from-symbol op))
5307 (setq fill-fn (artist-go-get-fill-fn-from-symbol op))))
5310 (if artist-rubber-banding
5311 (setq shape (artist-funcall draw-fn x1 y1 x2 y2))
5312 (artist-no-rb-set-point2 x2 y2))
5314 (artist-move-to-xy x2 y2))
5322 (if (not artist-rubber-banding)
5324 (artist-no-rb-unset-points)
5325 (setq shape (artist-funcall draw-fn x1 y1 x2 y2))))
5327 (artist-funcall prep-fill-fn shape x1 y1 x2 y2)
5330 (if (artist-funcall fill-pred)
5331 (artist-funcall fill-fn shape x1 y1 x2 y2))
5334 (if (artist-funcall arrow-pred)
5335 (artist-funcall arrow-set-fn shape x1 y1 x2 y2)
5336 (artist-clear-arrow-points))
5338 (artist-funcall exit-fn shape x1 y1 x2 y2)
5339 (artist-move-to-xy x2 y2)))
5345 (defun artist-submit-bug-report ()
5350 (let ((to artist-maintainer-address)
5354 artist-rubber-banding
5355 artist-interface-with-rect
5356 artist-aspect-ratio
5358 artist-curr-go
5359 artist-key-poly-point-list
5360 artist-key-shape
5361 artist-key-draw-how
5362 artist-arrow-point-1
5363 artist-arrow-point-2)))
5371 artist-maintainer-address
5372 (concat "artist.el " artist-version)
5383 (provide 'artist)
5432 ;; b. Add your mode to the master table, `artist-mt'.
5450 ;; Use the artist-endpoint-* accessors to create and inspect
5454 ;; borders if the `artist-borderless-shapes' is non-nil.
5455 ;; See `artist-draw-rect' for an example.
5465 ;; c. Add your mode to the master table, `artist-mt'.
5483 ;; borders if the `artist-borderless-shapes' is non-nil.
5484 ;; See `artist-draw-rect' for an example.
5490 ;; c. Add your mode to the master table, `artist-mt'.
5497 ;; The arrow-set-fn must set the variables `artist-arrow-point-1'
5498 ;; and `artist-arrow-point-2'. If your mode does not take arrows,
5500 ;; artist-arrow-point-* to create and inspect arrow-points.
5509 ;; symbol artist-do-xxx.
5511 ;; b. Create a function artist-mouse-draw-xxx for drawing with
5512 ;; mouse. It should be called from `artist-down-mouse-1'.
5517 ;; the function `artist-coord-win-to-buf'.
5519 ;; It must take care to the `artist-rubber-banding' variable
5521 ;; artist-no-rb-* functions if not rubber-banding.
5524 ;; borders if the `artist-borderless-shapes' is non-nil.
5525 ;; See `artist-draw-rect' for an example.
5530 ;; When artist-mouse-draw-xxx ends, the shape for your mode
5535 ;; - artist-key-set-point-xxx for setting a point in the
5536 ;; mode, to be called from `artist-key-set-point-common'.
5538 ;; - artist-key-do-continously-xxx to be called from
5539 ;; `artist-key-do-continously-common' whenever the user
5542 ;; As for the artist-mouse-draw-xxx, these two functions must
5546 ;; These functions should set the variable `artist-key-shape'
5549 ;; d. Create artist-key-draw-xxx and artist-key-undraw-xxx for
5563 ;; e. Add your new mode to the master table, `artist-mt'.
5571 ;;; artist.el ends here