annotate lisp/eos/sun-eos-common.el @ 98:0d2f883870bc r20-1b1

Import from CVS: tag r20-1b1
author cvs
date Mon, 13 Aug 2007 09:13:56 +0200
parents 131b0175ea99
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;; Copyright (C) 1995, Sun Microsystems
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 ;; Light Weight Editor Integration for Sparcworks.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 ;; "Era on Sparcworks" (EOS)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 ;; Author: Eduardo Pelegri-Llopart
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 ;; Please send feedback to eduardo.pelegri-llopart@eng.sun.com
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;; Common routines for EOS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 (defvar eos::version "1.5.2"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 "Version of Eos")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 (defvar eos::left-margin-width 5
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 "size of left margin")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 (defvar eos::stop-color "red"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 "foreground color for stop signs")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 (defvar eos::solid-arrow-color "purple"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 "foreground color for solid arrow")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 (defvar eos::hollow-arrow-color "purple"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 "foreground color for hollow arrow")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 (defvar eos::sbrowse-arrow-color "blue"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 "foreground color for browser glyphs")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 (defun eos::recompute-presentation ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 (set-face-foreground 'stop-face eos::stop-color)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 (set-face-foreground 'solid-arrow-face eos::solid-arrow-color)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 (set-face-foreground 'hollow-arrow-face eos::hollow-arrow-color)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 (set-face-foreground 'sbrowse-arrow-face eos::sbrowse-arrow-color)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 (defvar eos::displayed-initial-message nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 "Whether we have shown the initial display message")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 (defconst eos::startup-message-lines
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 '("Please send feedback to eos-comments@cs.uiuc.edu."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 "The latest Eos news are under SPARCworks->News"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 "See Options->SPARCworks for configuration and Help->SPARCworks for help"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 ;; copied from vm
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 (defun eos::display-initial-message ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 ;; Display initial Eos message - REMOVED
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 (defun eos-old::display-initial-message ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 ;; Display initial Eos message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 (if (not eos::displayed-initial-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 (let ((lines eos::startup-message-lines))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 (message "Eos %s, Copyright (C) 1995 Sun MicroSystems"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 eos::version)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 (setq eos::displayed-initial-message t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 (while (and (sit-for 3) lines)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 (message (car lines))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 (setq lines (cdr lines))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 (message "")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 ;; misc
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 (defun eos::line-at (pos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 ;; At what line is POS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 (goto-char pos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 (1+ (count-lines 1 (point))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 ;; frame-specific enabling
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 ;; will maintain at most one frame to debugger, one to sbrowser
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 ;; annotations have a type, either
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 ;; sbrowser
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 ;; debugger-solid-arrow
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 ;; debugger-holow-arrow
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 ;; debugger-stop
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 ;; debugger-visit
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 ;; adding an annotation of type sbrowser will be only on frame sbrowser
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 ;; adding an annotation of type debugger will be only on frame debugger
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 ;; turn off patterns when there is no frame.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 ;;; Common ToolTalk function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 (defun make-an-observer (op callback)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 (let ((pattern-desc
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 'category 'TT_OBSERVE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 'scope 'TT_SESSION
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 'class 'TT_NOTICE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 'op op
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 'callback callback)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 (make-tooltalk-pattern pattern-desc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 ;;; Frame management
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 (defun eos::log (msg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 (if (fboundp 'ut-log-text)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 (ut-log-text "eos version: %s; %s" eos::version msg)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 (defvar eos::sbrowser-frame nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 (defvar eos::debugger-frame nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 (defun eos::update-specifiers (type old-frame new-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 ;; Change the database for annotations of TYPE, so that OLD-FRAME is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 ;; now using the alternate specifier, while NEW-FRAME uses the main one
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 (let* ((device-type (device-type (selected-device)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 (g (eos::annotation-get-glyph type device-type))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 (im (and (glyphp g) (glyph-image g)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 (new-instantiator (eos::annotation-get-inst type device-type))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 (alt-instantiator (eos::annotation-get-inst-alt type device-type))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 (if (eq device-type 'x)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 (if (frame-live-p old-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 (remove-specifier im old-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 (add-spec-to-specifier im alt-instantiator old-frame)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 (if new-frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 (add-spec-to-specifier im new-instantiator new-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 ))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 (defun eos::select-sbrowser-frame (frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 (require 'eos-toolbar "sun-eos-toolbar")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 (let ((toolbar (eos::toolbar-position)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 (eos::display-initial-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 ;; logging
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 (if frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 (eos::log "selected frame for sbrowser")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 (eos::log "unselected frame for sbrowser"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 ;; TT patterns
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 ((and (null eos::sbrowser-frame) frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 (eos::register-sbrowser-patterns))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 ((and (null frame) eos::sbrowser-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 (eos::unregister-sbrowser-patterns)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 ;; adjust toolbars
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 (if (frame-live-p eos::sbrowser-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 (remove-specifier toolbar eos::sbrowser-frame))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 (if (frame-live-p eos::debugger-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 (remove-specifier toolbar eos::debugger-frame))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 ;; then add
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 ((and (frame-live-p eos::debugger-frame) (frame-live-p frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 (equal eos::debugger-frame frame))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 (add-spec-to-specifier toolbar eos::debugger-sbrowser-toolbar frame))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 ((and (frame-live-p eos::debugger-frame) (frame-live-p frame))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 (add-spec-to-specifier toolbar eos::sbrowser-toolbar frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 (add-spec-to-specifier toolbar eos::debugger-toolbar eos::debugger-frame))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 ((frame-live-p frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 (add-spec-to-specifier toolbar eos::sbrowser-toolbar frame))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 ((frame-live-p eos::debugger-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 (add-spec-to-specifier toolbar eos::debugger-toolbar eos::debugger-frame))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 ;; adjust specifiers for glyphs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 (eos::update-specifiers 'sbrowser eos::sbrowser-frame frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 (if (frame-live-p eos::sbrowser-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 (remove-specifier use-left-overflow eos::sbrowser-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 (remove-specifier left-margin-width eos::sbrowser-frame)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 (if (frame-live-p frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 (add-spec-to-specifier use-left-overflow t frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 (add-spec-to-specifier left-margin-width eos::left-margin-width frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 (add-spec-to-specifier left-margin-width 0 (minibuffer-window))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 (if (frame-live-p eos::debugger-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 (add-spec-to-specifier use-left-overflow t eos::debugger-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 (add-spec-to-specifier left-margin-width eos::left-margin-width eos::debugger-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 (add-spec-to-specifier left-margin-width 0 (minibuffer-window))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 (setq eos::sbrowser-frame frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 (set-menubar-dirty-flag)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 (defun eos::select-debugger-frame (frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 (require 'eos-toolbar "sun-eos-toolbar")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 (let ((toolbar (eos::toolbar-position)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 (eos::display-initial-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 (eos::ensure-debugger-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 (bury-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 ;; logging
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 (if frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 (eos::log "selected frame for debugger")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 (eos::log "unselected frame for debugger"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 ;; TT patterns
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 ((and (null eos::debugger-frame) frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 (eos::register-debugger-patterns)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 (eos::register-visit-file-pattern))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 ((and (null frame) eos::debugger-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 (eos::unregister-debugger-patterns)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 (eos::unregister-visit-file-pattern)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 ;; adjust toolbars, remove
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 (if (frame-live-p eos::sbrowser-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 (remove-specifier toolbar eos::sbrowser-frame))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 (if (frame-live-p eos::debugger-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 (remove-specifier toolbar eos::debugger-frame))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 ;; then add
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 ((and (frame-live-p eos::sbrowser-frame) (frame-live-p frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 (equal eos::sbrowser-frame frame))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 (add-spec-to-specifier toolbar eos::debugger-sbrowser-toolbar frame))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 ((and (frame-live-p eos::sbrowser-frame) (frame-live-p frame))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 (add-spec-to-specifier toolbar eos::debugger-toolbar frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 (add-spec-to-specifier toolbar eos::sbrowser-toolbar eos::sbrowser-frame))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 ((frame-live-p frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 (add-spec-to-specifier toolbar eos::debugger-toolbar frame))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 ((frame-live-p eos::sbrowser-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 (add-spec-to-specifier toolbar eos::sbrowser-toolbar eos::sbrowser-frame))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 ;; update glyph specifiers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 (eos::update-specifiers 'debugger-solid-arrow eos::debugger-frame frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 (eos::update-specifiers 'debugger-hollow-arrow eos::debugger-frame frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 (eos::update-specifiers 'debugger-stop eos::debugger-frame frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 (if (frame-live-p eos::debugger-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 (remove-specifier use-left-overflow eos::debugger-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 (remove-specifier left-margin-width eos::debugger-frame)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 (if (frame-live-p frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 (add-spec-to-specifier use-left-overflow t frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 (add-spec-to-specifier left-margin-width eos::left-margin-width frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 (add-spec-to-specifier left-margin-width 0 (minibuffer-window))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 (if (frame-live-p eos::sbrowser-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 (add-spec-to-specifier use-left-overflow t eos::sbrowser-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 (add-spec-to-specifier left-margin-width eos::left-margin-width eos::sbrowser-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 (add-spec-to-specifier left-margin-width 0 (minibuffer-window))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 (setq eos::debugger-frame frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 (set-menubar-dirty-flag)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 ;; HERE use file-truename
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 (defun eos::select-frame (type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 ;; Select a frame; return nil if should skip
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 (cond ((eq type 'sbrowser)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 (if (frame-live-p eos::sbrowser-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 eos::sbrowser-frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 (message "selecting destroyed frame; will ignore")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 (eos::select-sbrowser-frame nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 ((or (eq type 'debugger-solid-arrow)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 (eq type 'debugger-hollow-arrow)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 (eq type 'debugger-stop)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 (eq type 'debugger-visit))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 (if (frame-live-p eos::debugger-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 eos::debugger-frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 (message "selecting destroyed frame; will ignore")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 (eos::select-debugger-frame nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 (t (selected-frame))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 (defun eos::select-window (win)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 ;; Will select a window if it is not showing neither of eos::debugger-buffer or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 ;; eos::toolbar-buffer"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 (let ((name (buffer-name (window-buffer win))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 (if (and (>= (length name) 4)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 (equal (substring name 0 4) "*Eos"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 (select-window win)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 (throw 'found t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 )))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 (defun eos::find-line (file line type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 ;; Show FILE at LINE; returns frame or nil if inappropriate
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 ;; if type is nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 (if (eos::null-file file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 (selected-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 (let ((sc (eos::select-frame type))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 (win (selected-window)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 (if (null sc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 (select-frame sc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 (if (catch 'found
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 (eos::select-window (selected-window))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 (walk-windows 'eos::select-window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 nil ; do nothing, already there
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 (select-window win)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 (split-window-vertically)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 (other-window 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 (switch-to-buffer (find-file-noselect file t)) ;; no warn!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 (if (eq (device-type) 'x) (x-disown-selection))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 (goto-line line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 sc
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 ))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 (defun eos::null-file (file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 ;; returns t if FILE is nil or the empty string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 (or (null file) (equal file "")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 ;;; Annotation handling
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 (defun eos::valid-annotation (annotation)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 ;; returns t if ANNOTATION is an annotation and its buffer exists
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 (and (annotationp annotation)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 (bufferp (extent-buffer annotation))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 (buffer-name (extent-buffer annotation)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 (defvar eos::annotation-list nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 "list of annotations set")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 (defun eos::add-to-annotation-list (ann type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 (if (not (eq type 'debugger-stop))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 (error "not implemented"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 (setq eos::annotation-list (cons ann
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 eos::annotation-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 (defun eos::remove-from-annotation-list (ann type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 (if (not (eq type 'debugger-stop))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 (error "not implemented"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 (setq eos::annotation-list (delq ann eos::annotation-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 (defun eos::remove-all-from-annotation-list (type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 (if (not (eq type 'debugger-stop))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 (error "not implemented"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 (mapcar (function (lambda (annot)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 (if (extent-live-p annot)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 (delete-annotation annot))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 eos::annotation-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 (setq eos::annotation-list nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 (defun eos::add-annotation (type file line uid)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 (let ((anot nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 (fr (selected-frame))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 (win (selected-window))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 (if (eos::null-file file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 (setq anot nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 (if (null (eos::find-line file line type))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 (error "No frame to select"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 (let* ((device-type (device-type (selected-device)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 (graphics (eos::annotation-get-glyph type device-type))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 (face (eos::annotation-get-face type device-type))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 )
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
361 (setq anot (make-annotation graphics (point) 'outside-margin))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 (set-annotation-data anot uid)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 (set-extent-face anot face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 (eos::add-to-annotation-list anot type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 (select-frame fr)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 (select-window win)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 anot
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 (defun eos::compare-uid (extent uid)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 (and (annotationp extent)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 (equal (annotation-data extent) uid)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 extent))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 (defun eos::delete-annotation (type file line uid)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 ;; ignore file and line, they are here for backward compatibility
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 (let ((anot nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 (alist eos::annotation-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 (if (not (eq type 'debugger-stop))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 (error "not implemented"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 (while (and alist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 (not (equal (annotation-data (car alist)) uid)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 (setq alist (cdr alist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 (if (null alist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 (error "Event UID not found; ignored")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 (setq anot (car alist))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 (delete-annotation anot)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 (eos::remove-from-annotation-list anot type))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 ;; probably type should not be given here... (already stored in the annotation-data
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 ;; field) but it is a bit more robust this way.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 (defun eos::make-annotation-visible (annotation file line type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 ;; returns nil or moves the ANNOTATION to FILE and LINE; annotation is of TYPE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 (let ((back nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 (fr (selected-frame))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 (win (selected-window))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 ;; (save-window-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 (if (not (eos::null-file file))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 (if (eos::valid-annotation annotation)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 (detach-extent annotation) ; should operate on annotations
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 (if (null (eos::find-line file line type))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 (error "No frame to select"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 (let* ((device-type (device-type (selected-device)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 (graphics (eos::annotation-get-glyph type device-type))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 (face (eos::annotation-get-face type device-type))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 (if (and (eos::valid-annotation annotation)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 (extent-detached-p annotation))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 (setq back (insert-extent annotation (point) (point) t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 (set-annotation-glyph back graphics 'whitespace)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 (setq back (make-annotation graphics (point) 'whitespace))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 (set-annotation-data back type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 (set-extent-face back face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 )))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 ;; )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 (if (not (eq (selected-frame) fr))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 (select-frame fr))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 (select-window win)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 back
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 (defun eos::make-annotation-invisible (annotation)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 ;; make this ANNOTATION invisible
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 (if (eos::valid-annotation annotation)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 (detach-extent annotation) ;; should operate on annotations
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439 ;; mapping between annotation types and their screen representations.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441 (defvar eos::alist-annotation-glyph nil) ; assoc list of annotation type
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 ; device type, and glyph
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443 (defvar eos::alist-annotation-inst nil) ; assoc list of annotation type
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 ; device type, and instantiator
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445 (defvar eos::alist-annotation-inst-alt nil) ; alternate assoc list of annotation type
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446 ; device type, and instantiator
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 (defvar eos::alist-annotation-face nil) ;; assoc list of annotation type,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 ;; device type and face
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 ;; PUBLIC
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 ;; TBD! merge both instance lists.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455 (defun eos::annotation-set-inst (annotation-type device-type inst inst-alt)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 "define the instantiator for ANNOTATION-TYPE on DEVICE-TYPE to be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 INST for the frame enabled for this type and INST-ALT for other frames"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459 (setq eos::alist-annotation-inst
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460 (cons (cons (cons annotation-type device-type) inst)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461 eos::alist-annotation-inst))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462 (setq eos::alist-annotation-inst-alt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463 (cons (cons (cons annotation-type device-type) inst-alt)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464 eos::alist-annotation-inst-alt)) )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466 (defun eos::annotation-set-face (annotation-type device-type face-1 face-2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467 "define the face for ANNOTATION-TYPE on DEVICE-TYPE to be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468 FACE-1 for the frame enabled for this type and FACE-2 for other frames"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470 (setq eos::alist-annotation-face
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 (cons (cons (cons annotation-type device-type) face-1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 eos::alist-annotation-face))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475 ;; PRIVATE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477 (defun eos::annotation-get-glyph (annotation-type device-type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 ;; Get the glyph for ANNOTATION-TYPE on DEVICE-TYPE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480 (let ((found (assoc (cons annotation-type device-type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481 eos::alist-annotation-glyph)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 (if found
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483 (cdr found)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 (let ((inst (eos::annotation-get-inst annotation-type device-type))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 (alt-inst (eos::annotation-get-inst-alt annotation-type device-type))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 (glyph nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 (frame (selected-frame)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 (if (null inst)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 (setq glyph (make-glyph `((global . (nil . ,alt-inst)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 (add-spec-to-specifier (glyph-image glyph) inst frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 (setq eos::alist-annotation-glyph
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493 (cons (cons (cons annotation-type device-type) glyph)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 eos::alist-annotation-glyph))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 glyph))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 )))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498 (defun eos::annotation-get-inst (annotation-type device-type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499 ;; Get the primary instantiator for ANNOTATION-TYPE on DEVICE-TYPE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 (let ((found (assoc (cons annotation-type device-type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 eos::alist-annotation-inst)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 (if found
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 (cdr found)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 (defun eos::annotation-get-inst-alt (annotation-type device-type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 ;; Get the alternate instantiator for ANNOTATION-TYPE on DEVICE-TYPE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510 (let ((found (assoc (cons annotation-type device-type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511 eos::alist-annotation-inst-alt)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512 (if found
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513 (cdr found)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514 nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516 (defun eos::annotation-get-face (annotation-type device-type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517 ;; Get the face for ANNOTATION-TYPE on DEVICE-TYPE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519 (let ((found (assoc (cons annotation-type device-type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520 eos::alist-annotation-face))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522 (if found
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523 (cdr found)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529 (defun eos::common-startup () )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533 (provide 'eos-common)