Lisp HUG Maillist Archive

(LWW) variable thickness line-pinboard-objects

Unable to parse email body. Email id is 9442

Re: (LWW) variable thickness line-pinboard-objects

On Tue, Oct 6, 2009 at 9:26 AM, Nick Levine <ndl@ravenbrook.com> wrote:
> I want my line-pinboard-objects (one pixel thick by default) to be
> drawn thicker (3 pixels) when they're "selected".
>
> If they're on a slant this just works, and if they're
> arrow-pinboard-objects it just works. But I can't get horizontal /
> vertical lines without an arrow to draw more than 2 pixels thick.
>
> Testing this with a vertical line, I noticed that the width reported
> by capi:pinboard-pane-size was 1. OK, so I set that to 3. But now the
> line was no longer vertical: start-x was 2 greater than it had been
> before. OK, so I used capi:move-line to put start-x back to its
> original value. But doing that reset the width to 1 and I was back to
> where I'd started.

The following code on LWW seems to make line-pinboard-objects thicker
and thinner, and I don't have to do any manual adjustment of the
pane's width.

(let ((pane (capi:contain (make-instance 'capi:pinboard-layout)))
      (line (make-instance 'capi:line-pinboard-object
                           :start-x 10
                           :start-y 10
                           :end-x 10
                           :end-y 100
                           :graphics-args (list :thickness 4))))
  (labels
      ((%toggle ()
         (setf (capi:pinboard-object-graphics-arg line :thickness)
               (abs (- (capi:pinboard-object-graphics-arg line :thickness) 5)))
         (capi:redraw-pinboard-object line t))
       (toggle ()
         (capi:apply-in-pane-process pane #'%toggle))
       (status ()
         (capi:display-message-for-pane
          pane "~A" (multiple-value-list
                     (capi:line-pinboard-object-coordinates line)))))
    (capi:manipulate-pinboard pane line :add-top)
    (status)
    (sleep 3) (toggle) (status)
    (sleep 3) (toggle) (status)))

-- 
=====================
Joshua Taylor
tayloj@cs.rpi.edu, jtaylor@alum.rpi.edu

"A lot of good things went down one time,
  back in the goodle days."
    John Hartford


Re: (LWW) variable thickness line-pinboard-objects

Unable to parse email body. Email id is 9445

Updated at: 2020-12-10 08:40 UTC