Subversion Repositories Kolibri OS

Rev

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

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