1
0
mirror of synced 2026-01-13 15:37:38 +00:00
Interlisp.medley/lispusers/MACINTERFACE.TXT
2020-11-15 19:22:14 -08:00

53 lines
3.3 KiB
Plaintext

MACINTERFACE documentation
Ron Kaplan, June 2020
MACINTERFACE is a symbol Lispusers package that changes the mouse actions on Medley windows so that moving and shaping can be done in a way that approximates the behavior of windows on the Mac desktop.
Thus, for a window that has been created or transformed in this way, you can move the window by left-clicking in the title bar and dragging the window.
The menu behavior for other buttons in the title bar is unchanged.
Similarly, you can reshape a window by clicking near one of its corners and dragging it out.
For bottom corners, "near" means inside the window within MACINTERFACECORNERMARGIN (initially 25) pixels above or to the left/right of the corner.
For top corners, "near" means within the title bar and within the margin from the left/right edges.
(Windows that don't have a title-bar, like Snap windows, can be set up so that moving can happen by clicking anywhere, and shaping at the top is determined by the margin inside the window region.)
When the package is loaded, this behavior is installed for the following kinds of windows:
Tedit
Debugger/break
Sedit
Inspector
Snap
Exec
The function MACWINDOW.SETUP establishes the new behavior for classes of windows:
(MACWINDOW.SETUP ORIGFN MACWINDOWFN ANYWHERE)
ORIGFN is either the name of the BUTTONEVENTFN for a class of windows (e.g. \TEDIT.BUTTONEVENTFN for Tedit windows) or it is a function that creates windows of a particulate kind (e.g. SNAPW or ADD-EXEC).
MACWINDOW.SETUP moves the definition of ORIGFN to the name (PACK* 'MACORIG- ORIGFN), and then provides a new definition for ORIGFN that does the moving or reshaping for clicks in the triggering locations, and otherwise passes control through to the original definition.
If ORIGNFN is a button event function, then MACWINDOWFN should not be specified. In that case a new definition for ORIGFN is constructed to provide the desired windowing behavior.
Otherwise, if ORIGFN is the function that creates windows of a class (e.g. SNAPW), then a MACWINDOWFN should be provided to create such window (by calling (PACK* MACORIG- ORIGFN)). The definition of MACWINDOWFN replaces the original definition of ORIGFN.
If the flag ANYWHERE is non-NIL, especially for windows without a title bar, then the moving behavior is triggered by a click anywhere in the window (except the corners).
Because this works by redefining existing functions, it is important that the MACINTERFACE package be loaded AFTER Tedit and Sedit, if those are not already in the sysout. And it should be called to upgrade the proper functions for other window classes that might later be added (e.g. GRAPHER).
If it is not known or it is inconvenient to systematically upgrade a button function or a window-creation function, the new behavior can be provided after a window has been created, by invoking
(MACWINDOW WINDOW ANYWHERE)
This saves the windows existing BUTTONEVENTFN as a window property PREMACBUTTONEVENTFN, and installs a simple stub function in its place.
Known issue: Clicking at the bottom-right corner of Tedit windows sometimes doesn't catch the new behavior--there seems to be a conflict with Tedit's window-splitting conventions.
A future extension might be to add an X or some circles on the left of the title bar, to implement a close/shrink behaviors.