Browse code
added objects instead of global arrays
Alexey Veretennikov authored on 25/05/2015 22:31:30
Showing 1 changed files
Showing 1 changed files
... | ... |
@@ -54,15 +54,26 @@ |
54 | 54 |
:incremental-search-other-matches-face |
55 | 55 |
)) |
56 | 56 |
|
57 |
-(defvar *all-editor-panes* nil) |
|
58 | 57 |
|
59 |
-(defvar *all-listener-editor-panes* nil) |
|
60 | 58 |
|
61 |
-(defvar *all-collector-panes* nil) |
|
62 |
- |
|
59 |
+(defclass editor-panes-theme () |
|
60 |
+ ((editor-panes :initform nil :accessor editor-panes) |
|
61 |
+ (output-panes :initform nil :accessor output-panes))) |
|
62 |
+ |
|
63 |
+(defclass listener-panes-theme () |
|
64 |
+ ((listener-panes :initform nil :accessor listener-panes))) |
|
65 |
+ |
|
66 |
+ |
|
67 |
+(defclass general-panes-theme () |
|
68 |
+ ((output-panes :initform nil :accessor output-panes))) |
|
69 |
+ |
|
70 |
+(defvar *editor-tool* (make-instance 'editor-panes-theme)) |
|
71 |
+(defvar *listener-tool* (make-instance 'listener-panes-theme)) |
|
72 |
+(defvar *all-tools* (make-instance 'general-panes-theme)) |
|
63 | 73 |
|
64 | 74 |
;; (eq (capi:capi-object-name b) 'lw-tools::buffers-list) |
65 | 75 |
|
76 |
+ |
|
66 | 77 |
(defun all-color-themes () |
67 | 78 |
(maphash #'(lambda (key value) |
68 | 79 |
(declare (ignore value)) |
... | ... |
@@ -98,7 +109,7 @@ |
98 | 109 |
(background (gethash :background-color *current-colors*))) |
99 | 110 |
(mapcar #'(lambda (pane) |
100 | 111 |
(update-pane-colors pane foreground background)) |
101 |
- *all-editor-panes*))) |
|
112 |
+ (editor-panes *editor-tool*)))) |
|
102 | 113 |
|
103 | 114 |
|
104 | 115 |
(defun update-listener-panes () |
... | ... |
@@ -106,12 +117,13 @@ |
106 | 117 |
(background (gethash :listener-background-color *current-colors*))) |
107 | 118 |
(mapcar #'(lambda (pane) |
108 | 119 |
(update-pane-colors pane foreground background)) |
109 |
- *all-listener-editor-panes*)) |
|
120 |
+ (listener-panes *listener-tool*))) |
|
110 | 121 |
(let ((foreground (gethash :output-foreground-color *current-colors*)) |
111 | 122 |
(background (gethash :output-background-color *current-colors*))) |
112 | 123 |
(mapcar #'(lambda (pane) |
113 | 124 |
(update-pane-colors pane foreground background)) |
114 |
- *all-collector-panes*))) |
|
125 |
+ (output-panes *all-tools*)))) |
|
126 |
+ |
|
115 | 127 |
|
116 | 128 |
|
117 | 129 |
|
... | ... |
@@ -194,7 +206,7 @@ |
194 | 206 |
(typecase pane |
195 | 207 |
(capi:collector-pane |
196 | 208 |
(progn |
197 |
- (pushnew pane *all-collector-panes*) |
|
209 |
+ (pushnew pane (output-panes *all-tools*)) |
|
198 | 210 |
(let ((bg-color (gethash :output-background-color *current-colors*)) |
199 | 211 |
(fg-color (gethash :output-foreground-color *current-colors*))) |
200 | 212 |
(when fg-color |
... | ... |
@@ -203,7 +215,7 @@ |
203 | 215 |
(setf (capi:simple-pane-background pane) bg-color))))) |
204 | 216 |
(capi:editor-pane |
205 | 217 |
(progn |
206 |
- (pushnew pane *all-editor-panes*) |
|
218 |
+ (pushnew pane (editor-panes *editor-tool*)) |
|
207 | 219 |
(let ((bg-color (gethash :background-color *current-colors*)) |
208 | 220 |
(fg-color (gethash :foreground-color *current-colors*))) |
209 | 221 |
(when fg-color |
... | ... |
@@ -216,7 +228,7 @@ |
216 | 228 |
(typecase pane |
217 | 229 |
(capi:editor-pane |
218 | 230 |
(progn |
219 |
- (pushnew pane *all-listener-editor-panes*) |
|
231 |
+ (pushnew pane (listener-panes *listener-tool*)) |
|
220 | 232 |
(let ((bg-color (gethash :listener-background-color *current-colors*)) |
221 | 233 |
(fg-color (gethash :listener-foreground-color *current-colors*))) |
222 | 234 |
(when fg-color |
... | ... |
@@ -228,7 +240,7 @@ |
228 | 240 |
(defun set-collector-pane-colors (pane) |
229 | 241 |
;; only for listener output panes |
230 | 242 |
;(when (typep (capi:top-level-interface o) 'lw-tools:listener) |
231 |
- (pushnew pane *all-collector-panes*) |
|
243 |
+ (pushnew pane (output-panes *all-tools*)) |
|
232 | 244 |
(let ((bg-color (gethash :output-background-color *current-colors*)) |
233 | 245 |
(fg-color (gethash :output-foreground-color *current-colors*))) |
234 | 246 |
(when fg-color |
... | ... |
@@ -237,8 +249,6 @@ |
237 | 249 |
(setf (capi:simple-pane-background pane) bg-color)))) |
238 | 250 |
|
239 | 251 |
|
240 |
- |
|
241 |
- |
|
242 | 252 |
(lispworks:defadvice ((method capi:interface-display :before (lw-tools:editor)) |
243 | 253 |
change-editor-colors |
244 | 254 |
:before |
... | ... |
@@ -270,7 +280,7 @@ |
270 | 280 |
(not (eq obj (hcl:class-prototype (class-of obj)))))) |
271 | 281 |
|
272 | 282 |
(defun cache-existing-pane (pane) |
273 |
- (pushnew pane *all-editor-panes*)) |
|
283 |
+ (pushnew pane (editor-panes *editor-tool*))) |
|
274 | 284 |
|
275 | 285 |
(defun cache-if-pane (obj) |
276 | 286 |
(when (is-editor-pane-p obj) |