annotate lisp/w3/w3-prefs.el @ 30:ec9a17fef872 r19-15b98

Import from CVS: tag r19-15b98
author cvs
date Mon, 13 Aug 2007 08:52:29 +0200
parents 0293115a14e9
children e04119814345
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-prefs.el --- Preferences panels for Emacs-W3
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 ;; Author: wmperry
30
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 16
diff changeset
3 ;; Created: 1997/03/04 14:33:41
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 16
diff changeset
4 ;; Version: 1.16
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;; Keywords: hypermedia, preferences
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 ;;;
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
11 ;;; This file is part of GNU Emacs.
0
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 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 ;;; Preferences panels for Emacs-W3
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 (require 'w3-vars)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 (require 'w3-keyword)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
34 (require 'w3-toolbar)
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
35 (eval-and-compile
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
36 (require 'w3-widget))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 (defvar w3-preferences-panel-begin-marker nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 (defvar w3-preferences-panel-end-marker nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 (defvar w3-preferences-panels '(
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 (appearance . "Appearance")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 (images . "Images")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 (cookies . "HTTP Cookies")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 (hooks . "Various Hooks")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 (compatibility . "Compatibility")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 (proxy . "Proxy")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 (defun w3-preferences-generic-variable-callback (widget &rest ignore)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 (condition-case ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 (set (widget-get widget 'variable) (widget-value widget))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 (error (message "Invalid or incomplete data..."))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 (defun w3-preferences-restore-variables (vars)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 (let ((temp nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 (while vars
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 (setq temp (intern (format "w3-preferences-temp-%s" (car vars))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 (set (car vars) (symbol-value temp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 (setq vars (cdr vars)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 (defun w3-preferences-create-temp-variables (vars)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 (let ((temp nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 (while vars
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 (setq temp (intern (format "w3-preferences-temp-%s" (car vars))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 (set (make-local-variable temp) (symbol-value (car vars)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 (setq vars (cdr vars)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 ;;; Appearance of the frame / pages
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 (defun w3-preferences-init-appearance-panel ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 (let ((vars '(w3-toolbar-orientation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 w3-use-menus
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 w3-honor-stylesheets
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 w3-default-stylesheet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 w3-default-homepage
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 w3-toolbar-type))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 (temp nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 (set (make-local-variable 'w3-preferences-temp-use-home-page)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 (and w3-default-homepage t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 (w3-preferences-create-temp-variables vars)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 (defun w3-preferences-create-appearance-panel ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 ;; First the toolbars
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 (widget-insert "\nToolbars\n--------\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 (widget-insert "\tShow Toolbars as:\t")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 (widget-put
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 (widget-create 'radio
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 :value (symbol-value 'w3-preferences-temp-w3-toolbar-type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 :notify 'w3-preferences-generic-variable-callback
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
91 :format "%v"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 (list 'item :format "%t\t" :tag "Pictures" :value 'pictures)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 (list 'item :format "%t\t" :tag "Text" :value 'text)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 (list 'item :format "%t" :tag "Both" :value 'both))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 'variable 'w3-preferences-temp-w3-toolbar-type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 (widget-insert "\n\tToolbars appear on ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 (widget-put
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 (widget-create 'choice
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 :value (symbol-value 'w3-preferences-temp-w3-toolbar-orientation)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 :notify 'w3-preferences-generic-variable-callback
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 :format "%v"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 :tag "Toolbar Position"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 (list 'choice-item :format "%[%t%]" :tag "XEmacs Default" :value 'default)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 (list 'choice-item :format "%[%t%]" :tag "Top" :value 'top)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 (list 'choice-item :format "%[%t%]" :tag "Bottom" :value 'bottom)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 (list 'choice-item :format "%[%t%]" :tag "Right" :value 'right)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 (list 'choice-item :format "%[%t%]" :tag "Left" :value 'left)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 (list 'choice-item :format "%[%t%]" :tag "No Toolbar" :value 'none))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 'variable 'w3-preferences-temp-w3-toolbar-orientation)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 (widget-insert " side of window.\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 ;; Home page
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 (widget-insert "\nStartup\n--------\n\tBrowser starts with:\t")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 (widget-put
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 (widget-create
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 'radio
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
117 :format "%v"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 :value (symbol-value 'w3-preferences-temp-use-home-page)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 :notify 'w3-preferences-generic-variable-callback
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 (list 'item :format "%t\t" :tag "Blank Page" :value nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 (list 'item :format "%t" :tag "Home Page Location" :value t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 'variable 'w3-preferences-temp-use-home-page)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 (widget-insert "\n\t\tURL: ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 (widget-put
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 (widget-create
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
126 'editable-field
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 :value (or (symbol-value 'w3-preferences-temp-w3-default-homepage) "None")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 :notify 'w3-preferences-generic-variable-callback)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 'variable 'w3-preferences-temp-w3-default-homepage)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 ;; Stylesheet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 (widget-insert "\nStyle\n--------\n\tDefault stylesheet:\t")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 (widget-put
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 (widget-create
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 'file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 :value (or (symbol-value 'w3-preferences-temp-w3-default-stylesheet) "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 :must-match t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 :notify 'w3-preferences-generic-variable-callback)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 'variable 'w3-preferences-temp-w3-default-stylesheet)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 (widget-setup)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 (defun w3-preferences-save-appearance-panel ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 (let ((vars '(w3-toolbar-orientation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 w3-use-menus
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 w3-honor-stylesheets
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 w3-default-stylesheet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 w3-toolbar-type))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 (temp nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 (if (symbol-value 'w3-preferences-temp-use-home-page)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 (setq vars (cons 'w3-default-homepage vars))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 (setq w3-default-homepage nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 (w3-preferences-restore-variables vars)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 (w3-toolbar-make-buttons)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 ;;; The images panel
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 (defun w3-preferences-init-images-panel ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 (let ((vars '(w3-delay-image-loads
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 w3-image-mappings)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 (w3-preferences-create-temp-variables vars)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 (defun w3-preferences-create-images-panel ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 (widget-insert "\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 (widget-put
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 (widget-create
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 'checkbox
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 :notify 'w3-preferences-generic-variable-callback
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 :value (symbol-value 'w3-preferences-temp-w3-delay-image-loads))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 'variable 'w3-preferences-temp-w3-delay-image-loads)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 (widget-insert " Delay Image Loads\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 (defun w3-preferences-save-images-panel ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 (let ((vars '(w3-delay-image-loads
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 w3-image-mappings)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 (w3-preferences-restore-variables vars)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 ;;; The cookies panel
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 (defun w3-preferences-init-cookies-panel ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 (let ((cookies url-cookie-storage)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 (secure-cookies url-cookie-secure-storage))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 (defun w3-preferences-create-cookies-panel ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 (widget-insert "\n\t\tSorry, not yet implemented.\n\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 (defun w3-preferences-save-cookies-panel ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 ;;; The hooks panel
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 (defvar w3-preferences-hooks-variables
30
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 16
diff changeset
201 '(w3-load-hook
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 w3-mode-hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 w3-preferences-cancel-hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 w3-preferences-default-hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 w3-preferences-ok-hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 w3-preferences-setup-hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 w3-source-file-hook))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 (defun w3-preferences-init-hooks-panel ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 (w3-preferences-create-temp-variables w3-preferences-hooks-variables))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 (defun w3-preferences-create-hooks-panel ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 (let ((todo w3-preferences-hooks-variables)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 (cur nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 (pt nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 (doc nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 (widget-insert "\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 (while todo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 (setq cur (car todo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 todo (cdr todo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 doc (get cur 'variable-documentation))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 (if (string-match "^\\*" doc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 (setq doc (substring doc 1 nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 (setq pt (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 (widget-insert "\n" (symbol-name cur) " - " doc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 (fill-region-as-paragraph pt (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 (setq cur (intern (format "w3-preferences-temp-%s" cur)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 (widget-put
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 (widget-create
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 'sexp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 :notify 'w3-preferences-generic-variable-callback
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 :value (or (symbol-value cur) "nil"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 'variable cur))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 (widget-setup)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 (defun w3-preferences-save-hooks-panel ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 (w3-preferences-restore-variables w3-preferences-hooks-variables))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 ;;; The compatibility panel
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 (defvar w3-preferences-compatibility-variables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 '(
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 (w3-netscape-compatible-comments
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 . "Allow Netscape compatible comments")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 (w3-user-colors-take-precedence
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 . "Ignore netscape document color control")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 (url-honor-refresh-requests
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 . "Allow Netscape `Client Pull'"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 "A list of variables that the preferences compability pane knows about.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 (defun w3-preferences-init-compatibility-panel ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 (let ((compat w3-preferences-compatibility-variables)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 (cur nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 (var nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 (w3-preferences-create-temp-variables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 (mapcar 'car w3-preferences-compatibility-variables))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 (defun w3-preferences-create-compatibility-panel ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 (let ((compat w3-preferences-compatibility-variables)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 (cur nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 (var nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 (widget-insert "\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 (while compat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 (setq cur (car compat)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 compat (cdr compat)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 var (intern (format "w3-preferences-temp-%s" (car cur))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 (widget-put
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 (widget-create 'checkbox
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 :notify 'w3-preferences-generic-variable-callback
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 :value (symbol-value var))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 'variable var)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 (widget-insert " " (cdr cur) "\n\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 (widget-setup)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 (defun w3-preferences-save-compatibility-panel ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 (w3-preferences-restore-variables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 (mapcar 'car w3-preferences-compatibility-variables)))
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 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 ;;; The proxy configuration panel
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 (defun w3-preferences-init-proxy-panel ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 (let ((proxies '("FTP" "Gopher" "HTTP" "Security" "WAIS" "SHTTP" "News"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 (proxy nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 (host-var nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 (port-var nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 (urlobj nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 (widget-insert "\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 (while proxies
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 (setq proxy (car proxies)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 proxies (cdr proxies)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 host-var (intern (format "w3-%s-proxy-host" (downcase proxy)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 port-var (intern (format "w3-%s-proxy-port" (downcase proxy)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 urlobj (url-generic-parse-url
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 (cdr-safe
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 (assoc (downcase proxy) url-proxy-services))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 (set (make-local-variable host-var) (or (url-host urlobj) ""))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 (set (make-local-variable port-var) (or (url-port urlobj) "")))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 (defun w3-preferences-create-proxy-panel ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 (let ((proxies '("FTP" "Gopher" "HTTP" "Security" "WAIS" "SHTTP" "News"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 (proxy nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 (host-var nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 (port-var nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 (urlobj nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 (widget-insert "\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 (while proxies
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 (setq proxy (car proxies)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 proxies (cdr proxies)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 host-var (intern (format "w3-%s-proxy-host" (downcase proxy)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 port-var (intern (format "w3-%s-proxy-port" (downcase proxy))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 (widget-insert (format "%10s Proxy: " proxy))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 (widget-put
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
317 (widget-create 'editable-field
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 :size 20
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 :value-face 'underline
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 :notify 'w3-preferences-generic-variable-callback
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 :value (format "%-20s" (symbol-value host-var)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 'variable host-var)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 (widget-insert " Port: ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 (widget-put
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
325 (widget-create 'editable-field
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 :size 5
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 :value-face 'underline
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 :notify 'w3-preferences-generic-variable-callback
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 :value (format "%5s" (symbol-value port-var)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 'variable port-var)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 (widget-insert "\n\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 (widget-setup)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 (defun w3-preferences-save-proxy-panel ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 (let ((proxies '("FTP" "Gopher" "HTTP" "Security" "WAIS" "SHTTP" "News"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 (proxy nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 (host-var nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 (port-var nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 (urlobj nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 (host nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 (port nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 (new-proxy-services nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 (while proxies
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 (setq proxy (car proxies)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 proxies (cdr proxies)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 host-var (intern (format "w3-%s-proxy-host" (downcase proxy)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 port-var (intern (format "w3-%s-proxy-port" (downcase proxy)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 urlobj (url-generic-parse-url
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 (cdr-safe
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 (assoc (downcase proxy) url-proxy-services)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 host (symbol-value host-var)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 port (symbol-value port-var))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 (if (and host (/= 0 (length host)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 (setq new-proxy-services (cons (cons (downcase proxy)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 (format "http://%s:%s/" host
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 (or port "80")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 new-proxy-services))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 (setq url-proxy-services new-proxy-services)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 (defun w3-preferences-create-panel (panel)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 (let ((func (intern (format "w3-preferences-create-%s-panel" panel)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 (inhibit-read-only t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 (goto-char w3-preferences-panel-begin-marker)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 (delete-region w3-preferences-panel-begin-marker
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 w3-preferences-panel-end-marker)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 (set-marker-insertion-type w3-preferences-panel-end-marker t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 (if (fboundp func)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 (funcall func)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 (insert (format "You should be seeing %s right now.\n" panel))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 (set-marker-insertion-type w3-preferences-panel-end-marker nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 (set-marker w3-preferences-panel-end-marker (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 (goto-char w3-preferences-panel-begin-marker)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 (condition-case ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 (widget-forward 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 (error nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 (defun w3-preferences-notify (widget widget-ignore &optional event)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 (let* ((glyph (and event w3-running-xemacs (event-glyph event)))
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
382 (x (and glyph (widget-glyphp glyph) (event-glyph-x-pixel event)))
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
383 (y (and glyph (widget-glyphp glyph) (event-glyph-y-pixel event)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 (map (widget-get widget 'usemap))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 (value (widget-value widget)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 (if (and map x y)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 (setq value (w3-point-in-map (vector x y) map)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 (if value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 (w3-preferences-create-panel value))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 (defun w3-preferences-save-options ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 (w3-menu-save-options))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 (defun w3-preferences-ok-callback (widget &rest ignore)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 (let ((panels w3-preferences-panels)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 (buffer (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 (func nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 (run-hooks 'w3-preferences-ok-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 (while panels
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 (setq func (intern
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 (format "w3-preferences-save-%s-panel" (caar panels)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 panels (cdr panels))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 (if (fboundp func)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 (funcall func)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 (w3-preferences-save-options)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 (message "Options saved")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407 (sit-for 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 (kill-buffer (current-buffer))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 (defun w3-preferences-reset-all-panels ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 (let ((panels w3-preferences-panels)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 (func nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 (while panels
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 (setq func (intern (format "w3-preferences-init-%s-panel"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 (caar panels)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 panels (cdr panels))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 (if (and func (fboundp func))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 (funcall func)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 (defun w3-preferences-cancel-callback (widget &rest ignore)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 (if (not (funcall url-confirmation-func "Cancel and lose all changes? "))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 (error "Not cancelled!"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 (w3-preferences-reset-all-panels)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 (kill-buffer (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 (run-hooks 'w3-preferences-cancel-hook))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 (defun w3-preferences-reset-callback (widget &rest ignore)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 (w3-preferences-reset-all-panels)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 (run-hooks 'w3-preferences-default-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430 (w3-preferences-create-panel (caar w3-preferences-panels)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 (defvar w3-preferences-setup-hook nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 "*Hooks to be run before setting up the preferences buffer.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 (defvar w3-preferences-cancel-hook nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 "*Hooks to be run when cancelling the preferences (Cancel was chosen).")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438 (defvar w3-preferences-default-hook nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439 "*Hooks to be run when resetting preference defaults (Defaults was chosen).")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441 (defvar w3-preferences-ok-hook nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 "*Hooks to be run before saving the preferences (OK was chosen).")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 (defun w3-preferences-init-all-panels ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445 (let ((todo w3-preferences-panels)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446 (func nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447 (while todo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 (setq func (intern (format "w3-preferences-init-%s-panel" (caar todo)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 todo (cdr todo))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450 (and (fboundp func) (funcall func)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
452 ;;###autoload
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 (defun w3-preferences-edit ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455 (let* ((prefs-buffer (get-buffer-create "W3 Preferences"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 (widget nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 (inhibit-read-only t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458 (window-conf (current-window-configuration)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459 (delete-other-windows)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460 (set-buffer prefs-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461 (w3-preferences-init-all-panels)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462 (set-window-buffer (selected-window) prefs-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463 (make-local-variable 'widget-field-face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464 (setq w3-preferences-panel-begin-marker (make-marker)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465 w3-preferences-panel-end-marker (make-marker))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466 (set-marker-insertion-type w3-preferences-panel-begin-marker nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467 (set-marker-insertion-type w3-preferences-panel-end-marker t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468 (use-local-map widget-keymap)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470 (run-hooks 'w3-preferences-setup-hook)
30
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 16
diff changeset
471 (setq widget (apply 'widget-create 'menu-choice
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 16
diff changeset
472 :tag "Panel"
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 16
diff changeset
473 :notify 'w3-preferences-notify
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 16
diff changeset
474 :value 'appearance
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 16
diff changeset
475 (mapcar
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 16
diff changeset
476 (function
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 16
diff changeset
477 (lambda (x)
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 16
diff changeset
478 (list 'choice-item
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 16
diff changeset
479 :format "%[%t%]"
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 16
diff changeset
480 :tag (cdr x)
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 16
diff changeset
481 :value (car x))))
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 16
diff changeset
482 w3-preferences-panels)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 (insert "\n\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 (set-marker w3-preferences-panel-begin-marker (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 (set-marker w3-preferences-panel-end-marker (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 (w3-preferences-create-panel (caar w3-preferences-panels))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 (widget-insert "\n\n")
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
490 (widget-create 'push-button
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 :notify 'w3-preferences-ok-callback
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 :value "Ok")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493 (widget-insert " ")
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
494 (widget-create 'push-button
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 :notify 'w3-preferences-cancel-callback
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 :value "Cancel")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 (widget-insert " ")
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
498 (widget-create 'push-button
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499 :notify 'w3-preferences-reset-callback
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 :value "Reset")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 (center-region (point-min) w3-preferences-panel-begin-marker)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 (center-region w3-preferences-panel-end-marker (point-max))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 (provide 'w3-prefs)