Subversion Repositories Kolibri OS

Rev

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

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