~ubuntu-branches/ubuntu/natty/ess/natty

« back to all changes in this revision

Viewing changes to lisp/ess-toolbar.el

  • Committer: Bazaar Package Importer
  • Author(s): Camm Maguire
  • Date: 2006-04-28 16:27:11 UTC
  • mto: (3.1.1 etch) (1.2.3 upstream)
  • mto: This revision was merged to the branch mainline in revision 5.
  • Revision ID: james.westby@ubuntu.com-20060428162711-u9n7jsygfnd59r3i
ImportĀ upstreamĀ versionĀ 5.3.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
;;; This code is experimental, and runs best on Emacs 21 and XEmacs
20
20
;;; 21.  It has been tested only on Linux machines.  All feedback
21
21
;;; appreciated.
22
 
;;; To use this code, place the following in .emacs after you have
23
 
;;; loaded ess-site:
24
22
;;;
25
 
;;; (setq ess-use-toolbar t)
26
 
;;; (if (fboundp 'tool-bar-mode) (tool-bar-mode t))     ;Emacs 21.
27
 
;;; (require 'ess-toolbar)
 
23
;;; If your emacs can support images, the ESS toolbar should be loaded.
 
24
;;; 
28
25
;;; If you see a toolbar, but no icons, check out the value of
29
26
;;; ess-icon-directory.
30
27
;;;
31
28
;;; The toolbar can be customized in several ways.  To see options, do:
32
29
;;; M-x customize-group RET ess-toolbar RET
33
 
;;; If you change any of the variables, you may need to restart Emacs
34
 
;;; to see any effect.
 
30
;;; If you change any of the variables, you _may_ need to restart Emacs
 
31
;;; to see any effect.  See also the documentation for ess-toolbar-items
 
32
;;; if you wish to change its value.
35
33
;;;
36
34
;;; Technical issues.
37
35
;; Emacs vs XEmacs.
92
90
3. the tooltip doc string (XEmacs only; Emacs gets doc string from menu items.
93
91
 
94
92
General toolbar items are also added to the ESS toolbar
95
 
iff `ess-toolbar-own-icons' is nil."
 
93
iff `ess-toolbar-own-icons' is nil.
 
94
 
 
95
Setting this variable with setq doesn't take effect once you have
 
96
loaded ess-site, unless you follow it by a call to
 
97
`ess-make-toolbar' afterwards.  Instead, change its value using
 
98
Custom, and then on all new ESS buffers you should see the
 
99
toolbar has changed."
96
100
  :group 'ess-toolbar
 
101
  :set (lambda (symbol value)
 
102
         (set-default symbol value)
 
103
         (if (fboundp 'ess-make-toolbar)
 
104
             (ess-make-toolbar)))
97
105
  :type '(repeat (list (function :tag "Function to run")
98
106
                       (string  :tag "Icon")
99
107
                       (string  :tag "Tooltip"))))
100
108
 
101
109
(defvar ess-icon-directory
102
 
  (expand-file-name (concat ess-etc-directory "/icons"))
 
110
  (expand-file-name (concat (file-name-as-directory ess-etc-directory) "icons"))
103
111
  "*Location for ESS icons.
104
112
This variable should be set automatically by the ESS install process.
105
113
Icons should be found in ESS/etc/icons/ directory.
117
125
  "Make the ESS toolbar."
118
126
  (if (featurep 'xemacs)
119
127
      (ess-make-toolbar-xemacs)
120
 
    (ess-make-toolbar-emacs)))
 
128
    ;; Under Emacs, only worth building the toolbar if tool-bar-map is 
 
129
    ;; available.  e.g. when running Emacs within a terminal, tool-bar-map
 
130
    ;; is not available, so no need to make the tool-bar.
 
131
    (if (boundp 'tool-bar-map)
 
132
        (ess-make-toolbar-emacs))))
121
133
 
122
134
(defun ess-make-toolbar-emacs ()
123
135
  "Make the ESS toolbar under Emacs."
145
157
    (expand-file-name (concat (cadr x) ".xpm") ess-icon-directory))
146
158
   (car x)                              ;function
147
159
   t
148
 
   (caddr x)                            ;doc string
 
160
   (nth 2 x)                            ;doc string
149
161
   ))
150
162
 
151
163
(defvar ess-toolbar-xemacs-general