1 ;;; hui-menu.el --- InfoDock/Emacs menubar menu of Hyperbole commands.
3 ;; Copyright (C) 1994, 1995, 2007 Free Software Foundation, Inc.
4 ;; Developed with support from Motorola Inc.
6 ;; Author: Bob Weiner, Brown U.
7 ;; Maintainer: Mats Lidell <matsl@contactor.se>
8 ;; Keywords: hypermedia, mouse
10 ;; This file is part of GNU Hyperbole.
12 ;; GNU Hyperbole is free software; you can redistribute it and/or
13 ;; modify it under the terms of the GNU General Public License as
14 ;; published by the Free Software Foundation; either version 3, or (at
15 ;; your option) any later version.
17 ;; GNU Hyperbole is distributed in the hope that it will be useful,
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 ;; General Public License for more details.
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the
24 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
25 ;; Boston, MA 02110-1301, USA.
32 ;;; Other required Elisp libraries
42 ;; Add Hyperbole menu to menubar.
43 (defun hyperbole-menubar-menu ()
44 "Add the Hyperbole menu to the global menubar."
46 (add-menu nil (car hui-menu-global-menu) (cdr hui-menu-global-menu))))
48 (defun hui-menu-remove ()
49 "Remove Hyperbole menu from the global menubars."
51 (delete-menu-item (list (car hui-menu-global-menu)))
52 (easy-menu-remove-item nil nil (car hui-menu-global-menu))))
58 (defconst hui-menu-global-menu
62 '["Activate-Button-at-Point" hui:hbut-act t]
63 '["Back-to-Prior-Location" (hhist:remove current-prefix-arg) t]
65 ["Edit-Per-Directory-File" (find-file hbmap:filename) t]
66 ["Edit-Personal-File" (find-file
68 hbmap:filename hbmap:dir-user)) t]
70 ["Manual" (id-info "(hyperbole.info)Button Files") t]
73 ["Customize Hyperbole..." hyperb:customize t]
75 ["Display URLs in ..." (customize-variable 'browse-url-browser-function) t]
78 ["Manual" (id-info "(hyperbole.info)Top") t]
80 ["Copyright" (id-info "(hyperbole.info)Top") t]
81 ["Demonstration" (find-file-read-only
82 (expand-file-name "DEMO" hyperb:dir)) t]
83 ["Manifest" (find-file-read-only
84 (expand-file-name "MANIFEST" hyperb:dir)) t]
85 ["Glossary" (id-info "(hyperbole.info)Glossary") t]
86 ["Mail-Lists" (id-info "(hyperbole.info)Mail Lists") t]
87 ["New-Features" (progn
88 (hact 'link-to-regexp-match
89 "\\*[ \t]+What's New" 2
90 (expand-file-name "README" hyperb:dir))
91 (setq buffer-read-only nil)
92 (toggle-read-only)) t]
93 ["Smart-Key-Summary" (id-browse-file (hypb:mouse-help-file)) t]
96 ("Activate" :filter hui-menu-explicit-buttons-filter)
98 ["Activate-at-Point" hui:hbut-act t]
99 ["Create" hui:ebut-create t]
100 ["Delete" hui:ebut-delete t]
101 ["Edit" hui:ebut-modify t]
103 ["Buffer-Buttons" (hui:hbut-report -1) t]
104 ["Current-Button" (hui:hbut-report) t]
105 ["Ordered-Buttons" (hui:hbut-report 1) t]
107 ["Manual" (id-info "(hyperbole.info)Location") t]
109 ["Modify" hui:ebut-modify t]
110 ["Rename" hui:ebut-rename t]
111 ["Search" hui:ebut-search t]
113 ["Manual" (id-info "(hyperbole.info)Explicit Buttons") t]
116 ("Activate" :filter hui-menu-global-buttons-filter)
118 ["Create" hui:gbut-create t]
119 ["Edit" hui:gbut-modify t]
121 ["Modify" hui:gbut-modify t]
123 ["Manual" (id-info "(hyperbole.info)Global Buttons") t]
126 ["Activate-at-Point" hui:hbut-act t]
127 ["Delete-Type" (hui:htype-delete 'ibtypes) t]
128 ["Help" hui:hbut-help t]
129 ["Types" (hui:htype-help 'ibtypes 'no-sort) t]
131 ["Manual" (id-info "(hyperbole.info)Implicit Buttons") t]
135 ["Mail To Hyperbole-Users ..."
136 (hmail:compose "hyperbole-users@gnu.org" '(hact 'hyp-config)) t]
137 ["Manage Hyperbole-Users Subscription"
138 (browse-url "http://lists.gnu.org/mailman/listinfo/hyperbole-users") t]
140 ["Send Bug Report ..."
141 (hmail:compose "bug-hyperbole@gnu.org" '(hact 'hyp-config)) t]
142 ["Manage Bug-Hyperbole Subscription"
143 (browse-url "http://lists.gnu.org/mailman/listinfo/bug-hyperbole") t]
145 ["Manual" (id-info "(hyperbole.info)Suggestion or Bug Reporting") t]
149 ["Create-File" kfile:find t]
150 ["View-File" kfile:view t]
152 ["Collapse-Tree" (progn (kotl-mode:is-p)
154 (kcell-view:label))) t]
155 ["Create-Link" klink:create t]
156 ["Expand-All-Trees" kotl-mode:show-all t]
157 ["Expand-Tree" (progn (kotl-mode:is-p)
159 (kcell-view:label))) t]
160 ["Show-Top-Level-Only" kotl-mode:hide-body t]
162 ["Manual" (id-info "(hyperbole.info)Outliner") t]
163 ["Example" (find-file-read-only
165 "EXAMPLE.kotl" (concat hyperb:dir "kotl/")))
170 ["Action-Types-Manual"
171 (id-info "(hyperbole.info)Action Types") t]
172 ["Implicit-Button-Types-Manual"
173 (id-info "(hyperbole.info)Implicit Buttons") t]
175 ["Action-Types" (hui:htype-help 'actypes) t]
176 ["Implicit-Button-Types" (hui:htype-help 'ibtypes 'no-sort) t]
178 '("Window-Configuration"
179 ["Name-Configuration" wconfig-add-by-name t]
180 ["Delete-Name" wconfig-delete-by-name t]
181 ["Restore-Name" wconfig-restore-by-name t]
183 ["Pop-from-Ring" wconfig-delete-pop t]
184 ["Save-to-Ring" wconfig-ring-save t]
185 ["Yank-from-Ring" wconfig-yank-pop t]
187 ["Manual" (id-info "(hyperbole.info)Window Configurations") t]
190 '["Browse-Manual" (id-info "(hyperbole.info)Top") t]
193 ;; Delete Hyperbole menu item from all menubars.
201 ;; Remove Hyperbole button comment from future
203 (if (boundp 'smail:comment)
204 (setq smail:comment "")))
208 ;; Dynamic menus for Global and Explicit buttons.
209 (defvar hui-menu-max-list-length 24
210 "Limits the length of a Hyperbole dynamic menu lists.")
212 ;; List existing global buttons for menu activation.
213 (defun hui-menu-global-buttons-filter (rest-of-menu)
215 (let ((labels (delq nil (gbut:lbl-list)))
219 ;; Cutoff list if too long.
220 (if (setq cutoff (nthcdr (1- hui-menu-max-list-length) labels))
223 (mapcar (function (lambda (label)
224 (vector label `(gbut:act ,label) t)))
225 (sort labels 'string-lessp))
230 (defun hui-menu-explicit-but-act (label)
231 "Activate explicit button with LABEL."
232 (hbut:act (ebut:get (hbut:label-to-key label))))
234 ;; List existing explicit buttons for menu activation.
235 (defun hui-menu-explicit-buttons-filter (rest-of-menu)
237 (let ((labels (delq nil (ebut:list)))
241 ;; Cutoff list if too long.
242 (if (setq cutoff (nthcdr (1- hui-menu-max-list-length) labels))
245 (mapcar (function (lambda (label)
246 (vector label `(hui-menu-explicit-but-act ,label) t)))
247 (sort labels 'string-lessp))
254 (easy-menu-define hui-menu-global-menu nil "Hyperbole" hui-menu-global-menu)
255 (easy-menu-add-item nil nil (easy-menu-create-menu
256 (car hui-menu-global-menu)
257 (cdr hui-menu-global-menu))
261 ;;; Private variables
266 ;;; hui-menu.el ends here