Subversion Repositories Kolibri OS

Rev

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