annotate lisp/w3/w3-mouse.el @ 98:0d2f883870bc r20-1b1

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