Function: artist-key-set-point-2points

artist-key-set-point-2points is a byte-compiled function defined in artist.el.gz.

Signature

(artist-key-set-point-2points X Y)

Documentation

Set first or second point in current 2-point shape at X,Y.

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/artist.el.gz
(defun artist-key-set-point-2points (x y)
  "Set first or second point in current 2-point shape at X,Y."
  (let ((draw-fn      (artist-go-get-draw-fn-from-symbol artist-curr-go))
	(init-fn      (artist-go-get-init-fn-from-symbol artist-curr-go))
	(prep-fill-fn (artist-go-get-prep-fill-fn-from-symbol artist-curr-go))
	(exit-fn      (artist-go-get-exit-fn-from-symbol artist-curr-go))
	(fill-pred    (artist-go-get-fill-pred-from-symbol artist-curr-go))
	(fill-fn      (artist-go-get-fill-fn-from-symbol artist-curr-go))
	(arrow-pred   (artist-go-get-arrow-pred-from-symbol artist-curr-go))
	(arrow-set-fn (artist-go-get-arrow-set-fn-from-symbol artist-curr-go)))
    (if (not artist-key-is-drawing)

	;; *** We were not drawing ==> set first point
	(progn

	  (artist-funcall init-fn x y)

	  ;; If not rubber-banding, set first point.
	  ;; Otherwise, draw the shape from x,y to x,y
	  (if (not artist-rubber-banding)
	      (artist-no-rb-set-point1 x y)
	    (setq artist-key-shape (artist-funcall draw-fn x y x y)))

	  ;; Set first endpoint
	  (setq artist-key-endpoint1 (artist-make-endpoint x y))

	  ;; Since we are not ready, clear the arrow-points
	  (artist-clear-arrow-points)

	  ;; Change state to drawing
	  (setq artist-key-is-drawing t))

      ;; *** We were drawing ==> we are about to set 2nd point
      ;;     and end the drawing operation

      (let ((x1 (artist-endpoint-get-x artist-key-endpoint1))
	    (y1 (artist-endpoint-get-y artist-key-endpoint1))
	    (x2 x)
	    (y2 y))

	;; If not rubber-banding, undraw the 1's and 2's, then
	;; draw the shape (if we were rubber-banding, then the
        ;; shape is already drawn in artist-key-do-continuously-2points.)
	;;
	(if (not artist-rubber-banding)
	    (progn
	      (artist-no-rb-unset-points)
	      (setq artist-key-shape (artist-funcall draw-fn x1 y1 x2 y2))))

	(artist-funcall prep-fill-fn artist-key-shape x1 y1 x2 y2)

	;; Maybe fill
	;;
	(if (artist-funcall fill-pred)
	    (artist-funcall fill-fn artist-key-shape x1 y1 x2 y2))

	;; Maybe set the arrow-points
	;;
	(if (artist-funcall arrow-pred)
	    (artist-funcall arrow-set-fn artist-key-shape x1 y1 x2 y2)
	  (artist-clear-arrow-points))

	(artist-funcall exit-fn artist-key-shape x1 y1 x2 y2)

	;; Change state to not drawing
	(setq artist-key-is-drawing nil)))))