comparison 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
comparison
equal deleted inserted replaced
13:13c6d0aaafe5 14:9ee227acff29
1 ;;; w3-prefs.el --- Preferences panels for Emacs-W3 1 ;;; w3-prefs.el --- Preferences panels for Emacs-W3
2 ;; Author: wmperry 2 ;; Author: wmperry
3 ;; Created: 1996/06/30 18:10:45 3 ;; Created: 1996/12/29 01:49:57
4 ;; Version: 1.5 4 ;; Version: 1.12
5 ;; Keywords: hypermedia, preferences 5 ;; Keywords: hypermedia, preferences
6 6
7 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 7 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8 ;;; Copyright (c) 1996 by William M. Perry (wmperry@cs.indiana.edu) 8 ;;; Copyright (c) 1996 by William M. Perry (wmperry@cs.indiana.edu)
9 ;;; Copyright (c) 1996 Free Software Foundation, Inc.
9 ;;; 10 ;;;
10 ;;; This file is not part of GNU Emacs, but the same permissions apply. 11 ;;; This file is part of GNU Emacs.
11 ;;; 12 ;;;
12 ;;; GNU Emacs is free software; you can redistribute it and/or modify 13 ;;; GNU Emacs is free software; you can redistribute it and/or modify
13 ;;; it under the terms of the GNU General Public License as published by 14 ;;; it under the terms of the GNU General Public License as published by
14 ;;; the Free Software Foundation; either version 2, or (at your option) 15 ;;; the Free Software Foundation; either version 2, or (at your option)
15 ;;; any later version. 16 ;;; any later version.
18 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of 19 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;;; GNU General Public License for more details. 21 ;;; GNU General Public License for more details.
21 ;;; 22 ;;;
22 ;;; You should have received a copy of the GNU General Public License 23 ;;; You should have received a copy of the GNU General Public License
23 ;;; along with GNU Emacs; see the file COPYING. If not, write to 24 ;;; along with GNU Emacs; see the file COPYING. If not, write to the
24 ;;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 25 ;;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
26 ;;; Boston, MA 02111-1307, USA.
25 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 27 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
26 28
27 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 29 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
28 ;;; Preferences panels for Emacs-W3 30 ;;; Preferences panels for Emacs-W3
29 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 31 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
30 (require 'widget)
31 (require 'widget-edit)
32 (require 'w3-vars) 32 (require 'w3-vars)
33 (require 'w3-keyword) 33 (require 'w3-keyword)
34 (require 'w3-widget)
35 (require 'w3-toolbar) 34 (require 'w3-toolbar)
35 (eval-and-compile
36 (require 'w3-widget))
36 37
37 (defvar w3-preferences-glyph nil) 38 (defvar w3-preferences-glyph nil)
38 (defvar w3-preferences-map nil) 39 (defvar w3-preferences-map nil)
39 (defvar w3-preferences-panel-begin-marker nil) 40 (defvar w3-preferences-panel-begin-marker nil)
40 (defvar w3-preferences-panel-end-marker nil) 41 (defvar w3-preferences-panel-end-marker nil)
102 (widget-insert "\tShow Toolbars as:\t") 103 (widget-insert "\tShow Toolbars as:\t")
103 (widget-put 104 (widget-put
104 (widget-create 'radio 105 (widget-create 'radio
105 :value (symbol-value 'w3-preferences-temp-w3-toolbar-type) 106 :value (symbol-value 'w3-preferences-temp-w3-toolbar-type)
106 :notify 'w3-preferences-generic-variable-callback 107 :notify 'w3-preferences-generic-variable-callback
108 :format "%v"
107 (list 'item :format "%t\t" :tag "Pictures" :value 'pictures) 109 (list 'item :format "%t\t" :tag "Pictures" :value 'pictures)
108 (list 'item :format "%t\t" :tag "Text" :value 'text) 110 (list 'item :format "%t\t" :tag "Text" :value 'text)
109 (list 'item :format "%t" :tag "Both" :value 'both)) 111 (list 'item :format "%t" :tag "Both" :value 'both))
110 'variable 'w3-preferences-temp-w3-toolbar-type) 112 'variable 'w3-preferences-temp-w3-toolbar-type)
111 (widget-insert "\n\tToolbars appear on ") 113 (widget-insert "\n\tToolbars appear on ")
127 ;; Home page 129 ;; Home page
128 (widget-insert "\nStartup\n--------\n\tBrowser starts with:\t") 130 (widget-insert "\nStartup\n--------\n\tBrowser starts with:\t")
129 (widget-put 131 (widget-put
130 (widget-create 132 (widget-create
131 'radio 133 'radio
134 :format "%v"
132 :value (symbol-value 'w3-preferences-temp-use-home-page) 135 :value (symbol-value 'w3-preferences-temp-use-home-page)
133 :notify 'w3-preferences-generic-variable-callback 136 :notify 'w3-preferences-generic-variable-callback
134 (list 'item :format "%t\t" :tag "Blank Page" :value nil) 137 (list 'item :format "%t\t" :tag "Blank Page" :value nil)
135 (list 'item :format "%t" :tag "Home Page Location" :value t)) 138 (list 'item :format "%t" :tag "Home Page Location" :value t))
136 'variable 'w3-preferences-temp-use-home-page) 139 'variable 'w3-preferences-temp-use-home-page)
137 (widget-insert "\n\t\tURL: ") 140 (widget-insert "\n\t\tURL: ")
138 (widget-put 141 (widget-put
139 (widget-create 142 (widget-create
140 'field 143 'editable-field
141 :value (or (symbol-value 'w3-preferences-temp-w3-default-homepage) "None") 144 :value (or (symbol-value 'w3-preferences-temp-w3-default-homepage) "None")
142 :notify 'w3-preferences-generic-variable-callback) 145 :notify 'w3-preferences-generic-variable-callback)
143 'variable 'w3-preferences-temp-w3-default-homepage) 146 'variable 'w3-preferences-temp-w3-default-homepage)
144 147
145 ;; Stylesheet 148 ;; Stylesheet
269 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 272 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
270 ;;; The compatibility panel 273 ;;; The compatibility panel
271 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 274 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
272 (defvar w3-preferences-compatibility-variables 275 (defvar w3-preferences-compatibility-variables
273 '( 276 '(
274 (w3-style-ie-compatibility 277 (css-ie-compatibility
275 . "Internet Explorer (tm) 3.0 compatible stylesheet parsing") 278 . "Internet Explorer (tm) 3.0 compatible stylesheet parsing")
276 (w3-netscape-compatible-comments 279 (w3-netscape-compatible-comments
277 . "Allow Netscape compatible comments") 280 . "Allow Netscape compatible comments")
278 (w3-user-colors-take-precedence 281 (w3-user-colors-take-precedence
279 . "Ignore netscape document color control") 282 . "Ignore netscape document color control")
343 proxies (cdr proxies) 346 proxies (cdr proxies)
344 host-var (intern (format "w3-%s-proxy-host" (downcase proxy))) 347 host-var (intern (format "w3-%s-proxy-host" (downcase proxy)))
345 port-var (intern (format "w3-%s-proxy-port" (downcase proxy)))) 348 port-var (intern (format "w3-%s-proxy-port" (downcase proxy))))
346 (widget-insert (format "%10s Proxy: " proxy)) 349 (widget-insert (format "%10s Proxy: " proxy))
347 (widget-put 350 (widget-put
348 (widget-create 'field 351 (widget-create 'editable-field
349 :size 20 352 :size 20
350 :value-face 'underline 353 :value-face 'underline
351 :notify 'w3-preferences-generic-variable-callback 354 :notify 'w3-preferences-generic-variable-callback
352 :value (format "%-20s" (symbol-value host-var))) 355 :value (format "%-20s" (symbol-value host-var)))
353 'variable host-var) 356 'variable host-var)
354 (widget-insert " Port: ") 357 (widget-insert " Port: ")
355 (widget-put 358 (widget-put
356 (widget-create 'field 359 (widget-create 'editable-field
357 :size 5 360 :size 5
358 :value-face 'underline 361 :value-face 'underline
359 :notify 'w3-preferences-generic-variable-callback 362 :notify 'w3-preferences-generic-variable-callback
360 :value (format "%5s" (symbol-value port-var))) 363 :value (format "%5s" (symbol-value port-var)))
361 'variable port-var) 364 'variable port-var)
408 (widget-forward 1) 411 (widget-forward 1)
409 (error nil))) 412 (error nil)))
410 413
411 (defun w3-preferences-notify (widget widget-ignore &optional event) 414 (defun w3-preferences-notify (widget widget-ignore &optional event)
412 (let* ((glyph (and event w3-running-xemacs (event-glyph event))) 415 (let* ((glyph (and event w3-running-xemacs (event-glyph event)))
413 (x (and glyph (w3-glyphp glyph) (event-glyph-x-pixel event))) 416 (x (and glyph (widget-glyphp glyph) (event-glyph-x-pixel event)))
414 (y (and glyph (w3-glyphp glyph) (event-glyph-y-pixel event))) 417 (y (and glyph (widget-glyphp glyph) (event-glyph-y-pixel event)))
415 (map (widget-get widget 'usemap)) 418 (map (widget-get widget 'usemap))
416 (value (widget-value widget))) 419 (value (widget-value widget)))
417 (if (and map x y) 420 (if (and map x y)
418 (setq value (w3-point-in-map (vector x y) map))) 421 (setq value (w3-point-in-map (vector x y) map)))
419 (if value 422 (if value
510 (set-marker w3-preferences-panel-begin-marker (point)) 513 (set-marker w3-preferences-panel-begin-marker (point))
511 (set-marker w3-preferences-panel-end-marker (point)) 514 (set-marker w3-preferences-panel-end-marker (point))
512 (w3-preferences-create-panel (caar w3-preferences-panels)) 515 (w3-preferences-create-panel (caar w3-preferences-panels))
513 (goto-char (point-max)) 516 (goto-char (point-max))
514 (widget-insert "\n\n") 517 (widget-insert "\n\n")
515 (widget-create 'push 518 (widget-create 'push-button
516 :notify 'w3-preferences-ok-callback 519 :notify 'w3-preferences-ok-callback
517 :value "Ok") 520 :value "Ok")
518 (widget-insert " ") 521 (widget-insert " ")
519 (widget-create 'push 522 (widget-create 'push-button
520 :notify 'w3-preferences-cancel-callback 523 :notify 'w3-preferences-cancel-callback
521 :value "Cancel") 524 :value "Cancel")
522 (widget-insert " ") 525 (widget-insert " ")
523 (widget-create 'push 526 (widget-create 'push-button
524 :notify 'w3-preferences-reset-callback 527 :notify 'w3-preferences-reset-callback
525 :value "Reset") 528 :value "Reset")
526 (center-region (point-min) w3-preferences-panel-begin-marker) 529 (center-region (point-min) w3-preferences-panel-begin-marker)
527 (center-region w3-preferences-panel-end-marker (point-max)))) 530 (center-region w3-preferences-panel-end-marker (point-max))))
528 531