[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Window zooming weirdness
- To: info-mcl@ministry.cambridge.apple.com
- Subject: Window zooming weirdness
- From: Joey Gray <gray@ils.nwu.edu>
- Date: 2 Nov 1993 21:57:02 GMT
- Distribution: world
- Newsgroups: comp.lang.lisp.mcl
- Organization: Institute for the Learning Sciences
I'm having some weird problems when trying to do what I think should be a
fairly simple task. I have some varying sized pictures (with captions)
that
I need to display, and have been trying to get the following scheme to
work,
but not with much success. Since the pictures are of almost any size or
aspect ratio, I display the picture in a view of a specific size and scale
the picture to that view. Below the view in a text-edit-type view, I show
the caption for the picture. Because the users will want to see these
pictures in the "correct" size and proportions, I'd like to have another
state in which the window is changed to the real size of the picture, the
picture view is sized to take up the entire window, and the text-edit-type
view is moved off of the window.
I've got the view size/position mucking around working (or so it seems),
but what I can't get to work right is the sizing/positioning of the
window.
I'm trying to implement this as a zoomed/normal state of the window where
the zoomed state is the whole picture and nothing but the picture, and the
normal state has the scaled picture and other stuff. I've defined a new
class based on the window class and added some slots to this class:
normal-position -> last window position when the window was in
"normal" mode.
normal-size (*) -> window size for the "normal" mode.
zoom-position (*) -> window position for the window when in "zoomed"
mode.
zoom-size (*) -> window size for the "zoom" mode.
zoomed-p -> whether the window is currently in the "zoomed"
or "normal" mode.
(*) the values in these slots don't change, I'm using them to cut down on
the number of times I do certain calculations.
Initially the window is created/opened in normal mode, so the "zoomed-p"
slot has a value of "nil".
Here are the methods I've defined on my new window-based class:
(defmethod window-zoom-position ((window picture-window))
(if (zoomed-p window)
(zoom-position window)
(normal-position window)))
(defmethod window-zoom-size ((window picture-window))
(if (zoomed-p window)
(zoom-size window)
(normal-size window)))
(defmethod window-zoom-event-handler :before ((window picture-window)
message)
(let ((zoom-state (zoomed-p window))
(new-zoom-state (eql message #$InZoomOut)))
(when (and new-zoom-state (not zoom-state))
(setf (normal-position window) (view-position window)))
(setf (zoomed-p window) new-zoom-state)))
(defmethod window-size-parts ((window picture-window))
(let ((picture (view-named 'picture window))
(caption (view-named 'caption window)))
(when (and picture caption)
(let* ((caption-position (view-position caption))
(caption-height (point-v (view-size caption)))
(caption-h (point-h caption-position))
(dimensions (view-size window)))
(if (zoomed-p window)
(let ((caption-v (+ 10 (point-v dimensions))))
(set-view-position picture 0 0)
(set-view-size picture dimensions)
(set-view-position caption caption-h caption-v))
(let ((caption-v (- (point-v dimensions) caption-height 10)))
(set-view-position picture 10 10)
(set-view-size picture 320 240)
(set-view-position caption caption-h caption-v)))))))
The problem is this: the window will zoom to the correct size and position
on the very first click in the zoom box; however, any subsequent click
will
not change the size and/or position of the window, yet the two views
inside
the window toggle as expected.
I've tried wrapping calls to "set-window-zoom-position" and "-size" around
the then and else forms in "window-zoom-position" and "window-zoom-size"
methods, but that doesn't seem to make a difference.
I'm using MCL 2.01 with a whole ton of other stuff loaded, the most
notable
of which are Oodles-Of-Utils v1.3, and Cartier's Contribs. Any
help/hints/ideas that anybody can provide are more than welcome!
Thanks!
-joey
=======================================================================
===
Joey Gray | gray@ils.nwu.edu
Institute for the Learning Sciences | (708) 467-1704
Northwestern University |
**Bandwagon disclaimer: My opinions | "Albert Einstein nailed space/time,
are mine, not my employer's. so | but the wild thing had him stumped"
there! | -- Thomas Dolby
=======================================================================
===