annotate lisp/w3/w3-xemac.el @ 93:486ff617c2a1

Added tag r20-0test1 for changeset 6a43545367ac
author cvs
date Mon, 13 Aug 2007 09:11:41 +0200
parents 6a378aca36af
children 0d2f883870bc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
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
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
3 ;; Created: 1997/01/19 20:06:02
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
4 ;; Version: 1.12
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;; Keywords: faces, help, 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) 1993 - 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
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 (require 'w3-imap)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 (require 'images)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 (require 'w3-widget)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 (require 'w3-menu)
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
33 (require 'w3-forms)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 ;;; Enhancements For XEmacs
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-mouse-handler (e)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 "Function to message the url under the mouse cursor"
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
39 (interactive "e")
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 (let* ((pt (event-point e))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
41 (good (eq (event-window e) (selected-window)))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
42 (widget (and good pt (number-or-marker-p pt) (widget-at pt)))
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
43 (link (and widget (or (widget-get widget 'href)
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
44 (widget-get widget 'name))))
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
45 (form (and widget (widget-get widget :w3-form-data)))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
46 (imag nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
47 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
48 (cond
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
49 (link (message "%s" (w3-widget-echo widget)))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
50 (form
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
51 (cond
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
52 ((eq 'submit (w3-form-element-type form))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
53 (message "Submit form to %s"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
54 (cdr-safe (assq 'action (w3-form-element-action form)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
55 ((eq 'reset (w3-form-element-type form))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
56 (message "Reset form contents"))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
57 (t
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
58 (message "Form entry (name=%s, type=%s)" (w3-form-element-name form)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
59 (w3-form-element-type form)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
60 (imag (message "Inlined image (%s)" (car imag)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
61 (t (message "")))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 ;;; Functions to build menus of urls
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 (defun w3-setup-version-specifics ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 "Set up routine for XEmacs 19.12 or later"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 ;; Create the toolbar buttons
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 (and (featurep 'toolbar)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 (w3-toolbar-make-buttons))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 ;; Register the default set of image conversion utilities
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 (image-register-netpbm-utilities)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 ;; Add our menus, but make sure that we do it to the global menubar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 ;; not the current one, which could be anything, but usually GNUS or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 ;; VM if not the default.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 (if (featurep 'menubar)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 (let ((current-menubar (default-value 'current-menubar)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 (if current-menubar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 (add-submenu '("Help") (cons "WWW" (cdr w3-menu-help-menu))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 (defun w3-store-in-clipboard (str)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 "Store string STR into the clipboard in X"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 ((eq (device-type) 'tty)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 ((eq (device-type) 'x)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 (x-own-selection str))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 ((eq (device-type) 'ns)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 (t nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 (defun w3-color-light-p (color-or-face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 (let (face color)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 ((or (facep color-or-face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 (and (symbolp color-or-face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 (find-face color-or-face)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 (setq color (specifier-instance (face-background color-or-face))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 ((color-instance-p color-or-face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 (setq color color-or-face))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 ((color-specifier-p color-or-face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 (setq color (specifier-instance color-or-face)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 ((stringp color-or-face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 (setq color (make-color-instance color-or-face)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 (t (signal 'wrong-type-argument 'color-or-face-p)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 (if color
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 (not (< (apply '+ (color-instance-rgb-components color))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 (/ (apply '+ (color-instance-rgb-components
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 (make-color-instance "white"))) 3)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 (defun w3-mode-motion-hook (e)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 (let* ((glyph (event-glyph e))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 (x (and glyph (event-glyph-x-pixel e)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 (y (and glyph (event-glyph-y-pixel e)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 (widget (and glyph (glyph-property glyph 'widget)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 (usemap (and widget (w3-image-widget-usemap widget)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 (ismap (and widget (widget-get widget 'ismap)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 (echo (and widget (widget-get widget 'href))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 (usemap
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 (setq echo (w3-point-in-map (vector x y) usemap t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 (ismap
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 (setq echo (format "%s?%d,%d" echo x y)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 (and echo (message "%s" echo))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 (defun w3-mode-version-specifics ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 "XEmacs specific stuff for w3-mode"
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
135 (if (featurep 'mouse)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
136 (cond
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
137 ((not w3-track-mouse)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
138 (setq inhibit-help-echo nil))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
139 (inhibit-help-echo
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
140 (setq mode-motion-hook 'w3-mouse-handler))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
141 (t nil)))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
142 (if (eq (device-type) 'tty)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
143 nil
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
144 (w3-add-toolbar-to-buffer))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 (setq mode-popup-menu w3-popup-menu))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 (require 'w3-toolbar)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 (provide 'w3-xemacs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 (provide 'w3-xemac)