Subversion Repositories Kolibri OS

Rev

Rev 1362 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1362 Rev 1376
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                              ;;
2
;;                                                              ;;
3
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
4
;; Distributed under terms of the GNU General Public License    ;;
4
;; Distributed under terms of the GNU General Public License    ;;
5
;;                                                              ;;
5
;;                                                              ;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7
 
7
 
8
$Revision: 1362 $
8
$Revision: 1376 $
9
 
9
 
10
 
10
 
11
include "skindata.inc"
11
include "skindata.inc"
12
 
12
 
13
;skin_data = 0x00778000
13
;skin_data = 0x00778000
14
 
14
 
15
read_skin_file:
15
read_skin_file:
16
        stdcall load_file, ebx
16
        stdcall load_file, ebx
17
        test    eax, eax
17
        test    eax, eax
18
        jz      .notfound
18
        jz      .notfound
19
        cmp     dword [eax], 'SKIN'
19
        cmp     dword [eax], 'SKIN'
20
        jnz     .noskin
20
        jnz     .noskin
21
        cmp     ebx, 32*1024
21
        cmp     ebx, 32*1024
22
        jb      @f
22
        jb      @f
23
        mov     ebx, 32*1024
23
        mov     ebx, 32*1024
24
@@:
24
@@:
25
        lea     ecx, [ebx+3]
25
        lea     ecx, [ebx+3]
26
        shr     ecx, 2
26
        shr     ecx, 2
27
        mov     esi, eax
27
        mov     esi, eax
28
        mov     edi, skin_data
28
        mov     edi, skin_data
29
        rep     movsd
29
        rep     movsd
30
        stdcall kernel_free, eax
30
        stdcall kernel_free, eax
31
 
31
 
32
        call    parse_skin_data
32
        call    parse_skin_data
33
        xor     eax, eax
33
        xor     eax, eax
34
        ret
34
        ret
35
.notfound:
35
.notfound:
36
        xor     eax, eax
36
        xor     eax, eax
37
        inc     eax
37
        inc     eax
38
        ret
38
        ret
39
.noskin:
39
.noskin:
40
        stdcall kernel_free, eax
40
        stdcall kernel_free, eax
41
        push    2
41
        push    2
42
        pop     eax
42
        pop     eax
43
        ret
43
        ret
44
 
44
 
45
struct SKIN_HEADER
45
struct SKIN_HEADER
46
  .ident   dd ?
46
  .ident   dd ?
47
  .version dd ?
47
  .version dd ?
48
  .params  dd ?
48
  .params  dd ?
49
  .buttons dd ?
49
  .buttons dd ?
50
  .bitmaps dd ?
50
  .bitmaps dd ?
51
ends
51
ends
52
 
52
 
53
struct SKIN_PARAMS
53
struct SKIN_PARAMS
54
  .skin_height    dd ?
54
  .skin_height    dd ?
55
  .margin.right   dw ?
55
  .margin.right   dw ?
56
  .margin.left    dw ?
56
  .margin.left    dw ?
57
  .margin.bottom  dw ?
57
  .margin.bottom  dw ?
58
  .margin.top     dw ?
58
  .margin.top     dw ?
59
  .colors.inner   dd ?
59
  .colors.inner   dd ?
60
  .colors.outer   dd ?
60
  .colors.outer   dd ?
61
  .colors.frame   dd ?
61
  .colors.frame   dd ?
62
  .colors_1.inner dd ?
62
  .colors_1.inner dd ?
63
  .colors_1.outer dd ?
63
  .colors_1.outer dd ?
64
  .colors_1.frame dd ?
64
  .colors_1.frame dd ?
65
  .dtp.size       dd ?
65
  .dtp.size       dd ?
66
  .dtp.data       db 40 dup (?)
66
  .dtp.data       db 40 dup (?)
67
ends
67
ends
68
 
68
 
69
struct SKIN_BUTTONS
69
struct SKIN_BUTTONS
70
  .type     dd ?
70
  .type     dd ?
71
  .pos:
71
  .pos:
72
    .left   dw ?
72
    .left   dw ?
73
    .top    dw ?
73
    .top    dw ?
74
  .size:
74
  .size:
