Browse code
Initial commit
Ed Langley authored on 13/12/2017 02:01:04
Showing 2 changed files
Showing 2 changed files
1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,7 @@ |
1 |
+* What Is This??? |
|
2 |
+ |
|
3 |
+An experiment with Lispworks CAPI to create a Lisp listener with a |
|
4 |
+space for dynamically created components: think a widget that runs |
|
5 |
+your tests and displays the results. The idea is to provide a |
|
6 |
+repl-like gui that can be adjusted as necessary to suit one's |
|
7 |
+immediate needs. |
0 | 8 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,59 @@ |
1 |
+(defpackage :fancy-listener |
|
2 |
+ (:use :cl :fl-user) |
|
3 |
+ (:export :row :column :button :stream-disp)) |
|
4 |
+ |
|
5 |
+(defpackage :fl-user |
|
6 |
+ (:use :cl :fancy-listener) |
|
7 |
+ (:export *interface-layout*)) |
|
8 |
+(in-package :fl-user) |
|
9 |
+ |
|
10 |
+(defvar *interface-layout* nil) |
|
11 |
+ |
|
12 |
+(defmacro with-pp ((pane) &body body) |
|
13 |
+ `(capi:apply-in-pane-process ,pane |
|
14 |
+ (lambda () |
|
15 |
+ ,@body))) |
|
16 |
+ |
|
17 |
+(defun push-widget (widget) |
|
18 |
+ (when *interface-layout* |
|
19 |
+ (with-pp (*interface-layout*) |
|
20 |
+ (when (capi:layout-description *interface-layout*) |
|
21 |
+ (push :divider (capi:layout-description *interface-layout*))) |
|
22 |
+ (push widget (capi:layout-description *interface-layout*))))) |
|
23 |
+ |
|
24 |
+(defun pop-widget () |
|
25 |
+ (when *interface-layout* |
|
26 |
+ (with-pp (*interface-layout*) |
|
27 |
+ (pop (capi:layout-description *interface-layout*))))) |
|
28 |
+ |
|
29 |
+(in-package :fancy-listener) |
|
30 |
+ |
|
31 |
+(defun row (&rest components) |
|
32 |
+ (make-instance 'capi:row-layout :children components)) |
|
33 |
+ |
|
34 |
+(defun column (&rest components) |
|
35 |
+ (make-instance 'capi:column-layout :children components)) |
|
36 |
+ |
|
37 |
+(defun button (cb &optional (text "Go!")) |
|
38 |
+ (make-instance 'capi:push-button |
|
39 |
+ :text text |
|
40 |
+ :callback cb)) |
|
41 |
+ |
|
42 |
+(defun stream-disp () |
|
43 |
+ (let ((out-pane (make-instance 'capi:collector-pane))) |
|
44 |
+ (values out-pane |
|
45 |
+ (capi:collector-pane-stream out-pane)))) |
|
46 |
+ |
|
47 |
+(defun listener-pane () |
|
48 |
+ (make-instance 'capi:listener-pane)) |
|
49 |
+ |
|
50 |
+ |
|
51 |
+(defun interface () |
|
52 |
+ (setf *interface-layout* (column)) |
|
53 |
+ (let* ((listener-pane (listener-pane)) |
|
54 |
+ (result (make-instance 'capi:interface |
|
55 |
+ :layout (row listener-pane |
|
56 |
+ :divider |
|
57 |
+ *interface-layout*)))) |
|
58 |
+ (capi:interactive-pane-execute-command listener-pane "(in-package :fl-user)") |
|
59 |
+ result)) |