Subversion Repositories Kolibri OS

Rev

Rev 488 | Rev 593 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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