75
    .width  dw ?
75
    .width  dw ?
76
    .height dw ?
76
    .height dw ?
77
ends
77
ends
78
 
78
 
79
struct SKIN_BITMAPS
79
struct SKIN_BITMAPS
80
  .kind  dw ?
80
  .kind  dw ?
81
  .type  dw ?
81
  .type  dw ?
82
  .data  dd ?
82
  .data  dd ?
83
ends
83
ends
84
 
84
 
85
load_default_skin:
85
load_default_skin:
86
        mov     [_skinh],22
86
        mov     [_skinh],22
87
        mov     ebx,_skin_file_default
87
        mov     ebx,_skin_file_default
88
        call    read_skin_file
88
        call    read_skin_file
89
        ret
89
        ret
90
 
90
 
91
parse_skin_data:
91
parse_skin_data:
92
        mov     ebp,skin_data
92
        mov     ebp,skin_data
93
        cmp     [ebp+SKIN_HEADER.ident],'SKIN'
93
        cmp     [ebp+SKIN_HEADER.ident],'SKIN'
94
        jne     .exit
94
        jne     .exit
95
 
95
 
96
        mov     edi,skin_udata
96
        mov     edi,skin_udata
97
        mov     ecx,(skin_udata.end-skin_udata)/4
97
        mov     ecx,(skin_udata.end-skin_udata)/4
98
        xor     eax,eax
98
        xor     eax,eax
99
        cld
99
        cld
100
        rep	stosd
100
        rep	stosd
101
 
101
 
102
        mov     ebx,[ebp+SKIN_HEADER.params]
102
        mov     ebx,[ebp+SKIN_HEADER.params]
103
        add     ebx,skin_data
103
        add     ebx,skin_data
104
        mov     eax,[ebx+SKIN_PARAMS.skin_height]
104
        mov     eax,[ebx+SKIN_PARAMS.skin_height]
105
        mov     [_skinh],eax
105
        mov     [_skinh],eax
106
        mov     eax,[ebx+SKIN_PARAMS.colors.inner]
106
        mov     eax,[ebx+SKIN_PARAMS.colors.inner]
107
        mov     [skin_active.colors.inner],eax
107
        mov     [skin_active.colors.inner],eax
108
        mov     eax,[ebx+SKIN_PARAMS.colors.outer]
108
        mov     eax,[ebx+SKIN_PARAMS.colors.outer]
109
        mov     [skin_active.colors.outer],eax
109
        mov     [skin_active.colors.outer],eax
110
        mov     eax,[ebx+SKIN_PARAMS.colors.frame]
110
        mov     eax,[ebx+SKIN_PARAMS.colors.frame]
111
        mov     [skin_active.colors.frame],eax
111
        mov     [skin_active.colors.frame],eax
112
        mov     eax,[ebx+SKIN_PARAMS.colors_1.inner]
112
        mov     eax,[ebx+SKIN_PARAMS.colors_1.inner]
113
        mov     [skin_inactive.colors.inner],eax
113
        mov     [skin_inactive.colors.inner],eax
114
        mov     eax,[ebx+SKIN_PARAMS.colors_1.outer]
114
        mov     eax,[ebx+SKIN_PARAMS.colors_1.outer]
115
        mov     [skin_inactive.colors.outer],eax
115
        mov     [skin_inactive.colors.outer],eax
116
        mov     eax,[ebx+SKIN_PARAMS.colors_1.frame]
116
        mov     eax,[ebx+SKIN_PARAMS.colors_1.frame]
117
        mov     [skin_inactive.colors.frame],eax
117
        mov     [skin_inactive.colors.frame],eax
118
        lea     esi,[ebx+SKIN_PARAMS.dtp.data]
118
        lea     esi,[ebx+SKIN_PARAMS.dtp.data]
119
        mov     edi,common_colours
119
        mov     edi,common_colours
120
        mov     ecx,[ebx+SKIN_PARAMS.dtp.size]
120
        mov     ecx,[ebx+SKIN_PARAMS.dtp.size]
121
        and     ecx,127
121
        and     ecx,127
122
        rep     movsb
122
        rep     movsb
