Subversion Repositories Kolibri OS

Rev

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

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