Mercurial > hg > xemacs-beta
comparison lisp/w3/w3-forms.el @ 88:821dec489c24 r20-0
Import from CVS: tag r20-0
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:09:59 +0200 |
parents | 364816949b59 |
children | 0d2f883870bc |
comparison
equal
deleted
inserted
replaced
87:7df2982f5c17 | 88:821dec489c24 |
---|---|
1 ;;; w3-forms.el --- Emacs-w3 forms parsing code for new display engine | 1 ;;; w3-forms.el --- Emacs-w3 forms parsing code for new display engine |
2 ;; Author: wmperry | 2 ;; Author: wmperry |
3 ;; Created: 1997/01/27 00:57:39 | 3 ;; Created: 1997/01/28 14:21:54 |
4 ;; Version: 1.51 | 4 ;; Version: 1.55 |
5 ;; Keywords: faces, help, comm, data, languages | 5 ;; Keywords: faces, help, comm, data, languages |
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. |
82 (symbol-name | 82 (symbol-name |
83 (w3-form-element-type el)))))) | 83 (w3-form-element-type el)))))) |
84 (multiline 21) | 84 (multiline 21) |
85 (hidden nil) | 85 (hidden nil) |
86 (file (or size 26)) | 86 (file (or size 26)) |
87 ((float text int) (or size 20)) | 87 ((float password text int) (or size 20)) |
88 (image (+ 2 (length (or | |
89 (plist-get (w3-form-element-plist el) 'alt) | |
90 "Form-Image")))) | |
88 (option | 91 (option |
89 (or size | 92 (or size |
90 (length (caar (sort (w3-form-element-options el) | 93 (length (caar (sort (w3-form-element-options el) |
91 (function | 94 (function |
92 (lambda (x y) | 95 (lambda (x y) |
106 action | 109 action |
107 nil | 110 nil |
108 plist)) | 111 plist)) |
109 (size (w3-form-determine-size el (plist-get plist 'size))) | 112 (size (w3-form-determine-size el (plist-get plist 'size))) |
110 (node (assoc action w3-form-elements))) | 113 (node (assoc action w3-form-elements))) |
111 (if (eq (plist-get plist 'type) 'hidden) | 114 (if (and (eq (plist-get plist 'type) 'hidden) |
115 (not (assq '*table-autolayout w3-display-open-element-stack))) | |
112 (if node | 116 (if node |
113 (setcdr node (cons el (cdr node))) | 117 (setcdr node (cons el (cdr node))) |
114 (setq w3-form-elements (cons (cons action (list el)) | 118 (setq w3-form-elements (cons (cons action (list el)) |
115 w3-form-elements)))) | 119 w3-form-elements)))) |
116 (if size | 120 (if size |
200 (put 'image 'w3-widget-creation-function 'w3-form-create-image) | 204 (put 'image 'w3-widget-creation-function 'w3-form-create-image) |
201 (put 'int 'w3-widget-creation-function 'w3-form-create-integer) | 205 (put 'int 'w3-widget-creation-function 'w3-form-create-integer) |
202 (put 'float 'w3-widget-creation-function 'w3-form-create-float) | 206 (put 'float 'w3-widget-creation-function 'w3-form-create-float) |
203 (put 'custom 'w3-widget-creation-function 'w3-form-create-custom) | 207 (put 'custom 'w3-widget-creation-function 'w3-form-create-custom) |
204 (put 'text 'w3-widget-creation-function 'w3-form-create-text) | 208 (put 'text 'w3-widget-creation-function 'w3-form-create-text) |
209 (put 'password 'w3-widget-creation-function 'w3-form-create-password) | |
205 | 210 |
206 ;; Custom support. | 211 ;; Custom support. |
207 (defvar w3-custom-options nil) | 212 (defvar w3-custom-options nil) |
208 (make-variable-buffer-local 'w3-custom-options) | 213 (make-variable-buffer-local 'w3-custom-options) |
209 | 214 |
277 :notify 'ignore | 282 :notify 'ignore |
278 :button-face face | 283 :button-face face |
279 val))) | 284 val))) |
280 | 285 |
281 (defun w3-form-create-image (el face) | 286 (defun w3-form-create-image (el face) |
282 (let ((widget (widget-create 'push-button | 287 (widget-create 'push-button |
283 :notify 'w3-form-submit/reset-callback | 288 :notify 'w3-form-submit/reset-callback |
284 :value "Form-Image"))) | 289 :value (or |
285 widget)) | 290 (plist-get (w3-form-element-plist el) 'alt) |
291 "Form-Image"))) | |
286 | 292 |
287 (defun w3-form-create-submit-button (el face) | 293 (defun w3-form-create-submit-button (el face) |
288 (let ((val (w3-form-element-value el))) | 294 (let ((val (w3-form-element-value el))) |
289 (if (or (not val) (string= val "")) | 295 (if (or (not val) (string= val "")) |
290 (setq val (if (eq (w3-form-element-type el) 'submit) | 296 (setq val (if (eq (w3-form-element-type el) 'submit) |
383 :keymap w3-form-keymap | 389 :keymap w3-form-keymap |
384 :size (w3-form-element-size el) | 390 :size (w3-form-element-size el) |
385 :value-face face | 391 :value-face face |
386 :w3-form-data el | 392 :w3-form-data el |
387 (w3-form-element-value el))) | 393 (w3-form-element-value el))) |
394 | |
395 (defun w3-form-create-password (el face) | |
396 ;; *sigh* This will fail under XEmacs, but I can yell at them about | |
397 ;; upgrading separately for the release of 19.15 and 20.0 | |
398 (if (boundp :secret) | |
399 (widget-create 'editable-field | |
400 :secret ?* | |
401 :keymap w3-form-keymap | |
402 :size (w3-form-element-size el) | |
403 :value-face face | |
404 :w3-form-data el | |
405 (w3-form-element-value el)) | |
406 (w3-form-default-widget-creator el face))) | |
388 | 407 |
389 (defun w3-form-default-widget-creator (el face) | 408 (defun w3-form-default-widget-creator (el face) |
390 (widget-create 'link | 409 (widget-create 'link |
391 :notify 'w3-form-default-button-callback | 410 :notify 'w3-form-default-button-callback |
392 :value-to-internal 'w3-form-default-button-update | 411 :value-to-internal 'w3-form-default-button-update |