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