Subversion Repositories Kolibri OS

Rev

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

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