Subversion Repositories Kolibri OS

Rev

Rev 1635 | Rev 2439 | 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: 2434 $
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
2434 Serge 29
        rep movsd
523 diamond 30
        stdcall kernel_free, eax
488 spraid 31
 
523 diamond 32
        call    parse_skin_data
33
        xor     eax, eax
34
        ret
35
.notfound:
36
        xor     eax, eax
37
        inc     eax
38
        ret
39
.noskin:
40
        stdcall kernel_free, eax
41
        push    2
42
        pop     eax
43
        ret
1 ha 44
 
2434 Serge 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
 
2434 Serge 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
 
2434 Serge 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
 
2434 Serge 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:
2434 Serge 86
        mov     [_skinh], 22
87
        mov     ebx, _skin_file_default
523 diamond 88
        call    read_skin_file
49 mikedld 89
        ret
1 ha 90
 
49 mikedld 91
parse_skin_data:
2434 Serge 92
        mov     ebp, skin_data
93
        cmp     [ebp+SKIN_HEADER.ident], 'SKIN'
49 mikedld 94
        jne     .exit
1 ha 95
 
2434 Serge 96
        mov     edi, skin_udata
97
        mov     ecx, (skin_udata.end-skin_udata)/4
98
        xor     eax, eax
54 mikedld 99
        cld
2434 Serge 100
        rep stosd
54 mikedld 101
 
2434 Serge 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
 
2434 Serge 128
        mov     ebx, [ebp+SKIN_HEADER.bitmaps]
129
        add     ebx, skin_data
130
  .lp1:
131
        cmp     dword[ebx], 0
49 mikedld 132
        je      .end_bitmaps
2434 Serge 133
        movzx   eax, [ebx+SKIN_BITMAPS.kind]
134
        movzx   ecx, [ebx+SKIN_BITMAPS.type]
49 mikedld 135
        dec     eax
136
        jnz     .not_left
2434 Serge 137
        xor     eax, eax
138
        mov     edx, skin_active.left.data
139
        or      ecx, ecx
49 mikedld 140
        jnz     @f
2434 Serge 141
        mov     edx, skin_inactive.left.data
142
    @@:
143
        jmp     .next_bitmap
49 mikedld 144
  .not_left:
145
        dec     eax
146
        jnz     .not_oper
2434 Serge 147
        mov     esi, [ebx+SKIN_BITMAPS.data]
148
        add     esi, skin_data
149
        mov     eax, [esi+0]
49 mikedld 150
        neg     eax
2434 Serge 151
        mov     edx, skin_active.oper.data
152
        or      ecx, ecx
49 mikedld 153
        jnz     @f
2434 Serge 154
        mov     edx, skin_inactive.oper.data
155
    @@:
156
        jmp     .next_bitmap
49 mikedld 157
  .not_oper:
158
        dec     eax
159
        jnz     .not_base
2434 Serge 160
        mov     eax, [skin_active.left.width]
161
        mov     edx, skin_active.base.data
162
        or      ecx, ecx
49 mikedld 163
        jnz     @f
2434 Serge 164
        mov     eax, [skin_inactive.left.width]
165
        mov     edx, skin_inactive.base.data
166
    @@:
167
        jmp     .next_bitmap
49 mikedld 168
  .not_base:
2434 Serge 169
        add     ebx, 8
49 mikedld 170
        jmp     .lp1
171
  .next_bitmap:
2434 Serge 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
49 mikedld 180
        jmp     .lp1
181
  .end_bitmaps:
1 ha 182
 
2434 Serge 183
        mov     ebx, [ebp+SKIN_HEADER.buttons]
184
        add     ebx, skin_data
185
  .lp2:
186
        cmp     dword[ebx], 0
49 mikedld 187
        je      .end_buttons
2434 Serge 188
        mov     eax, [ebx+SKIN_BUTTONS.type]
49 mikedld 189
        dec     eax
190
        jnz     .not_close
2434 Serge 191
        mov     edx, skin_btn_close
49 mikedld 192
        jmp     .next_button
193
  .not_close:
194
        dec     eax
195
        jnz     .not_minimize
2434 Serge 196
        mov     edx, skin_btn_minimize
49 mikedld 197
        jmp     .next_button
198
  .not_minimize:
2434 Serge 199
        add     ebx, 12
49 mikedld 200
        jmp     .lp2
201
  .next_button:
2434 Serge 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
49 mikedld 211
        jmp     .lp2
212
  .end_buttons:
1 ha 213
 
49 mikedld 214
  .exit:
215
        ret
