annotate lisp/w3/w3-prefs.el @ 14:9ee227acff29 r19-15b90

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