Mercurial > hg > xemacs-beta
comparison lisp/w3/w3-prefs.el @ 30:ec9a17fef872 r19-15b98
Import from CVS: tag r19-15b98
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:52:29 +0200 |
parents | 0293115a14e9 |
children | e04119814345 |
comparison
equal
deleted
inserted
replaced
29:7976500f47f9 | 30:ec9a17fef872 |
---|---|
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: 1997/01/17 04:34:13 | 3 ;; Created: 1997/03/04 14:33:41 |
4 ;; Version: 1.15 | 4 ;; Version: 1.16 |
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, 1997 Free Software Foundation, Inc. | 9 ;;; Copyright (c) 1996, 1997 Free Software Foundation, Inc. |
33 (require 'w3-keyword) | 33 (require 'w3-keyword) |
34 (require 'w3-toolbar) | 34 (require 'w3-toolbar) |
35 (eval-and-compile | 35 (eval-and-compile |
36 (require 'w3-widget)) | 36 (require 'w3-widget)) |
37 | 37 |
38 (defvar w3-preferences-glyph nil) | |
39 (defvar w3-preferences-map nil) | |
40 (defvar w3-preferences-panel-begin-marker nil) | 38 (defvar w3-preferences-panel-begin-marker nil) |
41 (defvar w3-preferences-panel-end-marker nil) | 39 (defvar w3-preferences-panel-end-marker nil) |
42 (defvar w3-preferences-panels '( | 40 (defvar w3-preferences-panels '( |
43 (appearance . "Appearance") | 41 (appearance . "Appearance") |
44 (images . "Images") | 42 (images . "Images") |
45 (cookies . "HTTP Cookies") | 43 (cookies . "HTTP Cookies") |
46 (hooks . "Various Hooks") | 44 (hooks . "Various Hooks") |
47 (compatibility . "Compatibility") | 45 (compatibility . "Compatibility") |
48 (proxy . "Proxy"))) | 46 (proxy . "Proxy"))) |
49 | |
50 (defun w3-preferences-setup-glyph-map () | |
51 (let* ((x 0) | |
52 (height (and w3-preferences-glyph | |
53 (glyph-height w3-preferences-glyph))) | |
54 (width (and height (/ (glyph-width w3-preferences-glyph) | |
55 (length w3-preferences-panels))))) | |
56 (mapcar | |
57 (function | |
58 (lambda (region) | |
59 (vector "rect" (list (vector (if width (* x width) 0) 0) | |
60 (vector (if width (* (setq x (1+ x)) width) 0) | |
61 (or height 0))) | |
62 (car region) (cdr region)))) | |
63 w3-preferences-panels))) | |
64 | 47 |
65 (defun w3-preferences-generic-variable-callback (widget &rest ignore) | 48 (defun w3-preferences-generic-variable-callback (widget &rest ignore) |
66 (condition-case () | 49 (condition-case () |
67 (set (widget-get widget 'variable) (widget-value widget)) | 50 (set (widget-get widget 'variable) (widget-value widget)) |
68 (error (message "Invalid or incomplete data...")))) | 51 (error (message "Invalid or incomplete data...")))) |
186 'checkbox | 169 'checkbox |
187 :notify 'w3-preferences-generic-variable-callback | 170 :notify 'w3-preferences-generic-variable-callback |
188 :value (symbol-value 'w3-preferences-temp-w3-delay-image-loads)) | 171 :value (symbol-value 'w3-preferences-temp-w3-delay-image-loads)) |
189 'variable 'w3-preferences-temp-w3-delay-image-loads) | 172 'variable 'w3-preferences-temp-w3-delay-image-loads) |
190 (widget-insert " Delay Image Loads\n" | 173 (widget-insert " Delay Image Loads\n" |
191 ;;; "\nAllowed Image Types\n" | |
192 ;;; "-------------------\n") | |
193 ;;; (set | |
194 ;;; (make-local-variable 'w3-preferences-image-type-widget) | |
195 ;;; (widget-create | |
196 ;;; 'repeat | |
197 ;;; :entry-format "%i %d %v" | |
198 ;;; :value (mapcar | |
199 ;;; (function | |
200 ;;; (lambda (x) | |
201 ;;; (list 'item :format "%t" :tag (car x) :value (cdr x)))) | |
202 ;;; w3-image-mappings) | |
203 ;;; '(item :tag "*/*" :value 'unknown))) | |
204 )) | 174 )) |
205 | 175 |
206 (defun w3-preferences-save-images-panel () | 176 (defun w3-preferences-save-images-panel () |
207 (let ((vars '(w3-delay-image-loads | 177 (let ((vars '(w3-delay-image-loads |
208 w3-image-mappings))) | 178 w3-image-mappings))) |
226 | 196 |
227 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 197 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
228 ;;; The hooks panel | 198 ;;; The hooks panel |
229 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 199 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
230 (defvar w3-preferences-hooks-variables | 200 (defvar w3-preferences-hooks-variables |
231 '(w3-file-done-hook | 201 '(w3-load-hook |
232 w3-file-prepare-hook | |
233 w3-load-hook | |
234 w3-mode-hook | 202 w3-mode-hook |
235 w3-preferences-cancel-hook | 203 w3-preferences-cancel-hook |
236 w3-preferences-default-hook | 204 w3-preferences-default-hook |
237 w3-preferences-ok-hook | 205 w3-preferences-ok-hook |
238 w3-preferences-setup-hook | 206 w3-preferences-setup-hook |
482 (and (fboundp func) (funcall func))))) | 450 (and (fboundp func) (funcall func))))) |
483 | 451 |
484 ;;###autoload | 452 ;;###autoload |
485 (defun w3-preferences-edit () | 453 (defun w3-preferences-edit () |
486 (interactive) | 454 (interactive) |
487 (if (not w3-preferences-map) | |
488 (setq w3-preferences-map (w3-preferences-setup-glyph-map))) | |
489 (let* ((prefs-buffer (get-buffer-create "W3 Preferences")) | 455 (let* ((prefs-buffer (get-buffer-create "W3 Preferences")) |
490 (widget nil) | 456 (widget nil) |
491 (inhibit-read-only t) | 457 (inhibit-read-only t) |
492 (window-conf (current-window-configuration))) | 458 (window-conf (current-window-configuration))) |
493 (delete-other-windows) | 459 (delete-other-windows) |
500 (set-marker-insertion-type w3-preferences-panel-begin-marker nil) | 466 (set-marker-insertion-type w3-preferences-panel-begin-marker nil) |
501 (set-marker-insertion-type w3-preferences-panel-end-marker t) | 467 (set-marker-insertion-type w3-preferences-panel-end-marker t) |
502 (use-local-map widget-keymap) | 468 (use-local-map widget-keymap) |
503 (erase-buffer) | 469 (erase-buffer) |
504 (run-hooks 'w3-preferences-setup-hook) | 470 (run-hooks 'w3-preferences-setup-hook) |
505 (setq widget (widget-create 'image | 471 (setq widget (apply 'widget-create 'menu-choice |
506 :notify 'w3-preferences-notify | 472 :tag "Panel" |
507 :value 'appearance | 473 :notify 'w3-preferences-notify |
508 :tag "Panel" | 474 :value 'appearance |
509 'usemap w3-preferences-map)) | 475 (mapcar |
476 (function | |
477 (lambda (x) | |
478 (list 'choice-item | |
479 :format "%[%t%]" | |
480 :tag (cdr x) | |
481 :value (car x)))) | |
482 w3-preferences-panels))) | |
510 (goto-char (point-max)) | 483 (goto-char (point-max)) |
511 (insert "\n\n") | 484 (insert "\n\n") |
512 (set-marker w3-preferences-panel-begin-marker (point)) | 485 (set-marker w3-preferences-panel-begin-marker (point)) |
513 (set-marker w3-preferences-panel-end-marker (point)) | 486 (set-marker w3-preferences-panel-end-marker (point)) |
514 (w3-preferences-create-panel (caar w3-preferences-panels)) | 487 (w3-preferences-create-panel (caar w3-preferences-panels)) |