1 ha 216
 
53 mikedld 217
sys_putimage_with_check:
2434 Serge 218
        or      ebx, ebx
219
        jz      @f
114 mikedld 220
        call    sys_putimage.forced
2434 Serge 221
    @@:
222
        ret
53 mikedld 223
 
114 mikedld 224
drawwindow_IV_caption:
225
 
2434 Serge 226
        mov     ebp, skin_active
227
        or      al, al
114 mikedld 228
        jnz     @f
2434 Serge 229
        mov     ebp, skin_inactive
114 mikedld 230
    @@:
231
 
2434 Serge 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
 
240
        mov     ebx, [ebp+SKIN_DATA.left.data]
241
        call    sys_putimage_with_check
242
 
2434 Serge 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]
114 mikedld 248
        jng     .non_base
2434 Serge 249
        xor     edx, edx
250
        mov     ecx, [ebp+SKIN_DATA.base.width]
114 mikedld 251
        jecxz   .non_base
252
        div     ecx
253
 
254
        inc     eax
255
 
2434 Serge 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:
2434 Serge 264
        shr     edx, 16
265
        add     edx, [ebp+SKIN_DATA.base.width]
266
        shl     edx, 16
114 mikedld 267
 
268
        push    eax ebx ecx edx
269
        call    sys_putimage_with_check
270
        pop     edx ecx ebx eax
271
 
272
        dec     eax
273
        jnz     .baseskinloop
274
  .non_base:
275
 
2434 Serge 276
        mov     esi, [esp+4]
277
        mov     edx, [esi+WDATA.box.width]
278
        sub     edx, [ebp+SKIN_DATA.oper.width]
114 mikedld 279
        inc     edx
2434 Serge 280
        shl     edx, 16
281
        mov     ebx, [ebp+SKIN_DATA.oper.data]
114 mikedld 282
 
2434 Serge 283
        mov     ecx, [ebp+SKIN_DATA.oper.width]
284
        shl     ecx, 16
285
        add     ecx, [_skinh]
114 mikedld 286
        call    sys_putimage_with_check
287
 
288
        ret
289
 
290
;//mike.dld, 2006-08-02 ]
291
 
292
 
1 ha 293
drawwindow_IV:
35 halyavin 294
;param1 - aw_yes
1 ha 295
 
296
        pusha
297
 
2434 Serge 298
        push    edx
1 ha 299
 
2434 Serge 300
        mov     edi, edx
1 ha 301
 
2434 Serge 302
        mov     ebp, skin_active
303
        cmp     byte [esp+32+4+4], 0
49 mikedld 304
        jne     @f
2434 Serge 305
        mov     ebp, skin_inactive
49 mikedld 306
     @@:
307
 
2434 Serge 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
2434 Serge 319
        mov     esi, [ebp+SKIN_DATA.colors.outer]
320
        or      esi, 1 shl 25 ; 0x02000000 used for draw_rectangle without top line
321
        ror     ebx, 16
322
        add     ebx, [_skinh]
323
        sub     bx, 1
324
        rol     ebx, 16
325
        call    draw_rectangle
326
        mov     ecx, 3
1 ha 327
      _dw3l:
2434 Serge 328
        add     eax, 1*65536-1
329
        add     ebx, 0*65536-1
330
        test    ax, ax
331
        js      no_skin_add_button
332
        test    bx, bx
333
        js      no_skin_add_button
334
        mov     esi, [ebp+SKIN_DATA.colors.frame];[edi+24]
335
        or      esi, 1 shl 25; 0x02000000 used for draw_rectangle without top line
336
        call    draw_rectangle
337
        dec     ecx
338
        jnz     _dw3l
339
        mov     esi, [ebp+SKIN_DATA.colors.inner]
340
        or      esi, 1 shl 25; 0x02000000 used for draw_rectangle without top line
341
        add     eax, 1*65536-1
342
        add     ebx, 0*65536-1
343
        test    ax, ax
344
        js      no_skin_add_button
345
        test    bx, bx
346
        js      no_skin_add_button
347
        call    draw_rectangle
1 ha 348
 
2434 Serge 349
        cmp     dword[skin_data], 'SKIN'
350
        je      @f
351
        xor     eax, eax
352
        xor     ebx, ebx
353
        mov     esi, [esp]
354
        mov     ecx, [esi+WDATA.box.width]
355
        inc     ecx
356
        mov     edx, [_skinh]
357
        mov     edi, [common_colours+4]; standard grab color
358
        call    [drawbar]
359
        jmp     draw_clientbar
