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