Subversion Repositories Kolibri OS

Rev

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

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