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