123
        mov     eax,dword[ebx+SKIN_PARAMS.margin.right]
123
        mov     eax,dword[ebx+SKIN_PARAMS.margin.right]
124
        mov     dword[_skinmargins+0],eax
124
        mov     dword[_skinmargins+0],eax
125
        mov     eax,dword[ebx+SKIN_PARAMS.margin.bottom]
125
        mov     eax,dword[ebx+SKIN_PARAMS.margin.bottom]
126
        mov     dword[_skinmargins+4],eax
126
        mov     dword[_skinmargins+4],eax
127
 
127
 
128
        mov     ebx,[ebp+SKIN_HEADER.bitmaps]
128
        mov     ebx,[ebp+SKIN_HEADER.bitmaps]
129
        add     ebx,skin_data
129
        add     ebx,skin_data
130
  .lp1: cmp     dword[ebx],0
130
  .lp1: cmp     dword[ebx],0
131
        je      .end_bitmaps
131
        je      .end_bitmaps
132
        movzx   eax,[ebx+SKIN_BITMAPS.kind]
132
        movzx   eax,[ebx+SKIN_BITMAPS.kind]
133
        movzx   ecx,[ebx+SKIN_BITMAPS.type]
133
        movzx   ecx,[ebx+SKIN_BITMAPS.type]
134
        dec     eax
134
        dec     eax
135
        jnz     .not_left
135
        jnz     .not_left
136
        xor     eax,eax
136
        xor     eax,eax
137
        mov     edx,skin_active.left.data
137
        mov     edx,skin_active.left.data
138
        or      ecx,ecx
138
        or      ecx,ecx
139
        jnz     @f
139
        jnz     @f
140
        mov     edx,skin_inactive.left.data
140
        mov     edx,skin_inactive.left.data
141
    @@: jmp     .next_bitmap
141
    @@: jmp     .next_bitmap
142
  .not_left:
142
  .not_left:
143
        dec     eax
143
        dec     eax
144
        jnz     .not_oper
144
        jnz     .not_oper
145
        mov     esi,[ebx+SKIN_BITMAPS.data]
145
        mov     esi,[ebx+SKIN_BITMAPS.data]
146
        add     esi,skin_data
146
        add     esi,skin_data
147
        mov     eax,[esi+0]
147
        mov     eax,[esi+0]
148
        neg     eax
148
        neg     eax
149
        mov     edx,skin_active.oper.data
149
        mov     edx,skin_active.oper.data
150
        or      ecx,ecx
150
        or      ecx,ecx
151
        jnz     @f
151
        jnz     @f
152
        mov     edx,skin_inactive.oper.data
152
        mov     edx,skin_inactive.oper.data
153
    @@: jmp     .next_bitmap
153
    @@: jmp     .next_bitmap
154
  .not_oper:
154
  .not_oper:
155
        dec     eax
155
        dec     eax
156
        jnz     .not_base
156
        jnz     .not_base
157
        mov     eax,[skin_active.left.width]
157
        mov     eax,[skin_active.left.width]
158
        mov     edx,skin_active.base.data
158
        mov     edx,skin_active.base.data
159
        or      ecx,ecx
159
        or      ecx,ecx
160
        jnz     @f
160
        jnz     @f
161
        mov     eax,[skin_inactive.left.width]
161
        mov     eax,[skin_inactive.left.width]
162
        mov     edx,skin_inactive.base.data
162
        mov     edx,skin_inactive.base.data
163
    @@: jmp     .next_bitmap
163
    @@: jmp     .next_bitmap
164
  .not_base:
164
  .not_base:
165
        add     ebx,8
165
        add     ebx,8
166
        jmp     .lp1
166
        jmp     .lp1
167
  .next_bitmap:
167
  .next_bitmap:
168
        mov     ecx,[ebx+SKIN_BITMAPS.data]
168
        mov     ecx,[ebx+SKIN_BITMAPS.data]
169
        add     ecx,skin_data
169
        add     ecx,skin_data
170
        mov     [edx+4],eax
170
        mov     [edx+4],eax
171
        mov     eax,[ecx+0]
171
        mov     eax,[ecx+0]
172
        mov     [edx+8],eax
172
        mov     [edx+8],eax
