Browse code
updated CLOS refactoring
Alexey Veretennikov authored on 26/05/2015 20:55:54
Showing 1 changed files
Showing 1 changed files
... | ... |
@@ -98,31 +98,54 @@ |
98 | 98 |
(defun color-theme-args (theme-name) |
99 | 99 |
(rest (color-theme-data theme-name))) |
100 | 100 |
|
101 |
- |
|
102 |
- |
|
103 | 101 |
(defun update-pane-colors (pane foreground background) |
104 | 102 |
(setf (capi:simple-pane-foreground pane) foreground) |
105 | 103 |
(setf (capi:simple-pane-background pane) background) |
106 | 104 |
|
107 | 105 |
(let ((recolorize-p (editor::buffer-font-lock-mode-p (capi:editor-pane-buffer pane)))) |
108 | 106 |
(when recolorize-p |
109 |
- (gp:invalidate-rectangle pane))) |
|
110 |
- (values)) |
|
107 |
+ (gp:invalidate-rectangle pane)))) |
|
108 |
+ |
|
109 |
+ |
|
110 |
+(defgeneric clear-colors (tool) |
|
111 |
+ (:documentation "Clear colors for tool keeping other data untouched")) |
|
112 |
+ |
|
113 |
+(defgeneric update (tool) |
|
114 |
+ (:documentation "Update tool's colors")) |
|
115 |
+ |
|
116 |
+ |
|
117 |
+(defmethod clear-colors ((self editor-panes-theme)) |
|
118 |
+ (with-slots (editor-background editor-foreground) self |
|
119 |
+ (setf editor-background +default-background-color+) |
|
120 |
+ (setf editor-foreground +default-foreground-color+))) |
|
121 |
+ |
|
122 |
+(defmethod clear-colors ((self listener-panes-theme)) |
|
123 |
+ (with-slots (listener-background listener-foreground) self |
|
124 |
+ (setf listener-background +default-background-color+) |
|
125 |
+ (setf listener-foreground +default-foreground-color+))) |
|
126 |
+ |
|
127 |
+(defmethod clear-colors ((self general-panes-theme)) |
|
128 |
+ (with-slots (output-background output-foreground) self |
|
129 |
+ (setf output-background +default-background-color+) |
|
130 |
+ (setf output-foreground +default-foreground-color+))) |
|
131 |
+ |
|
132 |
+ |
|
133 |
+(defmethod update ((self editor-panes-theme)) |
|
134 |
+ (mapcar #'(lambda (pane) |
|
135 |
+ (update-pane-colors pane (fg self) (bg self))) |
|
136 |
+ (editor-panes self))) |
|
137 |
+ |
|
138 |
+(defmethod update ((self listener-panes-theme)) |
|
139 |
+ (mapcar #'(lambda (pane) |
|
140 |
+ (update-pane-colors pane (fg self) (bg self))) |
|
141 |
+ (listener-panes self))) |
|
111 | 142 |
|
112 |
-(defun update-editor-panes () |
|
113 |
- (let ((foreground (fg *editor-tool*)) |
|
114 |
- (background (bg *editor-tool*))) |
|
115 |
- (mapcar #'(lambda (pane) |
|
116 |
- (update-pane-colors pane foreground background)) |
|
117 |
- (editor-panes *editor-tool*)))) |
|
118 | 143 |
|
144 |
+(defmethod update ((self general-panes-theme)) |
|
145 |
+ (mapcar #'(lambda (pane) |
|
146 |
+ (update-pane-colors pane (output-fg self) (output-bg self))) |
|
147 |
+ (output-panes self))) |
|
119 | 148 |
|
120 |
-(defun update-listener-panes () |
|
121 |
- (let ((foreground (fg *listener-tool*)) |
|
122 |
- (background (bg *listener-tool*))) |
|
123 |
- (mapcar #'(lambda (pane) |
|
124 |
- (update-pane-colors pane foreground background)) |
|
125 |
- (listener-panes *listener-tool*)))) |
|
126 | 149 |
|
127 | 150 |
(defun set-color-theme (theme-name) |
128 | 151 |
(destructuring-bind (&rest color-theme-args |
... | ... |
@@ -134,6 +157,11 @@ |
134 | 157 |
&allow-other-keys) |
135 | 158 |
(color-theme-args theme-name) |
136 | 159 |
|
160 |
+ ;; new instances of tools wrappers |
|
161 |
+ (clear-colors *editor-tool*) |
|
162 |
+ (clear-colors *listener-tool*) |
|
163 |
+ (clear-colors *all-tools*) |
|
164 |
+ |
|
137 | 165 |
;; editor foreground and background |
138 | 166 |
(when foreground |
139 | 167 |
(setf (fg *editor-tool*) foreground)) |
... | ... |
@@ -172,8 +200,9 @@ |
172 | 200 |
(mapc 'set-color-theme (color-theme-super-theme-names theme-name)) |
173 | 201 |
(set-color-theme theme-name) |
174 | 202 |
|
175 |
- (update-editor-panes) |
|
176 |
- (update-listener-panes) |
|
203 |
+ (update *editor-tool*) |
|
204 |
+ (update *listener-tool*) |
|
205 |
+ (update *all-tools*) |
|
177 | 206 |
|
178 | 207 |
theme-name) |
179 | 208 |
|