1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-17 17:58:46 +00:00

Avoid inline image variables for checkboxes (Bug#7222).

* etc/images/checked.xpm:
* etc/images/unchecked.xpm: New images.

* image.el (image-checkbox-checked, image-checkbox-unchecked):
Deleted (Bug#7222).

* startup.el (fancy-startup-tail): Instead of using inline images,
refer to image files from etc/.

* wid-edit.el (checkbox): Likewise.
(widget-image-find): Center image specs.
This commit is contained in:
Chong Yidong 2010-10-24 19:40:55 -04:00
parent 7c051dd87f
commit 01898dc200
7 changed files with 80 additions and 33 deletions

View File

@ -1,3 +1,8 @@
2010-10-24 Chong Yidong <cyd@stupidchicken.com>
* images/checked.xpm:
* images/unchecked.xpm: New images.
2010-10-20 Richard Stallman <rms@gnu.org> 2010-10-20 Richard Stallman <rms@gnu.org>
* DISTRIB: Update donation section. * DISTRIB: Update donation section.

20
etc/images/checked.xpm Normal file
View File

@ -0,0 +1,20 @@
/* XPM */
static char * checked_xpm[] = {
"12 12 5 1",
" c None",
". c gray20",
"+ c white",
"@ c gray70",
"# c black",
"............",
"............",
"..@@@@@@##+.",
"..@@@@@@##+.",
"..#@@@@##@+.",
"..##@@@##@+.",
"..###@##@@+.",
"..@#####@@+.",
"..@@###@@@+.",
"..@++##++++.",
".@+++++++++.",
"............"};

20
etc/images/unchecked.xpm Normal file
View File

@ -0,0 +1,20 @@
/* XPM */
static char * unchecked_xpm[] = {
"12 12 5 1",
" c None",
". c gray20",
"+ c white",
"@ c gray70",
"# c black",
"............",
"............",
"..@@@@@@@@+.",
"..@@@@@@@@+.",
"..@@@@@@@@+.",
"..@@@@@@@@+.",
"..@@@@@@@@+.",
"..@@@@@@@@+.",
"..@@@@@@@@+.",
"..@++++++++.",
".@+++++++++.",
"............"};

View File

@ -1,3 +1,14 @@
2010-10-24 Chong Yidong <cyd@stupidchicken.com>
* image.el (image-checkbox-checked, image-checkbox-unchecked):
Deleted (Bug#7222).
* startup.el (fancy-startup-tail): Instead of using inline images,
refer to image files from etc/.
* wid-edit.el (checkbox): Likewise.
(widget-image-find): Center image specs.
2010-10-24 Glenn Morris <rgm@gnu.org> 2010-10-24 Glenn Morris <rgm@gnu.org>
* term/ns-win.el (x-select-text): Doc fix. * term/ns-win.el (x-select-text): Doc fix.

View File

@ -723,21 +723,6 @@ shall be displayed."
(cons (concat "\\." extension "\\'") 'imagemagick) (cons (concat "\\." extension "\\'") 'imagemagick)
image-type-file-name-regexps))))) image-type-file-name-regexps)))))
;;; Inline stock images
(defvar image-checkbox-checked
(create-image "\300\300\141\143\067\076\034\030"
'xbm t :width 8 :height 8 :background "grey75"
:foreground "black" :relief -2 :ascent 'center)
"Image of a checked checkbox.")
(defvar image-checkbox-unchecked
(create-image (make-string 8 0)
'xbm t :width 8 :height 8 :background "grey75"
:foreground "black" :relief -2 :ascent 'center)
"Image of an unchecked checkbox.")
(provide 'image) (provide 'image)
;; arch-tag: 8e76a07b-eb48-4f3e-a7a0-1a7ba9f096b3 ;; arch-tag: 8e76a07b-eb48-4f3e-a7a0-1a7ba9f096b3

View File

@ -1563,21 +1563,26 @@ a face or button specification."
(kill-buffer "*GNU Emacs*"))) (kill-buffer "*GNU Emacs*")))
" ") " ")
(when (or user-init-file custom-file) (when (or user-init-file custom-file)
(insert-button (let ((checked (create-image "checked.xpm"
" " nil nil :ascent 'center))
:on-glyph image-checkbox-checked (unchecked (create-image "unchecked.xpm"
:off-glyph image-checkbox-unchecked nil nil :ascent 'center)))
'checked nil 'display image-checkbox-unchecked 'follow-link t (insert-button
'action (lambda (button) " "
(if (overlay-get button 'checked) :on-glyph checked
(progn (overlay-put button 'checked nil) :off-glyph unchecked
(overlay-put button 'display 'checked nil 'display unchecked 'follow-link t
(overlay-get button :off-glyph)) 'action (lambda (button)
(setq startup-screen-inhibit-startup-screen nil)) (if (overlay-get button 'checked)
(overlay-put button 'checked t) (progn (overlay-put button 'checked nil)
(overlay-put button 'display (overlay-put button 'display
(overlay-get button :on-glyph)) (overlay-get button :off-glyph))
(setq startup-screen-inhibit-startup-screen t)))) (setq startup-screen-inhibit-startup-screen
nil))
(overlay-put button 'checked t)
(overlay-put button 'display
(overlay-get button :on-glyph))
(setq startup-screen-inhibit-startup-screen t)))))
(fancy-splash-insert :face '(variable-pitch (:height 0.9)) (fancy-splash-insert :face '(variable-pitch (:height 0.9))
" Never show it again."))))) " Never show it again.")))))

View File

@ -638,7 +638,8 @@ extension (xpm, xbm, gif, jpg, or png) located in
specs) specs)
(dolist (elt widget-image-conversion) (dolist (elt widget-image-conversion)
(dolist (ext (cdr elt)) (dolist (ext (cdr elt))
(push (list :type (car elt) :file (concat image ext)) specs))) (push (list :type (car elt) :file (concat image ext)
:ascent 'center) specs)))
(find-image (nreverse specs)))) (find-image (nreverse specs))))
(t (t
;; Oh well. ;; Oh well.
@ -2195,9 +2196,9 @@ when he invoked the menu."
;; We could probably do the same job as the images using single ;; We could probably do the same job as the images using single
;; space characters in a boxed face with a stretch specification to ;; space characters in a boxed face with a stretch specification to
;; make them square. ;; make them square.
:on-glyph image-checkbox-checked :on-glyph "checked"
:off "[ ]" :off "[ ]"
:off-glyph image-checkbox-unchecked :off-glyph "unchecked"
:help-echo "Toggle this item." :help-echo "Toggle this item."
:action 'widget-checkbox-action) :action 'widget-checkbox-action)