4 ;; SUMMARY: Site OO-Browser per Emacs session initialization.
5 ;; USAGE: GNU Emacs Lisp Library
6 ;; KEYWORDS: local, oop, tools
11 ;; ORIG-DATE: 18-May-90
12 ;; LAST-MOD: 9-Jun-99 at 18:05:14 by Bob Weiner
14 ;; Copyright (C) 1990-1995, 1997, 1998 BeOpen.com
15 ;; See the file BR-COPY for license information.
17 ;; This file is part of the OO-Browser.
22 ;;; ************************************************************************
24 ;;; ************************************************************************
26 (defvar smart-scroll-proportional t
27 "*Non-nil means Smart Keys should scroll relative to current line when pressed at the end of a line.
28 Action Key moves current line to top of window. Assist Key moves current
29 line to bottom of window. Repeated presses then scroll up or down a
30 windowful. Nil value instead ignores current line and always scrolls up or
33 ;;; ************************************************************************
35 ;;; ************************************************************************
37 (defun br-setup-internal ()
38 "Site customizable function to configure the OO-Browser for Emacs-based editing.
39 This must be run after \"br-init\" has been loaded."
40 (setq br-editor-cmd nil br-ed1 nil br-ed2 nil))
42 (defun br-setup-external ()
43 "Site customizable function to configure the OO-Browser for non-Emacs editing.
44 This must be run after \"br-init\" has been loaded."
45 (setq br-editor-cmd "xterm"
46 br-ed1 "-e" br-ed2 "vi"
47 ;; In general, users will want to view within the textual browser
48 ;; itself, even when using an external editor.
49 ;; br-viewer-cmd "xterm"
50 ;; br-vw1 "-e" br-vw2 "more"
53 (defun br-setup-mouse-keys ()
54 "Binds the Action Key within OO-Browser listing buffers under XEmacs and GNU Emacs."
55 ;; Do nothing when running in batch mode.
56 (if (or noninteractive (featurep 'infodock))
60 (if (= hyperb:mouse-buttons 2)
61 ;; With 2 mouse buttons, we have to use the left as the Action Key.
62 ;; We move the mouse-set-point command to shift-left.
64 (define-key br-mode-map [S-down-mouse-1] 'mouse-drag-region)
65 (define-key br-mode-map [S-mouse-1] 'mouse-set-point)
66 (define-key br-mode-map [down-mouse-1] 'action-key-depress-emacs19)
67 (define-key br-mode-map [mouse-1] 'action-mouse-key-emacs19)
68 (define-key br-mode-map [double-mouse-1] 'action-mouse-key-emacs19)
69 (define-key br-mode-map [triple-mouse-1] 'action-mouse-key-emacs19)
70 (define-key br-mode-map [vertical-line down-mouse-1]
71 'action-key-depress-emacs19)
72 (define-key br-mode-map [vertical-line mouse-1]
73 'action-mouse-key-emacs19))
75 (define-key br-mode-map [down-mouse-2] 'action-key-depress-emacs19)
76 (define-key br-mode-map [mouse-2] 'action-mouse-key-emacs19)
77 (define-key br-mode-map [double-mouse-2] 'action-mouse-key-emacs19)
78 (define-key br-mode-map [triple-mouse-2] 'action-mouse-key-emacs19)
79 (define-key br-mode-map [vertical-line down-mouse-2]
80 'action-key-depress-emacs19)
81 (define-key br-mode-map [vertical-line mouse-2]
82 'action-mouse-key-emacs19)))
86 ;; Set mouse bindings under XEmacs, even if not under a window
87 ;; system since it can have frames on ttys and windowed displays at
90 (if (= hyperb:mouse-buttons 2)
91 ;; With 2 mouse buttons, we have to use the left as the Action Key.
92 ;; We move the mouse-set-point command to shift-left.
93 (progn (define-key br-mode-map '(shift button1)
94 (lookup-key global-map 'button1))
95 (define-key br-mode-map '(shift button1up)
96 (lookup-key global-map 'button1up))
97 (define-key br-mode-map 'button1 'action-key-depress)
98 (define-key br-mode-map 'button1up 'action-mouse-key))
99 (define-key br-mode-map 'button2 'action-key-depress)
100 (define-key br-mode-map 'button2up 'action-mouse-key))))))
102 (defun br-site-after-term-init ()
107 (br-setup-mouse-keys))
109 ;; DON'T PUT IN br-init.el
114 (setq c++-cpp-include-dirs '("/usr/include/")
117 (function (lambda (dir) (if (file-exists-p dir) dir)))
118 '("/usr/include/X11/" "/usr/openwin/include/X11/"))))))
121 (br-site-after-term-init)
122 (if hyperb:window-system (require 'br-tree))
124 ;; Add global browser-related keys.
126 ;; Adds or replaces class entry in an Environment
127 ; (global-set-key "\C-c^" 'br-add-class-file)
129 ;; Goes to and from class viewer window
130 (global-set-key "\C-c\C-v" 'br-to-from-viewer)
132 ;; Completes symbols using OO-Browser Environments when available.
133 (global-set-key "\M-\C-i" 'br-complete-symbol)
135 ;; Add mode-specific browser-related keys.
137 (if (locate-file "c++-browse.elc" load-path)
142 (define-key c++-mode-map "\C-c\M-j" 'br-feature-edit-declaration)
143 (define-key c++-mode-map "\C-c\M-f" 'br-find)
144 (define-key c++-mode-map "\C-\M-i" 'br-complete-symbol)
145 (define-key c++-mode-map "\C-c\M-w" 'br-where)
146 ;; Prevent these bindings from interfering with the global
147 ;; OO-Browser bindings.
148 (define-key c++-mode-map "\C-c\C-o" nil)
149 (define-key c++-mode-map "\C-c\C-v" nil)
150 (if (boundp 'c-mode-map)
151 (progn (define-key c-mode-map "\C-c\C-o" nil)
152 (define-key c-mode-map "\C-c\C-v" nil)))))))
154 (if (locate-file "eif-browse.elc" load-path)
159 (define-key eiffel-mode-map "\C-c\M-f" 'br-find)
160 (define-key eiffel-mode-map "\C-\M-i" 'br-complete-symbol)
161 (define-key eiffel-mode-map "\C-c\M-w" 'br-where)))))
163 (if (locate-file "java-brows.elc" load-path)
168 (define-key java-mode-map "\C-c\M-f" 'br-find)
169 (define-key java-mode-map "\C-\M-i" 'br-complete-symbol)
170 (define-key java-mode-map "\C-c\M-w" 'br-where)
171 (define-key java-mode-map "\C-c\C-o" nil)
172 (define-key java-mode-map "\C-c\C-v" nil)
173 (if (boundp 'c-mode-map)
174 ;; Prevent these bindings from interfering with the global
175 ;; OO-Browser bindings.
176 (progn (define-key c-mode-map "\C-c\C-o" nil)
177 (define-key c-mode-map "\C-c\C-v" nil)))))))
179 (if (locate-file "clos-brows.elc" load-path)
184 (define-key lisp-mode-map "\C-c\M-f" 'br-find)
185 (define-key lisp-mode-map "\C-\M-i" 'br-complete-symbol)
186 (define-key lisp-mode-map "\C-c\M-w" 'br-where)))))
188 (if (locate-file "objc-brows.elc" load-path)
193 (define-key objc-mode-map "\C-c\M-f" 'br-find)
194 (define-key objc-mode-map "\C-\M-i" 'br-complete-symbol)
195 (define-key objc-mode-map "\C-c\M-w" 'br-where)
196 (if (boundp 'c-mode-map)
197 ;; Prevent these bindings from interfering with the global
198 ;; OO-Browser bindings.
199 (progn (define-key c-mode-map "\C-c\C-o" nil)
200 (define-key c-mode-map "\C-c\C-v" nil)))))))
202 (if (locate-file "pyth-brows.elc" load-path)
207 (let ((keymap (if (and (boundp 'py-mode-map) (keymapp py-mode-map))
210 (define-key keymap "\C-c\M-f" 'br-find)
211 (define-key keymap "\C-\M-i" 'br-complete-symbol)
212 (define-key keymap "\C-c\M-w" 'br-where)
213 ;; Prevent these bindings from interfering with the global
214 ;; OO-Browser bindings.
215 (define-key keymap "\C-c\C-o" nil)
216 (define-key keymap "\C-c\C-v" nil))))))
218 (if (locate-file "smt-browse.elc" load-path)
223 (define-key smalltalk-mode-map "\C-c\M-f" 'br-find)
224 (define-key smalltalk-mode-map "\C-\M-i" 'br-complete-symbol)
225 (define-key smalltalk-mode-map "\C-c\M-w" 'br-where)))))