~ubuntu-branches/ubuntu/lucid/sawfish/lucid-updates

« back to all changes in this revision

Viewing changes to themes/mono/theme.jl

  • Committer: Bazaar Package Importer
  • Author(s): Christian Marillat
  • Date: 2002-01-20 17:42:28 UTC
  • Revision ID: james.westby@ubuntu.com-20020120174228-4q1ydztbkvfq1ht2
Tags: upstream-1.0.1.20020116
ImportĀ upstreamĀ versionĀ 1.0.1.20020116

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
;; mono/theme.jl
 
2
;; $Id: theme.jl,v 1.10 2001/02/11 01:33:56 jsh Exp $
 
3
 
 
4
;; Copyright (C) 1999 John Harper <john@dcs.warwick.ac.uk>
 
5
 
 
6
;; This file is part of sawmill.
 
7
 
 
8
;; sawmill is free software; you can redistribute it and/or modify it
 
9
;; under the terms of the GNU General Public License as published by
 
10
;; the Free Software Foundation; either version 2, or (at your option)
 
11
;; any later version.
 
12
 
 
13
;; sawmill is distributed in the hope that it will be useful, but
 
14
;; WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
16
;; GNU General Public License for more details.
 
17
 
 
18
;; You should have received a copy of the GNU General Public License
 
19
;; along with sawmill; see the file COPYING.  If not, write to
 
20
;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
 
21
 
 
22
(defgroup mono "Mono Theme"
 
23
  :group appearance)
 
24
 
 
25
(defcustom mono:normal-color nil
 
26
  "Color of inactive frames (if unset use GTK+ background color)."
 
27
  :type (optional color)
 
28
  :group (appearance mono)
 
29
  :user-level novice
 
30
  :after-set after-setting-frame-option)
 
31
 
 
32
(defcustom mono:active-color nil
 
33
  "Color of active frames (if unset use GTK+ selection color)."
 
34
  :type (optional color)
 
35
  :group (appearance mono)
 
36
  :user-level novice
 
37
  :after-set after-setting-frame-option)
 
38
 
 
39
(defcustom mono:text-justify 'left
 
40
  "Text is \\w justified in window titles."
 
41
  :type (choice left right center)
 
42
  :group (appearance mono)
 
43
  :after-set after-setting-frame-option)
 
44
 
 
45
;; 16x16
 
46
(define minimize `((inactive . ,(make-image "min.png"))
 
47
                   (clicked . ,(make-image "min-c.png"))))
 
48
(define close `((inactive . ,(make-image "close.png"))
 
49
                (clicked . ,(make-image "close-c.png"))))
 
50
(define maximize `((inactive . ,(make-image "max.png"))
 
51
                   (clicked . ,(make-image "max-c.png"))))
 
52
(define restore `((inactive . ,(make-image "restore.png"))
 
53
                  (clicked . ,(make-image "restore-c.png"))))
 
54
(define (maximize-restore w) (if (window-maximized-p w) restore maximize))
 