173
        add     ecx,8
173
        add     ecx,8
174
        mov     [edx+0],ecx
174
        mov     [edx+0],ecx
175
        add     ebx,8
175
        add     ebx,8
176
        jmp     .lp1
176
        jmp     .lp1
177
  .end_bitmaps:
177
  .end_bitmaps:
178
 
178
 
179
        mov     ebx,[ebp+SKIN_HEADER.buttons]
179
        mov     ebx,[ebp+SKIN_HEADER.buttons]
180
        add     ebx,skin_data
180
        add     ebx,skin_data
181
  .lp2: cmp     dword[ebx],0
181
  .lp2: cmp     dword[ebx],0
182
        je      .end_buttons
182
        je      .end_buttons
183
        mov     eax,[ebx+SKIN_BUTTONS.type]
183
        mov     eax,[ebx+SKIN_BUTTONS.type]
184
        dec     eax
184
        dec     eax
185
        jnz     .not_close
185
        jnz     .not_close
186
        mov     edx,skin_btn_close
186
        mov     edx,skin_btn_close
187
        jmp     .next_button
187
        jmp     .next_button
188
  .not_close:
188
  .not_close:
189
        dec     eax
189
        dec     eax
190
        jnz     .not_minimize
190
        jnz     .not_minimize
191
        mov     edx,skin_btn_minimize
191
        mov     edx,skin_btn_minimize
192
        jmp     .next_button
192
        jmp     .next_button
193
  .not_minimize:
193
  .not_minimize:
194
        add     ebx,12
194
        add     ebx,12
195
        jmp     .lp2
195
        jmp     .lp2
196
  .next_button:
196
  .next_button:
197
        movsx   eax,[ebx+SKIN_BUTTONS.left]
197
        movsx   eax,[ebx+SKIN_BUTTONS.left]
198
        mov     [edx+SKIN_BUTTON.left],eax
198
        mov     [edx+SKIN_BUTTON.left],eax
199
        movsx   eax,[ebx+SKIN_BUTTONS.top]
199
        movsx   eax,[ebx+SKIN_BUTTONS.top]
200
        mov     [edx+SKIN_BUTTON.top],eax
200
        mov     [edx+SKIN_BUTTON.top],eax
201
        movsx   eax,[ebx+SKIN_BUTTONS.width]
201
        movsx   eax,[ebx+SKIN_BUTTONS.width]
202
        mov     [edx+SKIN_BUTTON.width],eax
202
        mov     [edx+SKIN_BUTTON.width],eax
203
        movsx   eax,[ebx+SKIN_BUTTONS.height]
203
        movsx   eax,[ebx+SKIN_BUTTONS.height]
204
        mov     [edx+SKIN_BUTTON.height],eax
204
        mov     [edx+SKIN_BUTTON.height],eax
205
        add     ebx,12
205
        add     ebx,12
206
        jmp     .lp2
206
        jmp     .lp2
207
  .end_buttons:
207
  .end_buttons:
208
 
208
 
209
  .exit:
209
  .exit:
210
        ret
210
        ret
211
 
211
 
212
sys_putimage_with_check:
212
sys_putimage_with_check:
213
	or	ebx,ebx
213
	or	ebx,ebx
214
	jz	@f
214
	jz	@f
215
        call    sys_putimage.forced
215
        call    sys_putimage.forced
216
    @@: ret
216
    @@: ret
217
 
217
 
218
drawwindow_IV_caption:
218
drawwindow_IV_caption:
219
 
219
 
220
        mov     ebp,skin_active
220
        mov     ebp,skin_active
221
        or      al,al
221
        or      al,al
222
        jnz     @f
222
        jnz     @f
223
        mov     ebp,skin_inactive
223
        mov     ebp,skin_inactive
224
    @@:
224
    @@:
225
 
225
 
226
        mov     esi,[esp+4]
226
        mov     esi,[esp+4]
227
        mov     eax,[esi+WDATA.box.width]    ; window width
227
        mov     eax,[esi+WDATA.box.width]    ; window width
228
        mov     edx,[ebp+SKIN_DATA.left.left]
228
        mov     edx,[ebp+SKIN_DATA.left.left]
