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