Function: artist-key-set-point-poly
artist-key-set-point-poly is a byte-compiled function defined in
artist.el.gz.
Signature
(artist-key-set-point-poly X Y &optional THIS-IS-LAST-POINT)
Documentation
Set point for current poly-point shape at X,Y.
If optional argument THIS-IS-LAST-POINT is non-nil, this point is the last.
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/artist.el.gz
(defun artist-key-set-point-poly (x y &optional this-is-last-point)
"Set point for current poly-point shape at X,Y.
If optional argument THIS-IS-LAST-POINT is non-nil, this point is the last."
(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))
;; Set point-list to contain start point
(setq artist-key-poly-point-list (list (artist-make-endpoint x y)))
;; Since we are not ready, set the arrow-points to nil
(artist-clear-arrow-points)
;; Change state to drawing
(setq artist-key-is-drawing t)
;; Feedback
(message "%s" (substitute-command-keys
(concat "First point set. "
"Set next with \\[artist-key-set-point], "
"set last with C-u \\[artist-key-set-point]"))))
;; *** We were drawing ==> we are about to set nth point
;; (last point if the argument this-is-last-point is non-nil)
;;
(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))))
;; Set x2 and y2 from shape's second point
;; (which might be different from the mouse's second point,
;; if, for example, we are drawing a straight line)
;;
(if (not (null artist-key-shape))
(let ((endpoint2 (artist-2point-get-endpoint2 artist-key-shape)))
(setq x2 (artist-endpoint-get-x endpoint2))
(setq y2 (artist-endpoint-get-y endpoint2))))
;; Add the endpoint to the list of poly-points
(setq artist-key-poly-point-list
(append artist-key-poly-point-list
(list (artist-make-endpoint x2 y2))))
;; Now do handle the case when this is the last point,
;; and the case when this point isn't the last
;;
(if (not this-is-last-point)
;; ** This is not the last point
(progn
;; Start drawing a new 2-point-shape from last endpoint.
;; First set the start-point
(setq x1 x2)
(setq y1 y2)
(setq artist-key-endpoint1 (artist-make-endpoint x1 y1))
;; If we are not rubber-banding, then place the '1
;; Otherwise, draw the shape from x1,y1 to x1,y1
(if (not artist-rubber-banding)
(artist-no-rb-set-point1 x1 y1)
(setq artist-key-shape (artist-funcall draw-fn x1 y1 x1 y1)))
;; Feedback
(message "Point set"))
;; ** This is the last point
(progn
(artist-funcall prep-fill-fn artist-key-poly-point-list)
;; Maybe fill
(if (artist-funcall fill-pred)
(artist-funcall fill-fn artist-key-shape
artist-key-poly-point-list))
;; Set the arrow-points
(if (artist-funcall arrow-pred)
(artist-funcall arrow-set-fn artist-key-poly-point-list)
(artist-clear-arrow-points))
(artist-funcall exit-fn artist-key-poly-point-list)
;; Change state to not drawing
(setq artist-key-shape nil)
(setq artist-key-endpoint1 nil)
(setq artist-key-is-drawing nil)))))))