229
        shl     edx,16
229
        shl     edx,16
230
        mov     ecx,[ebp+SKIN_DATA.left.width]
230
        mov     ecx,[ebp+SKIN_DATA.left.width]
231
        shl     ecx,16
231
        shl     ecx,16
232
        add     ecx,[_skinh]
232
        add     ecx,[_skinh]
233
 
233
 
234
        mov     ebx, [ebp+SKIN_DATA.left.data]
234
        mov     ebx, [ebp+SKIN_DATA.left.data]
235
        call    sys_putimage_with_check
235
        call    sys_putimage_with_check
236
 
236
 
237
        mov     esi,[esp+4]
237
        mov     esi,[esp+4]
238
        mov     eax,[esi+WDATA.box.width]
238
        mov     eax,[esi+WDATA.box.width]
239
        sub     eax,[ebp+SKIN_DATA.left.width]
239
        sub     eax,[ebp+SKIN_DATA.left.width]
240
        sub     eax,[ebp+SKIN_DATA.oper.width]
240
        sub     eax,[ebp+SKIN_DATA.oper.width]
241
        cmp     eax,[ebp+SKIN_DATA.base.left]
241
        cmp     eax,[ebp+SKIN_DATA.base.left]
242
        jng     .non_base
242
        jng     .non_base
243
        xor     edx,edx
243
        xor     edx,edx
244
        mov     ecx,[ebp+SKIN_DATA.base.width]
244
        mov     ecx,[ebp+SKIN_DATA.base.width]
245
        jecxz   .non_base
245
        jecxz   .non_base
246
        div     ecx
246
        div     ecx
247
 
247
 
248
        inc     eax
248
        inc     eax
249
 
249
 
250
        mov     ebx,[ebp+SKIN_DATA.base.data]
250
        mov     ebx,[ebp+SKIN_DATA.base.data]
251
        mov     ecx,[ebp+SKIN_DATA.base.width]
251
        mov     ecx,[ebp+SKIN_DATA.base.width]
252
        shl     ecx,16
252
        shl     ecx,16
253
        add     ecx,[_skinh]
253
        add     ecx,[_skinh]
254
        mov     edx,[ebp+SKIN_DATA.base.left]
254
        mov     edx,[ebp+SKIN_DATA.base.left]
255
        sub     edx,[ebp+SKIN_DATA.base.width]
255
        sub     edx,[ebp+SKIN_DATA.base.width]
256
        shl     edx,16
256
        shl     edx,16
257
  .baseskinloop:
257
  .baseskinloop:
258
        shr     edx,16
258
        shr     edx,16
259
        add     edx,[ebp+SKIN_DATA.base.width]
259
        add     edx,[ebp+SKIN_DATA.base.width]
260
        shl     edx,16
260
        shl     edx,16
261
 
261
 
262
        push    eax ebx ecx edx
262
        push    eax ebx ecx edx
263
        call    sys_putimage_with_check
263
        call    sys_putimage_with_check
264
        pop     edx ecx ebx eax
264
        pop     edx ecx ebx eax
265
 
265
 
266
        dec     eax
266
        dec     eax
267
        jnz     .baseskinloop
267
        jnz     .baseskinloop
268
  .non_base:
268
  .non_base:
269
 
269
 
270
        mov     esi,[esp+4]
270
        mov     esi,[esp+4]
271
        mov     edx,[esi+WDATA.box.width]
271
        mov     edx,[esi+WDATA.box.width]
272
        sub     edx,[ebp+SKIN_DATA.oper.width]
272
        sub     edx,[ebp+SKIN_DATA.oper.width]
273
        inc     edx
273
        inc     edx
274
        shl     edx,16
274
        shl     edx,16
275
        mov     ebx,[ebp+SKIN_DATA.oper.data]
275
        mov     ebx,[ebp+SKIN_DATA.oper.data]
276
 
276
 
277
        mov     ecx,[ebp+SKIN_DATA.oper.width]
277
        mov     ecx,[ebp+SKIN_DATA.oper.width]
278
        shl     ecx,16
278
        shl     ecx,16
279
        add     ecx,[_skinh]
279
        add     ecx,[_skinh]
