[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
multiple selection highlighting in fred windows
- To: info-macl@cambridge.apple.com
- Subject: multiple selection highlighting in fred windows
- From: Luke Hohmann <hohmann@csmil.umich.edu>
- Date: Fri, 07 Jun 91 15:59:04 -0400
I have a question regarding MCL 1.3.2 and the manner in which fred-windows
are updated. Here goes:
We have constructed a Pascal programming environment that supports multiple
selection highlighting. For example, let's say I have:
IF (X < 100) THEN
WRITELN('X is less than 100');
ELSE
WRITELN('X is greater than 100');
In our system it is possible to click on the IF statement and only highlight
the text that relates to the IF, namely, "IF (X < 100) THEN" & "ELSE".
We provide this functionality by maintaining a list of lists that represent
the character ranges in the window. For example, the IF construct referenced
above might be ((1 18) (25 31)). To support multiple highlighting, we iterate
over this list collecting all the regions represented by the list of ranges.
In this case we get two regions. We then take this region and then invert it.
This system works well and is completely functional, but fails in one
extremely important situation: when the window is responding to update events
and the window is not the front-window strange things happen. For example,
let's say some text is highlighted. A window is covering the highlighted
text. Fred redraws the contents of the window A-OK, but my highlighting is
incorrect. This is an expected error, because I am expecting that I have to
manage this kind of highlighting myself.
The problem is that the MCL 1.3.2 manual is rather confusing on how
I should specialize methods on the *fred-window* to get the desired
results. Should I go after window-update or view-draw-contents?
Do I really need to use 'without-interupts, since I am NOT adding
something to the cliprgn?
My general plan was as follows:
;; METHOD: view-draw-contents *gp-pascal-window* ---------------------
;;
;; DESCRIPTION : a portion of the window was uncovered or needs to be
;; updated. It is likely that the region to be updated
;; includes a portion of the currently selected region.
;; To update correctly we take the current clip-region
;; of the window (which was set by lisp to that portion
;; of the window that needs updating) and intersect that
;; with the currently selected region. This new region
;; (ie the interestion) is then inverted to maintain
;; consistent highlighting.
;; NOTES :
;; PARAMETERS :
;; RETURNS : nil
;; CALLS :
;;
;; REVISION HISTORY
;; 06/07/91 lhh - Initial Version for SODA
;;
(defobfun (view-draw-contents *gp-pascal-window*) ()
; get the current clip region
(let ((clip-region (copy-region (rref wptr :window.port.visrgn))))
; get the intersection of this region and the current highlight region
(when (selection-on-p)
(intersect-region clip-region selection-region clip-region))
(usual-view-draw-contents)
(when (selection-on-p)
(invert-region clip-region))
(dispose-region clip-region)))
But this is not working. And I am thrashing. I have worked on this for
several days now, and have no other ideas. Can anyone help? If this mail
was incomprehensible, but you are interested in this problem, let me know
and I will try again.
THANKS.
-- Luke