1099 |
|
|
1100 |
;; look at function `image-type-available-p' for Emacs !!!! |
;; look at function `image-type-available-p' for Emacs !!!! |
1101 |
|
|
1102 |
(defun toolbarx-find-image (filename) |
(defun toolbarx-find-image (name) |
1103 |
"Return a image object from image on FILENAME, a string. |
"Return an image object from image on NAME, a string. |
1104 |
In Emacs, return a image descriptor from FILENAME and in Xemacs, |
In Emacs, return a image descriptor from NAME and in XEmacs, |
1105 |
return a glyph. It is optional to include path and/or extension |
return a glyph. |
|
in FILENAME. If path is not given, looks for files in |
|
|
`load-path', and after `data-directory'. If file extension is |
|
|
ommited, tries `xpm', `xbm' and `pbm'." |
|
|
(let ((file)) |
|
|
(dolist (i '("" ".xpm" ".xbm" ".pbm")) |
|
|
(unless file |
|
|
(setq file |
|
|
(or |
|
|
(and (fboundp 'image-search-load-path) ;; Emacs 22+ |
|
|
(boundp 'image-load-path) |
|
|
(image-search-load-path (concat filename i) |
|
|
image-load-path)) |
|
|
(locate-library (concat filename i) t toolbarx-image-path))))) |
|
|
(when file |
|
|
(funcall (if (featurep 'xemacs) 'make-glyph 'create-image) |
|
|
file)))) |
|
1106 |
|
|
1107 |
|
Usually it should NAME does not contain a directory or an |
1108 |
|
extension. If the extension is omitted, `xpm', `xbm' and `pbm' |
1109 |
|
are tried. If the directory is omitted, `toolbarx-image-path' is |
1110 |
|
searched." |
1111 |
|
;; `find-image' in Emacs 21 looks in `load-path' and `data-directory'. In |
1112 |
|
;; Emacs 22, we have `image-load-path' which includes `load-path' and |
1113 |
|
;; `data-directory'. |
1114 |
|
;; |
1115 |
|
;; If there's some API in XEmacs to find the images, we should use it |
1116 |
|
;; instead of locate-library. |
1117 |
|
(or (when (fboundp 'find-image) |
1118 |
|
(let ((load-path toolbarx-image-path)) |
1119 |
|
;; We promised to consider toolbarx-image-path. |
1120 |
|
(find-image `((:type xpm :file ,(concat name ".xpm")) |
1121 |
|
(:type xbm :file ,(concat name ".xbm")) |
1122 |
|
(:type pbm :file ,(concat name ".pbm")))))) |
1123 |
|
;; The following is for XEmacs and "name" _with_ extension. I doubt |
1124 |
|
;; that the latter is useful, but the doc string says so. |
1125 |
|
(let ((file)) |
1126 |
|
(dolist (i '("" ".xpm" ".xbm" ".pbm")) |
1127 |
|
(unless file |
1128 |
|
(setq file |
1129 |
|
(locate-library (concat name i) |
1130 |
|
t toolbarx-image-path)))) |
1131 |
|
(when file (if (featurep 'xemacs) |
1132 |
|
(make-glyph file) |
1133 |
|
;; Only used if "name" _with_ extension was given as this |
1134 |
|
;; is not covered by `find-image': |
1135 |
|
(create-image file)))))) |
1136 |
|
|
1137 |
;; next variable interfaces between parsing and display engines |
;; next variable interfaces between parsing and display engines |
1138 |
(defvar toolbarx-internal-button-switches nil |
(defvar toolbarx-internal-button-switches nil |