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