Coverage report: /home/runner/work/geb/geb/src/gui/show-view.lisp
Kind | Covered | All | % |
expression | 0 | 332 | 0.0 |
branch | 0 | 0 | nil |
Key
Not instrumented
Conditionalized out
Executed
Not executed
Both branches taken
One branch taken
Neither branch taken
3
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
5
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7
(defclass show-view (view)
8
((counter :initform 0 :initarg :counter :accessor counter)))
10
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
12
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
14
;; Has to come before the presentation methods probably due to load order
17
(defmacro with-presenting-alias ((obj pane) &body otherwise)
18
"Presents an alias if it exists, otherwise"
19
(let ((alias (gensym))
21
`(multiple-value-bind (,alias ,in-there) (geb.mixins:meta-lookup ,obj :alias)
23
(surrounding-output-with-border (,pane :shape :rectangle :background +alice-blue+)
24
(formatting-table (,pane)
25
(formatting-row (,pane)
26
(formatting-cell (,pane)
27
(format ,pane "~W" (intern (symbol-name ,alias)))))))
28
(progn ,@otherwise)))))
30
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
31
;;;; Presentation ;;;;
32
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
34
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
35
;; General Presentation
36
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
38
;; TODO Abstract out the dualities better
40
(define-presentation-method present ((object geb:prod)
42
(stream extended-output-stream)
45
(with-presenting-alias (object stream)
46
(surrounding-output-with-border (stream)
47
(formatting-table (stream :x-spacing " ")
49
(dolist (x (serapeum:intersperse nil (geb:same-type-to-list object 'geb:prod)))
50
(formatting-column (stream)
51
(formatting-cell (stream :align-x :center :align-y :center)
53
(present-object x stream)
54
(cross-circle stream 7.5)))))))))
56
(define-presentation-method present ((object geb:coprod)
58
(stream extended-output-stream)
61
(with-presenting-alias (object stream)
62
(surrounding-output-with-border (stream)
63
(formatting-table (stream :x-spacing " ")
65
(dolist (x (serapeum:intersperse nil (geb:same-type-to-list object 'geb:coprod)))
66
(center-column-cell (stream)
68
(present-object x stream)
69
(plus-circle stream 10.5))))))))
71
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
73
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
75
(define-presentation-method present ((object graph:node)
77
(pane extended-output-stream)
80
;; update this to be better later
81
(present-object (graph::value object) pane))
83
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
84
;; Presentation: Box View
85
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
88
(define-presentation-method present ((object geb:project-left)
89
(type geb:project-left)
90
(pane extended-output-stream)
93
(with-presenting-alias (object pane)
94
(formatting-table (pane)
95
(center-column-cell (pane) (present-object
96
(geb:prod (geb:mcar object) (geb:mcadr object))
98
(center-column-cell (pane) (draw-text-arrow* pane "π₁" 0 0 50 0))
99
(center-column-cell (pane) (present-object (geb:mcar object) pane)))))
101
(define-presentation-method present ((object geb:project-right)
102
(type geb:project-right)
103
(pane extended-output-stream)
106
(with-presenting-alias (object pane)
107
(formatting-table (pane)
108
(center-column-cell (pane) (present-object
109
(geb:prod (geb:mcar object) (geb:mcadr object))
111
(center-column-cell (pane) (draw-text-arrow* pane "π₂" 0 0 50 0))
112
(center-column-cell (pane) (present-object (geb:mcadr object) pane)))))
115
(define-presentation-method present ((object geb:inject-left)
116
(type geb:inject-left)
117
(pane extended-output-stream)
120
(with-presenting-alias (object pane)
121
(formatting-table (pane)
122
(center-column-cell (pane) (present-object (geb:mcar object) pane))
123
(center-column-cell (pane) (draw-text-arrow* pane "ι₁" 0 0 50 0))
124
(center-column-cell (pane) (present-object
125
(geb:coprod (geb:mcar object) (geb:mcadr object))
128
(define-presentation-method present ((object geb:inject-right)
129
(type geb:inject-right)
130
(pane extended-output-stream)
133
(with-presenting-alias (object pane)
134
(formatting-table (pane)
135
(center-column-cell (pane) (present-object (geb:mcar object) pane))
136
(center-column-cell (pane) (draw-text-arrow* pane "ι₂" 0 0 50 0))
137
(center-column-cell (pane) (present-object
138
(geb:coprod (geb:mcar object) (geb:mcadr object))
141
(define-presentation-method present ((object geb:terminal)
143
(pane extended-output-stream)
146
(with-presenting-alias (object pane)
147
(formatting-table (pane)
148
(center-column-cell (pane) (present-object (geb:mcar object) pane))
149
(center-column-cell (pane) (draw-text-arrow* pane "" 0 0 50 0))
150
(center-column-cell (pane) (present-object geb:so1 pane)))))
152
(define-presentation-method present ((object geb:init)
154
(pane extended-output-stream)
157
(with-presenting-alias (object pane)
158
(formatting-table (pane)
159
(center-column-cell (pane) (present-object geb:so0 pane))
160
(center-column-cell (pane) (draw-text-arrow* pane "" 0 0 50 0))
161
(center-column-cell (pane) (present-object (geb:mcar object) pane)))))
163
(define-presentation-method present ((object geb:distribute)
164
(type geb:distribute)
165
(pane extended-output-stream)
168
(with-presenting-alias (object pane)
169
(formatting-table (pane)
170
(center-column-cell (pane) (present-object
171
(geb:prod (geb:mcar object)
172
(geb:coprod (geb:mcadr object)
173
(geb:mcaddr object)))
175
(center-column-cell (pane) (draw-text-arrow* pane "Dist" 0 0 50 0))
176
(center-column-cell (pane) (present-object
177
(geb:coprod (geb:prod (geb:mcar object)
179
(geb:prod (geb:mcar object)
180
(geb:mcaddr object)))
183
(define-presentation-method present ((object geb:comp)
185
(pane extended-output-stream)
188
(with-presenting-alias (object pane)
189
(formatting-table (pane)
190
(center-column-cell (pane) (present-object (geb:mcadr object) pane))
191
(center-column-cell (pane) (draw-arrow* pane 0 0 50 0))
192
(center-column-cell (pane) (present-object (geb:mcar object) pane)))))
194
;; Dumb please remove once better system #23 is in.
195
(define-presentation-method present ((object geb:pair)
197
(pane extended-output-stream)
200
(with-presenting-alias (object pane)
201
(surrounding-output-with-border (pane :shape :drop-shadow)
202
(formatting-table (pane)
203
(formatting-row (pane)
204
(formatting-cell (pane :align-x :center)
205
(format pane "Pair")))
206
(formatting-row (pane)
207
(formatting-cell (pane)
208
(present-object (geb.utils:mcar object) pane)))
209
(formatting-row (pane)
210
(formatting-cell (pane)
211
(present-object (geb.utils:mcdr object) pane)))))))
213
(define-presentation-method present ((object geb:case)
215
(pane extended-output-stream)
218
(with-presenting-alias (object pane)
219
(surrounding-output-with-border (pane :shape :drop-shadow)
220
(formatting-table (pane)
221
(formatting-row (pane)
222
(formatting-cell (pane :align-x :center)
223
(format pane "Case")))
224
(formatting-row (pane)
225
(formatting-cell (pane)
226
(present-object (geb.utils:mcar object) pane)))
227
(formatting-row (pane)
228
(formatting-cell (pane)
229
(present-object (geb.utils:mcadr object) pane)))))))
231
(define-presentation-method present ((object geb:<substmorph>)
232
(type geb:<substmorph>)
233
(stream extended-output-stream)
238
(define-presentation-method present ((object geb:<substobj>)
239
(type geb:<substobj>)
240
(stream extended-output-stream)
245
(define-presentation-method present ((object geb:so0)
247
(pane extended-output-stream)
250
(with-presenting-alias (object pane)
253
(define-presentation-method present ((object geb:so1)
255
(pane extended-output-stream)
258
(with-presenting-alias (object pane)
262
(define-presentation-method present ((object symbol)
264
(stream extended-output-stream)
268
(define-presentation-method present ((object string)
270
(stream extended-output-stream)
273
(format stream object))
275
(define-presentation-method present ((object geb.common:reference)
276
(type geb.common:reference)
277
(pane extended-output-stream)
280
(surrounding-output-with-border (pane :shape :rectangle :background +alice-blue+)
281
(formatting-table (pane)
282
(formatting-row (pane)
283
(formatting-cell (pane)
284
(format pane "~W" (intern (symbol-name (geb.utils:name object)))))))))