133 |
|
|
134 |
;;; All the useful code bits |
;;; All the useful code bits |
135 |
(defmacro sm::hit-code (hit) |
(defmacro sm::hit-code (hit) |
136 |
(` (nth 0 (, hit)))) |
`(nth 0 ,hit)) |
137 |
;;; The button, or buttons if a chord. |
;;; The button, or buttons if a chord. |
138 |
(defmacro sm::hit-button (hit) |
(defmacro sm::hit-button (hit) |
139 |
(` (logand sm::ButtonBits (nth 0 (, hit))))) |
`(logand sm::ButtonBits (nth 0 ,hit))) |
140 |
;;; The shift, control, and meta flags. |
;;; The shift, control, and meta flags. |
141 |
(defmacro sm::hit-shiftmask (hit) |
(defmacro sm::hit-shiftmask (hit) |
142 |
(` (logand sm::ShiftmaskBits (nth 0 (, hit))))) |
`(logand sm::ShiftmaskBits (nth 0 ,hit))) |
143 |
;;; Set if a double click (but not a chord). |
;;; Set if a double click (but not a chord). |
144 |
(defmacro sm::hit-double (hit) |
(defmacro sm::hit-double (hit) |
145 |
(` (logand sm::DoubleBits (nth 0 (, hit))))) |
`(logand sm::DoubleBits (nth 0 ,hit))) |
146 |
;;; Set on button release (as opposed to button press). |
;;; Set on button release (as opposed to button press). |
147 |
(defmacro sm::hit-up (hit) |
(defmacro sm::hit-up (hit) |
148 |
(` (logand sm::UpBits (nth 0 (, hit))))) |
`(logand sm::UpBits (nth 0 ,hit))) |
149 |
;;; Screen x position. |
;;; Screen x position. |
150 |
(defmacro sm::hit-x (hit) (list 'nth 1 hit)) |
(defmacro sm::hit-x (hit) (list 'nth 1 hit)) |
151 |
;;; Screen y position. |
;;; Screen y position. |
153 |
;;; Milliseconds since last hit. |
;;; Milliseconds since last hit. |
154 |
(defmacro sm::hit-delta (hit) (list 'nth 3 hit)) |
(defmacro sm::hit-delta (hit) (list 'nth 3 hit)) |
155 |
|
|
156 |
(defmacro sm::hit-up-p (hit) ; A predicate. |
(defmacro sm::hit-up-p (hit) ; A predicate. |
157 |
(` (not (zerop (sm::hit-up (, hit)))))) |
`(not (zerop (sm::hit-up ,hit)))) |
158 |
|
|
159 |
;;; |
;;; |
160 |
;;; Loc accessors. for sm::window-xy |
;;; Loc accessors. for sm::window-xy |
166 |
(defmacro eval-in-buffer (buffer &rest forms) |
(defmacro eval-in-buffer (buffer &rest forms) |
167 |
"Macro to switches to BUFFER, evaluates FORMS, returns to original buffer." |
"Macro to switches to BUFFER, evaluates FORMS, returns to original buffer." |
168 |
;; When you don't need the complete window context of eval-in-window |
;; When you don't need the complete window context of eval-in-window |
169 |
(` (let ((StartBuffer (current-buffer))) |
`(let ((StartBuffer (current-buffer))) |
170 |
(unwind-protect |
(unwind-protect |
171 |
(progn |
(progn |
172 |
(set-buffer (, buffer)) |
(set-buffer ,buffer) |
173 |
(,@ forms)) |
,@forms) |
174 |
(set-buffer StartBuffer))))) |
(set-buffer StartBuffer)))) |
175 |
|
|
176 |
(put 'eval-in-buffer 'lisp-indent-function 1) |
(put 'eval-in-buffer 'lisp-indent-function 1) |
177 |
|
|
179 |
;;; |
;;; |
180 |
(defmacro eval-in-window (window &rest forms) |
(defmacro eval-in-window (window &rest forms) |
181 |
"Switch to WINDOW, evaluate FORMS, return to original window." |
"Switch to WINDOW, evaluate FORMS, return to original window." |
182 |
(` (let ((OriginallySelectedWindow (selected-window))) |
`(let ((OriginallySelectedWindow (selected-window))) |
183 |
(unwind-protect |
(unwind-protect |
184 |
(progn |
(progn |
185 |
(select-window (, window)) |
(select-window ,window) |
186 |
(,@ forms)) |
,@forms) |
187 |
(select-window OriginallySelectedWindow))))) |
(select-window OriginallySelectedWindow)))) |
188 |
(put 'eval-in-window 'lisp-indent-function 1) |
(put 'eval-in-window 'lisp-indent-function 1) |
189 |
|
|
190 |
;;; |
;;; |
196 |
"Switches to each window and evaluates FORM. Optional argument |
"Switches to each window and evaluates FORM. Optional argument |
197 |
YESMINI says to include the minibuffer as a window. |
YESMINI says to include the minibuffer as a window. |
198 |
This is a macro, and does not evaluate its arguments." |
This is a macro, and does not evaluate its arguments." |
199 |
(` (let ((OriginallySelectedWindow (selected-window))) |
`(let ((OriginallySelectedWindow (selected-window))) |
200 |
(unwind-protect |
(unwind-protect |
201 |
(while (progn |
(while (progn |
202 |
(, form) |
,form |
203 |
(not (eq OriginallySelectedWindow |
(not (eq OriginallySelectedWindow |
204 |
(select-window |
(select-window |
205 |
(next-window nil (, yesmini))))))) |
(next-window nil ,yesmini)))))) |
206 |
(select-window OriginallySelectedWindow))))) |
(select-window OriginallySelectedWindow)))) |
207 |
(put 'eval-in-window 'lisp-indent-function 0) |
(put 'eval-in-window 'lisp-indent-function 0) |
208 |
|
|
209 |
(defun move-to-loc (x y) |
(defun move-to-loc (x y) |