Subversion Repositories Kolibri OS

Rev

Rev 53 | Rev 114 | 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
194
	call	sys_putimage
195
    @@: ret
196
 
1 ha 197
drawwindow_IV:
35 halyavin 198
;param1 - aw_yes
1 ha 199
 
200
        pusha
201
 
202
        push  edx
203
 
204
        mov   edi,[esp]                              ; RECTANGLE
205
 
49 mikedld 206
        mov     ebp,skin_active
207
        cmp     byte [esp+32+4+4],0
208
        jne     @f
209
        mov     ebp,skin_inactive
210
     @@:
211
 
1 ha 212
        mov   eax,[edi+0]
213
        shl   eax,16
214
        mov   ax,[edi+0]
215
        add   ax,[edi+8]
216
        mov   ebx,[edi+4]
217
        shl   ebx,16
218
        mov   bx,[edi+4]
219
        add   bx,[edi+12]
220
;        mov   esi,[edi+24]
221
;        shr   esi,1
222
;        and   esi,0x007f7f7f
49 mikedld 223
        mov   esi,[ebp+SKIN_DATA.colors.outer]
1 ha 224
        call  draw_rectangle
225
        mov   ecx,3
226
      _dw3l:
227
        add   eax,1*65536-1
228
        add   ebx,1*65536-1
229
        test  ax,ax
230
        js    no_skin_add_button
231
        test  bx,bx
232
        js    no_skin_add_button
49 mikedld 233
        mov   esi,[ebp+SKIN_DATA.colors.frame] ;[edi+24]
1 ha 234
        call  draw_rectangle
235
        dec   ecx
236
        jnz   _dw3l
49 mikedld 237
        mov   esi,[ebp+SKIN_DATA.colors.inner]
1 ha 238
        add   eax,1*65536-1
239
        add   ebx,1*65536-1
240
        test  ax,ax
241
        js    no_skin_add_button
242
        test  bx,bx
243
        js    no_skin_add_button
244
        call  draw_rectangle
245
 
54 mikedld 246
        cmp   dword[skin_data],'SKIN'
247
        je    @f
248
        xor   eax,eax
249
        xor   ebx,ebx
1 ha 250
        mov   esi,[esp]
54 mikedld 251
        mov   ecx,[esi+8]
252
        inc   ecx
253
        mov   edx,[_skinh]
254
        mov   edi,[common_colours+4] ; standard grab color
255
        call  [drawbar]
256
        jmp   draw_clientbar
257
    @@:
258
 
259
        mov   esi,[esp]
1 ha 260
        mov   eax,[esi+8]    ; window width
49 mikedld 261
        mov   edx,[ebp+SKIN_DATA.left.left]
1 ha 262
        shl   edx,16
49 mikedld 263
        mov   ecx,[ebp+SKIN_DATA.left.width]
1 ha 264
        shl   ecx,16
265
        add   ecx,[_skinh]
33 mario79 266
 
49 mikedld 267
        mov   ebx, [ebp+SKIN_DATA.left.data]
53 mikedld 268
        call  sys_putimage_with_check
1 ha 269
 
270
        mov   esi,[esp]
271
        mov   eax,[esi+8]
49 mikedld 272
        sub   eax,[ebp+SKIN_DATA.left.width]
273
        sub   eax,[ebp+SKIN_DATA.oper.width]
274
        cmp   eax,[ebp+SKIN_DATA.base.left]
1 ha 275
        jng   non_base
276
        xor   edx,edx
53 mikedld 277
        mov   ecx,[ebp+SKIN_DATA.base.width]
278
        jecxz non_base
279
        div   ecx
1 ha 280
 
281
        inc   eax
282
 
49 mikedld 283
        mov   ebx,[ebp+SKIN_DATA.base.data]
284
        mov   ecx,[ebp+SKIN_DATA.base.width]
1 ha 285
        shl   ecx,16
286
        add   ecx,[_skinh]
49 mikedld 287
        mov   edx,[ebp+SKIN_DATA.base.left]
288
        sub   edx,[ebp+SKIN_DATA.base.width]
1 ha 289
        shl   edx,16
290
      baseskinloop:
291
        shr   edx,16
49 mikedld 292
        add   edx,[ebp+SKIN_DATA.base.width]
1 ha 293
        shl   edx,16
294
 
295
        push  eax ebx ecx edx
53 mikedld 296
        call  sys_putimage_with_check
1 ha 297
        pop   edx ecx ebx eax
298
 
299
        dec   eax
300
        jnz   baseskinloop
301
      non_base:
302
 
303
        mov   esi,[esp]
