Subversion Repositories Kolibri OS

Rev

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