55
(define menu `((inactive . ,(make-image "menu.png"))
 
56
               (clicked . ,(make-image "menu-c.png"))))
 
57
 
 
58
(define initialised-gtk nil)
 
59
 
 
60
(define (rebuild)
 
61
  (when (and (or (not mono:normal-color)
 
62
                 (not mono:active-color))
 
63
             (not initialised-gtk))
 
64
    (setq initialised-gtk t)
 
65
    (require 'gtkrc)
 
66
    (gtkrc-call-after-changed
 
67
     (lambda () (rebuild-frames-with-style 'mono))))
 
68
  (rebuild-frames-with-style 'mono))
 
69
 
 
70
(define (frame-colors w)
 
71
  (list (or (window-get w 'frame-inactive-color)
 
72
            (and (not mono:normal-color)
 
73
                 (car gtkrc-background))
 
74
            mono:normal-color)
 
75
        (or (window-get w 'frame-active-color)
 
76
            (and (not mono:active-color)
 
77
                 (nth 3 gtkrc-background))
 
78
            mono:active-color)))
 
79
 
 
80
(define (text-justifier w)
 
81
  (case mono:text-justify
 
82
    ((left) 24)
 
83
    ((right) -64)
 
84
    ((center) 'center)))
 
85
 
 
86
(define frame
 
87
  `(((background . ,frame-colors)
 
88
     (foreground . "black")
 
89
     (text . ,window-name)
 
90
     (x-justify . ,text-justifier)
 
91
     (y-justify . center)
 
92
     (left-edge . 0)
 
93
     (right-edge . 0)
 
94
     (top-edge . -21)
 
95
     (height . 21)
 
96
     (class . title))
 
97
 
 
98
    ((background . "black")
 
99
     (left-edge . 0)
 
100
     (right-edge . 0)
 
101
     (top-edge . -22)
 
102
     (height . 1))
 
103
 
 
104
    ((background . "black")
 
105
     (left-edge . -1)
 
106
     (width . 1)
 
107
     (top-edge . -22)
 
108
     (bottom-edge . -5))
 
109
 
 
110
    ((background . "black")
 
111
     (right-edge . -1)
 
112
     (width . 1)
 
113
     (top-edge . -22)
 
114
     (bottom-edge . -5))
 
115
 
 
116
    ((background . ,frame-colors)
 
117
     (left-edge . 0)
 
118
     (right-edge . 0)
 
119
     (bottom-edge . -4)
 
120
     (height . 4)
 
121
     (class . bottom-border))
 
122
 
 
123
    ((background . "black")
 
124
     (left-edge . 0)
 
125
     (right-edge . 0)
 
126
     (bottom-edge . -5)
 
127
     (height . 1))
 
128
 
 
129
    ((background . ,frame-colors)
 
130
     (foreground . ,menu)
 
131
     (left-edge . 4)
 
132
     (top-edge . -18)
 
133
     (width . 16)
 
134
     (height . 16)
 
135
     (class . menu-button)
 
136
     (removable . t))
 
137
 
 
138
    ((background . ,frame-colors)
 
139
     (foreground . ,minimize)
 
140
     (right-edge . 35)
 
141
     (top-edge . -18)
 
142
     (width . 16)
 
143
     (height . 16)
 
144
     (class . iconify-button)
 
145
     (removable . t))
 
146
 
 
147
    ((background . ,frame-colors)
 
148
     (foreground . ,maximize-restore)
 
149
     (right-edge . 19)
 
150
     (top-edge . -18)
 
151
     (width . 16)
 
152
     (height . 16)
 
153
     (class . maximize-button)
 
154
     (removable . t))
 
155
 
 
156
    ((background . ,frame-colors)
 
157
     (foreground . ,close)
 
158
     (right-edge . 0)
 
159
     (top-edge . -18)
 
160
     (width . 19)
 
161
     (height . 16)
 
162
     (class . close-button)
 
163
     (removable . t))))
 
