2
|
1 ;;; w3-xemac.el --- XEmacs specific functions for emacs-w3
|
0
|
2 ;; Author: wmperry
|
110
|
3 ;; Created: 1997/03/09 01:59:33
|
|
4 ;; Version: 1.16
|
0
|
5 ;; Keywords: faces, help, mouse, hypermedia
|
|
6
|
|
7 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
2
|
8 ;;; Copyright (c) 1993 - 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
|
|
29 (require 'w3-imap)
|
|
30 (require 'images)
|
|
31 (require 'w3-widget)
|
|
32 (require 'w3-menu)
|
82
|
33 (require 'w3-forms)
|
102
|
34 (require 'w3-script)
|
0
|
35 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
36 ;;; Enhancements For XEmacs
|
|
37 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
38 (defun w3-mouse-handler (e)
|
|
39 "Function to message the url under the mouse cursor"
|
2
|
40 (interactive "e")
|
0
|
41 (let* ((pt (event-point e))
|
2
|
42 (good (eq (event-window e) (selected-window)))
|
102
|
43 (mouse-events))
|
|
44 (if (not (and good pt (number-or-marker-p pt)))
|
|
45 nil
|
|
46 (if (and inhibit-help-echo w3-track-mouse)
|
|
47 (widget-echo-help pt))
|
|
48 (setq mouse-events (w3-script-find-event-handlers pt 'mouse))
|
|
49 (if (assq 'onmouseover mouse-events)
|
|
50 (w3-script-evaluate-form (cdr (assq 'onmouseover mouse-events)))))))
|
0
|
51
|
|
52 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
53 ;;; Functions to build menus of urls
|
|
54 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
55 (defun w3-setup-version-specifics ()
|
|
56 "Set up routine for XEmacs 19.12 or later"
|
|
57 ;; Create the toolbar buttons
|
|
58 (and (featurep 'toolbar)
|
|
59 (w3-toolbar-make-buttons))
|
|
60
|
|
61 ;; Register the default set of image conversion utilities
|
|
62 (image-register-netpbm-utilities)
|
|
63
|
|
64 ;; Add our menus, but make sure that we do it to the global menubar
|
|
65 ;; not the current one, which could be anything, but usually GNUS or
|
|
66 ;; VM if not the default.
|
|
67 (if (featurep 'menubar)
|
|
68 (let ((current-menubar (default-value 'current-menubar)))
|
|
69 (if current-menubar
|
|
70 (add-submenu '("Help") (cons "WWW" (cdr w3-menu-help-menu))))))
|
|
71
|
98
|
72 ;; FIXME FIXME: Do sexy things to the default modeline for Emacs-W3
|
|
73
|
|
74 ;; The following is a workaround for XEmacs 19.14 and XEmacs 20.0
|
|
75 ;; The text property implementation is badly broken - you could not have
|
|
76 ;; a text property with a `nil' value. Bad bad bad.
|
|
77 (if (or (and (= emacs-major-version 20)
|
|
78 (= emacs-minor-version 0))
|
|
79 (and (= emacs-major-version 19)
|
|
80 (= emacs-minor-version 14)))
|
|
81 (defun text-prop-extent-paste-function (ext from to)
|
|
82 (let ((prop (extent-property ext 'text-prop nil))
|
|
83 (val nil))
|
|
84 (if (null prop)
|
|
85 (error "Internal error: no text-prop"))
|
|
86 (setq val (extent-property ext prop nil))
|
|
87 (put-text-property from to prop val nil)
|
|
88 nil))
|
|
89 )
|
0
|
90 )
|
|
91
|
|
92 (defun w3-store-in-clipboard (str)
|
|
93 "Store string STR into the clipboard in X"
|
|
94 (cond
|
|
95 ((eq (device-type) 'tty)
|
|
96 nil)
|
|
97 ((eq (device-type) 'x)
|
|
98 (x-own-selection str))
|
|
99 ((eq (device-type) 'ns)
|
|
100 )
|
|
101 (t nil)))
|
|
102
|
|
103 (defun w3-color-light-p (color-or-face)
|
|
104 (let (face color)
|
|
105 (cond
|
|
106 ((or (facep color-or-face)
|
|
107 (and (symbolp color-or-face)
|
|
108 (find-face color-or-face)))
|
|
109 (setq color (specifier-instance (face-background color-or-face))))
|
|
110 ((color-instance-p color-or-face)
|
|
111 (setq color color-or-face))
|
|
112 ((color-specifier-p color-or-face)
|
|
113 (setq color (specifier-instance color-or-face)))
|
|
114 ((stringp color-or-face)
|
|
115 (setq color (make-color-instance color-or-face)))
|
|
116 (t (signal 'wrong-type-argument 'color-or-face-p)))
|
|
117 (if color
|
|
118 (not (< (apply '+ (color-instance-rgb-components color))
|
|
119 (/ (apply '+ (color-instance-rgb-components
|
|
120 (make-color-instance "white"))) 3)))
|
|
121 t)))
|
|
122
|
|
123 (defun w3-mode-motion-hook (e)
|
|
124 (let* ((glyph (event-glyph e))
|
|
125 (x (and glyph (event-glyph-x-pixel e)))
|
|
126 (y (and glyph (event-glyph-y-pixel e)))
|
|
127 (widget (and glyph (glyph-property glyph 'widget)))
|
|
128 (usemap (and widget (w3-image-widget-usemap widget)))
|
|
129 (ismap (and widget (widget-get widget 'ismap)))
|
|
130 (echo (and widget (widget-get widget 'href))))
|
|
131 (cond
|
|
132 (usemap
|
|
133 (setq echo (w3-point-in-map (vector x y) usemap t)))
|
|
134 (ismap
|
|
135 (setq echo (format "%s?%d,%d" echo x y)))
|
|
136 (t
|
|
137 nil))
|
|
138 (and echo (message "%s" echo))))
|
|
139
|
|
140 (defun w3-mode-version-specifics ()
|
|
141 "XEmacs specific stuff for w3-mode"
|
82
|
142 (if (featurep 'mouse)
|
102
|
143 (progn
|
|
144 (if (not w3-track-mouse)
|
|
145 (setq inhibit-help-echo nil))
|
|
146 (setq mode-motion-hook 'w3-mouse-handler)))
|
110
|
147 (case (device-type)
|
|
148 ((tty stream) ; TTY or batch
|
|
149 nil)
|
|
150 (otherwise
|
|
151 (w3-add-toolbar-to-buffer)))
|
0
|
152 (setq mode-popup-menu w3-popup-menu))
|
|
153
|
|
154 (require 'w3-toolbar)
|
|
155 (provide 'w3-xemacs)
|
|
156 (provide 'w3-xemac)
|