annotate lisp/w3/w3-prefs.el @ 102:a145efe76779 r20-1b3

Import from CVS: tag r20-1b3
author cvs
date Mon, 13 Aug 2007 09:15:49 +0200
parents 6a378aca36af
children 360340f9fd5f
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
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
3 ;; Created: 1997/01/17 04:34:13
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
4 ;; Version: 1.15
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)
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
9 ;;; Copyright (c) 1996, 1997 Free Software Foundation, Inc.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;;;
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
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
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
24 ;;; along with GNU Emacs; see the file COPYING. If not, write to the
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
25 ;;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
26 ;;; Boston, MA 02111-1307, USA.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
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)
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
35 (eval-and-compile
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
36 (require 'w3-widget))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
38 (defvar w3-preferences-glyph nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
39 (defvar w3-preferences-map nil)
0
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")
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
48 (proxy . "Proxy")))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
49
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
50 (defun w3-preferences-setup-glyph-map ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
51 (let* ((x 0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
52 (height (and w3-preferences-glyph
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
53 (glyph-height w3-preferences-glyph)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
54 (width (and height (/ (glyph-width w3-preferences-glyph)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
55 (length w3-preferences-panels)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
56 (mapcar
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
57 (function
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
58 (lambda (region)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
59 (vector "rect" (list (vector (if width (* x width) 0) 0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
60 (vector (if width (* (setq x (1+ x)) width) 0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
61 (or height 0)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
62 (car region) (cdr region))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
63 w3-preferences-panels)))
0
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
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
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
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
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
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
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"
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
191 ;;; "\nAllowed Image Types\n"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
192 ;;; "-------------------\n")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
193 ;;; (set
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
194 ;;; (make-local-variable 'w3-preferences-image-type-widget)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
195 ;;; (widget-create
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
196 ;;; 'repeat
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
197 ;;; :entry-format "%i %d %v"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
198 ;;; :value (mapcar
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
199 ;;; (function
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
200 ;;; (lambda (x)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
201 ;;; (list 'item :format "%t" :tag (car x) :value (cdr x))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
202 ;;; w3-image-mappings)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
203 ;;; '(item :tag "*/*" :value 'unknown)))
0
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
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
231 '(w3-file-done-hook
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
232 w3-file-prepare-hook
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
233 w3-load-hook
0
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)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
253 doc (get cur 'variable-documentation))
0
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 '(
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 (w3-netscape-compatible-comments
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 . "Allow Netscape compatible comments")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 (w3-user-colors-take-precedence
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 . "Ignore netscape document color control")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 (url-honor-refresh-requests
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 . "Allow Netscape `Client Pull'"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 "A list of variables that the preferences compability pane knows about.")
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-compatibility-panel ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 (let ((compat w3-preferences-compatibility-variables)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 (cur nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 (var nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 (w3-preferences-create-temp-variables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 (mapcar 'car w3-preferences-compatibility-variables))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 (defun w3-preferences-create-compatibility-panel ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 (let ((compat w3-preferences-compatibility-variables)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 (cur nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 (var nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 (widget-insert "\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 (while compat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 (setq cur (car compat)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 compat (cdr compat)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 var (intern (format "w3-preferences-temp-%s" (car cur))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 (widget-put
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 (widget-create 'checkbox
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 :notify 'w3-preferences-generic-variable-callback
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 :value (symbol-value var))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 'variable var)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 (widget-insert " " (cdr cur) "\n\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 (widget-setup)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 (defun w3-preferences-save-compatibility-panel ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 (w3-preferences-restore-variables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 (mapcar 'car w3-preferences-compatibility-variables)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 ;;; The proxy configuration panel
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 (defun w3-preferences-init-proxy-panel ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 (let ((proxies '("FTP" "Gopher" "HTTP" "Security" "WAIS" "SHTTP" "News"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 (proxy nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 (host-var nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 (port-var nil)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
322 (urlobj nil))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 (widget-insert "\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 (while proxies
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 (setq proxy (car proxies)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 proxies (cdr proxies)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 host-var (intern (format "w3-%s-proxy-host" (downcase proxy)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 port-var (intern (format "w3-%s-proxy-port" (downcase proxy)))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
329 urlobj (url-generic-parse-url
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
330 (cdr-safe
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
331 (assoc (downcase proxy) url-proxy-services))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
332 (set (make-local-variable host-var) (or (url-host urlobj) ""))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
333 (set (make-local-variable port-var) (or (url-port urlobj) "")))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 (defun w3-preferences-create-proxy-panel ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 (let ((proxies '("FTP" "Gopher" "HTTP" "Security" "WAIS" "SHTTP" "News"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 (proxy nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 (host-var nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 (port-var nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 (urlobj nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 (widget-insert "\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 (while proxies
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 (setq proxy (car proxies)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 proxies (cdr proxies)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 host-var (intern (format "w3-%s-proxy-host" (downcase proxy)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 port-var (intern (format "w3-%s-proxy-port" (downcase proxy))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 (widget-insert (format "%10s Proxy: " proxy))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 (widget-put
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
349 (widget-create 'editable-field
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 :size 20
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 :value-face 'underline
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 :notify 'w3-preferences-generic-variable-callback
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 :value (format "%-20s" (symbol-value host-var)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 'variable host-var)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 (widget-insert " Port: ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 (widget-put
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
357 (widget-create 'editable-field
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 :size 5
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 :value-face 'underline
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 :notify 'w3-preferences-generic-variable-callback
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 :value (format "%5s" (symbol-value port-var)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 'variable port-var)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 (widget-insert "\n\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 (widget-setup)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 (defun w3-preferences-save-proxy-panel ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 (let ((proxies '("FTP" "Gopher" "HTTP" "Security" "WAIS" "SHTTP" "News"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 (proxy nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 (host-var nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 (port-var nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 (urlobj nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 (host nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 (port nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 (new-proxy-services nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 (while proxies
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 (setq proxy (car proxies)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 proxies (cdr proxies)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 host-var (intern (format "w3-%s-proxy-host" (downcase proxy)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 port-var (intern (format "w3-%s-proxy-port" (downcase proxy)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 urlobj (url-generic-parse-url
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 (cdr-safe
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 (assoc (downcase proxy) url-proxy-services)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 host (symbol-value host-var)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 port (symbol-value port-var))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 (if (and host (/= 0 (length host)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 (setq new-proxy-services (cons (cons (downcase proxy)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
387 (format "http://%s:%s/" host
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 (or port "80")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 new-proxy-services))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 (setq url-proxy-services new-proxy-services)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
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 (defun w3-preferences-create-panel (panel)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 (let ((func (intern (format "w3-preferences-create-%s-panel" panel)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 (inhibit-read-only t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 (goto-char w3-preferences-panel-begin-marker)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 (delete-region w3-preferences-panel-begin-marker
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 w3-preferences-panel-end-marker)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 (set-marker-insertion-type w3-preferences-panel-end-marker t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 (if (fboundp func)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 (funcall func)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 (insert (format "You should be seeing %s right now.\n" panel))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 (set-marker-insertion-type w3-preferences-panel-end-marker nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 (set-marker w3-preferences-panel-end-marker (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407 (goto-char w3-preferences-panel-begin-marker)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 (condition-case ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 (widget-forward 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 (error nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 (defun w3-preferences-notify (widget widget-ignore &optional event)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 (let* ((glyph (and event w3-running-xemacs (event-glyph event)))
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
414 (x (and glyph (widget-glyphp glyph) (event-glyph-x-pixel event)))
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
415 (y (and glyph (widget-glyphp glyph) (event-glyph-y-pixel event)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 (map (widget-get widget 'usemap))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 (value (widget-value widget)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 (if (and map x y)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 (setq value (w3-point-in-map (vector x y) map)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 (if value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 (w3-preferences-create-panel value))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 (defun w3-preferences-save-options ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 (w3-menu-save-options))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 (defun w3-preferences-ok-callback (widget &rest ignore)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 (let ((panels w3-preferences-panels)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 (buffer (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 (func nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430 (run-hooks 'w3-preferences-ok-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431 (while panels
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 (setq func (intern
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 (format "w3-preferences-save-%s-panel" (caar panels)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 panels (cdr panels))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 (if (fboundp func)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 (funcall func)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437 (w3-preferences-save-options)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438 (message "Options saved")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439 (sit-for 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440 (kill-buffer (current-buffer))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 (defun w3-preferences-reset-all-panels ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443 (let ((panels w3-preferences-panels)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 (func nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445 (while panels
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446 (setq func (intern (format "w3-preferences-init-%s-panel"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447 (caar panels)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 panels (cdr panels))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 (if (and func (fboundp func))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450 (funcall func)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452 (defun w3-preferences-cancel-callback (widget &rest ignore)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 (if (not (funcall url-confirmation-func "Cancel and lose all changes? "))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454 (error "Not cancelled!"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455 (w3-preferences-reset-all-panels)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 (kill-buffer (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 (run-hooks 'w3-preferences-cancel-hook))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459 (defun w3-preferences-reset-callback (widget &rest ignore)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460 (w3-preferences-reset-all-panels)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461 (run-hooks 'w3-preferences-default-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462 (w3-preferences-create-panel (caar w3-preferences-panels)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464 (defvar w3-preferences-setup-hook nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465 "*Hooks to be run before setting up the preferences buffer.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467 (defvar w3-preferences-cancel-hook nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468 "*Hooks to be run when cancelling the preferences (Cancel was chosen).")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470 (defvar w3-preferences-default-hook nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 "*Hooks to be run when resetting preference defaults (Defaults was chosen).")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473 (defvar w3-preferences-ok-hook nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474 "*Hooks to be run before saving the preferences (OK was chosen).")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 (defun w3-preferences-init-all-panels ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477 (let ((todo w3-preferences-panels)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 (func nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 (while todo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480 (setq func (intern (format "w3-preferences-init-%s-panel" (caar todo)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481 todo (cdr todo))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 (and (fboundp func) (funcall func)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
484 ;;###autoload
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 (defun w3-preferences-edit ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 (interactive)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
487 (if (not w3-preferences-map)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
488 (setq w3-preferences-map (w3-preferences-setup-glyph-map)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 (let* ((prefs-buffer (get-buffer-create "W3 Preferences"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 (widget nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 (inhibit-read-only t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 (window-conf (current-window-configuration)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493 (delete-other-windows)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 (set-buffer prefs-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 (w3-preferences-init-all-panels)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 (set-window-buffer (selected-window) prefs-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 (make-local-variable 'widget-field-face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498 (setq w3-preferences-panel-begin-marker (make-marker)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499 w3-preferences-panel-end-marker (make-marker))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 (set-marker-insertion-type w3-preferences-panel-begin-marker nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 (set-marker-insertion-type w3-preferences-panel-end-marker t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 (use-local-map widget-keymap)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 (run-hooks 'w3-preferences-setup-hook)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
505 (setq widget (widget-create 'image
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
506 :notify 'w3-preferences-notify
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
507 :value 'appearance
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
508 :tag "Panel"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
509 'usemap w3-preferences-map))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511 (insert "\n\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512 (set-marker w3-preferences-panel-begin-marker (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513 (set-marker w3-preferences-panel-end-marker (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514 (w3-preferences-create-panel (caar w3-preferences-panels))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516 (widget-insert "\n\n")
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
517 (widget-create 'push-button
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518 :notify 'w3-preferences-ok-callback
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519 :value "Ok")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520 (widget-insert " ")
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
521 (widget-create 'push-button
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522 :notify 'w3-preferences-cancel-callback
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523 :value "Cancel")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524 (widget-insert " ")
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
525 (widget-create 'push-button
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526 :notify 'w3-preferences-reset-callback
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527 :value "Reset")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528 (center-region (point-min) w3-preferences-panel-begin-marker)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529 (center-region w3-preferences-panel-end-marker (point-max))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 (provide 'w3-prefs)