[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Dialog-editing bug in graphic-items.Lisp
- To: John_Gersh@aplmail.jhuapl.edu (John R. Gersh), kardank@ERE.UMontreal.CA (Kardan Kaveh), Keith Erf <keith@mv.MV.COM>
- Subject: Re: Dialog-editing bug in graphic-items.Lisp
- From: email@example.com (Bill St. Clair)
- Date: Fri, 11 Mar 1994 11:19:24 -0600
- Cc: info-mcl
At 12:28 PM 12/13/93 -0500, John R. Gersh wrote:
Keith Erf remonded me of this old outstanding bug, so I finally looked
at it. My apologies if this has been causing anyone grief.
>In a recent contribution to info-mcl, Kaveh Kardan reported a "bug" in the
>graphic-items.lisp library file:
>>While trying out graphic-items.Lisp in the library folder, I found that
>>when the mouse moves over the created window, the following error occurs:
>>> Error: No applicable method for args:
>>> (#<DIALOG "Untitled Dialog" #x493CC1>)
>>> to #<STANDARD-GENERIC-FUNCTION CCL::EDITING-DIALOGS-P #x365306>
>>> While executing: #<STANDARD-METHOD NO-APPLICABLE-METHOD (T)>
>This obviously results from an unstated assumption in graphic-items.Lisp
>that the Interface Toolkit had been loaded, defining editing-dialogs-p;
>Kaveh must have run without the Interface Toolkit.
This can be fixed by the following whether or not the Interface Toolkit
(defmethod editing-dialogs-p ((window t))
>The (admittedly somewhat
>obscure) bug that _I'm_ reporting, though, is evident when you _do_ have
>the Interface Toolkit loaded and attempt to go to the Design Dialogs state
>and edit one of the title-box-dialog-items defined in graphic-items.Lisp:
> Moving the title-box-dialog-item around in its window causes it to
> dribble bits of its title text behind it.
>(This can be seen by evaluating the demo code at the end of graphic-items
>text, going to Design Dialogs, and dragging the "Buttons"
>This appears to happen because the view-draw-contents method for
>title-box-dialog-item draws part of the title text _outside_ the boundaries
>of the title-box-dialog-items view:
>[proposed fix elided]
MCL has a mechanism for dealing with the case of a simple-view
drawing outside of its boundaries. This is also done by the frame
drawn around a default button-dialog-item. The view-corners method
needs to deal with it:
(defun label-offset (title-box-dialog-item)
(multiple-value-bind (ff ms) (view-font-codes title-box-dialog-item)
(multiple-value-bind (ascent descent) (font-codes-info ff ms)
(let ((ascent/2 (floor ascent 2)))
(values (make-point 6 ascent/2)
(- ascent/2 ascent)
; The title extends outside of the bounding box, so we need to correct.
(defmethod view-corners ((item title-box-dialog-item))
(multiple-value-bind (tl br) (call-next-method)
(values (add-points tl (make-point 0 (nth-value 1 (label-offset item))))
I found a few other bugs in the "graphic-items.lisp" code. Some erasure
was missing on set-dialog-item-text and set-view-font, and it used
to invalidate the entire view, which wasn't necessary. I've fixed these.
If you want a fixed copy of the file, just ask. I've only tested
it in MCL 2.0.1, but I think it will also work in earlier versions.