280
        call    sys_putimage_with_check
280
        call    sys_putimage_with_check
281
 
281
 
282
        ret
282
        ret
283
 
283
 
284
;//mike.dld, 2006-08-02 ]
284
;//mike.dld, 2006-08-02 ]
285
 
285
 
286
 
286
 
287
drawwindow_IV:
287
drawwindow_IV:
288
;param1 - aw_yes
288
;param1 - aw_yes
289
 
289
 
290
        pusha
290
        pusha
291
 
291
 
292
        push  edx
292
        push  edx
293
 
293
 
294
        mov   edi,edx
294
        mov   edi,edx
295
 
295
 
296
        mov     ebp,skin_active
296
        mov     ebp,skin_active
297
        cmp     byte [esp+32+4+4],0
297
        cmp     byte [esp+32+4+4],0
298
        jne     @f
298
        jne     @f
299
        mov     ebp,skin_inactive
299
        mov     ebp,skin_inactive
300
     @@:
300
     @@:
301
 
301
 
302
        mov   eax,[edi+WDATA.box.left]
302
        mov   eax,[edi+WDATA.box.left]
303
        shl   eax,16
303
        shl   eax,16
304
		mov   ax,word [edi+WDATA.box.left]
304
		mov   ax,word [edi+WDATA.box.left]
305
		add   ax,word [edi+WDATA.box.width]
305
		add   ax,word [edi+WDATA.box.width]
306
        mov   ebx,[edi+WDATA.box.top]
306
        mov   ebx,[edi+WDATA.box.top]
307
        shl   ebx,16
307
        shl   ebx,16
308
		mov   bx,word [edi+WDATA.box.top]
308
		mov   bx,word [edi+WDATA.box.top]
309
		add   bx,word [edi+WDATA.box.height]
309
		add   bx,word [edi+WDATA.box.height]
310
;        mov   esi,[edi+24]
310
;        mov   esi,[edi+24]
311
;        shr   esi,1
311
;        shr   esi,1
312
;        and   esi,0x007f7f7f
312
;        and   esi,0x007f7f7f
313
        mov   esi,[ebp+SKIN_DATA.colors.outer]
313
        mov   esi,[ebp+SKIN_DATA.colors.outer]
314
        call  draw_rectangle
314
        call  draw_rectangle
315
        mov   ecx,3
315
        mov   ecx,3
316
      _dw3l:
316
      _dw3l:
317
        add   eax,1*65536-1
317
        add   eax,1*65536-1
318
        add   ebx,1*65536-1
318
        add   ebx,1*65536-1
319
        test  ax,ax
319
        test  ax,ax
320
        js    no_skin_add_button
320
        js    no_skin_add_button
321
        test  bx,bx
321
        test  bx,bx
322
        js    no_skin_add_button
322
        js    no_skin_add_button
323
        mov   esi,[ebp+SKIN_DATA.colors.frame] ;[edi+24]
323
        mov   esi,[ebp+SKIN_DATA.colors.frame] ;[edi+24]
324
        call  draw_rectangle
324
        call  draw_rectangle
325
        dec   ecx
325
        dec   ecx
326
        jnz   _dw3l
326
        jnz   _dw3l
327
        mov   esi,[ebp+SKIN_DATA.colors.inner]
327
        mov   esi,[ebp+SKIN_DATA.colors.inner]
328
        add   eax,1*65536-1
328
        add   eax,1*65536-1
329
        add   ebx,1*65536-1
329
        add   ebx,1*65536-1
330
        test  ax,ax
330
        test  ax,ax
331
        js    no_skin_add_button
331
        js    no_skin_add_button
332
        test  bx,bx
332
        test  bx,bx
333
        js    no_skin_add_button
333
        js    no_skin_add_button
334
        call  draw_rectangle
334
        call  draw_rectangle
335
 
335
 
336
        cmp   dword[skin_data],'SKIN'
336
        cmp   dword[skin_data],'SKIN'
337
        je    @f
337
        je    @f
338
        xor   eax,eax
338
        xor   eax,eax
339
        xor   ebx,ebx
339
        xor   ebx,ebx
340
        mov   esi,[esp]
340
        mov   esi,[esp]
