annotate lisp/w3/w3-mouse.el @ 0:376386a54a3c r19-14

Import from CVS: tag r19-14
author cvs
date Mon, 13 Aug 2007 08:45:50 +0200
parents
children ac2d302a0011
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;; w3-xemac.el,v --- XEmacs specific functions for emacs-w3
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 ;; Author: wmperry
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 ;; Created: 1996/05/29 18:21:00
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 ;; Version: 1.7
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;; Keywords: mouse, hypermedia
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 ;;; Copyright (c) 1996 by William M. Perry (wmperry@spry.com)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;;; This file is part of GNU Emacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;;; GNU Emacs is free software; you can redistribute it and/or modify
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;;; it under the terms of the GNU General Public License as published by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ;;; the Free Software Foundation; either version 2, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;;; any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 ;;; GNU Emacs is distributed in the hope that it will be useful,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 ;;; GNU General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 ;;; You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 ;;; along with GNU Emacs; see the file COPYING. If not, write to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 ;;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 (require 'w3-vars)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 (defun w3-follow-mouse-other-frame (e)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 "Function suitable to being bound to a mouse key. Follows the link under
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 the mouse click, opening it in another frame."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 (interactive "e")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 (mouse-set-point e)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 (w3-follow-link-other-frame))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 (defun w3-follow-inlined-image-mouse (e)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 "Follow an inlined image from the mouse"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 (interactive "e")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 (mouse-set-point e)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 (w3-follow-inlined-image))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 (defun w3-follow-inlined-image ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 "Follow an inlined image, regardless of whether it is a hyperlink or not."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 (let ((widget (widget-at (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 (and (not widget) (error "No inlined image at point."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 (setq widget (widget-get widget :parent))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 (and (or (not widget)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 (not (eq 'image (car widget))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 (error "No inlined image at point."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 (and (widget-get widget 'src)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 (w3-fetch (widget-get widget 'src)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 (defvar w3-mouse-button1 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 ((and w3-running-xemacs (featurep 'mouse)) 'button1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 (w3-running-xemacs 'return)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 (t 'mouse-1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 (defvar w3-mouse-button2 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 ((and w3-running-xemacs (featurep 'mouse)) 'button2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 (w3-running-xemacs 'return)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 (t 'mouse-2)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 (defvar w3-mouse-button3 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 ((and w3-running-xemacs (featurep 'mouse)) 'button3)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 (w3-running-xemacs (list 'meta ?`))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 (t 'mouse-3)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 (define-key w3-mode-map (vector w3-mouse-button2) 'w3-widget-button-click)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 (define-key w3-mode-map (vector w3-mouse-button3) 'w3-popup-menu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 (define-key w3-mode-map (vector (list 'shift w3-mouse-button2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 'w3-follow-mouse-other-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 (define-key w3-netscape-emulation-minor-mode-map (vector w3-mouse-button1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 'w3-widget-button-click)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 (define-key w3-netscape-emulation-minor-mode-map (vector w3-mouse-button2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 'w3-follow-mouse-other-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 (if w3-running-FSF19
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 (define-key w3-mode-map [down-mouse-3] 'w3-popup-menu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 (define-key w3-mode-map [mouse-movement] 'w3-mouse-handler)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 (provide 'w3-mouse)