Mercurial > hg > xemacs-beta
comparison lisp/utils/toolbar-utils.el @ 173:8eaf7971accc r20-3b13
Import from CVS: tag r20-3b13
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:49:09 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
172:a38aed19690b | 173:8eaf7971accc |
---|---|
1 ;;; toolbar-utils.el --- Toolbar utility functions for XEmacs | |
2 | |
3 ;; Copyright (C) 1997 by Free Software Foundation, Inc. | |
4 | |
5 ;; Author: Jeff Miller <jmiller@smart.net> | |
6 ;; Keywords: extensions | |
7 | |
8 ;; This file is part of XEmacs. | |
9 | |
10 ;; XEmacs is free software; you can redistribute it and/or modify it | |
11 ;; under the terms of the GNU General Public License as published by | |
12 ;; the Free Software Foundation; either version 2, or (at your option) | |
13 ;; any later version. | |
14 | |
15 ;; XEmacs is distributed in the hope that it will be useful, but | |
16 ;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
18 ;; General Public License for more details. | |
19 | |
20 ;; You should have received a copy of the GNU General Public License | |
21 ;; along with XEmacs; see the file COPYING. If not, write to the Free | |
22 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | |
23 ;; 02111-1307, USA. | |
24 | |
25 ;;; Synched up with: Not in FSF | |
26 | |
27 ;;; Commentary: | |
28 | |
29 ;; Based largely on edit-toolbar.el by Peter D. Pezaris <pez@dwwc.com> | |
30 | |
31 ;;; Code: | |
32 | |
33 ;;;###autoload | |
34 (defun restore-initial-toolbar () | |
35 "Restores the default toolbar defined by initial-toolbar-spec." | |
36 (interactive) | |
37 (set-specifier default-toolbar initial-toolbar-spec) | |
38 ) | |
39 | |
40 ;;;###autoload | |
41 (defun toolbar-add-item (item &optional index &optional toolbar-spec) | |
42 "Add a toolbar item ITEM at the first location of the toolbar specifier. | |
43 Optionally, can specify an INDEX position to insert the ITEM. The default is | |
44 to use default-toolbar, but a different specifier can by specified with | |
45 TOOLBAR-SPEC." | |
46 (if (eq toolbar-spec nil ) | |
47 (setq toolbar-spec default-toolbar)) | |
48 (let* ((toolbar (specifier-instance toolbar-spec))) | |
49 (if(or (eq index nil) (eq index 0)) | |
50 (setq toolbar (cons item toolbar)) | |
51 (setcdr (nthcdr (- index 1) toolbar) | |
52 (cons item (nthcdr index toolbar)))) | |
53 (set-specifier toolbar-spec toolbar) | |
54 )) | |
55 | |
56 | |
57 ;;;###autoload | |
58 (defun toolbar-kill-item-pos ( index &optional toolbar-spec) | |
59 "Remove a toolbar item ITEM at the first location of the toolbar specifier. | |
60 Optionally, can specify an INDEX position where to remove the ITEM. The | |
61 default is to use default-toolbar, but a different specifier can by | |
62 specified with TOOLBAR-SPEC." | |
63 (if (eq toolbar-spec nil ) | |
64 (setq toolbar-spec default-toolbar)) | |
65 (let* ((toolbar (specifier-instance toolbar-spec)) | |
66 (item (nth index toolbar))) | |
67 (if (eq index 0) | |
68 (setq toolbar(cdr toolbar)) | |
69 (setcdr (nthcdr (1- index) toolbar) | |
70 (nthcdr (1+ index) toolbar))) | |
71 (set-specifier toolbar-spec toolbar) | |
72 )) | |
73 | |
74 ;;;###autoload | |
75 (defun toolbar-kill-item ( item &optional toolbar-spec) | |
76 "Remove a toolbar item ITEM at the first location of the toolbar specifier. | |
77 Optionally, can specify an ITEM to remove. The ITEM must be in form of a | |
78 vector. The default is to use default-toolbar, but a different specifier | |
79 can by specified with TOOLBAR-SPEC." | |
80 (if (eq toolbar-spec nil ) | |
81 (setq toolbar-spec default-toolbar)) | |
82 (let* ((toolbar (specifier-instance toolbar-spec)) ) | |
83 (eval item) | |
84 (set-specifier toolbar-spec (delete item toolbar)) | |
85 )) | |
86 | |
87 | |
88 (provide 'toolbar-utils) | |
89 | |
90 ;;; toolbar-utils.el ends here |