[Openmcl-devel] y-or-n-dialog contribution

Gary Byers gb at clozure.com
Fri Sep 5 13:35:58 UTC 2008


Thanks.

As a reminder, if anyone wants write access to the SVN repository, just
ask (me, for the time being.)  There's a little bit of setup involved
(on the server end and on your end), but there seem to be several
advantages to doing it this way.

Those advantages include:

1) no two email clients/servers/whatever seem able to agree on which
    of the many standards (if any ...) to follow when wrapping lines
    in email messages, but all seem to agree that lisp source code
    sent in the body of a message should have line breaks inserted
    at unfortunate points, and it takes some small effort and occasional
    guesswork to repair that damage (and sometimes raises lingering doubts
    that nothing's been lost in translation.)
2) as I've gotten older, my attention span and ability to shift focus
    and multitask have all declined.  It may not take any longer to
    deal with small issues like (1), but my ability to get back to
    what I was doing and pick up where I left off has definitely
    declined.  (Of course, so has my long-term memory, so perhaps
    I'm not remembering that correctly ...)  In any case, interrupt
    latency isn't what it could be, and focus (and gears ...) don't
    get shifted as quickly as they could and should.  Whether it's
    due to the ravages of time or other factors, I think that the
    same sort of thing applies to other people who have SVN write
    access.

    Increasing the number of people who have SVN write access seems
    like a good approach here.

Hmm.  That reads more like "me whining" than "an enumeration of the
advantages of encouraging the notion that contributions be made via
SVN".

There are lots of advantages to all concerned if anyone who's
interested in doing so can easily contribute (examples, enhancements,
bug fixes, ...) to CCL, and I hope that I'm right in thinking that
using SVN (rather than ad hoc email) to do that will scale better
and generally work better for everyone (whether senility is
rapidly approaching or still a ways off.)



On Fri, 5 Sep 2008, Arthur W Cater wrote:

> Here's a y-or-n-dialog function using cocoa calls. Maybe there was something like it already but I failed to find it.
> Suggested improvements most welcome: I am just learning ...
>
> (in-package :easygui)
>
> (defun y-or-n-dialog (message)
>   (let* (dialog content
>          (app (#/sharedApplication ns:ns-application))
>          (yes (make-instance 'ns:ns-button))
>          (no (make-instance 'ns:ns-button))
>          (query (make-instance 'ns:ns-text-field)))
>     (flet ((buttonize (button text x action)
>              (dcc (#/setTitle: button text))
>              (dcc (#/setBezelStyle: button #$NSRoundedBezelStyle))
>              (dcc (#/sizeToFit button))
>              (if (< x 0)
>                (let ((left (- 0 x (ns:ns-rect-width (dcc (#/bounds button))))))
>                  (dcc (#/setFrameOrigin: button (ns:make-ns-point left 9))))
>                (dcc (#/setFrameOrigin: button (ns:make-ns-point x 9))))
>              (dcc (#/addSubview: content button))
>              (dcc (#/setTarget: button app))
>              (dcc (#/setAction: button action))))
>       (dcc (#/setStringValue: query message))
>       (dcc (#/setFrameOrigin: query (ns:make-ns-point 9 48)))
>       (dcc (#/sizeToFit query))
>       (let* ((querybounds (dcc (#/bounds query)))
>              (width (max 100.0 (+ 18.0 (ns:ns-rect-width querybounds))))
>              (rect (ns:make-ns-rect
>                     *window-position-default-x*
>                     *window-position-default-y*
>                     width
>                     (max 90.0 (+ 57.0 (ns:ns-rect-height querybounds))))))
>         (setf dialog (make-instance 'ns:ns-window
>                        :with-content-rect rect
>                        :style-mask (logior #$NSBorderlessWindowMask #$NSTexturedBackgroundWindowMask)
>                        :backing #$NSBackingStoreBuffered ; TODO? Copied from ccl:examples/cocoa/easygui/views.lisp
>                        :defer nil)
>               content (#/contentView dialog))
>         (buttonize yes "Yes" 9 (@selector #/stopModal))
>         (buttonize no "No" (- 9 width) (@selector #/abortModal)))
>       (dcc (#/addSubview: content query))
>       (prog1
>           (eq #$NSRunStoppedResponse (dcc (#/runModalForWindow: app dialog)))
>           (#/close dialog)))))
>


More information about the Openmcl-devel mailing list