1 ;;; wrolo-menu.el --- Pulldown and popup menus of Hyperbole rolodex commands.
3 ;; Copyright (C) 1994-1995, 2006 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, matching, 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.
37 ;;; This definition is used by InfoDock and XEmacs.
38 (defconst infodock-wrolo-menu
40 ["Add-Entry" (id-tool-invoke 'rolo-add) t]
41 ["Delete-Entry" (id-tool-invoke 'rolo-kill) t]
42 ["Display-Prior-Matches" (id-tool-invoke 'rolo-display-matches) t]
43 ["Edit-Entry" (id-tool-invoke 'rolo-edit) t]
44 ["Edit-Rolodex" (id-tool-invoke
45 '(progn (require 'wrolo)
46 (find-file (car rolo-file-list))
47 (setq buffer-read-only nil)))
49 ["Insert-Entry-at-Point" (id-tool-invoke 'rolo-yank) t]
50 ["Mail-to-Address" (id-tool-invoke 'rolo-mail-to) t]
51 ["Search-for-Regexp" (id-tool-invoke 'rolo-grep) t]
52 ["Search-for-String" (id-tool-invoke 'rolo-fgrep) t]
53 ["Search-for-Word" (id-tool-invoke 'rolo-word) t]
54 ["Sort-Entries" (id-tool-invoke 'rolo-sort) t]
56 ["Manual" (id-tool-invoke id-man-rolodex) t]
59 ;;; This definition is used by InfoDock only.
60 (defconst id-menubar-wrolo
63 ["Help" describe-mode t]
64 ["Manual" (id-info "(hyperbole.info)Rolo Keys") t]
66 ["Toggle-Read-Only" toggle-read-only t]
67 ["Write (Save as)" write-file t]
69 ["Quit" (id-tool-quit '(kill-buffer nil)) t]
71 '["Edit-Entry-at-Point" rolo-edit-entry t]
72 ["Mail-to-Address" (id-tool-invoke 'rolo-mail-to) t]
74 ["Scroll-Backward" scroll-down t]
75 ["Scroll-Forward" scroll-up t]
76 ["To-Beginning" beginning-of-buffer t]
77 ["To-End" end-of-buffer t]
79 ["To-Next-Entry" outline-next-visible-heading t]
80 ["To-Next-Same-Level" outline-forward-same-level t]
81 ["To-Previous-Entry" outline-previous-visible-heading t]
82 ["To-Previous-Same-Level" outline-backward-same-level t]
83 ["Up-a-Level" outline-up-heading t]
86 ["Hide (Collapse)" hide-subtree t]
87 ["Show (Expand)" show-subtree t]
88 ["Show-All" show-all t]
89 ["Show-Only-First-Line" hide-body t]
91 '["Next-Match" rolo-next-match t]
92 '["Previous-Match" rolo-previous-match t]
96 ;;; This definition is used by InfoDock and XEmacs.
97 (defconst id-popup-wrolo-menu
100 '["Edit-Entry-at-Point" rolo-edit-entry t]
102 '["Next-Match" rolo-next-match t]
103 '["Previous-Match" rolo-previous-match t]
106 ["Scroll-Backward" scroll-down t]
107 ["Scroll-Forward" scroll-up t]
108 ["To-Beginning" beginning-of-buffer t]
109 ["To-End" end-of-buffer t]
111 ["To-Next-Entry" outline-next-visible-heading t]
112 ["To-Next-Same-Level" outline-forward-same-level t]
113 ["To-Previous-Entry" outline-previous-visible-heading t]
114 ["To-Previous-Same-Level" outline-backward-same-level t]
115 ["Up-a-Level" outline-up-heading t]
118 ["Hide (Collapse)" hide-subtree t]
119 ["Show (Expand)" show-subtree t]
120 ["Show-All" show-all t]
121 ["Show-Only-First-Line" hide-body t]
125 '["Help" describe-mode t]
126 '["Manual" (id-info "(hyperbole.info)Rolo Keys") t]
128 '["Quit" (id-tool-invoke 'rolo-quit) t]
135 ;;; This definition is used only by XEmacs and Emacs19.
136 (defun wrolo-menubar-menu ()
137 "Add a Hyperbole Rolodex menu to the rolodex match buffer menubar."
138 (cond ((fboundp 'popup-mode-menu)
139 (setq mode-popup-menu id-popup-wrolo-menu))
141 (define-key wrolo-mode-map 'button3 'wrolo-popup-menu))
142 (t ;; hyperb:emacs19-p
143 (define-key wrolo-mode-map [down-mouse-3] 'wrolo-popup-menu)
144 (define-key wrolo-mode-map [mouse-3] nil)))
145 (if (and (boundp 'current-menubar)
146 (or hyperb:emacs19-p current-menubar)
147 (not (car (find-menu-item current-menubar '("Wrolo")))))
149 (set-buffer-menubar (copy-sequence current-menubar))
150 (if (fboundp 'add-submenu)
151 (add-submenu nil id-popup-wrolo-menu)
152 (add-menu nil (car id-popup-wrolo-menu)
153 (cdr id-popup-wrolo-menu))))))
155 ;;; This definition is used only by XEmacs and Emacs19.
156 (defun wrolo-popup-menu (event)
157 "Popup the Hyperbole Rolodex match buffer menu."
159 (mouse-set-point event)
160 (if (fboundp 'popup-mode-menu)
162 (popup-menu id-popup-wrolo-menu)))
164 (cond ((null hyperb:window-system))
165 ((fboundp 'id-menubar-set)
166 ;; InfoDock under a window system
167 (require 'id-menubars)
168 (id-menubar-set 'wrolo-mode 'id-menubar-wrolo))
170 ;; XEmacs under a window system
171 (add-hook 'wrolo-mode-hook 'wrolo-menubar-menu))
173 ;; Emacs 19 under a window system
177 (easy-menu-define wrolo-mode-menubar-menu wrolo-mode-map "Wrolo-mode menu" id-popup-wrolo-menu)
179 (provide 'wrolo-menu)
181 ;;; wrolo-menu.el ends here