164
 
 
165
(define shaped-frame
 
166
  `(((background . ,frame-colors)
 
167
     (foreground . "black")
 
168
     (text . ,window-name)
 
169
     (x-justify . ,text-justifier)
 
170
     (y-justify . center)
 
171
     (left-edge . 0)
 
172
     (right-edge . 0)
 
173
     (top-edge . -21)
 
174
     (height . 21)
 
175
     (class . title))
 
176
 
 
177
    ((background . "black")
 
178
     (left-edge . 0)
 
179
     (right-edge . 0)
 
180
     (top-edge . -22)
 
181
     (height . 1))
 
182
 
 
183
    ((background . "black")
 
184
     (left-edge . -1)
 
185
     (width . 1)
 
186
     (top-edge . -22)
 
187
     (height . 23))
 
188
 
 
189
    ((background . "black")
 
190
     (right-edge . -1)
 
191
     (width . 1)
 
192
     (top-edge . -22)
 
193
     (height . 23))
 
194
 
 
195
    ((background . "black")
 
196
     (left-edge . 0)
 
197
     (right-edge . 0)
 
198
     (top-edge . 0)
 
199
     (height . 1))
 
200
 
 
201
    ((background . ,frame-colors)
 
202
     (foreground . ,menu)
 
203
     (left-edge . 4)
 
204
     (top-edge . -18)
 
205
     (width . 16)
 
206
     (height . 16)
 
207
     (class . menu-button)
 
208
     (removable . t))
 
209
 
 
210
    ((background . ,frame-colors)
 
211
     (foreground . ,minimize)
 
212
     (right-edge . 35)
 
213
     (top-edge . -18)
 
214
     (width . 16)
 
215
     (height . 16)
 
216
     (class . iconify-button)
 
217
     (removable . t))
 
218
 
 
219
    ((background . ,frame-colors)
 
220
     (foreground . ,maximize-restore)
 
221
     (right-edge . 19)
 
222
     (top-edge . -18)
 
223
     (width . 16)
 
224
     (height . 16)
 
225
     (class . maximize-button)
 
226
     (removable . t))
 
227
 
 
228
    ((background . ,frame-colors)
 
229
     (foreground . ,close)
 
230
     (right-edge . 0)
 
231
     (top-edge . -18)
 
232
     (width . 19)
 
233
     (height . 16)
 
234
     (class . close-button)
 
235
     (removable . t))))
 
236
 
 
237
 
 
238
(define transient-frame
 
239
  `(((background . ,frame-colors)
 
240
     (left-edge . 0)
 
241
     (right-edge . 0)
 
242
     (top-edge . -4)
 
243
     (height . 4)
 
244
     (class . title))
 
245
 
 
246
    ((background . "black")
 
247
     (left-edge . 0)
 
248
     (right-edge . 0)
 
249
     (top-edge . -5)
 
250
     (height . 1))
 
251
 
 
252
    ((background . "black")
 
253
     (left-edge . -1)
 
254
     (width . 1)
 
255
     (top-edge . -5)
 
256
     (bottom-edge . -5))
 
257
 
 
258
    ((background . "black")
 
259
     (right-edge . -1)
 
260
     (width . 1)
 
261
     (top-edge . -5)
 
262
     (bottom-edge . -5))
 
263
 
 
264
    ((background . ,frame-colors)
 
265
     (left-edge . 0)
 
266
     (right-edge . 0)
 
267
     (bottom-edge . -4)
 
268
     (height . 4)
 
269
     (class . bottom-border))
 
270
 
 
271
    ((background . "black")
 
272
     (left-edge . 0)
 
273
     (right-edge . 0)
 
274
     (bottom-edge . -5)
 
275
     (height . 1))))
 
276
 
 
277
(define shaped-transient-frame
 
278
  `(((background . ,frame-colors)
 
279
     (left-edge . 0)
 
280
     (right-edge . 0)
 
281
     (top-edge . -5)
 
282
     (height . 4)
 
283
     (class . title))
 
284
 
 
285
    ((background . "black")
 
286
     (left-edge . 0)
 
287
     (right-edge . 0)
 
288
     (top-edge . -6)
 
289
     (height . 1))
 
290
 
 
291
    ((background . "black")
 
292
     (left-edge . -1)
 
293
     (width . 1)
 
294
     (top-edge . -6)
 
295
     (height . 6))
 
296
 
 
297
    ((background . "black")
 
298
     (right-edge . -1)
 
299
     (width . 1)
 
300
     (top-edge . -6)
 
301
     (height . 6))
 
302
 
 
303
    ((background . "black")
 
304
     (left-edge . 0)
 
305
     (right-edge . 0)
 
306
     (top-edge . -1)
 
307
     (height . 1))))
 
308
 
 
309
(add-frame-style 'mono
 
310
                 (lambda (w type)
 
311
                   (case type
 
312
                     ((default) frame)
 
313
                     ((transient) transient-frame)
 
314
                     ((shaped) shaped-frame)
 
315
                     ((shaped-transient) shaped-transient-frame))))
 
316
 
 
317
(rebuild)
 
318
(custom-set-property 'mono:normal-color ':after-set rebuild)