341
        mov   ecx,[esi+WDATA.box.width]
341
        mov   ecx,[esi+WDATA.box.width]
342
        inc   ecx
342
        inc   ecx
343
        mov   edx,[_skinh]
343
        mov   edx,[_skinh]
344
        mov   edi,[common_colours+4] ; standard grab color
344
        mov   edi,[common_colours+4] ; standard grab color
345
        call  [drawbar]
345
        call  [drawbar]
346
        jmp   draw_clientbar
346
        jmp   draw_clientbar
347
    @@:
347
    @@:
348
 
348
 
349
        mov     al,[esp+32+4+4]
349
        mov     al,[esp+32+4+4]
350
        call    drawwindow_IV_caption
350
        call    drawwindow_IV_caption
351
 
351
 
352
    draw_clientbar:
352
    draw_clientbar:
353
 
353
 
354
        mov   esi,[esp]
354
        mov   esi,[esp]
355
 
355
 
356
        mov   edx,[esi+WDATA.box.top]                       ; WORK AREA
356
        mov   edx,[esi+WDATA.box.top]                       ; WORK AREA
357
        add   edx,21+5
357
        add   edx,21+5
358
        mov   ebx,[esi+WDATA.box.top]
358
        mov   ebx,[esi+WDATA.box.top]
359
        add   ebx,[esi+WDATA.box.height]
359
        add   ebx,[esi+WDATA.box.height]
360
        cmp   edx,ebx
360
        cmp   edx,ebx
361
        jg    _noinside2
361
        jg    _noinside2
362
        mov   eax,5
362
        mov   eax,5
363
        mov   ebx,[_skinh]
363
        mov   ebx,[_skinh]
364
        mov   ecx,[esi+WDATA.box.width]
364
        mov   ecx,[esi+WDATA.box.width]
365
        mov   edx,[esi+WDATA.box.height]
365
        mov   edx,[esi+WDATA.box.height]
366
        sub   ecx,4
366
        sub   ecx,4
367
        sub   edx,4
367
        sub   edx,4
368
        mov   edi,[esi+WDATA.cl_workarea]
368
        mov   edi,[esi+WDATA.cl_workarea]
369
	test  edi,0x40000000
369
	test  edi,0x40000000
370
	jnz   _noinside2
370
	jnz   _noinside2
371
        call  [drawbar]
371
        call  [drawbar]
372
      _noinside2:
372
      _noinside2:
373
 
373
 
374
        cmp   dword[skin_data],'SKIN'
374
        cmp   dword[skin_data],'SKIN'
375
        jne   no_skin_add_button
375
        jne   no_skin_add_button
376
 
376
 
377
;* close button
377
;* close button
378
        mov   edi,[BTN_ADDR]
378
        mov   edi,[BTN_ADDR]
379
        movzx eax,word [edi]
379
        movzx eax,word [edi]
380
        cmp   eax,1000
380
        cmp   eax,1000
381
        jge   no_skin_add_button
381
        jge   no_skin_add_button
382
        inc   eax
382
        inc   eax
383
        mov   [edi],ax
383
        mov   [edi],ax
384
 
384
 
385
        shl   eax,4
385
        shl   eax,4
386
        add   eax,edi
386
        add   eax,edi
387
 
387
 
388
        mov   bx,[CURRENT_TASK]
388
        mov   bx,[CURRENT_TASK]
389
        mov   [eax],bx
389
        mov   [eax],bx
390
 
390
 
391
        add   eax,2         ; save button id number
391
        add   eax,2         ; save button id number
392
        mov   bx,1
392
        mov   bx,1
393
        mov   [eax],bx
393
        mov   [eax],bx
394
        add   eax,2         ; x start
394
        add   eax,2         ; x start
395
        xor   ebx,ebx
395
        xor   ebx,ebx
396
        cmp   [skin_btn_close.left],0
396
        cmp   [skin_btn_close.left],0
397
        jge   _bCx_at_right
397
        jge   _bCx_at_right
398
        mov   ebx,[esp]
398
        mov   ebx,[esp]
399
        mov   ebx,[ebx+WDATA.box.width]
399
        mov   ebx,[ebx+WDATA.box.width]