304
        mov   edx,[esi+8]
49 mikedld 305
        sub   edx,[ebp+SKIN_DATA.oper.width]
1 ha 306
        inc   edx
307
        shl   edx,16
49 mikedld 308
        mov   ebx,[ebp+SKIN_DATA.oper.data]
35 halyavin 309
 
49 mikedld 310
        mov   ecx,[ebp+SKIN_DATA.oper.width]
1 ha 311
        shl   ecx,16
312
        add   ecx,[_skinh]
53 mikedld 313
        call  sys_putimage_with_check
1 ha 314
 
54 mikedld 315
    draw_clientbar:
316
 
1 ha 317
        mov   esi,[esp]
318
 
319
        mov   edx,[esi+04]                       ; WORK AREA
320
        add   edx,21+5
321
        mov   ebx,[esi+04]
322
        add   ebx,[esi+12]
323
        cmp   edx,ebx
324
        jg    _noinside2
325
        mov   eax,5
326
        mov   ebx,[_skinh]
327
        mov   ecx,[esi+8]
328
        mov   edx,[esi+12]
329
        sub   ecx,4
330
        sub   edx,4
331
        mov   edi,[esi+16]
332
        call  [drawbar]
333
      _noinside2:
334
 
54 mikedld 335
        cmp   dword[skin_data],'SKIN'
336
        jne   no_skin_add_button
337
 
49 mikedld 338
;* close button
1 ha 339
        mov   edi,[0xfe88]
340
        movzx eax,word [edi]
341
        cmp   eax,1000
342
        jge   no_skin_add_button
343
        inc   eax
344
        mov   [edi],ax
345
 
346
        shl   eax,4
347
        add   eax,edi
348
 
349
        mov   bx,[0x3000]
350
        mov   [eax],bx
351
 
352
        add   eax,2         ; save button id number
353
        mov   bx,1
354
        mov   [eax],bx
355
        add   eax,2         ; x start
49 mikedld 356
        xor   ebx,ebx
357
        cmp   [skin_btn_close.left],0
358
        jge   _bCx_at_right
1 ha 359
        mov   ebx,[esp]
360
        mov   ebx,[ebx+8]
49 mikedld 361
        inc   ebx
1 ha 362
      _bCx_at_right:
49 mikedld 363
        add   ebx,[skin_btn_close.left]
1 ha 364
        mov   [eax],bx
365
        add   eax,2         ; x size
49 mikedld 366
        mov   ebx,[skin_btn_close.width]
367
        dec   ebx
1 ha 368
        mov   [eax],bx
369
        add   eax,2         ; y start
49 mikedld 370
        mov   ebx,[skin_btn_close.top]
1 ha 371
        mov   [eax],bx
372
        add   eax,2         ; y size
49 mikedld 373
        mov   ebx,[skin_btn_close.height]
374
        dec   ebx
1 ha 375
        mov   [eax],bx
376
 
377
;* minimize button
378
        mov   edi,[0xfe88]
379
        movzx eax,word [edi]
380
        cmp   eax,1000
381
        jge   no_skin_add_button
382
        inc   eax
383
        mov   [edi],ax
384
 
385
        shl   eax,4
386
        add   eax,edi
387
 
388
        mov   bx,[0x3000]
389
        mov   [eax],bx
390
 
391
        add   eax,2         ; save button id number
392
        mov   bx,65535 ;999
393
        mov   [eax],bx
394
        add   eax,2         ; x start
49 mikedld 395
        xor   ebx,ebx
396
        cmp   [skin_btn_minimize.left],0
397
        jge   _bMx_at_right
1 ha 398
        mov   ebx,[esp]
399
        mov   ebx,[ebx+8]
49 mikedld 400
        inc   ebx
1 ha 401
      _bMx_at_right:
49 mikedld 402
        add   ebx,[skin_btn_minimize.left]
1 ha 403
        mov   [eax],bx
404
        add   eax,2         ; x size
49 mikedld 405
        mov   ebx,[skin_btn_minimize.width]
406
        dec   ebx
1 ha 407
        mov   [eax],bx
408
        add   eax,2         ; y start
49 mikedld 409
        mov   ebx,[skin_btn_minimize.top]
1 ha 410
        mov   [eax],bx
411
        add   eax,2         ; y size
49 mikedld 412
        mov   ebx,[skin_btn_minimize.height]
413
        dec   ebx
1 ha 414
        mov   [eax],bx
415
 
416
      no_skin_add_button:
417
 
418
        add   esp,4
419
        popa
33 mario79 420
 
35 halyavin 421
        ret  4
1 ha 422