Subversion Repositories Kolibri OS

Rev

Rev 114 | Rev 186 | 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
 
273
        mov   edi,[esp]                              ; RECTANGLE
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]
1 ha 293
        call  draw_rectangle
294
        mov   ecx,3
295
      _dw3l:
296
        add   eax,1*65536-1
297
        add   ebx,1*65536-1
298
        test  ax,ax
299
        js    no_skin_add_button
300
        test  bx,bx
301
        js    no_skin_add_button
49 mikedld 302
        mov   esi,[ebp+SKIN_DATA.colors.frame] ;[edi+24]
1 ha 303
        call  draw_rectangle
304
        dec   ecx
305
        jnz   _dw3l
49 mikedld 306
        mov   esi,[ebp+SKIN_DATA.colors.inner]
1 ha 307
        add   eax,1*65536-1
308
        add   ebx,1*65536-1
309
        test  ax,ax
310
        js    no_skin_add_button
311
        test  bx,bx
312
        js    no_skin_add_button
313
        call  draw_rectangle
314
 
54 mikedld 315
        cmp   dword[skin_data],'SKIN'
316
        je    @f
317
        xor   eax,eax
318
        xor   ebx,ebx
1 ha 319
        mov   esi,[esp]
115 poddubny 320
        mov   ecx,[esi+WDATA.box.width]
54 mikedld 321
        inc   ecx
322
        mov   edx,[_skinh]
323
        mov   edi,[common_colours+4] ; standard grab color
324
        call  [drawbar]
325
        jmp   draw_clientbar
326
    @@:
327
 
114 mikedld 328
        mov     al,[esp+32+4+4]
329
        call    drawwindow_IV_caption
33 mario79 330
 
54 mikedld 331
    draw_clientbar:
332
 
1 ha 333
        mov   esi,[esp]
334
 
115 poddubny 335
        mov   edx,[esi+WDATA.box.top]                       ; WORK AREA
1 ha 336
        add   edx,21+5
115 poddubny 337
        mov   ebx,[esi+WDATA.box.top]
338
        add   ebx,[esi+WDATA.box.height]
1 ha 339
        cmp   edx,ebx
340
        jg    _noinside2
341
        mov   eax,5
342
        mov   ebx,[_skinh]
115 poddubny 343
        mov   ecx,[esi+WDATA.box.width]
344
        mov   edx,[esi+WDATA.box.height]
1 ha 345
        sub   ecx,4
346
        sub   edx,4
115 poddubny 347
        mov   edi,[esi+WDATA.cl_workarea]
1 ha 348
        call  [drawbar]
349
      _noinside2:
350
 
54 mikedld 351
        cmp   dword[skin_data],'SKIN'
352
        jne   no_skin_add_button
353
 
49 mikedld 354
;* close button
1 ha 355
        mov   edi,[0xfe88]
356
        movzx eax,word [edi]
357
        cmp   eax,1000
358
        jge   no_skin_add_button
359
        inc   eax
360
        mov   [edi],ax
361
 
362
        shl   eax,4
363
        add   eax,edi
364
 
365
        mov   bx,[0x3000]
366
        mov   [eax],bx
367
 
368
        add   eax,2         ; save button id number
369
        mov   bx,1
370
        mov   [eax],bx
371
        add   eax,2         ; x start
49 mikedld 372
        xor   ebx,ebx
373
        cmp   [skin_btn_close.left],0
374
        jge   _bCx_at_right
1 ha 375
        mov   ebx,[esp]
115 poddubny 376
        mov   ebx,[ebx+WDATA.box.width]
49 mikedld 377
        inc   ebx
1 ha 378
      _bCx_at_right:
49 mikedld 379
        add   ebx,[skin_btn_close.left]
1 ha 380
        mov   [eax],bx
381
        add   eax,2         ; x size
49 mikedld 382
        mov   ebx,[skin_btn_close.width]
383
        dec   ebx
1 ha 384
        mov   [eax],bx
385
        add   eax,2         ; y start
49 mikedld 386
        mov   ebx,[skin_btn_close.top]
1 ha 387
        mov   [eax],bx
388
        add   eax,2         ; y size
49 mikedld 389
        mov   ebx,[skin_btn_close.height]
390
        dec   ebx
1 ha 391
        mov   [eax],bx
392
 
393
;* minimize button
394
        mov   edi,[0xfe88]
395
        movzx eax,word [edi]
396
        cmp   eax,1000
397
        jge   no_skin_add_button
398
        inc   eax
399
        mov   [edi],ax
400
 
401
        shl   eax,4
402
        add   eax,edi
403
 
404
        mov   bx,[0x3000]
405
        mov   [eax],bx
406
 
407
        add   eax,2         ; save button id number
408
        mov   bx,65535 ;999
409
        mov   [eax],bx
410
        add   eax,2         ; x start
49 mikedld 411
        xor   ebx,ebx
412
        cmp   [skin_btn_minimize.left],0
413
        jge   _bMx_at_right
1 ha 414
        mov   ebx,[esp]
115 poddubny 415
        mov   ebx,[ebx+WDATA.box.width]
49 mikedld 416
        inc   ebx
1 ha 417
      _bMx_at_right:
49 mikedld 418
        add   ebx,[skin_btn_minimize.left]
1 ha 419
        mov   [eax],bx
420
        add   eax,2         ; x size
49 mikedld 421
        mov   ebx,[skin_btn_minimize.width]
422
        dec   ebx
1 ha 423
        mov   [eax],bx
424
        add   eax,2         ; y start
49 mikedld 425
        mov   ebx,[skin_btn_minimize.top]
1 ha 426
        mov   [eax],bx
427
        add   eax,2         ; y size
49 mikedld 428
        mov   ebx,[skin_btn_minimize.height]
429
        dec   ebx
1 ha 430
        mov   [eax],bx
431
 
432
      no_skin_add_button:
433
 
434
        add   esp,4
435
        popa
33 mario79 436
 
35 halyavin 437
        ret  4
1 ha 438