annotate lisp/w3/w3-xemac.el @ 80:1ce6082ce73f r20-0b90

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