400
        inc   ebx
400
        inc   ebx
401
      _bCx_at_right:
401
      _bCx_at_right:
402
        add   ebx,[skin_btn_close.left]
402
        add   ebx,[skin_btn_close.left]
403
        mov   [eax],bx
403
        mov   [eax],bx
404
        add   eax,2         ; x size
404
        add   eax,2         ; x size
405
        mov   ebx,[skin_btn_close.width]
405
        mov   ebx,[skin_btn_close.width]
406
        dec   ebx
406
        dec   ebx
407
        mov   [eax],bx
407
        mov   [eax],bx
408
        add   eax,2         ; y start
408
        add   eax,2         ; y start
409
        mov   ebx,[skin_btn_close.top]
409
        mov   ebx,[skin_btn_close.top]
410
        mov   [eax],bx
410
        mov   [eax],bx
411
        add   eax,2         ; y size
411
        add   eax,2         ; y size
412
        mov   ebx,[skin_btn_close.height]
412
        mov   ebx,[skin_btn_close.height]
413
        dec   ebx
413
        dec   ebx
414
        mov   [eax],bx
414
        mov   [eax],bx
415
 
415
 
416
;* minimize button
416
;* minimize button
417
        mov   edi,[BTN_ADDR]
417
        mov   edi,[BTN_ADDR]
418
        movzx eax,word [edi]
418
        movzx eax,word [edi]
419
        cmp   eax,1000
419
        cmp   eax,1000
420
        jge   no_skin_add_button
420
        jge   no_skin_add_button
421
        inc   eax
421
        inc   eax
422
        mov   [edi],ax
422
        mov   [edi],ax
423
 
423
 
424
        shl   eax,4
424
        shl   eax,4
425
        add   eax,edi
425
        add   eax,edi
426
 
426
 
427
        mov   bx,[CURRENT_TASK]
427
        mov   bx,[CURRENT_TASK]
428
        mov   [eax],bx
428
        mov   [eax],bx
429
 
429
 
430
        add   eax,2         ; save button id number
430
        add   eax,2         ; save button id number
431
        mov   bx,65535 ;999
431
        mov   bx,65535 ;999
432
        mov   [eax],bx
432
        mov   [eax],bx
433
        add   eax,2         ; x start
433
        add   eax,2         ; x start
434
        xor   ebx,ebx
434
        xor   ebx,ebx
435
        cmp   [skin_btn_minimize.left],0
435
        cmp   [skin_btn_minimize.left],0
436
        jge   _bMx_at_right
436
        jge   _bMx_at_right
437
        mov   ebx,[esp]
437
        mov   ebx,[esp]
438
        mov   ebx,[ebx+WDATA.box.width]
438
        mov   ebx,[ebx+WDATA.box.width]
439
        inc   ebx
439
        inc   ebx
440
      _bMx_at_right:
440
      _bMx_at_right:
441
        add   ebx,[skin_btn_minimize.left]
441
        add   ebx,[skin_btn_minimize.left]
442
        mov   [eax],bx
442
        mov   [eax],bx
443
        add   eax,2         ; x size
443
        add   eax,2         ; x size
444
        mov   ebx,[skin_btn_minimize.width]
444
        mov   ebx,[skin_btn_minimize.width]
445
        dec   ebx
445
        dec   ebx
446
        mov   [eax],bx
446
        mov   [eax],bx
447
        add   eax,2         ; y start
447
        add   eax,2         ; y start
448
        mov   ebx,[skin_btn_minimize.top]
448
        mov   ebx,[skin_btn_minimize.top]
449
        mov   [eax],bx
449
        mov   [eax],bx
450
        add   eax,2         ; y size
450
        add   eax,2         ; y size
451
        mov   ebx,[skin_btn_minimize.height]
451
        mov   ebx,[skin_btn_minimize.height]
452
        dec   ebx
452
        dec   ebx
453
        mov   [eax],bx
453
        mov   [eax],bx
454
 
454
 
455
      no_skin_add_button:
455
      no_skin_add_button:
456
        pop     edi
456
        pop     edi
457
        popa
457
        popa
458
 
458
 
459
        ret  4
459
        ret  4