X-Git-Url: http://git.chise.org/gitweb/?p=chise%2Fxemacs-chise.git.1;a=blobdiff_plain;f=lisp%2Fdialog.el;h=235d13594583fce9811954d7ae4a6cff964fa5a2;hp=db1ed86b6210dcde63f0588f27551cdc8b58f744;hb=eeca41d3213b7a3b7efcf6508693e748c1590748;hpb=426fe636212336bb32a5e6f187c4d623709fa57d diff --git a/lisp/dialog.el b/lisp/dialog.el index db1ed86..235d135 100644 --- a/lisp/dialog.el +++ b/lisp/dialog.el @@ -40,8 +40,8 @@ ;;; Code: (defun yes-or-no-p-dialog-box (prompt) "Ask user a yes-or-no question with a popup dialog box. -Return t if the answer is \"yes\". -Takes one argument, which is the string to display to ask the question." +Return t if the answer is \"yes\", nil if \"no\". Takes one argument, +the question string to display." (save-selected-frame (make-dialog-box 'question :question prompt @@ -195,6 +195,8 @@ The keywords allowed for `general' are The frame is made a child of this frame (defaults to the selected frame). :properties Additional properties of the frame, as well as `dialog-frame-plist'. +:autosize + If t the frame is sized to exactly fit the widgets given by :spec. --------------------------------------------------------------------------- @@ -547,7 +549,9 @@ The keywords allowed are 'internal-make-dialog-box-exit did) (remove-hook 'delete-dialog-box-hook ',sym)))) - (add-hook 'delete-dialog-box-hook sym) + (if (framep id) + (add-hook 'delete-frame-hook sym) + (add-hook 'delete-dialog-box-hook sym)) (mapc 'disable-frame frames) (block nil (while t @@ -568,6 +572,7 @@ The keywords allowed are (:parent (selected-frame)) :modal :properties + :autosize :spec) () (flet ((create-dialog-box-frame () @@ -615,6 +620,7 @@ The keywords allowed are vertical-scrollbar-visible-p nil horizontal-scrollbar-visible-p nil unsplittable t + internal-border-width 8 left ,(+ fleft (- (/ fwidth 2) (/ (* dfwidth fontw) @@ -625,6 +631,19 @@ The keywords allowed are 2))))))) (set-face-foreground 'modeline [default foreground] frame) (set-face-background 'modeline [default background] frame) + ;; resize before mapping + (when cl-autosize + (set-frame-pixel-size + frame + (image-instance-width + (glyph-image-instance cl-spec + (frame-selected-window frame))) + (image-instance-height + (glyph-image-instance cl-spec + (frame-selected-window frame))))) + ;; somehow, even though the resizing is supposed + ;; to be while the frame is not visible, a + ;; visible resize is perceptible (unless unmapped (make-frame-visible frame)) (let ((newbuf (generate-new-buffer " *dialog box*"))) (set-buffer-dedicated-frame newbuf frame)