[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: hilighting
- To: mcdougal@cs.uchicago.edu (Tom McDougal)
- Subject: Re: hilighting
- From: bill@cambridge.apple.com (Bill St. Clair)
- Date: Tue, 2 Mar 1993 09:15:42 -0600
- Cc: info-mcl
>I'm trying to figure out how to hilight an object using the hilite
>mode described in IM V, 61-62. It says:
>
>"There are two ways to use hilite mode. The easiest is to call
>
> BitClr (Ptr(HiliteMode,pHiliteBit))
>
>just before calling InvertRect..."
>
>On the next page it says:
>
>"The constants used with hilite mode are listed below:
>
> CONST
> hilite = 50;
> pHiliteBit = 0;"
>
>
>Well, I couldn't figure this out, so I searched files for "hilite" and
>found this example, in MCL:library:Inspector
>Folder:inspector-window.lisp:
>
>; Invert a region using the highlight color (see Inside Mac V-62).
>(defun %invert-region (rgn)
> (with-macptrs ((hiliteMode (%int-to-ptr #x938)))
> (%put-byte hiliteMode (logand #x7f (%get-byte hiliteMode))))
> (#_InvertRgn :ptr rgn))
>
>
>The connection between this code and what IM-V says could use some
>hilighting!
Pascal's BitClr procedure numbers bits from the most significant.
Hence the Pascal "pHiliteBit" has a value of 0, whereas the
assembly language "hiliteBit" has a value of 7. I don't know where
"hilite=50" came from. This equate is not in any of my interface files.
I assume it's a manual bug.
The MCL code would probably be clearer if it were written as:
(defun %invert-region (rgn)
(with-macptrs ((hiliteMode (%int-to-ptr #$HiliteMode)))
(%put-byte hiliteMode
(logand (lognot (ash 1 #$hiliteBit)) (%get-byte hiliteMode))))
(#_InvertRgn :ptr rgn))