54 mikedld 360
    @@:
361
 
2434 Serge 362
        mov     al, [esp+32+4+4]
114 mikedld 363
        call    drawwindow_IV_caption
33 mario79 364
 
54 mikedld 365
    draw_clientbar:
366
 
2434 Serge 367
        mov     esi, [esp]
1 ha 368
 
2434 Serge 369
        mov     edx, [esi+WDATA.box.top]                    ; WORK AREA
370
        add     edx, 21+5
371
        mov     ebx, [esi+WDATA.box.top]
372
        add     ebx, [esi+WDATA.box.height]
373
        cmp     edx, ebx
374
        jg      _noinside2
375
        mov     eax, 5
376
        mov     ebx, [_skinh]
377
        mov     ecx, [esi+WDATA.box.width]
378
        mov     edx, [esi+WDATA.box.height]
379
        sub     ecx, 4
380
        sub     edx, 4
381
        mov     edi, [esi+WDATA.cl_workarea]
382
        test    edi, 0x40000000
383
        jnz     _noinside2
384
        call    [drawbar]
1 ha 385
      _noinside2:
386
 
2434 Serge 387
        cmp     dword[skin_data], 'SKIN'
388
        jne     no_skin_add_button
54 mikedld 389
 
49 mikedld 390
;* close button
2434 Serge 391
        mov     edi, [BTN_ADDR]
392
        movzx   eax, word [edi]
393
        cmp     eax, 1000
394
        jge     no_skin_add_button
395
        inc     eax
396
        mov     [edi], ax
1 ha 397
 
2434 Serge 398
        shl     eax, 4
399
        add     eax, edi
1 ha 400
 
2434 Serge 401
        mov     bx, [CURRENT_TASK]
402
        mov     [eax], bx
1 ha 403
 
2434 Serge 404
        add     eax, 2      ; save button id number
405
        mov     bx, 1
406
        mov     [eax], bx
407
        add     eax, 2      ; x start
408
        xor     ebx, ebx
409
        cmp     [skin_btn_close.left], 0
410
        jge     _bCx_at_right
411
        mov     ebx, [esp]
412
        mov     ebx, [ebx+WDATA.box.width]
413
        inc     ebx
1 ha 414
      _bCx_at_right:
2434 Serge 415
        add     ebx, [skin_btn_close.left]
416
        mov     [eax], bx
417
        add     eax, 2      ; x size
418
        mov     ebx, [skin_btn_close.width]
419
        dec     ebx
420
        mov     [eax], bx
421
        add     eax, 2      ; y start
422
        mov     ebx, [skin_btn_close.top]
423
        mov     [eax], bx
424
        add     eax, 2      ; y size
425
        mov     ebx, [skin_btn_close.height]
426
        dec     ebx
427
        mov     [eax], bx
1 ha 428
 
429
;* minimize button
2434 Serge 430
        mov     edi, [BTN_ADDR]
431
        movzx   eax, word [edi]
432
        cmp     eax, 1000
433
        jge     no_skin_add_button
434
        inc     eax
435
        mov     [edi], ax
1 ha 436
 
2434 Serge 437
        shl     eax, 4
438
        add     eax, edi
1 ha 439
 
2434 Serge 440
        mov     bx, [CURRENT_TASK]
441
        mov     [eax], bx
1 ha 442
 
2434 Serge 443
        add     eax, 2      ; save button id number
444
        mov     bx, 65535;999
445
        mov     [eax], bx
446
        add     eax, 2      ; x start
447
        xor     ebx, ebx
448
        cmp     [skin_btn_minimize.left], 0
449
        jge     _bMx_at_right
450
        mov     ebx, [esp]
451
        mov     ebx, [ebx+WDATA.box.width]
452
        inc     ebx
1 ha 453
      _bMx_at_right:
2434 Serge 454
        add     ebx, [skin_btn_minimize.left]
455
        mov     [eax], bx
456
        add     eax, 2      ; x size
457
        mov     ebx, [skin_btn_minimize.width]
458
        dec     ebx
459
        mov     [eax], bx
460
        add     eax, 2      ; y start
461
        mov     ebx, [skin_btn_minimize.top]
462
        mov     [eax], bx
463
        add     eax, 2      ; y size
464
        mov     ebx, [skin_btn_minimize.height]
465
        dec     ebx
466
        mov     [eax], bx
1 ha 467
 
468
      no_skin_add_button:
186 diamond 469
        pop     edi
1 ha 470
        popa
33 mario79 471
 
2434 Serge 472
        ret     4
1 ha 473