Mercurial > hg > xemacs-beta
comparison lisp/x11/x-toolbar.el @ 195:a2f645c6b9f8 r20-3b24
Import from CVS: tag r20-3b24
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:59:05 +0200 |
parents | 489f57a838ef |
children | acd284d43ca1 |
comparison
equal
deleted
inserted
replaced
194:2947057885e5 | 195:a2f645c6b9f8 |
---|---|
37 (require 'pending-del)) | 37 (require 'pending-del)) |
38 | 38 |
39 (defgroup toolbar nil | 39 (defgroup toolbar nil |
40 "Configure XEmacs Toolbar functions and properties" | 40 "Configure XEmacs Toolbar functions and properties" |
41 :group 'environment) | 41 :group 'environment) |
42 | |
43 | |
44 (defun toolbar-not-configured-message () | |
45 (interactive) | |
46 (message "Toolbar item MUST be configured, first.")) | |
47 | |
48 (defcustom toolbar-item-not-configured-function 'toolbar-not-configured-message | |
49 "*Function to call when News or Mail are not configured yet." | |
50 :type '(radio (function-item toolbar-not-configured-message) | |
51 (function :tag "Other")) | |
52 :group 'toolbar) | |
53 | |
54 (defun toolbar-item-not-configured () | |
55 (interactive) | |
56 (call-interactively toolbar-item-not-configured-function)) | |
57 | |
42 | 58 |
43 (defcustom toolbar-open-function 'find-file | 59 (defcustom toolbar-open-function 'find-file |
44 "*Function to call when the open icon is selected." | 60 "*Function to call when the open icon is selected." |
45 :type '(radio (function-item find-file) | 61 :type '(radio (function-item find-file) |
46 (function :tag "Other")) | 62 (function :tag "Other")) |
166 (defun toolbar-external (process &rest args) | 182 (defun toolbar-external (process &rest args) |
167 (interactive) | 183 (interactive) |
168 (apply 'call-process process nil 0 nil args)) | 184 (apply 'call-process process nil 0 nil args)) |
169 | 185 |
170 (defcustom toolbar-mail-commands-alist | 186 (defcustom toolbar-mail-commands-alist |
171 `((vm . vm) | 187 `((item-not-configured . toolbar-item-not-configured) |
188 (vm . vm) | |
172 (gnus . gnus-no-server) | 189 (gnus . gnus-no-server) |
173 (rmail . rmail) | 190 (rmail . rmail) |
174 (mh . mh-rmail) | 191 (mh . mh-rmail) |
175 (pine . (toolbar-external "xterm" "-e" "pine")) ; *gag* | 192 (pine . (toolbar-external "xterm" "-e" "pine")) ; *gag* |
176 (elm . (toolbar-external "xterm" "-e" "elm")) | 193 (elm . (toolbar-external "xterm" "-e" "elm")) |
181 The car of each alist element is the mail reader, and the cdr is the form | 198 The car of each alist element is the mail reader, and the cdr is the form |
182 used to start it." | 199 used to start it." |
183 :type '(repeat (cons (symbol :tag "Mailer") (function :tag "Start with"))) | 200 :type '(repeat (cons (symbol :tag "Mailer") (function :tag "Start with"))) |
184 :group 'toolbar) | 201 :group 'toolbar) |
185 | 202 |
186 (defcustom toolbar-mail-reader 'vm | 203 (defcustom toolbar-mail-reader 'item-not-configured |
187 "*Mail reader toolbar will invoke. | 204 "*Mail reader toolbar will invoke. |
188 The legal values are the keys from `toolbar-mail-command-alist', which should | 205 The legal values are the keys from `toolbar-mail-command-alist', which should |
189 be used to add new mail readers. | 206 be used to add new mail readers. |
190 | 207 |
191 Mail readers known by default are vm, gnus, rmail, mh, pine, elm, mutt, | 208 Mail readers known by default are item-not-configured, vm, gnus, |
192 exmh and netscape." | 209 rmail, mh, pine, elm, mutt, exmh and netscape." |
193 :type '(symbol :validate (lambda (wid) | 210 :type '(symbol :validate (lambda (wid) |
194 (if (assq (widget-value wid) toolbar-mail-commands-alist) | 211 (if (assq (widget-value wid) toolbar-mail-commands-alist) |
195 nil | 212 nil |
196 (widget-put wid :error "Unknown mail reader.") | 213 (widget-put wid :error "Unknown mail reader.") |
197 wid))) | 214 wid))) |
211 ;; | 228 ;; |
212 | 229 |
213 (defvar toolbar-info-frame nil | 230 (defvar toolbar-info-frame nil |
214 "The frame in which info is displayed.") | 231 "The frame in which info is displayed.") |
215 | 232 |
233 (defcustom Info-frame-plist | |
234 (append (list 'width 80) | |
235 (let ((h (plist-get default-frame-plist 'height))) | |
236 (when h (list 'height h)))) | |
237 "Frame plist for the Info frame." | |
238 :type '(repeat (group :inline t | |
239 (symbol :tag "Property") | |
240 (sexp :tag "Value"))) | |
241 :group 'info) | |
242 | |
216 (defun toolbar-info () | 243 (defun toolbar-info () |
217 "Run info in a separate frame." | 244 "Run info in a separate frame." |
218 (interactive) | 245 (interactive) |
219 (if (or (not toolbar-info-frame) | 246 (if (or (not toolbar-info-frame) |
220 (not (frame-live-p toolbar-info-frame))) | 247 (not (frame-live-p toolbar-info-frame))) |
221 (progn | 248 (progn |
222 (setq toolbar-info-frame (make-frame)) | 249 (setq toolbar-info-frame (make-frame Info-frame-plist)) |
223 (select-frame toolbar-info-frame) | 250 (select-frame toolbar-info-frame) |
224 (raise-frame toolbar-info-frame))) | 251 (raise-frame toolbar-info-frame))) |
225 (if (frame-iconified-p toolbar-info-frame) | 252 (if (frame-iconified-p toolbar-info-frame) |
226 (deiconify-frame toolbar-info-frame)) | 253 (deiconify-frame toolbar-info-frame)) |
227 (select-frame toolbar-info-frame) | 254 (select-frame toolbar-info-frame) |
256 ;; | 283 ;; |
257 ;; toolbar news variables and defuns | 284 ;; toolbar news variables and defuns |
258 ;; | 285 ;; |
259 | 286 |
260 (defcustom toolbar-news-commands-alist | 287 (defcustom toolbar-news-commands-alist |
261 `((gnus . gnus) ; M-x all-hail-gnus | 288 `((item-not-configured . toolbar-item-not-configured) |
289 (gnus . toolbar-gnus) ; M-x all-hail-gnus | |
262 (rn . (toolbar-external "xterm" "-e" "rn")) | 290 (rn . (toolbar-external "xterm" "-e" "rn")) |
263 (nn . (toolbar-external "xterm" "-e" "nn")) | 291 (nn . (toolbar-external "xterm" "-e" "nn")) |
264 (trn . (toolbar-external "xterm" "-e" "trn")) | 292 (trn . (toolbar-external "xterm" "-e" "trn")) |
265 (xrn . (toolbar-external "xrn")) | 293 (xrn . (toolbar-external "xrn")) |
266 (slrn . (toolbar-external "xterm" "-e" "slrn")) | 294 (slrn . (toolbar-external "xterm" "-e" "slrn")) |
271 The car of each alist element the pair is the news reader, and the cdr | 299 The car of each alist element the pair is the news reader, and the cdr |
272 is the form used to start it." | 300 is the form used to start it." |
273 :type '(repeat (cons (symbol :tag "Reader") (sexp :tag "Start with"))) | 301 :type '(repeat (cons (symbol :tag "Reader") (sexp :tag "Start with"))) |
274 :group 'toolbar) | 302 :group 'toolbar) |
275 | 303 |
276 (defcustom toolbar-news-reader 'gnus | 304 (defcustom toolbar-news-reader 'item-not-configured |
277 "*News reader toolbar will invoke. | 305 "*News reader toolbar will invoke. |
278 The legal values are the keys from `toolbar-news-command-alist', which should | 306 The legal values are the keys from `toolbar-news-command-alist', which should |
279 be used to add new news readers. | 307 be used to add new news readers. |
280 | 308 |
281 Newsreaders known by default are gnus, rn, nn, trn, xrn, slrn, pine and | 309 Newsreaders known by default are item-not-configured, gnus, rn, nn, |
282 netscape." | 310 trn, xrn, slrn, pine and netscape." |
283 :type '(symbol :validate (lambda (wid) | 311 :type '(symbol :validate (lambda (wid) |
284 (if (assq (widget-value wid) toolbar-news-commands-alist) | 312 (if (assq (widget-value wid) toolbar-news-commands-alist) |
285 nil | 313 nil |
286 (widget-put wid :error "Unknown newsreader.") | 314 (widget-put wid :error "Unknown newsreader.") |
287 wid))) | 315 wid))) |
296 "The frame in which news is displayed.") | 324 "The frame in which news is displayed.") |
297 | 325 |
298 (defvar toolbar-news-frame-properties nil | 326 (defvar toolbar-news-frame-properties nil |
299 "The properties of the frame in which news is displayed.") | 327 "The properties of the frame in which news is displayed.") |
300 | 328 |
301 (defun toolbar-news () | 329 (defun toolbar-gnus () |
302 "Run Gnus in a separate frame." | 330 "Run Gnus in a separate frame." |
303 (interactive) | 331 (interactive) |
304 (when (or (not toolbar-news-frame) | 332 (when (or (not toolbar-news-frame) |
305 (not (frame-live-p toolbar-news-frame))) | 333 (not (frame-live-p toolbar-news-frame))) |
306 (setq toolbar-news-frame (make-frame toolbar-news-frame-properties)) | 334 (setq toolbar-news-frame (make-frame toolbar-news-frame-properties)) |
315 (gnus)) | 343 (gnus)) |
316 (if (frame-iconified-p toolbar-news-frame) | 344 (if (frame-iconified-p toolbar-news-frame) |
317 (deiconify-frame toolbar-news-frame)) | 345 (deiconify-frame toolbar-news-frame)) |
318 (select-frame toolbar-news-frame) | 346 (select-frame toolbar-news-frame) |
319 (raise-frame toolbar-news-frame)) | 347 (raise-frame toolbar-news-frame)) |
348 | |
349 (defun toolbar-news () | |
350 "Run News (in a separate frame??)." | |
351 (interactive) | |
352 (let ((command (assq toolbar-news-reader toolbar-news-commands-alist))) | |
353 (if (not command) | |
354 (error "Unknown news reader %s" toolbar-news-reader)) | |
355 (funcall (cdr command)))) | |
320 | 356 |
321 (defvar toolbar-last-win-icon nil "A `last-win' icon set.") | 357 (defvar toolbar-last-win-icon nil "A `last-win' icon set.") |
322 (defvar toolbar-next-win-icon nil "A `next-win' icon set.") | 358 (defvar toolbar-next-win-icon nil "A `next-win' icon set.") |
323 (defvar toolbar-file-icon nil "A `file' icon set.") | 359 (defvar toolbar-file-icon nil "A `file' icon set.") |
324 (defvar toolbar-folder-icon nil "A `folder' icon set") | 360 (defvar toolbar-folder-icon nil "A `folder' icon set") |
410 [toolbar-copy-icon toolbar-copy t "Copy region"] | 446 [toolbar-copy-icon toolbar-copy t "Copy region"] |
411 [toolbar-paste-icon toolbar-paste t "Paste from clipboard"] | 447 [toolbar-paste-icon toolbar-paste t "Paste from clipboard"] |
412 [toolbar-undo-icon toolbar-undo t "Undo edit"] | 448 [toolbar-undo-icon toolbar-undo t "Undo edit"] |
413 [toolbar-spell-icon toolbar-ispell t "Spellcheck"] | 449 [toolbar-spell-icon toolbar-ispell t "Spellcheck"] |
414 [toolbar-replace-icon toolbar-replace t "Replace text"] | 450 [toolbar-replace-icon toolbar-replace t "Replace text"] |
415 ;; [toolbar-mail-icon toolbar-mail t "Mail"] | 451 [toolbar-mail-icon toolbar-mail t "Mail"] |
416 [toolbar-info-icon toolbar-info t "Information"] | 452 [toolbar-info-icon toolbar-info t "Information"] |
417 [toolbar-compile-icon toolbar-compile t "Compile"] | 453 [toolbar-compile-icon toolbar-compile t "Compile"] |
418 [toolbar-debug-icon toolbar-debug t "Debug"] | 454 [toolbar-debug-icon toolbar-debug t "Debug"] |
419 ;; [toolbar-news-icon toolbar-news t "News"] | 455 [toolbar-news-icon toolbar-news t "News"] |
420 ) | 456 ) |
421 "The initial toolbar for a buffer.") | 457 "The initial toolbar for a buffer.") |
422 | 458 |
423 (defun x-init-toolbar-from-resources (locale) | 459 (defun x-init-toolbar-from-resources (locale) |
424 (x-init-specifier-from-resources | 460 (x-init-specifier-from-resources |