0
|
1 ;;; w3-xemac.el,v --- XEmacs specific functions for emacs-w3
|
|
2 ;; Author: wmperry
|
|
3 ;; Created: 1996/06/06 14:14:34
|
|
4 ;; Version: 1.165
|
|
5 ;; Keywords: faces, help, mouse, hypermedia
|
|
6
|
|
7 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
8 ;;; Copyright (c) 1993, 1994, 1995 by William M. Perry (wmperry@spry.com)
|
|
9 ;;;
|
|
10 ;;; This file is part of GNU Emacs.
|
|
11 ;;;
|
|
12 ;;; GNU Emacs is free software; you can redistribute it and/or modify
|
|
13 ;;; it under the terms of the GNU General Public License as published by
|
|
14 ;;; the Free Software Foundation; either version 2, or (at your option)
|
|
15 ;;; any later version.
|
|
16 ;;;
|
|
17 ;;; GNU Emacs is distributed in the hope that it will be useful,
|
|
18 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
19 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
20 ;;; GNU General Public License for more details.
|
|
21 ;;;
|
|
22 ;;; You should have received a copy of the GNU General Public License
|
|
23 ;;; along with GNU Emacs; see the file COPYING. If not, write to
|
|
24 ;;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
25 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
26
|
|
27 (require 'w3-imap)
|
|
28 (require 'images)
|
|
29 (require 'w3-widget)
|
|
30 (require 'w3-menu)
|
|
31 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
32 ;;; Enhancements For XEmacs
|
|
33 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
34 (defun w3-mouse-handler (e)
|
|
35 "Function to message the url under the mouse cursor"
|
|
36 (let* ((pt (event-point e))
|
|
37 (props (and pt (extent-properties-at pt)))
|
|
38 (link (nth 1 (nth 1 (memq 'w3 props)))) ; The link info if it exists
|
|
39 (form (nth 1 (memq 'w3form props))) ; The form info it it exists
|
|
40 (dely (nth 0 (nth 1 (memq 'w3delayed props)))) ; The delayed img info
|
|
41 (mpeg (nth 1 (memq 'w3mpeg props))) ; the delayed mpeg info
|
|
42 (imag (nth 1 (memq 'w3graphic props)))) ; The image info if it exists
|
|
43 (cond
|
|
44 (link (message "%s" link))
|
|
45 (form
|
|
46 (let ((args (nth 0 form)))
|
|
47 (cond
|
|
48 ((string= "SUBMIT" (nth 1 form))
|
|
49 (message "Submit form to %s" (cdr-safe (assq 'action args))))
|
|
50 ((string= "RESET" (nth 1 form))
|
|
51 (message "Reset form contents"))
|
|
52 (t
|
|
53 (message "Form entry (name=%s, type=%s)" (nth 2 form)
|
|
54 (if (equal "" (nth 1 form))
|
|
55 "text"
|
|
56 (downcase (nth 1 form))))))))
|
|
57 (dely (message "Delayed image (%s)" (car dely)))
|
|
58 (imag (message "Inlined image (%s)" (car imag)))
|
|
59 (mpeg (message "Delayed mpeg (%s)" (car mpeg)))
|
|
60 (t (message "")))))
|
|
61
|
|
62 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
63 ;;; Functions to build menus of urls
|
|
64 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
65 (defun w3-setup-version-specifics ()
|
|
66 "Set up routine for XEmacs 19.12 or later"
|
|
67 ;; Create the toolbar buttons
|
|
68 (and (featurep 'toolbar)
|
|
69 (w3-toolbar-make-buttons))
|
|
70
|
|
71 ;; Register the default set of image conversion utilities
|
|
72 (image-register-netpbm-utilities)
|
|
73
|
|
74 ;; Add our menus, but make sure that we do it to the global menubar
|
|
75 ;; not the current one, which could be anything, but usually GNUS or
|
|
76 ;; VM if not the default.
|
|
77 (if (featurep 'menubar)
|
|
78 (let ((current-menubar (default-value 'current-menubar)))
|
|
79 (if current-menubar
|
|
80 (add-submenu '("Help") (cons "WWW" (cdr w3-menu-help-menu))))))
|
|
81
|
|
82 )
|
|
83
|
|
84 (defun w3-store-in-clipboard (str)
|
|
85 "Store string STR into the clipboard in X"
|
|
86 (cond
|
|
87 ((eq (device-type) 'tty)
|
|
88 nil)
|
|
89 ((eq (device-type) 'x)
|
|
90 (x-own-selection str))
|
|
91 ((eq (device-type) 'ns)
|
|
92 )
|
|
93 (t nil)))
|
|
94
|
|
95 (defun w3-color-light-p (color-or-face)
|
|
96 (let (face color)
|
|
97 (cond
|
|
98 ((or (facep color-or-face)
|
|
99 (and (symbolp color-or-face)
|
|
100 (find-face color-or-face)))
|
|
101 (setq color (specifier-instance (face-background color-or-face))))
|
|
102 ((color-instance-p color-or-face)
|
|
103 (setq color color-or-face))
|
|
104 ((color-specifier-p color-or-face)
|
|
105 (setq color (specifier-instance color-or-face)))
|
|
106 ((stringp color-or-face)
|
|
107 (setq color (make-color-instance color-or-face)))
|
|
108 (t (signal 'wrong-type-argument 'color-or-face-p)))
|
|
109 (if color
|
|
110 (not (< (apply '+ (color-instance-rgb-components color))
|
|
111 (/ (apply '+ (color-instance-rgb-components
|
|
112 (make-color-instance "white"))) 3)))
|
|
113 t)))
|
|
114
|
|
115 (defun w3-mode-motion-hook (e)
|
|
116 (let* ((glyph (event-glyph e))
|
|
117 (x (and glyph (event-glyph-x-pixel e)))
|
|
118 (y (and glyph (event-glyph-y-pixel e)))
|
|
119 (widget (and glyph (glyph-property glyph 'widget)))
|
|
120 (usemap (and widget (w3-image-widget-usemap widget)))
|
|
121 (ismap (and widget (widget-get widget 'ismap)))
|
|
122 (echo (and widget (widget-get widget 'href))))
|
|
123 (cond
|
|
124 (usemap
|
|
125 (setq echo (w3-point-in-map (vector x y) usemap t)))
|
|
126 (ismap
|
|
127 (setq echo (format "%s?%d,%d" echo x y)))
|
|
128 (t
|
|
129 nil))
|
|
130 (and echo (message "%s" echo))))
|
|
131
|
|
132 (defun w3-mode-version-specifics ()
|
|
133 "XEmacs specific stuff for w3-mode"
|
|
134 (cond
|
|
135 ((not w3-track-mouse)
|
|
136 nil)
|
|
137 ((or (not (boundp 'inhibit-help-echo))
|
|
138 inhibit-help-echo)
|
|
139 (setq mode-motion-hook 'w3-mouse-handler))
|
|
140 (t nil))
|
|
141 (if (eq (device-type) 'tty)
|
|
142 nil
|
|
143 (w3-add-toolbar-to-buffer))
|
|
144 (setq mode-popup-menu w3-popup-menu))
|
|
145
|
|
146 (require 'w3-toolbar)
|
|
147 (provide 'w3-xemacs)
|
|
148 (provide 'w3-xemac)
|