2
|
1 ;;; w3-xemac.el --- XEmacs specific functions for emacs-w3
|
0
|
2 ;; Author: wmperry
|
14
|
3 ;; Created: 1996/11/27 15:11:46
|
|
4 ;; Version: 1.7
|
0
|
5 ;; Keywords: faces, help, mouse, hypermedia
|
|
6
|
|
7 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
2
|
8 ;;; Copyright (c) 1993 - 1996 by William M. Perry (wmperry@cs.indiana.edu)
|
14
|
9 ;;; Copyright (c) 1996 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
|
14
|
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)
|
|
33 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
34 ;;; Enhancements For XEmacs
|
|
35 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
36 (defun w3-mouse-handler (e)
|
|
37 "Function to message the url under the mouse cursor"
|
2
|
38 (interactive "e")
|
0
|
39 (let* ((pt (event-point e))
|
2
|
40 (good (eq (event-window e) (selected-window)))
|
|
41 (widget (and good pt (number-or-marker-p pt) (widget-at pt)))
|
14
|
42 (link (and widget (or (widget-get widget 'href)
|
|
43 (widget-get widget 'name))))
|
2
|
44 (form (and widget (widget-get widget 'w3-form-data)))
|
|
45 (imag nil)
|
|
46 )
|
0
|
47 (cond
|
14
|
48 (link (w3-widget-echo widget))
|
0
|
49 (form
|
2
|
50 (cond
|
|
51 ((eq 'submit (w3-form-element-type form))
|
|
52 (message "Submit form to %s"
|
|
53 (cdr-safe (assq 'action (w3-form-element-action form)))))
|
|
54 ((eq 'reset (w3-form-element-type form))
|
|
55 (message "Reset form contents"))
|
|
56 (t
|
|
57 (message "Form entry (name=%s, type=%s)" (w3-form-element-name form)
|
|
58 (w3-form-element-type form)))))
|
0
|
59 (imag (message "Inlined image (%s)" (car imag)))
|
|
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)
|
2
|
136 (setq inhibit-help-echo nil))
|
|
137 (inhibit-help-echo
|
0
|
138 (setq mode-motion-hook 'w3-mouse-handler))
|
|
139 (t nil))
|
|
140 (if (eq (device-type) 'tty)
|
|
141 nil
|
|
142 (w3-add-toolbar-to-buffer))
|
|
143 (setq mode-popup-menu w3-popup-menu))
|
|
144
|
|
145 (require 'w3-toolbar)
|
|
146 (provide 'w3-xemacs)
|
|
147 (provide 'w3-xemac)
|