Subversion Repositories Kolibri OS

Rev

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

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