[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Some questions and another "f
- To: HOHMANN@ZUG.CSMIL.UMICH.EDU
- Subject: Re: Some questions and another "f
- From: bill@cambridge.apple.com (Bill St. Clair)
- Date: Mon, 11 May 1992 17:08:19 -0500
- Cc: STEVE.M@AppleLink.Apple.COM (Carbon-based, S Mitchell,APD), info-mcl
>> 1) Buffer Marks
>> In MCL 1.3.2, you had to explicitly kill marks that you created with
>> a call to kill-mark....In MCL 2.0, you create buffer-marks in a
>> similar manner, but there is no kill-mark function.
>> How are buffer-marks that a create but no longer reference
>> manager by the MCL class fred-mixin? I want to be certain that
>> these puppies are garbage collected.
>Buffer marks are now internal to buffers so you do not have to worry
>about their disposal. Unfortunately they are not retained in the file
>when you save (any more than their owner, the buffer is).
Steve is correct, but he may not have made it clear that marks are
indeed garbage collected when there are no longer any pointers to
them. I sometimes find that compiling from an editor buffer becomes
very slow. This happens because the buffer has a huge number of
marks and I haven't GC'd in a while. (GC) makes READing from the
buffer fast again.
>
>> 3) A fun dialog item
>> I think all the code is correct (well, at least it doesn't
>> crash my Mac SE or my Mac IIci)
>It worked fine for me. Thanks.
Worked for me with one problem. The gray outline did not appear on
my second monitor. This can be fixed by using the portrect of the
window manager port rather than using *screen-width* & *screen-height*.
Changed code is CAPITALIZED below (I copied it from the file
"dialog-editor.lisp" in the "Interface Tools" folder):
(defmethod view-click-event-handler
((self dragable-sequence-dialog-item) where)
(cond
; the first test ignores clicks in the vertical scrollbar
; obviously this needs to be extended to actually check to
; make sure there is a vertical scrollbar, and similar checks
; need to made for horizontal scrollbars
;
((> (point-h where)
(point-h (add-points (- (view-size self) 16)
(view-position self))))
(call-next-method self where))
(t
; get the clicked on cell, and, if it is not selected,
; select it. If it can be dragged, drag it.
;
(let* ((currently-selected-cell (car (selected-cells self)))
(the-clicked-cell (point-to-cell self where)))
(unless (eq currently-selected-cell the-clicked-cell)
(when currently-selected-cell (cell-deselect self currently-selected-cell)))
(when the-clicked-cell
(cell-select self the-clicked-cell)
(let ((the-cell-contents (cell-contents self the-clicked-cell)))
(when (funcall (drag-checker self) the-cell-contents)
(let* ((topleft (cell-position self the-clicked-cell))
(bottomright (add-points topleft (cell-size self)))
(reg (#_NewRgn))
(WMGRPORT (%STACK-BLOCK ((PORT 4))
(#_GETWMGRPORT PORT)
(%GET-PTR PORT)))
where-dropped)
(DECLARE (DYNAMIC-EXTENT WMGRPORT))
(unwind-protect
(with-port WMGRPORT
(rlet ((rect :rect :topleft topleft :bottomright bottomright))
(#_RectRgn reg rect)
(WITH-MACPTRS ((VISRGN (RREF WMGRPORT :GRAFPORT.VISRGN)))
(SETF (RREF RECT :RECT.TOPLEFT) (RREF VISRGN :REGION.RGNBBOX.TOPLEFT))
(SETF (RREF RECT :RECT.BOTTOMRIGHT) (RREF VISRGN :REGION.RGNBBOX.BOTRIGHT)))
(with-clip-rect rect
(let* ((pos
(add-points
where
(#_DragGrayRgn reg where rect rect 0 (%null-ptr)))))
(rlet ((which-window :pointer))
(setf where-dropped (#_FindWindow pos which-window))
(%setf-macptr which-window (%get-ptr which-window))
(when (and (not (%null-ptr-p which-window))
(eq where-dropped $incontent))
(window-dropped-on (window-object which-window)
the-cell-contents
(global-to-local (window-object which-window) pos))))))))
; it is good to be neat
;
(#_DisposeRgn reg))))))))))