annotate lisp/w3/w3-menu.el @ 110:fe104dbd9147 r20-1b7

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