From 328d3f53cd33a8cb5889d7a913bf5747fb867b45 Mon Sep 17 00:00:00 2001 From: rmkaplan <69548581+rmkaplan@users.noreply.github.com> Date: Fri, 3 Nov 2023 17:45:49 -0700 Subject: [PATCH] NEARESTCORNER must be onscreen (addresses #1294 (#1295) * NEARESTCORNER must be onscreen (addresses #1294 Mouse jumps to the nearest onscreen corner of the ghost region * MODERNIZE: Fixed off by one bug in NEARESTCORNER --- lispusers/MODERNIZE | 122 +++++++++++++++++++-------------------- lispusers/MODERNIZE.LCOM | Bin 10915 -> 10424 bytes 2 files changed, 61 insertions(+), 61 deletions(-) diff --git a/lispusers/MODERNIZE b/lispusers/MODERNIZE index 09e99137d..515f99a71 100644 --- a/lispusers/MODERNIZE +++ b/lispusers/MODERNIZE @@ -1,12 +1,12 @@ (DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "INTERLISP" BASE 10) -(FILECREATED " 7-Oct-2022 21:45:29"  -{DSK}kaplan>Local>medley3.5>working-medley>lispusers>MODERNIZE.;43 30755 +(FILECREATED "29-Oct-2023 10:56:48" {WMEDLEY}MODERNIZE.;48 30909 - :CHANGES-TO (FNS MODERNWINDOW) + :EDIT-BY rmk - :PREVIOUS-DATE " 5-Mar-2022 23:20:21" -{DSK}kaplan>Local>medley3.5>working-medley>lispusers>MODERNIZE.;40) + :CHANGES-TO (FNS NEARESTCORNER) + + :PREVIOUS-DATE "29-Jul-2023 10:48:55" {WMEDLEY}MODERNIZE.;47) (PRETTYCOMPRINT MODERNIZECOMS) @@ -30,7 +30,7 @@ (* ;; "Add some Meta commands") - (FNS TEDIT.MODERNIZE \MODERNIZED.TEDIT.BUTTONEVENTFN TEDIT.SELECTALL) + (FNS TEDIT.MODERNIZE \MODERNIZED.TEDIT.BUTTONEVENTFN) (DECLARE%: DONTEVAL@LOAD DOCOPY (P (* ;; "Tedit") @@ -325,21 +325,47 @@ (IGREATERP LASTMOUSEX (IPLUS LEFT (TIMES WIDTH (DIFFERENCE 1 TITLEPROPORTION]) (NEARESTCORNER - [LAMBDA (REGION) (* ; "Edited 14-Feb-2021 21:46 by rmk:") - - (* ;; -"Moves the cursor to the corner of REGION that is closest to the current LASTMOUSEX AND LASTMOUSEY") - - (\CURSORPOSITION (CL:IF (ILESSP (IDIFFERENCE LASTMOUSEX (FETCH LEFT OF REGION)) - (IDIFFERENCE (FETCH RIGHT OF REGION) - LASTMOUSEX)) - (FETCH LEFT OF REGION) - (FETCH RIGHT OF REGION)) - (CL:IF (ILESSP (IDIFFERENCE LASTMOUSEY (FETCH BOTTOM OF REGION)) - (IDIFFERENCE (FETCH TOP OF REGION) - LASTMOUSEY)) - (FETCH BOTTOM OF REGION) - (FETCH TOP OF REGION))]) + [LAMBDA (REGION) (* ; "Edited 29-Oct-2023 10:56 by rmk") + (* ; "Edited 29-Jul-2023 10:32 by rmk") + (* ; "Edited 14-Feb-2021 21:46 by rmk:") + + (* ;; "Moves the cursor to the corner of REGION that is closest to the current LASTMOUSEX and LASTMOUSEY, provided that that corner is on-screen.") + + (LET ((LEFT (FETCH (REGION LEFT) OF REGION)) + (RIGHT (FETCH (REGION RIGHT) OF REGION)) + (TOP (FETCH (REGION TOP) OF REGION)) + (BOTTOM (FETCH (REGION BOTTOM) OF REGION)) + X Y) + + (* ;; "If the nearest corner is offscreen, pick the other one.") + + (SETQ X (if (OR (ILESSP LEFT 0) + (IGEQ LEFT SCREENWIDTH)) + then + (* ;; "LEFT is offscreen") + + RIGHT + elseif (ILESSP (IDIFFERENCE LASTMOUSEX LEFT) + (IDIFFERENCE RIGHT LASTMOUSEX)) + then + (* ;; "Closer to LEFT") + + LEFT + else RIGHT)) + (SETQ Y (if (OR (ILESSP TOP 0) + (IGEQ TOP SCREENHEIGHT)) + then + (* ;; "TOP is offscreen") + + BOTTOM + elseif (ILESSP (IDIFFERENCE LASTMOUSEY BOTTOM) + (IDIFFERENCE TOP LASTMOUSEY)) + then + (* ;; "Closer to BOTTOM") + + BOTTOM + else TOP)) + (\CURSORPOSITION X Y]) (INCORNER.REGION [LAMBDA (CORNERREGION TOPMARGIN) (* ; "Edited 13-Oct-2021 15:04 by rmk:") @@ -470,50 +496,25 @@ (DEFINEQ (TEDIT.MODERNIZE - [LAMBDA NIL (* ; "Edited 11-Oct-2021 15:02 by rmk:") + [LAMBDA NIL (* ; "Edited 14-Jun-2023 16:56 by rmk") + (* ; "Edited 11-Oct-2021 15:02 by rmk:") (MODERNWINDOW.SETUP (FUNCTION \TEDIT.BUTTONEVENTFN) - (FUNCTION \MODERNIZED.TEDIT.BUTTONEVENTFN)) - (CL:WHEN (GETD '\TEDIT.BUTTONEVENTFN) - - (* ;; "All") - - (TEDIT.SETFUNCTION (CHARCODE "Meta,a") - (FUNCTION TEDIT.SELECTALL) - TEDIT.READTABLE) - (TEDIT.SETFUNCTION (CHARCODE "Meta,A") - (FUNCTION TEDIT.SELECTALL) - TEDIT.READTABLE) - - (* ;; "Quit") - - (TEDIT.SETFUNCTION (CHARCODE "Meta,q") - (FUNCTION TEDIT.QUIT) - TEDIT.READTABLE) - (TEDIT.SETFUNCTION (CHARCODE "Meta,Q") - (FUNCTION TEDIT.QUIT) - TEDIT.READTABLE))]) + (FUNCTION \MODERNIZED.TEDIT.BUTTONEVENTFN]) (\MODERNIZED.TEDIT.BUTTONEVENTFN - [LAMBDA (W STREAM) (* ; "Edited 13-Oct-2021 21:43 by rmk:") + [LAMBDA (W STREAM) (* ; "Edited 29-Jul-2023 10:48 by rmk") + (* ; "Edited 13-Oct-2021 21:43 by rmk:") (* ;; "If a TEDIT window has been split, we have to make sure that movement happens only for clicks at the top of the main window and at the bottom of the bottom-most split window. Clicks near the split lines must be ignored. Essentially, the %"region%" of the Tedit window is the union of the regions of all of its split-panes.") - (* ;; "We pass the pain that received the click, because that's what the original \TEDIT.BUTTONEVENTFN needs to see, if we decide not to shape or move.") + (* ;; "We pass the pane that received the click, because that's what the original \TEDIT.BUTTONEVENTFN needs to see, if we decide not to shape or move.") (MODERNWINDOW.BUTTONEVENTFN W (FUNCTION MODERN-ORIG-\TEDIT.BUTTONEVENTFN) NIL NIL [APPLY (FUNCTION UNIONREGIONS) - (bind PANE _ (CENTRALWINDOW W) collect (WINDOWPROP PANE - 'REGION) + (bind PANE _ (CENTRALWINDOW W) collect (WINDOWPROP PANE 'REGION) repeatwhile (SETQ PANE (WINDOWPROP PANE 'TEDIT-NEXT-PANE-DOWN] (WINDOWPROP (CENTRALWINDOW W) 'TITLE]) - -(TEDIT.SELECTALL - [LAMBDA (STREAM TEXTOBJ SEL) (* ; "Edited 3-May-2020 17:29 by rmk:") - (LET [(TEXTSTREAM (TEXTSTREAM (TTY.PROCESS] - (CL:WHEN TEXTSTREAM - (TEDIT.SETSEL TEXTSTREAM 0 (ADD1 (fetch TEXTLEN of (TEXTOBJ TEXTSTREAM))) - 'LEFT))]) ) (DECLARE%: DONTEVAL@LOAD DOCOPY @@ -614,12 +615,11 @@ (ADDTOVAR LAMA MODERN-ADD-EXEC) ) (DECLARE%: DONTCOPY - (FILEMAP (NIL (5125 11487 (MODERNWINDOW 5135 . 6675) (MODERNWINDOW.SETUP 6677 . 9626) (UNMODERNWINDOW -9628 . 10022) (MODERNWINDOW.UNSETUP 10024 . 10836) (\MODERNIZED.FREEMENU.BUTTONEVENTFN 10838 . 11485)) - (11552 21714 (MODERNWINDOW.BUTTONEVENTFN 11562 . 18589) (NEARTOP 18591 . 19519) (NEARESTCORNER 19521 - . 20400) (INCORNER.REGION 20402 . 21712)) (21772 24244 (MODERN-ADD-EXEC 21782 . 22213) (MODERN-SNAPW -22215 . 22758) (TOTOPW.MODERNIZE 22760 . 23188) (MODERN-MENUBUTTONFN 23190 . 24242)) (24245 26674 ( -\MODERNIZED.FREEMENU.BUTTONEVENTFN 24255 . 24902) (MODERNIZED.TB.BUTTONEVENTFN 24904 . 26672)) (26715 -28994 (TEDIT.MODERNIZE 26725 . 27539) (\MODERNIZED.TEDIT.BUTTONEVENTFN 27541 . 28663) (TEDIT.SELECTALL - 28665 . 28992))))) + (FILEMAP (NIL (5048 11410 (MODERNWINDOW 5058 . 6598) (MODERNWINDOW.SETUP 6600 . 9549) (UNMODERNWINDOW +9551 . 9945) (MODERNWINDOW.UNSETUP 9947 . 10759) (\MODERNIZED.FREEMENU.BUTTONEVENTFN 10761 . 11408)) ( +11475 22625 (MODERNWINDOW.BUTTONEVENTFN 11485 . 18512) (NEARTOP 18514 . 19442) (NEARESTCORNER 19444 . +21311) (INCORNER.REGION 21313 . 22623)) (22683 25155 (MODERN-ADD-EXEC 22693 . 23124) (MODERN-SNAPW +23126 . 23669) (TOTOPW.MODERNIZE 23671 . 24099) (MODERN-MENUBUTTONFN 24101 . 25153)) (25156 27585 ( +\MODERNIZED.FREEMENU.BUTTONEVENTFN 25166 . 25813) (MODERNIZED.TB.BUTTONEVENTFN 25815 . 27583)) (27626 +29148 (TEDIT.MODERNIZE 27636 . 27989) (\MODERNIZED.TEDIT.BUTTONEVENTFN 27991 . 29146))))) STOP diff --git a/lispusers/MODERNIZE.LCOM b/lispusers/MODERNIZE.LCOM index 35b9aac7121dd84cc19316bfc04facba6dd9bbb9..3ce8dfb2aac18908395aadb9e618a05cfa1c04b8 100644 GIT binary patch delta 749 zcmZuv!EVz)5Va$LDjy0(6;cs`iA7agD3N2wiDMzr)ZWCK*k0G(G>KHCmNb->rmadj zAr!8hN|iHQxNxlSg(DXZ{6QljZhSyK0Kq1Nv;}6Ro%eQkX5NnGUG3xY>$;*AQlxd5 zQWaH$jAH6JGi!(-iLJfP{?<-=1NL@7gy(e+*)D3nxYs-8uXha@1W`54BGrtk=1jdH z!o!31B((K-eRs3{blwCX6+;wJi-bN3VT+|K)m#_Or%0#MB5bT5vXcMi&YOxZ%7RqF zF0#S}RHVoT@&DQ{YJFsYrWBL{n8?O7wbX=z&J!>#r|6eal%fPAq2xyw70O@+AzHzt z7Nu-fYgDT8Y-iG@tYPZ<-)-UZ@%_ZxE8PHeXhHy4Xs}&_B|<6j7*v6hfcXrBxa?4d z6mU_A0%jmYWlVe-xc$o<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