Mercurial > hg > xemacs-beta
comparison lisp/mouse.el @ 282:c42ec1d1cded r21-0b39
Import from CVS: tag r21-0b39
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:33:18 +0200 |
parents | 7df0dd720c89 |
children | 558f606b08ae |
comparison
equal
deleted
inserted
replaced
281:090b52736db2 | 282:c42ec1d1cded |
---|---|
38 (global-set-key '(shift button1) 'mouse-track-adjust) | 38 (global-set-key '(shift button1) 'mouse-track-adjust) |
39 (global-set-key '(control button1) 'mouse-track-insert) | 39 (global-set-key '(control button1) 'mouse-track-insert) |
40 (global-set-key '(control shift button1) 'mouse-track-delete-and-insert) | 40 (global-set-key '(control shift button1) 'mouse-track-delete-and-insert) |
41 (global-set-key '(meta button1) 'mouse-track-do-rectangle) | 41 (global-set-key '(meta button1) 'mouse-track-do-rectangle) |
42 | 42 |
43 ;; drops are now handled in dragdrop.el (ograf@fga.de) | |
44 | |
43 ;; enable drag regions (ograf@fga.de) | 45 ;; enable drag regions (ograf@fga.de) |
44 ;; if button2 is dragged from within a region, this becomes a drop | 46 ;; if button2 is dragged from within a region, this becomes a drop |
47 ;; | |
48 ;; this must be changed to the new api | |
45 (if (featurep '(or offix cde mswindows)) | 49 (if (featurep '(or offix cde mswindows)) |
46 (global-set-key 'button2 'mouse-drag-or-yank) | 50 (global-set-key 'button2 'mouse-drag-or-yank) |
47 (global-set-key 'button2 'mouse-yank)) | 51 (global-set-key 'button2 'mouse-yank)) |
48 | |
49 ;; enable drops from OffiX (ograf@fga.de) or mswindows | |
50 ;; accept any button1,2,3 drop with `mouse-offix-drop' or 'mswindows-mouse-drop' | |
51 (cond ((featurep 'offix) | |
52 (global-set-key 'drop1 'mouse-offix-drop) | |
53 (global-set-key 'drop2 'mouse-offix-drop) | |
54 (global-set-key 'drop3 'mouse-offix-drop)) | |
55 ((featurep 'mswindows) | |
56 (global-set-key 'drop0 'mouse-mswindows-drop) | |
57 (global-set-key 'drop1 'mouse-mswindows-drop) | |
58 (global-set-key 'drop2 'mouse-mswindows-drop) | |
59 (global-set-key 'drop3 'mouse-mswindows-drop))) | |
60 | 52 |
61 (defgroup mouse nil | 53 (defgroup mouse nil |
62 "Window system-independent mouse support." | 54 "Window system-independent mouse support." |
63 :group 'editing) | 55 :group 'editing) |
64 | 56 |
205 ;; no drag, call region-funct | 197 ;; no drag, call region-funct |
206 (and (not mouse-yank-at-point) | 198 (and (not mouse-yank-at-point) |
207 (mouse-set-point event)) | 199 (mouse-set-point event)) |
208 (funcall mouse-yank-function)) | 200 (funcall mouse-yank-function)) |
209 ) | 201 ) |
210 | |
211 (defun mouse-offix-drop (event) | |
212 "Do something with an OffiX drop event. | |
213 Insert Text drops and execute appropriate commands for specific drops. | |
214 Text drops follow the `mouse-yank-at-point' variable." | |
215 ;; by Oliver Graf <ograf@fga.de> | |
216 (interactive "e") | |
217 (let ((type (car (event-drag-and-drop-data event))) | |
218 (data (cadr (event-drag-and-drop-data event))) | |
219 (frame (event-channel event))) | |
220 (cond ((= type 2) | |
221 (let ((x pop-up-windows)) | |
222 (setq pop-up-windows nil) | |
223 (pop-to-buffer (find-file-noselect data) nil frame) | |
224 (make-frame-visible frame) | |
225 (setq pop-up-windows x))) | |
226 ((= type 3) | |
227 (let ((x pop-up-windows)) | |
228 (setq pop-up-windows nil) | |
229 (while (not (eq data ())) | |
230 (pop-to-buffer (find-file-noselect (car data)) nil frame) | |
231 (setq data (cdr data))) | |
232 (make-frame-visible frame) | |
233 (setq pop-up-windows x))) | |
234 ((= type 4) | |
235 (and (not mouse-yank-at-point) | |
236 (mouse-set-point event)) | |
237 (insert data)) | |
238 ((= type 5) (dired data)) | |
239 ((or (= type 6) (= type 7)) (dired data)) ;; this is junk | |
240 ((= type 8) (funcall browse-url-browser-function data)) | |
241 ((= type 9) | |
242 (let ((buf (generate-new-buffer "DndMIME"))) | |
243 (set-buffer buf) | |
244 (pop-to-buffer buf nil frame) | |
245 (insert data) | |
246 (make-frame-visible frame))) | |
247 (t ;; this is raw data or unknown stuff | |
248 (let ((buf (generate-new-buffer "DndRawData"))) | |
249 (set-buffer buf) | |
250 (pop-to-buffer buf nil frame) | |
251 (insert data) | |
252 (hexlify-buffer) | |
253 (make-frame-visible frame)))) | |
254 (undo-boundary))) | |
255 | |
256 (defun mouse-mswindows-drop (event) | |
257 "Do something with a drop event. | |
258 Insert Text drops and execute appropriate commands for specific drops. | |
259 Text drops follow the `mouse-yank-at-point' variable." | |
260 (interactive "e") | |
261 (let* ((type (car (event-drag-and-drop-data event))) | |
262 (data (cadr (event-drag-and-drop-data event))) | |
263 (frame (event-channel event)) | |
264 (window (if frame (event-window event) (frame-selected-window)))) | |
265 (cond ((= type 2) ;; file | |
266 (let ((x pop-up-windows)) | |
267 (setq pop-up-windows nil) | |
268 (cond (window | |
269 (select-window window))) | |
270 (switch-to-buffer (find-file-noselect data)) | |
271 (make-frame-visible frame) | |
272 (setq pop-up-windows x))) | |
273 ((= type 3) ;; files | |
274 (let ((x pop-up-windows)) | |
275 (setq pop-up-windows nil) | |
276 (while (not (eq data ())) | |
277 (pop-to-buffer (find-file-noselect (car data)) nil frame) | |
278 (setq data (cdr data))) | |
279 (make-frame-visible frame) | |
280 (setq pop-up-windows x))) | |
281 ((= type 4) ;; text | |
282 (and (not mouse-yank-at-point) | |
283 (mouse-set-point event)) | |
284 (insert data)) | |
285 (t ;; this is raw data or unknown stuff | |
286 (let ((buf (generate-new-buffer "DndRawData"))) | |
287 (set-buffer buf) | |
288 (pop-to-buffer buf nil frame) | |
289 (insert data) | |
290 (hexlify-buffer) | |
291 (make-frame-visible frame)))) | |
292 (undo-boundary))) | |
293 | 202 |
294 (defun mouse-eval-sexp (click force-window) | 203 (defun mouse-eval-sexp (click force-window) |
295 "Evaluate the sexp under the mouse. Usually, this is the last sexp before | 204 "Evaluate the sexp under the mouse. Usually, this is the last sexp before |
296 the click, but if you click on a left paren, then it is the sexp beginning | 205 the click, but if you click on a left paren, then it is the sexp beginning |
297 with the paren that is evaluated. Also, since strings evaluate to themselves, | 206 with the paren that is evaluated. Also, since strings evaluate to themselves, |