0
|
1 ;;!emacs
|
|
2 ;;
|
|
3 ;; FILE: kmenu.el
|
|
4 ;; SUMMARY: Pulldown and popup menus for kotl-mode, the Hyperbole Outliner.
|
|
5 ;; USAGE: GNU Emacs Lisp Library
|
|
6 ;; KEYWORDS: mouse, outlines, wp
|
|
7 ;;
|
|
8 ;; AUTHOR: Bob Weiner
|
|
9 ;;
|
|
10 ;; ORIG-DATE: 28-Mar-94 at 11:22:09
|
36
|
11 ;; LAST-MOD: 6-Mar-97 at 01:20:03 by Bob Weiner
|
0
|
12 ;;
|
36
|
13 ;; Copyright (C) 1994, 1995, 1997 Free Software Foundation, Inc.
|
0
|
14 ;;
|
|
15 ;; This file is part of Hyperbole.
|
|
16 ;;
|
|
17 ;; DESCRIPTION:
|
|
18 ;; DESCRIP-END.
|
|
19
|
|
20 ;;; ************************************************************************
|
|
21 ;;; Public variables
|
|
22 ;;; ************************************************************************
|
|
23
|
|
24 ;;; This definition is used by InfoDock only.
|
|
25 (defconst id-menubar-kotl
|
|
26 '(
|
|
27 ("Koutline"
|
24
|
28 ["All-Cells-Attributes" (kotl-mode:cell-help nil -1) t]
|
0
|
29 ["Help" describe-mode t]
|
|
30 ["Manual" (id-info "(hyperbole.info)Outliner") t]
|
|
31 "----"
|
|
32 ["Find (Open)" find-file t]
|
|
33 ["Find-Read-Only" find-file-read-only t]
|
|
34 ["Save" save-buffer t]
|
|
35 ["Toggle-Read-Only" toggle-read-only t]
|
|
36 ["Write (Save as)" kfile:write t]
|
|
37 "----"
|
|
38 ["Quit" (id-tool-quit '(kill-buffer nil)) t]
|
|
39 )
|
|
40 ("Edit"
|
|
41 ["Set-Cell-Attribute" kotl-mode:set-cell-attribute t]
|
|
42 "----"
|
|
43 ["Add-Child" kotl-mode:add-child t]
|
|
44 ["Add-Cell" kotl-mode:add-cell t]
|
|
45 ["Add-Parent" kotl-mode:add-parent t]
|
|
46 ["Append-Cell" kotl-mode:append-cell t]
|
|
47 ["Split-Cell" kotl-mode:split-cell t]
|
|
48 "----"
|
|
49 ["Kill-to-Cell-End" kotl-mode:kill-contents t]
|
|
50 ["Kill-Tree" kotl-mode:kill-tree t]
|
|
51 ["Yank" kotl-mode:yank t]
|
|
52 "----"
|
|
53 ["Copy-After-Cell" kotl-mode:copy-after t]
|
|
54 ["Copy-Before-Cell" kotl-mode:copy-before t]
|
|
55 ["Move-After-Cell" kotl-mode:move-after t]
|
|
56 ["Move-Before-Cell" kotl-mode:move-before t]
|
|
57 "----"
|
|
58 ["Fill" kotl-mode:fill-cell t]
|
|
59 ["Fill-Paragraph" kotl-mode:fill-paragraph t]
|
|
60 ["Set-Fill-Prefix" kotl-mode:set-fill-prefix t]
|
|
61 )
|
|
62 ("Jump-to"
|
|
63 ["Cell" kotl-mode:goto-cell t]
|
|
64 "----"
|
|
65 ["Cell-Beginning" kotl-mode:beginning-of-cell t]
|
|
66 ["Cell-End" kotl-mode:end-of-cell t]
|
|
67 "----"
|
|
68 ["Child" kotl-mode:down-level t]
|
|
69 ["Parent" kotl-mode:up-level t]
|
|
70 "----"
|
|
71 ["Next-Cell" kotl-mode:next-cell t]
|
|
72 ["Prev-Cell" kotl-mode:previous-cell t]
|
|
73 "----"
|
|
74 ["Next-Same-Level" kotl-mode:forward-cell t]
|
|
75 ["Prev-Same-Level" kotl-mode:backward-cell t]
|
|
76 "----"
|
|
77 ["First-Sibling" kotl-mode:first-sibling t]
|
|
78 ["Last-Sibling" kotl-mode:last-sibling t]
|
|
79 "----"
|
|
80 ["Beginning-of-Tree" kotl-mode:beginning-of-tree t]
|
|
81 ["End-of-Tree" kotl-mode:end-of-tree t]
|
|
82 "----"
|
|
83 ["First-Cell" kotl-mode:beginning-of-buffer t]
|
|
84 ["Last-Cell" kotl-mode:end-of-buffer t]
|
|
85 )
|
|
86 ("Label-Type"
|
|
87 ["Alphanumeric (Default)" (kview:set-label-type kview 'alpha) t]
|
|
88 ["Legal" (kview:set-label-type kview 'legal) t]
|
|
89 ["None" (kview:set-label-type kview 'no) t]
|
|
90 ["Partial-Alpha" (kview:set-label-type kview 'partial-alpha) t]
|
|
91 ["Permanent-Idstamp" (kview:set-label-type kview 'id) t]
|
|
92 ["Stars" (kview:set-label-type kview 'star) t]
|
|
93 )
|
|
94 ("Link"
|
|
95 ["Add-at-Point" klink:create t]
|
|
96 )
|
|
97 ("Tree"
|
|
98 ["Copy-to-Buffer" kotl-mode:copy-to-buffer t]
|
|
99 ["Demote" kotl-mode:demote-tree t]
|
|
100 ["Kill" kotl-mode:kill-tree t]
|
|
101 ["Mail" kotl-mode:mail-tree t]
|
|
102 ["Promote" kotl-mode:promote-tree t]
|
24
|
103 ["Show-Attributes" (kotl-mode:cell-help nil 2) t]
|
0
|
104 "----"
|
|
105 ["Copy-After-Cell" kotl-mode:copy-after t]
|
|
106 ["Copy-Before-Cell" kotl-mode:copy-before t]
|
|
107 ["Move-After-Cell" kotl-mode:move-after t]
|
|
108 ["Move-Before-Cell" kotl-mode:move-before t]
|
|
109 )
|
|
110 ("View"
|
|
111 ["Set-View-Spec" kvspec:activate t]
|
|
112 ["Toggle-Blank-Lines" kvspec:toggle-blank-lines t]
|
|
113 "----"
|
|
114 ["Set-Cell-Attribute" kotl-mode:set-cell-attribute t]
|
24
|
115 ["Show-Cell-Attributes" (kotl-mode:cell-help) t]
|
|
116 ["All-Cells-Attributes" (kotl-mode:cell-help nil -1) t]
|
|
117 ["Show-Tree-Attributes" (kotl-mode:cell-help nil 2) t]
|
0
|
118 "----"
|
|
119 ["Hide (Collapse)" kotl-mode:hide-tree t]
|
|
120 ["Hide-Levels" kotl-mode:hide-sublevels t]
|
|
121 ["Hide-Subtree" kotl-mode:hide-subtree t]
|
|
122 ["Overview" kotl-mode:overview t]
|
|
123 "----"
|
|
124 ["Show (Expand)" kotl-mode:show-tree t]
|
|
125 ["Show-All" kotl-mode:show-all t]
|
|
126 ["Show-Subtree" kotl-mode:show-subtree t]
|
|
127 ["Show-Top-Level-Only" kotl-mode:top-cells t]
|
|
128 )
|
|
129 ))
|
|
130
|
|
131 ;;; This definition is used by InfoDock and XEmacs.
|
|
132 (defconst id-popup-kotl-menu
|
|
133 '("Koutline"
|
24
|
134 ["All-Cells-Attributes" (kotl-mode:cell-help nil -1) t]
|
0
|
135 ["Help" describe-mode t]
|
|
136 ["Manual" (id-info "(hyperbole.info)Outliner") t]
|
|
137 "----"
|
|
138 ("Edit"
|
|
139 ["Set-Cell-Attribute" kotl-mode:set-cell-attribute t]
|
|
140 "----"
|
|
141 ["Add-Child" kotl-mode:add-child t]
|
|
142 ["Add-Cell" kotl-mode:add-cell t]
|
|
143 ["Add-Parent" kotl-mode:add-parent t]
|
|
144 ["Append-Cell" kotl-mode:append-cell t]
|
|
145 ["Split-Cell" kotl-mode:split-cell t]
|
|
146 "----"
|
|
147 ["Kill-to-Cell-End" kotl-mode:kill-contents t]
|
|
148 ["Kill-Tree" kotl-mode:kill-tree t]
|
|
149 ["Yank" kotl-mode:yank t]
|
|
150 "----"
|
|
151 ["Copy-After-Cell" kotl-mode:copy-after t]
|
|
152 ["Copy-Before-Cell" kotl-mode:copy-before t]
|
|
153 ["Move-After-Cell" kotl-mode:move-after t]
|
|
154 ["Move-Before-Cell" kotl-mode:move-before t]
|
|
155 "----"
|
|
156 ["Fill" kotl-mode:fill-cell t]
|
|
157 ["Fill-Paragraph" kotl-mode:fill-paragraph t]
|
|
158 ["Set-Fill-Prefix" kotl-mode:set-fill-prefix t]
|
|
159 )
|
|
160 ("Jump-to"
|
|
161 ["Cell" kotl-mode:goto-cell t]
|
|
162 "----"
|
|
163 ["Cell-Beginning" kotl-mode:beginning-of-cell t]
|
|
164 ["Cell-End" kotl-mode:end-of-cell t]
|
|
165 "----"
|
|
166 ["Child" kotl-mode:down-level t]
|
|
167 ["Parent" kotl-mode:up-level t]
|
|
168 "----"
|
|
169 ["Next-Cell" kotl-mode:next-cell t]
|
|
170 ["Prev-Cell" kotl-mode:previous-cell t]
|
|
171 "----"
|
|
172 ["Next-Same-Level" kotl-mode:forward-cell t]
|
|
173 ["Prev-Same-Level" kotl-mode:backward-cell t]
|
|
174 "----"
|
|
175 ["First-Sibling" kotl-mode:first-sibling t]
|
|
176 ["Last-Sibling" kotl-mode:last-sibling t]
|
|
177 "----"
|
|
178 ["Beginning-of-Tree" kotl-mode:beginning-of-tree t]
|
|
179 ["End-of-Tree" kotl-mode:end-of-tree t]
|
|
180 "----"
|
|
181 ["First-Cell" kotl-mode:beginning-of-buffer t]
|
|
182 ["Last-Cell" kotl-mode:end-of-buffer t]
|
|
183 )
|
|
184 ("Label-Type"
|
|
185 ["Alphanumeric (Default)" (kview:set-label-type kview 'alpha) t]
|
|
186 ["Legal" (kview:set-label-type kview 'legal) t]
|
|
187 ["None" (kview:set-label-type kview 'no) t]
|
|
188 ["Partial-Alpha" (kview:set-label-type kview 'partial-alpha) t]
|
|
189 ["Permanent-Idstamp" (kview:set-label-type kview 'id) t]
|
|
190 ["Stars" (kview:set-label-type kview 'star) t]
|
|
191 )
|
|
192 ("Link"
|
|
193 ["Add-at-Point" klink:create t]
|
|
194 )
|
|
195 ("Tree"
|
|
196 ["Copy-to-Buffer" kotl-mode:copy-to-buffer t]
|
|
197 ["Demote" kotl-mode:demote-tree t]
|
|
198 ["Kill" kotl-mode:kill-tree t]
|
|
199 ["Mail" kotl-mode:mail-tree t]
|
|
200 ["Promote" kotl-mode:promote-tree t]
|
24
|
201 ["Show-Attributes" (kotl-mode:cell-help nil 2) t]
|
0
|
202 "----"
|
|
203 ["Copy-After-Cell" kotl-mode:copy-after t]
|
|
204 ["Copy-Before-Cell" kotl-mode:copy-before t]
|
|
205 ["Move-After-Cell" kotl-mode:move-after t]
|
|
206 ["Move-Before-Cell" kotl-mode:move-before t]
|
|
207 )
|
|
208 ("View"
|
|
209 ["Set-View-Spec" kvspec:activate t]
|
|
210 ["Toggle-Blank-Lines" kvspec:toggle-blank-lines t]
|
|
211 "----"
|
|
212 ["Set-Cell-Attribute" kotl-mode:set-cell-attribute t]
|
24
|
213 ["Show-Cell-Attributes" (kotl-mode:cell-help) t]
|
|
214 ["All-Cells-Attributes" (kotl-mode:cell-help nil -1) t]
|
|
215 ["Show-Tree-Attributes" (kotl-mode:cell-help nil 2) t]
|
0
|
216 "----"
|
|
217 ["Hide (Collapse)" kotl-mode:hide-tree t]
|
|
218 ["Hide-Levels" kotl-mode:hide-sublevels t]
|
|
219 ["Hide-Subtree" kotl-mode:hide-subtree t]
|
|
220 ["Overview" kotl-mode:overview t]
|
|
221 "----"
|
|
222 ["Show (Expand)" kotl-mode:show-tree t]
|
|
223 ["Show-All" kotl-mode:show-all t]
|
|
224 ["Show-Subtree" kotl-mode:show-subtree t]
|
|
225 ["Show-Top-Level-Only" kotl-mode:top-cells t]
|
|
226 )
|
|
227 "----"
|
|
228 ["Find (Open)" find-file t]
|
|
229 ["Find-Read-Only" find-file-read-only t]
|
|
230 ["Save" save-buffer t]
|
|
231 ["Toggle-Read-Only" toggle-read-only t]
|
|
232 ["Write (Save as)" kfile:write t]
|
|
233 "----"
|
|
234 ["Quit" (id-tool-quit '(kill-buffer nil)) t]
|
|
235 ))
|
|
236
|
|
237 ;;; ************************************************************************
|
|
238 ;;; Public functions
|
|
239 ;;; ************************************************************************
|
|
240
|
|
241 ;;; This definition is used only by XEmacs and Emacs19.
|
|
242 (defun kotl-menubar-menu ()
|
|
243 "Add a Koutline menu to the menubar for each koutline buffer."
|
|
244 (cond ((fboundp 'popup-mode-menu)
|
|
245 (setq mode-popup-menu id-popup-kotl-menu))
|
|
246 (hyperb:lemacs-p
|
|
247 (define-key kotl-mode-map 'button3 'kotl-popup-menu))
|
|
248 (t ;; hyperb:emacs19-p
|
|
249 (define-key kotl-mode-map [down-mouse-3] 'kotl-popup-menu)
|
|
250 (define-key kotl-mode-map [mouse-3] nil)))
|
|
251 (if (and (boundp 'current-menubar)
|
|
252 (or hyperb:emacs19-p current-menubar)
|
|
253 (not (car (find-menu-item current-menubar '("Koutline")))))
|
|
254 (progn
|
|
255 (set-buffer-menubar (copy-sequence current-menubar))
|
|
256 (if (fboundp 'add-submenu)
|
|
257 (add-submenu nil id-popup-kotl-menu)
|
|
258 (add-menu nil (car id-popup-kotl-menu) (cdr id-popup-kotl-menu))))))
|
|
259
|
|
260 ;;; This definition is used only by XEmacs and Emacs19.
|
|
261 (defun kotl-popup-menu (event)
|
|
262 "Popup the Koutline buffer menu."
|
|
263 (interactive "@e")
|
|
264 (mouse-set-point event)
|
|
265 (if (fboundp 'popup-mode-menu)
|
|
266 (popup-mode-menu)
|
|
267 (popup-menu id-popup-kotl-menu)))
|
|
268
|
|
269 (cond ((null hyperb:window-system))
|
|
270 ((fboundp 'id-menubar-set)
|
|
271 ;; InfoDock under a window system
|
|
272 (require 'id-menubars)
|
|
273 (id-menubar-set 'kotl-mode 'id-menubar-kotl))
|
|
274 (hyperb:lemacs-p
|
|
275 ;; XEmacs under a window system
|
|
276 (add-hook 'kotl-mode-hook 'kotl-menubar-menu))
|
|
277 (hyperb:emacs19-p
|
|
278 ;; Emacs 19 under a window system
|
|
279 (require 'lmenu)
|
|
280 (add-hook 'kotl-mode-hook 'kotl-menubar-menu)))
|
|
281
|
|
282 (provide 'kmenu)
|