annotate lisp/w3/w3-menu.el @ 62:28a7c63c7e1e r19-16-pre6

Import from CVS: tag r19-16-pre6
author cvs
date Mon, 13 Aug 2007 08:59:13 +0200
parents 8d2a9b52c682
children 131b0175ea99
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1 ;;; w3-menu.el --- Menu functions for emacs-w3
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 ;; Author: wmperry
44
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents: 36
diff changeset
3 ;; Created: 1997/03/22 17:31:47
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents: 36
diff changeset
4 ;; Version: 1.35
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;; Keywords: menu, hypermedia
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
8 ;;; Copyright (c) 1996 by William M. Perry (wmperry@cs.indiana.edu)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
9 ;;; Copyright (c) 1996, 1997 Free Software Foundation, Inc.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 ;;; This file is part of GNU Emacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;;; GNU Emacs is free software; you can redistribute it and/or modify
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ;;; it under the terms of the GNU General Public License as published by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;;; the Free Software Foundation; either version 2, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;;; any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 ;;; GNU Emacs is distributed in the hope that it will be useful,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 ;;; GNU General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 ;;; You should have received a copy of the GNU General Public License
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
24 ;;; along with GNU Emacs; see the file COPYING. If not, write to the
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
25 ;;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
26 ;;; Boston, MA 02111-1307, USA.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 (require 'w3-vars)
36
c53a95d3c46d Import from CVS: tag r19-15b101
cvs
parents: 32
diff changeset
30 (require 'w3-mouse)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 ;;; Spiffy new menus (for both Emacs and XEmacs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 (defvar w3-menu-fsfemacs-bookmark-menu nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 (defvar w3-menu-fsfemacs-debug-menu nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 (defvar w3-menu-fsfemacs-edit-menu nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 (defvar w3-menu-fsfemacs-file-menu nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 (defvar w3-menu-fsfemacs-go-menu nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 (defvar w3-menu-fsfemacs-help-menu nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 (defvar w3-menu-fsfemacs-view-menu nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 (defvar w3-menu-fsfemacs-options-menu nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 (defvar w3-menu-fsfemacs-style-menu nil)
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
43 (defvar w3-menu-fsfemacs-search-menu nil)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 (defvar w3-menu-w3-menubar nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 (defvar w3-links-menu nil "Menu for w3-mode in XEmacs.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 (make-variable-buffer-local 'w3-links-menu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47
44
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents: 36
diff changeset
48 (defcustom w3-use-menus '(file edit view go bookmark options buffers style
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents: 36
diff changeset
49 emacs nil help)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 "*Non-nil value causes W3 to provide a menu interface.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 A value that is a list causes W3 to install its own menubar.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 A value of 1 causes W3 to install a \"W3\" item in the Emacs menubar.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 If the value of w3-use-menus is a list, it should be a list of symbols.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 The symbols and the order that they are listed determine what menus
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 will be in the menubar and how they are ordered. Valid symbol values
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 are:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 file -- A list of file related commands
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 edit -- Various standard editing commands (copy/paste)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 view -- Controlling various things about the document view
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 go -- Navigation control
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 bookmark -- Bookmark / hotlist control
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 options -- Various options
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 buffers -- The standard buffers menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 emacs -- A toggle button to switch back to normal emacs menus
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
67 style -- Control style information and who gets to set what
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
68 search -- Various search engines
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
69 help -- The help menu
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 nil -- ** special **
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 If nil appears in the list, it should appear exactly once. All
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 menus after nil in the list will be displayed flushright in the
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
74 menubar.
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
75
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
76 NOTE! The current port of Emacs to Windows NT/95 does not support
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
77 buttons in the menubar, so the 'emacs' keyword is currently ignored
44
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents: 36
diff changeset
78 on that platform."
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents: 36
diff changeset
79 :group 'w3-menus
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents: 36
diff changeset
80 :type '(set (const :tag "File related commands" :value file)
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents: 36
diff changeset
81 (const :tag "Standard editing commands" :value edit)
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents: 36
diff changeset
82 (const :tag "View document information" :value view)
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents: 36
diff changeset
83 (const :tag "Navigation" :value go)
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents: 36
diff changeset
84 (const :tag "Bookmarks" :value bookmark)
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents: 36
diff changeset
85 (const :tag "Options" :value options)
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents: 36
diff changeset
86 (const :tag "Buffer list" :value buffers)
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents: 36
diff changeset
87 (const :tag "Stylesheet information" :value style)
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents: 36
diff changeset
88 (const :tag "Search engines" :value search)
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents: 36
diff changeset
89 (const :tag "Toggle to default menus" :value emacs)
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents: 36
diff changeset
90 (const :tag "Separator" :value nil)
8d2a9b52c682 Import from CVS: tag r19-15prefinal
cvs
parents: 36
diff changeset
91 (const :tag "Help" :value help)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 (defun w3-menu-hotlist-constructor (menu-items)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 (or (cdr w3-html-bookmarks)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 (let ((hot-menu nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 (hot w3-hotlist))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 (while hot
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 (setq hot-menu (cons (vector
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 (w3-truncate-menu-item (car (car hot)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 (list 'w3-fetch (car (cdr (car hot))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 t) hot-menu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 hot (cdr hot)))
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
103 (or hot-menu '(["No Hotlist" nil nil])))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
104
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
105 (defun w3-menu-html-links-constructor (menu-items)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
106 (or menu-items
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
107 (let ((links (mapcar 'cdr w3-current-links))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
108 (menu nil))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
109 (if links
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
110 (setq links (delete*
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
111 nil
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
112 (reduce 'append links)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
113 :test-not (function
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
114 (lambda (a b) ; arg order unknown
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
115 (member
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
116 (car (or a b))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
117 w3-defined-link-types))))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
118 (while links
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
119 (let ((name (caar links))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
120 (vals (cdar links))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
121 (href nil)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
122 (new nil))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
123 (if (= (length vals) 1)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
124 (setq vals (car vals)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
125 new (vector (or (plist-get vals 'title)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
126 (capitalize name))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
127 (list 'w3-fetch (plist-get vals 'href)) t))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
128 (setq new (cons (capitalize name)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
129 (mapcar (function
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
130 (lambda (x)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
131 (setq href (plist-get x 'href))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
132 (vector (or (plist-get x 'title) href)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
133 (list 'w3-fetch href) t)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
134 vals))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
135 (setq links (cdr links)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
136 menu (cons new menu))))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
137 (or menu '(["None" nil nil])))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 (defun w3-menu-links-constructor (menu-items)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 (or menu-items
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 (let ((widgets (w3-only-links))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 widget href menu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 (while widgets
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 (setq widget (car widgets)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 widgets (cdr widgets)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 href (widget-get widget 'href)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 menu (cons
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 (vector (w3-truncate-menu-item
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
149 (or (widget-get widget 'title)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
150 (w3-fix-spaces
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
151 (buffer-substring
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
152 (widget-get widget :from)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
153 (widget-get widget :to)))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 (list 'url-maybe-relative href) t) menu)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 (setq menu (w3-breakup-menu menu w3-max-menu-length))
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
156 (or menu '(["No Links" nil nil])))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 (defun w3-toggle-minibuffer ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 (w3-running-xemacs
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
162 (if (equal (frame-property (selected-frame) 'minibuffer) t)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
163
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
164 ;; frame has a minibuffer, so remove it
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
165 ;; unfortunately, we must delete and redraw the frame
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
166 (let ((fp (frame-properties (selected-frame)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
167 (frame (selected-frame))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
168 (buf (current-buffer)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
169 (select-frame
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
170 (make-frame (plist-put
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
171 (plist-remprop
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
172 (plist-remprop fp 'window-id) 'minibuffer)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
173 'minibuffer nil)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
174 (delete-frame frame)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
175 (switch-to-buffer buf))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
176 ;; no minibuffer so add one
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
177 (set-frame-property (selected-frame) 'minibuffer t)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 (t nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 (defun w3-toggle-location ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 (w3-running-xemacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 (let ((on (specifier-instance has-modeline-p (selected-window))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 (set-specifier has-modeline-p (not on) (selected-window))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 (t nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 (defun w3-toggle-menubar ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 ;; XEmacs style
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 (w3-running-xemacs
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
193 (set-specifier menubar-visible-p (cons (current-buffer)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
194 (not (specifier-instance
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
195 menubar-visible-p)))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 ;; Emacs 19 style
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 (menu-bar-mode (if (w3-menubar-active) -1 1)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 (defun w3-location-active ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 (if w3-running-xemacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 (specifier-instance has-modeline-p (selected-window))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 (defun w3-menubar-active ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 (if w3-running-xemacs
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
207 (and (featurep 'menubar) (specifier-instance menubar-visible-p))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 (and (boundp 'menu-bar-mode) menu-bar-mode)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 (defun w3-menu-global-menubar ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 (if w3-running-xemacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 (default-value 'default-menubar)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 (lookup-key (current-global-map) [menu-bar])))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 (defconst w3-menu-file-menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 "File"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 ["Open Location..." w3-fetch t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 ["Open File..." w3-open-local t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 ["Open in New Window..." w3-fetch-other-frame t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 ["New Window" make-frame t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 "---"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 ["Save" save-buffer t nil]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 "Save As..."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 ["HTML" (w3-save-as "HTML Source") t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 ["Formatted Text" (w3-save-as "Formatted Text") t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 ["LaTeX" (w3-save-as "LaTeX Source") t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 ["PostScript" (w3-save-as "PostScript") t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 ["Binary" (w3-save-as "Binary") t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 "---"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 "Print As..."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 ["PostScript" (w3-print-this-url nil "PostScript") t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 ["Formatted Text" (w3-print-this-url nil "Formatted Text") t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 ["HTML Source" (w3-print-this-url nil "HTML Source") t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 ["LaTeX'd" (w3-print-this-url nil "LaTeX'd") t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 "Mail Document..."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 ["HTML" (w3-mail-current-document nil "HTML Source") t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 ["Formatted Text" (w3-mail-current-document nil "Formatted Text") t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 ["PostScript" (w3-mail-current-document nil "PostScript") t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 ["LaTeX Source" (w3-mail-current-document nil "LaTeX Source") t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 (if w3-running-xemacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 "---:shadowDoubleEtchedIn"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 "---")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 ["Close" delete-frame (not (eq (next-frame) (selected-frame)))]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 ["Exit" save-buffers-kill-emacs t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 "W3 file menu list.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 (defconst w3-menu-edit-menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 "Edit"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 ["Undo" advertised-undo nil]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 ["Cut" kill-region nil]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 ["Copy" copy-region-as-kill t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 "----"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 ["Search..." w3-search-forward t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 ["Search Again..." w3-search-again w3-last-search-item]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 "W3 edit menu list.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 (defconst w3-menu-view-menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 "View"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 ["Document Information" w3-document-information t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 ["Document Source" w3-source-document t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 ["Load Images" w3-load-delayed-images w3-delayed-images]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 "----"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 ["Refresh" w3-refresh-buffer w3-current-parse]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 ["Reload" w3-reload-document (and (url-view-url t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 (not (equal (url-view-url t) "")))]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 "----"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 ["Show URL" url-view-url t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 ["Show URL At Point" w3-view-this-url t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 "----"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 "W3 menu view list.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 (defconst w3-menu-debug-menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 "Debugging"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 ["View Parse Tree" (w3-display-parse-tree w3-current-parse)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 w3-current-parse]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 ["View Stylesheet" w3-display-stylesheet w3-current-stylesheet]
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
290 ["Reload Stylesheets" w3-refresh-stylesheets t]
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 "W3 menu debug list.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 (defconst w3-menu-go-menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 "Go"
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
297 ["Forward" w3-history-forward (cdr (w3-history-find-url-internal (url-view-url t)))]
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
298 ["Back" w3-history-backward (car (w3-history-find-url-internal (url-view-url t)))]
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 ["Home" w3 w3-default-homepage]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 ["View History..." w3-show-history-list url-keep-history]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 "----"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 (if w3-running-xemacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 '("Links" :filter w3-menu-links-constructor)
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
304 ["Links..." w3-e19-show-links-menu t])
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
305 (if w3-running-xemacs
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
306 '("Navigate" :filter w3-menu-html-links-constructor)
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
307 ["Navigate..." w3-e19-show-navigate-menu t])
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 "W3 menu go list.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 (defconst w3-menu-bookmark-menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 "Bookmark"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 ["View Bookmarks..." w3-show-hotlist w3-hotlist]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 ["Add Bookmark" w3-hotlist-add-document t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 ["Delete Bookmark" w3-hotlist-delete t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 ["Rename Bookmark" w3-hotlist-rename-entry t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 ["Append Bookmark List" w3-hotlist-append t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 "----"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 (if w3-running-xemacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 '("Bookmarks" :filter w3-menu-hotlist-constructor)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 ["Bookmarks" w3-e19-show-hotlist-menu t])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 "W3 menu bookmark list.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 (defconst w3-menu-options-menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 (list "Options"
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
328 ["Edit Preferences" w3-preferences-edit t]
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
329 "---"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 ["Show Menubar" w3-toggle-menubar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 :style toggle :selected (w3-menubar-active)]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 (if (and w3-running-xemacs (featurep 'toolbar))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 ["Show Toolbar" w3-toggle-toolbar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 :style toggle :selected (w3-toolbar-active)]
32
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
335 ["Show Toolbar" w3-toggle-toolbar nil])
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 (if w3-running-xemacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 ["Show Location" w3-toggle-location
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 :style toggle :selected (w3-location-active)]
32
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
339 ["Show Location" w3-toggle-location nil])
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 (if w3-running-xemacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 ["Show Status Bar" w3-toggle-minibuffer
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
342 :style toggle
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
343 :selected (eq (frame-property (selected-frame) 'minibuffer) t)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
344 ])
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 ["Incremental Display"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 (setq w3-do-incremental-display (not w3-do-incremental-display))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 :style toggle :selected w3-do-incremental-display]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 "----"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 ["Auto Load Images"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 (setq w3-delay-image-loads (not w3-delay-image-loads))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 :style toggle :selected (not w3-delay-image-loads)]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 ["Flush Image Cache" (setq w3-graphics-list nil) w3-graphics-list]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 "----"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 ["Download to disk" (setq w3-dump-to-disk (not w3-dump-to-disk))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 :style toggle :selected w3-dump-to-disk]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 ["Caching" (setq url-automatic-caching (not url-automatic-caching))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 :style toggle :selected url-automatic-caching]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 ["Use Cache Only"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 (setq url-standalone-mode (not url-standalone-mode))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 :style toggle :selected url-standalone-mode]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 "----"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 ["Save Options" w3-menu-save-options t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 "W3 menu options list.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 (defconst w3-menu-style-menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 "Style"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 ["Allow Document Stylesheets" (setq w3-honor-stylesheets
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 (not w3-honor-stylesheets))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 :style toggle :selected w3-honor-stylesheets]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 ["Honor Color Requests" (setq w3-user-colors-take-precedence
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 (not w3-user-colors-take-precedence))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 :style toggle :selected (not w3-user-colors-take-precedence)]
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
375 "---"
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
376 ["Reload Stylesheets" w3-refresh-stylesheets t]
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 "W3 menu style list.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 (defconst w3-menu-buffer-menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 (if w3-running-xemacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 '("Buffers"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 :filter buffers-menu-filter
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 ["List All Buffers" list-buffers t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 "--!here")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 "W3 menu buffer list.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
389 (defconst w3-menu-search-menu
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
390 (list
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
391 "Search"
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
392 ["Yahoo!" (w3-fetch "http://www.yahoo.com/") t]
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
393 ["Excite" (w3-fetch "http://www.excite.com/") t]
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
394 ["AltaVista" (w3-fetch "http://www.altavista.digital.com/") t]
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
395 "---"
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
396 )
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
397 "W3 search menu")
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
398
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 (defconst w3-menu-emacs-button
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 (vector
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 (if w3-running-xemacs "XEmacs" "Emacs") 'w3-menu-toggle-menubar t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 (defconst w3-menu-help-menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 "Help"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 ["About Emacs-w3" (w3-fetch "about:") t]
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
407 ["Manual" (w3-fetch (concat w3-documentation-root "docs/w3_toc.html")) t]
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 "---"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 ["Version Information..."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 (w3-fetch
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
411 (concat w3-documentation-root "help/version_" w3-version-number ".html"))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 t]
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
413 ["On FAQ" (w3-fetch (concat w3-documentation-root "help/FAQ.html")) t]
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 "---"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 ["Mail Developer(s)" w3-submit-bug t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 "W3 menu help list.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 (defvar w3-mode-menu-map nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 (defun w3-menu-initialize-w3-mode-menu-map ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 (if (null w3-mode-menu-map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 (let ((map (make-sparse-keymap))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 (dummy (make-sparse-keymap)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 (require 'easymenu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 ;; initialize all the w3-menu-fsfemacs-*-menu variables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 ;; with the menus.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 (easy-menu-define w3-menu-fsfemacs-bookmark-menu (list dummy) nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 w3-menu-bookmark-menu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430 (easy-menu-define w3-menu-fsfemacs-debug-menu (list dummy) nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431 w3-menu-debug-menu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 (easy-menu-define w3-menu-fsfemacs-edit-menu (list dummy) nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 w3-menu-edit-menu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 (easy-menu-define w3-menu-fsfemacs-file-menu (list dummy) nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 w3-menu-file-menu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 (easy-menu-define w3-menu-fsfemacs-go-menu (list dummy) nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437 w3-menu-go-menu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438 (easy-menu-define w3-menu-fsfemacs-help-menu (list dummy) nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439 w3-menu-help-menu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440 (easy-menu-define w3-menu-fsfemacs-view-menu (list dummy) nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441 w3-menu-view-menu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 (easy-menu-define w3-menu-fsfemacs-options-menu (list dummy) nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443 w3-menu-options-menu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 (easy-menu-define w3-menu-fsfemacs-style-menu (list dummy) nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445 w3-menu-style-menu)
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
446 (easy-menu-define w3-menu-fsfemacs-search-menu (list dummy) nil
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
447 w3-menu-search-menu)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 ;; block the global menubar entries in the map so that W3
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450 ;; can take over the menubar if necessary.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 (define-key map [rootmenu] (make-sparse-keymap))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452 (define-key map [rootmenu w3] (cons "W3" (make-sparse-keymap "W3")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 (define-key map [rootmenu w3 file] 'undefined)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454 (define-key map [rootmenu w3 files] 'undefined)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455 (define-key map [rootmenu w3 search] 'undefined)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 (define-key map [rootmenu w3 edit] 'undefined)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 (define-key map [rootmenu w3 options] 'undefined)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458 (define-key map [rootmenu w3 buffer] 'undefined)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459 (define-key map [rootmenu w3 tools] 'undefined)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460 (define-key map [rootmenu w3 help] 'undefined)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461 (define-key map [rootmenu w3 help-menu] 'undefined)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462 ;; now build W3's menu tree.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463 (let ((menu-alist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464 '(
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465 (bookmark
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466 (cons "Bookmark" w3-menu-fsfemacs-bookmark-menu))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467 (debug
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468 (cons "Debug" w3-menu-fsfemacs-debug-menu))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469 (edit
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470 (cons "Edit" w3-menu-fsfemacs-edit-menu))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 (file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 (cons "File" w3-menu-fsfemacs-file-menu))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473 (go
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474 (cons "Go" w3-menu-fsfemacs-go-menu))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475 (help
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 (cons "Help" w3-menu-fsfemacs-help-menu))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477 (options
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 (cons "Options" w3-menu-fsfemacs-options-menu))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 (view
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480 (cons "View" w3-menu-fsfemacs-view-menu))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481 (style
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 (cons "Style" w3-menu-fsfemacs-style-menu))
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
483 (search
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
484 (cons "Search" w3-menu-fsfemacs-search-menu))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 (emacs
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
486 ;; FIXME!!! Currently, win32 doesn't support buttons
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
487 ;; in menubars, so we hack around it and ignore the
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
488 ;; 'emacs keyword on that platform. REMOVE THIS CODE
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
489 ;; as soon as that is fixed. 19.35 timeframe?
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
490 (if (eq (device-type) 'win32)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
491 nil
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
492 (cons "[Emacs]" 'w3-menu-toggle-menubar)))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493 cons
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 (vec (vector 'rootmenu 'w3 nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 ;; menus appear in the opposite order that we
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 ;; define-key them.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 (menu-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498 (if (consp w3-use-menus)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499 (reverse w3-use-menus)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 (list 'help nil 'emacs 'buffers 'options 'bookmark
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 'go 'view 'edit 'file))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 (while menu-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 (if (null (car menu-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 nil;; no flushright support in FSF Emacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 (aset vec 2 (intern (concat "w3-menu-fsfemacs-"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506 (symbol-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 (car menu-list)) "-menu")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 (setq cons (assq (car menu-list) menu-alist))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509 (if cons
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510 (define-key map vec (eval (car (cdr cons))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511 (setq menu-list (cdr menu-list))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512 (setq w3-mode-menu-map map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513 (run-hooks 'w3-menu-setup-hook))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515 (defun w3-menu-make-xemacs-menubar ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516 (let ((menu-alist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517 '((bookmark . w3-menu-bookmark-menu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518 (style . w3-menu-style-menu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519 (buffer . w3-menu-buffer-menu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520 (debug . w3-menu-debug-menu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521 (edit . w3-menu-edit-menu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522 (emacs . w3-menu-emacs-button)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523 (file . w3-menu-file-menu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524 (go . w3-menu-go-menu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525 (help . w3-menu-help-menu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526 (options . w3-menu-options-menu)
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
527 (search . w3-menu-search-menu)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528 (view . w3-menu-view-menu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 cons
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532 (menubar nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533 (menu-list w3-use-menus))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534 (while menu-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535 (if (null (car menu-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536 (setq menubar (cons nil menubar))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537 (setq cons (assq (car menu-list) menu-alist))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538 (if cons
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539 (setq menubar (cons (symbol-value (cdr cons)) menubar))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540 (setq menu-list (cdr menu-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541 (nreverse menubar)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543 (defun w3-menu-install-menubar ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545 (w3-running-xemacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546 (if (not (featurep 'menubar))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547 nil ; No menus available
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548 (setq w3-menu-w3-menubar (w3-menu-make-xemacs-menubar))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 (set-buffer-menubar w3-menu-w3-menubar)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550 ((not (fboundp 'vm-menu-undo-menu))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551 (w3-menu-initialize-w3-mode-menu-map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552 (define-key w3-mode-map [menu-bar]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553 (lookup-key w3-mode-menu-map [rootmenu w3])))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
554
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
555 (defun w3-menu-install-menubar-item ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
556 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
557 (w3-running-xemacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
558 (if (not (featurep 'menubar))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
559 nil ; No menus available
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560 (set-buffer-menubar (copy-sequence (w3-menu-global-menubar)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
561 (add-menu nil "W3" (cdr w3-menu-w3-menubar))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
562 ((not (fboundp 'w3-menu-fsfemacs-edit-menu))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
563 (w3-menu-initialize-w3-mode-menu-map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
564 (define-key w3-mode-map [menu-bar]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565 (lookup-key w3-mode-menu-map [rootmenu])))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567 (defun w3-menu-install-menus ()
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
568 (cond ((= emacs-minor-version 28) ; Hey, get with the times people!!
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
569 nil)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
570 ((consp w3-use-menus)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571 (w3-menu-install-menubar))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572 ((eq w3-use-menus 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
573 (w3-menu-install-menubar-item))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574 (t nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
575
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
576 (defun w3-menu-set-menubar-dirty-flag ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577 (cond (w3-running-xemacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
578 (set-menubar-dirty-flag))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
580 (force-mode-line-update))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
581
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
582 (defun w3-menu-toggle-menubar ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
583 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
584 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
585 ;;((eq w3-use-menus 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
586 ;;nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
587 (w3-running-xemacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
588 (if (null (car (find-menu-item current-menubar '("XEmacs"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
589 (set-buffer-menubar w3-menu-w3-menubar)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
590 (set-buffer-menubar (copy-sequence (w3-menu-global-menubar)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
591 (condition-case ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
592 (add-menu-button nil ["W3" w3-menu-toggle-menubar t] nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
593 (void-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
594 (add-menu-item nil "W3" 'w3-menu-toggle-menubar t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
595 (w3-menu-set-menubar-dirty-flag))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
596 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
597 (if (not (eq (lookup-key w3-mode-map [menu-bar])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
598 (lookup-key w3-mode-menu-map [rootmenu w3])))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
599 (define-key w3-mode-map [menu-bar]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
600 (lookup-key w3-mode-menu-map [rootmenu w3]))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
601 (define-key w3-mode-map [menu-bar]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
602 (make-sparse-keymap))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
603 (define-key w3-mode-map [menu-bar w3]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
604 (cons "[W3]" 'w3-menu-toggle-menubar)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
605 (w3-menu-set-menubar-dirty-flag))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
606
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
607 (defun w3-menu-save-options ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
608 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
609 (let ((output-buffer (find-file-noselect w3-default-configuration-file))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
610 output-marker)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
611 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
612 (set-buffer output-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
613 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
614 ;; Find and delete the previously saved data, and position to write.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
615 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
616 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
617 (if (re-search-forward "^;; W3 Options Settings *\n" nil 'move)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
618 (let ((p (match-beginning 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
619 (goto-char p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
620 (or (re-search-forward
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
621 "^;; End of W3 Options Settings *\\(\n\\|\\'\\)"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
622 nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
623 (error "can't find END of saved state in .emacs"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
624 (delete-region p (match-end 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
625 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
626 (insert "\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
627 (setq output-marker (point-marker))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
628 (let ((print-readably t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
629 (print-escape-newlines t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
630 (standard-output output-marker))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
631 (princ ";; W3 Options Settings\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
632 (princ ";; ===================\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
633 (mapcar (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
634 (lambda (var)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
635 (princ " ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
636 (if (and (symbolp var) (boundp var))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
637 (prin1 (list 'setq-default var
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
638 (let ((val (symbol-value var)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
639 (if (or (memq val '(t nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
640 (and (not (symbolp val))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
641 (not (listp val))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
642 val
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
643 (list 'quote val))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
644 (if var (princ "\n"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
645 '(
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
646 ps-print-color-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
647 url-automatic-caching
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
648 url-be-asynchronous
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
649 url-honor-refresh-requests
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
650 url-privacy-level
32
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
651 url-cookie-confirmation
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
652 url-proxy-services
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
653 url-standalone-mode
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
654 url-use-hypertext-gopher
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
655 w3-default-homepage
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
656 w3-default-stylesheet
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
657 w3-delay-image-loads
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
658 w3-do-incremental-display
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
659 w3-dump-to-disk
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
660 w3-honor-stylesheets
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
661 w3-image-mappings
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
662 w3-load-hook
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
663 w3-mode-hook
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
664 w3-netscape-compatible-comments
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
665 w3-preferences-cancel-hook
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
666 w3-preferences-default-hook
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
667 w3-preferences-ok-hook
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
668 w3-preferences-setup-hook
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
669 w3-source-file-hook
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
670 w3-toolbar-orientation
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
671 w3-toolbar-type
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
672 w3-use-menus
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
673 w3-user-colors-take-precedence
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
674 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
675 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
676 (princ ";; ==========================\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
677 (princ ";; End of W3 Options Settings\n")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
678 (set-marker output-marker nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
679 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
680 (set-buffer output-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
681 (save-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
682 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
683
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
684 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
685 ;;; Context-sensitive popup menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
686 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
687 (if (not (fboundp 'event-glyph))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
688 (fset 'event-glyph 'ignore))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
689
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
690 (defun w3-popup-menu (e)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
691 "Pop up a menu of common w3 commands"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
692 (interactive "e")
36
c53a95d3c46d Import from CVS: tag r19-15b101
cvs
parents: 32
diff changeset
693 (if (not w3-popup-menu-on-mouse-3)
c53a95d3c46d Import from CVS: tag r19-15b101
cvs
parents: 32
diff changeset
694 (call-interactively (lookup-key global-map (vector w3-mouse-button3)))
c53a95d3c46d Import from CVS: tag r19-15b101
cvs
parents: 32
diff changeset
695 (mouse-set-point e)
c53a95d3c46d Import from CVS: tag r19-15b101
cvs
parents: 32
diff changeset
696 (let* ((glyph (event-glyph e))
c53a95d3c46d Import from CVS: tag r19-15b101
cvs
parents: 32
diff changeset
697 (widget (or (and glyph (glyph-property glyph 'widget))
c53a95d3c46d Import from CVS: tag r19-15b101
cvs
parents: 32
diff changeset
698 (widget-at (point))))
c53a95d3c46d Import from CVS: tag r19-15b101
cvs
parents: 32
diff changeset
699 (parent (and widget (widget-get widget :parent)))
c53a95d3c46d Import from CVS: tag r19-15b101
cvs
parents: 32
diff changeset
700 (href (or (and widget (widget-get widget 'href))
c53a95d3c46d Import from CVS: tag r19-15b101
cvs
parents: 32
diff changeset
701 (and parent (widget-get parent 'href))))
c53a95d3c46d Import from CVS: tag r19-15b101
cvs
parents: 32
diff changeset
702 (imag (or (and widget (widget-get widget 'src))
c53a95d3c46d Import from CVS: tag r19-15b101
cvs
parents: 32
diff changeset
703 (and parent (widget-get parent 'src))))
c53a95d3c46d Import from CVS: tag r19-15b101
cvs
parents: 32
diff changeset
704 (menu (copy-tree w3-popup-menu))
c53a95d3c46d Import from CVS: tag r19-15b101
cvs
parents: 32
diff changeset
705 url val trunc-url)
c53a95d3c46d Import from CVS: tag r19-15b101
cvs
parents: 32
diff changeset
706 (if href
c53a95d3c46d Import from CVS: tag r19-15b101
cvs
parents: 32
diff changeset
707 (progn
c53a95d3c46d Import from CVS: tag r19-15b101
cvs
parents: 32
diff changeset
708 (setq url href)
c53a95d3c46d Import from CVS: tag r19-15b101
cvs
parents: 32
diff changeset
709 (if url (setq trunc-url (url-truncate-url-for-viewing
c53a95d3c46d Import from CVS: tag r19-15b101
cvs
parents: 32
diff changeset
710 url
c53a95d3c46d Import from CVS: tag r19-15b101
cvs
parents: 32
diff changeset
711 w3-max-menu-width)))
c53a95d3c46d Import from CVS: tag r19-15b101
cvs
parents: 32
diff changeset
712 (setcdr menu (append (cdr menu)
c53a95d3c46d Import from CVS: tag r19-15b101
cvs
parents: 32
diff changeset
713 '("---")
c53a95d3c46d Import from CVS: tag r19-15b101
cvs
parents: 32
diff changeset
714 (mapcar
c53a95d3c46d Import from CVS: tag r19-15b101
cvs
parents: 32
diff changeset
715 (function
c53a95d3c46d Import from CVS: tag r19-15b101
cvs
parents: 32
diff changeset
716 (lambda (x)
c53a95d3c46d Import from CVS: tag r19-15b101
cvs
parents: 32
diff changeset
717 (vector (format (car x) trunc-url)
c53a95d3c46d Import from CVS: tag r19-15b101
cvs
parents: 32
diff changeset
718 (list (cdr x) url) t)))
c53a95d3c46d Import from CVS: tag r19-15b101
cvs
parents: 32
diff changeset
719 w3-hyperlink-menu)))))
c53a95d3c46d Import from CVS: tag r19-15b101
cvs
parents: 32
diff changeset
720 (if imag
c53a95d3c46d Import from CVS: tag r19-15b101
cvs
parents: 32
diff changeset
721 (progn
c53a95d3c46d Import from CVS: tag r19-15b101
cvs
parents: 32
diff changeset
722 (setq url imag
c53a95d3c46d Import from CVS: tag r19-15b101
cvs
parents: 32
diff changeset
723 trunc-url (url-truncate-url-for-viewing url
c53a95d3c46d Import from CVS: tag r19-15b101
cvs
parents: 32
diff changeset
724 w3-max-menu-width))
c53a95d3c46d Import from CVS: tag r19-15b101
cvs
parents: 32
diff changeset
725 (setcdr menu (append (cdr menu)
c53a95d3c46d Import from CVS: tag r19-15b101
cvs
parents: 32
diff changeset
726 '("---")
c53a95d3c46d Import from CVS: tag r19-15b101
cvs
parents: 32
diff changeset
727 (mapcar
c53a95d3c46d Import from CVS: tag r19-15b101
cvs
parents: 32
diff changeset
728 (function
c53a95d3c46d Import from CVS: tag r19-15b101
cvs
parents: 32
diff changeset
729 (lambda (x)
c53a95d3c46d Import from CVS: tag r19-15b101
cvs
parents: 32
diff changeset
730 (vector (format (car x) trunc-url)
c53a95d3c46d Import from CVS: tag r19-15b101
cvs
parents: 32
diff changeset
731 (list (cdr x) url) t)))
c53a95d3c46d Import from CVS: tag r19-15b101
cvs
parents: 32
diff changeset
732 w3-graphlink-menu)))))
c53a95d3c46d Import from CVS: tag r19-15b101
cvs
parents: 32
diff changeset
733 (if (not (w3-menubar-active))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
734 (setcdr menu (append (cdr menu)
36
c53a95d3c46d Import from CVS: tag r19-15b101
cvs
parents: 32
diff changeset
735 '("---" ["Show Menubar" w3-toggle-menubar t]))))
c53a95d3c46d Import from CVS: tag r19-15b101
cvs
parents: 32
diff changeset
736 (popup-menu menu))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
737
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
738 (provide 'w3-menu)