Rev 4120 | Rev 4124 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4120 | eAndrew | 1 | ;;; Docky v0.4 by eAndrew |
2 | |||
3 | use32 |
||
4 | org 0x0 |
||
5 | ;------------------------------------------------------------------------------- |
||
6 | db "MENUET01" |
||
7 | dd 1, main, __dataend, __memend, __stackend, 0, sys_path |
||
8 | ;------------------------------------------------------------------------------- |
||
9 | include "../../../macros.inc" |
||
10 | include "../../../proc32.inc" |
||
11 | include "../../../dll.inc" |
||
12 | include "../../../develop/libraries/box_lib/load_lib.mac" |
||
13 | |||
14 | @use_library_mem \ |
||
15 | mem.Alloc, \ |
||
16 | mem.Free, \ |
||
17 | mem.ReAlloc, \ |
||
18 | dll.Load |
||
19 | ;------------------------------------------------------------------------------- |
||
20 | ICON_SIZE equ 32 * 32 * 3 |
||
21 | IMAGE_FILE_SIZE equ ICON_SIZE * 29 |
||
22 | IMAGE_DATA_SIZE equ 32 * 32 * 4 * 29 |
||
23 | ;================================================================================ |
||
24 | proc main |
||
25 | ; ==== Init ==== |
||
26 | mcall 18, 7 |
||
27 | mov [win.psid], eax |
||
28 | |||
29 | mcall 40, 100101b |
||
30 | |||
31 | mov dword[file_exec.proc], 7 |
||
32 | |||
33 | ; ==== Load libs ==== |
||
34 | load_libraries load_lib_start, load_lib_end |
||
35 | |||
36 | ; ==== Config LibINI ==== |
||
37 | invoke ini.get_int, ini_data.file_name, ini_data.settings_name, ini_data.location_name, -1 |
||
38 | mov [dock_items.location], eax |
||
39 | |||
4121 | eAndrew | 40 | invoke ini.get_color, ini_data.file_name, ini_data.settings_name, ini_data.color_bg, 0x0 |
4120 | eAndrew | 41 | mov [color.bg], eax |
4121 | eAndrew | 42 | invoke ini.get_color, ini_data.file_name, ini_data.settings_name, ini_data.color_frame, 0xFFFFFF |
4120 | eAndrew | 43 | mov [color.frame], eax |
4121 | eAndrew | 44 | invoke ini.get_color, ini_data.file_name, ini_data.settings_name, ini_data.color_framein, 0x888888 |
4120 | eAndrew | 45 | mov [color.framein], eax |
4121 | eAndrew | 46 | invoke ini.get_color, ini_data.file_name, ini_data.settings_name, ini_data.color_text, 0xFFFFFF |
4120 | eAndrew | 47 | or eax, 0x80000000 |
48 | mov [color.text], eax |
||
49 | |||
50 | invoke ini.sections, ini_data.file_name, sections_callback |
||
51 | |||
52 | ; ==== Config LibIMG ==== |
||
53 | stdcall mem.Alloc, dword IMAGE_FILE_SIZE |
||
54 | mov [img_data.rgb_object], eax |
||
55 | |||
56 | mov dword[img_data.file.proc], 0 |
||
57 | mov dword[img_data.file.position], 0 |
||
58 | mov dword[img_data.file.size], dword IMAGE_FILE_SIZE |
||
59 | m2m dword[img_data.file.buffer], dword[img_data.rgb_object] |
||
60 | mov byte[img_data.file + 20], 0 |
||
61 | mov dword[img_data.file.name], img_data.file_name |
||
62 | |||
63 | mcall 70, img_data.file |
||
64 | |||
65 | cmp ebx, 0xFFFFFFFF |
||
66 | je @f |
||
67 | |||
68 | stdcall dword[img.decode], dword[img_data.rgb_object], ebx, 0 |
||
69 | mov dword[img_data.object], eax |
||
70 | |||
71 | ; === ALPHA === |
||
72 | mov edi, 0 |
||
73 | add eax, 24 |
||
74 | mov eax, [eax] |
||
75 | mov ecx, [color.bg] |
||
76 | .setalpha: |
||
77 | mov ebx, [eax + edi] |
||
78 | shr ebx, 24 |
||
79 | cmp ebx, 0 |
||
80 | jne .nonalpha |
||
81 | mov [eax + edi], ecx |
||
82 | .nonalpha: |
||
83 | add edi, 4 |
||
84 | cmp edi, IMAGE_DATA_SIZE |
||
85 | jne .setalpha |
||
86 | |||
87 | ; === CONVERTING TO BGR |
||
88 | stdcall dword[img.toRGB], dword[img_data.object], dword[img_data.rgb_object] |
||
89 | stdcall dword[img.destroy], dword[img_data.object] |
||
90 | |||
91 | ; ==== Config window ==== |
||
92 | mov eax, dword[dock_items.location] |
||
93 | and eax, 1b |
||
94 | cmp eax, 0 |
||
95 | je .vert |
||
96 | jmp .setshape |
||
97 | |||
98 | .vert: |
||
99 | mov byte[win.isvert], 1 |
||
100 | |||
101 | .setshape: |
||
102 | cmp byte[win.isvert], 1 |
||
103 | je .vert_sp |
||
104 | |||
105 | .horz_sp: |
||
106 | call .HORZ_WIDTH |
||
107 | call .HORZ_X |
||
108 | call .HORZ_HEIGHT |
||
109 | cmp dword[dock_items.location], 1 |
||
110 | je .settop |
||
111 | |||
112 | .setbottom: |
||
113 | call .HORZ_Y_BOTTOM |
||
114 | jmp .SETDEF |
||
115 | |||
116 | .settop: |
||
117 | call .HORZ_Y_TOP |
||
118 | jmp .SETDEF |
||
119 | |||
120 | |||
121 | .vert_sp: |
||
122 | call .VERT_WIDTH |
||
123 | call .VERT_HEIGHT |
||
124 | call .VERT_Y |
||
125 | cmp dword[dock_items.location], 2 |
||
126 | je .setleft |
||
127 | |||
128 | .setright: |
||
129 | call .VERT_X_RIGHT |
||
130 | jmp .SETDEF |
||
131 | |||
132 | .setleft: |
||
133 | call .VERT_X_LEFT |
||
134 | jmp .SETDEF |
||
135 | |||
136 | .HORZ_WIDTH: |
||
137 | mov eax, 42 |
||
138 | mov ebx, [dock_items.count] |
||
139 | imul eax, ebx |
||
140 | dec eax |
||
141 | mov [win.width_opn], eax |
||
142 | mov [win.width_hdn], eax |
||
143 | |||
144 | ret |
||
145 | |||
146 | .HORZ_X: |
||
147 | mcall 14 |
||
148 | shr eax, 16 |
||
149 | mov ebx, 2 |
||
150 | mov edx, 0 |
||
151 | div ebx |
||
152 | mov edx, 0 |
||
153 | mov ecx, eax |
||
154 | |||
155 | mov eax, [win.width_opn] |
||
156 | div ebx |
||
157 | sub ecx, eax |
||
158 | mov [win.x_opn], ecx |
||
159 | mov [win.x_hdn], ecx |
||
160 | |||
161 | ret |
||
162 | |||
163 | .HORZ_HEIGHT: |
||
164 | mov dword[win.height_opn], 42 |
||
165 | mov dword[win.height_hdn], 0 |
||
166 | |||
167 | ret |
||
168 | |||
169 | .HORZ_Y_BOTTOM: |
||
170 | mcall 14 |
||
171 | and eax, 0xFFFF |
||
172 | dec eax |
||
173 | mov [win.y_hdn], eax |
||
174 | sub eax, 42 |
||
175 | mov [win.y_opn], eax |
||
176 | |||
177 | ret |
||
178 | |||
179 | .HORZ_Y_TOP: |
||
180 | mov dword[win.y_opn], 0 |
||
181 | mov dword[win.y_hdn], 0 |
||
182 | |||
183 | ret |
||
184 | |||
185 | .VERT_WIDTH: |
||
186 | mov dword[win.width_opn], 42 |
||
187 | mov dword[win.width_hdn], 0 |
||
188 | |||
189 | ret |
||
190 | |||
191 | .VERT_X_LEFT: |
||
192 | |||
193 | mov dword[win.x_opn], 0 |
||
194 | mov dword[win.x_hdn], 0 |
||
195 | |||
196 | ret |
||
197 | |||
198 | .VERT_X_RIGHT: |
||
199 | mcall 14 |
||
200 | and eax, 0xFFFF0000 |
||
201 | shr eax, 16 |
||
202 | mov [win.x_hdn], eax |
||
203 | sub eax, 42 |
||
204 | mov [win.x_opn], eax |
||
205 | |||
206 | ret |
||
207 | |||
208 | .VERT_HEIGHT: |
||
209 | mov eax, 42 |
||
210 | mov ebx, [dock_items.count] |
||
211 | imul eax, ebx |
||
212 | dec eax |
||
213 | mov [win.height_opn], eax |
||
214 | mov [win.height_hdn], eax |
||
215 | |||
216 | ret |
||
217 | |||
218 | .VERT_Y: |
||
219 | mcall 14 |
||
220 | and eax, 0xFFFF |
||
221 | mov edx, 0 |
||
222 | mov ebx, 2 |
||
223 | div ebx |
||
224 | mov esi, eax |
||
225 | |||
226 | mov eax, [win.height_opn] |
||
227 | mov edx, 0 |
||
228 | mov ebx, 2 |
||
229 | div ebx |
||
230 | sub esi, eax |
||
231 | |||
232 | mov [win.y_hdn], esi |
||
233 | mov [win.y_opn], esi |
||
234 | |||
235 | ret |
||
236 | |||
237 | .SETDEF: |
||
238 | mov eax, [win.width_hdn] |
||
239 | mov [win.width], eax |
||
240 | |||
241 | mov eax, [win.x_hdn] |
||
242 | mov [win.x], eax |
||
243 | |||
244 | mov eax, [win.height_hdn] |
||
245 | mov [win.height], eax |
||
246 | |||
247 | mov eax, [win.y_hdn] |
||
248 | mov [win.y], eax |
||
249 | |||
250 | ; ==== START ==== |
||
251 | mcall 9, win.procinfo, -1 |
||
252 | mov ecx, [win.procinfo + 30] |
||
253 | mcall 18, 21 |
||
254 | and eax, 0xFFFF |
||
255 | mov [win.sid], eax |
||
256 | |||
257 | call main_loop |
||
258 | |||
259 | exit: |
||
260 | stdcall mem.Free, [img_data.rgb_object] |
||
261 | mcall 18, 2, [nwin.sid] |
||
262 | mcall -1 |
||
263 | endp |
||
264 | ;------------------------------------------------------------------------------- |
||
265 | proc main_loop |
||
266 | mcall 10 |
||
267 | |||
268 | cmp eax, EV_REDRAW |
||
269 | je event_redraw |
||
270 | |||
271 | cmp eax, EV_BUTTON |
||
272 | je event_button |
||
273 | |||
274 | cmp eax, EV_MOUSE |
||
275 | je event_mouse |
||
276 | |||
277 | jmp main_loop |
||
278 | |||
279 | .end: |
||
280 | ret |
||
281 | endp |
||
282 | ;------------------------------------------------------------------------------- |
||
283 | proc event_redraw |
||
284 | mcall 12, 1 |
||
285 | |||
286 | mcall 0, <[win.x], [win.width]>, <[win.y], [win.height]>, [color.frame], [color.frame], [color.frame] |
||
287 | |||
288 | and ebx, 0x0000FFFF |
||
289 | add ebx, 0x00010000 |
||
290 | sub ebx, 0x00000001 |
||
291 | |||
292 | and ecx, 0x0000FFFF |
||
293 | add ecx, 0x00010000 |
||
294 | sub ecx, 0x00000001 |
||
295 | |||
296 | mcall 13, , , [color.framein] |
||
297 | |||
298 | |||
299 | add ebx, 0x00010000 |
||
300 | sub ebx, 0x00000002 |
||
301 | |||
302 | add ecx, 0x00010000 |
||
303 | sub ecx, 0x00000002 |
||
304 | |||
305 | mcall 13, , , [color.bg] |
||
306 | |||
307 | mov edi, 0 |
||
308 | @@: |
||
309 | cmp edi, [dock_items.count] |
||
310 | je @f |
||
311 | |||
312 | push edi |
||
313 | imul esi, edi, 42 |
||
314 | shl esi, 16 |
||
315 | add esi, 41 |
||
316 | cmp byte[win.isvert], 1 |
||
317 | je .vert_btn |
||
318 | mcall 8, esi, <0, 42>, 0x60000002, [color.bg] |
||
319 | jmp .endbtn |
||
320 | .vert_btn: |
||
321 | mcall 8, <0, 42>, esi, 0x60000002, [color.bg] |
||
322 | .endbtn: |
||
323 | pop edi |
||
324 | |||
325 | cmp byte[dock_items.separator + edi], 1 |
||
326 | je .draw_separator |
||
327 | jmp .end_separator |
||
328 | |||
329 | .draw_separator: |
||
330 | push ebx |
||
331 | push ecx |
||
332 | mov ebx, edi |
||
333 | imul ebx, 42 |
||
334 | add ebx, 41 |
||
335 | shl ebx, 16 |
||
336 | add ebx, 1 |
||
337 | cmp byte[win.isvert], 1 |
||
338 | je .vert_draw_sep |
||
339 | mcall 13, , <0, 43>, [color.frame] |
||
340 | sub ebx, 0x00010000 |
||
341 | mcall 13, , <1, 41>, [color.framein] |
||
342 | add ebx, 0x00020000 |
||
343 | mcall 13, , <1, 41>, [color.framein] |
||
344 | jmp .end_inner_sep |
||
345 | .vert_draw_sep: |
||
346 | mov ecx, ebx |
||
347 | mcall 13, <0, 43>, , [color.frame] |
||
348 | sub ecx, 0x00010000 |
||
349 | mcall 13, <1, 41>, , [color.framein] |
||
350 | add ecx, 0x00020000 |
||
351 | mcall 13, <1, 41>, , [color.framein] |
||
352 | .end_inner_sep: |
||
353 | pop ecx |
||
354 | pop ebx |
||
355 | .end_separator: |
||
356 | |||
357 | cmp byte[win.isvert], 1 |
||
358 | je .vert_dig |
||
359 | mov edx, ebx |
||
360 | and edx, 0xFFFF0000 |
||
361 | add edx, 0x00050005 |
||
362 | jmp .digend |
||
363 | .vert_dig: |
||
364 | mov edx, ecx |
||
365 | and edx, 0xFFFF0000 |
||
366 | shr edx, 16 |
||
367 | add edx, 0x00050005 |
||
368 | .digend: |
||
369 | |||
370 | imul ebx, edi, 4 |
||
371 | add ebx, dock_items.icon |
||
372 | mov ebx, [ebx] |
||
373 | imul ebx, ICON_SIZE |
||
374 | add ebx, [img_data.rgb_object] |
||
375 | |||
376 | mcall 7, , <32, 32> |
||
377 | |||
378 | inc edi |
||
379 | jmp @b |
||
380 | @@: |
||
381 | |||
382 | mcall 12, 2 |
||
383 | |||
384 | jmp main_loop |
||
385 | endp |
||
386 | ;------------------------------------------------------------------------------- |
||
387 | proc event_button |
||
388 | mcall 17 |
||
389 | |||
390 | cmp ah, 1 |
||
391 | je .button_close |
||
392 | |||
393 | cmp ah, 2 |
||
394 | je .button_dock |
||
395 | |||
396 | jmp @f |
||
397 | |||
398 | .button_close: |
||
399 | jmp exit |
||
400 | |||
401 | .button_dock: |
||
402 | mov edi, [win.button_index] |
||
403 | imul edi, 256 |
||
404 | |||
405 | mov esi, edi |
||
406 | add esi, dock_items.path |
||
407 | mov dword[file_exec.file], esi |
||
408 | |||
409 | mov esi, edi |
||
410 | add esi, dock_items.param |
||
411 | mov dword[file_exec.param], esi |
||
412 | |||
413 | mcall 70, file_exec |
||
414 | |||
415 | @@: |
||
416 | jmp main_loop |
||
417 | endp |
||
418 | ;------------------------------------------------------------------------------- |
||
419 | proc event_mouse |
||
420 | mcall 37, 1 |
||
421 | mov edi, eax |
||
422 | mov esi, eax |
||
423 | shr edi, 16 |
||
424 | and esi, 0xFFFF |
||
425 | |||
426 | cmp edi, 0 |
||
427 | jl @f |
||
428 | dec edi |
||
429 | cmp edi, [win.width] |
||
430 | jg @f |
||
431 | cmp esi, 0 |
||
432 | jl @f |
||
433 | dec esi |
||
434 | cmp esi, [win.height] |
||
435 | jg @f |
||
436 | |||
437 | mov eax, [dock_items.location] |
||
438 | and eax, 1b |
||
439 | cmp eax, 1 |
||
440 | jne .vert |
||
441 | mov eax, edi |
||
442 | jmp .nxt |
||
443 | |||
444 | .vert: |
||
445 | mov eax, esi |
||
446 | |||
447 | .nxt: |
||
448 | mov edx, 0 |
||
449 | mov ebx, 42 |
||
450 | div ebx |
||
451 | |||
452 | cmp eax, [dock_items.count] |
||
453 | jge .set0 |
||
454 | jmp .nxtcmp |
||
455 | |||
456 | .set0: |
||
457 | mov eax, 100 |
||
458 | |||
459 | .nxtcmp: |
||
460 | cmp [win.button_index], eax |
||
461 | je .nxt2 |
||
462 | |||
463 | mov [win.button_index], eax |
||
464 | |||
465 | .nxt2: |
||
466 | mov eax, [win.button_index] |
||
467 | imul eax, 42 |
||
468 | cmp byte[win.isvert], 1 |
||
469 | je .vert_name |
||
470 | sub eax, 13 |
||
471 | add eax, [win.x] |
||
472 | mov [nwin.x], eax |
||
473 | jmp .vert_end |
||
474 | .vert_name: |
||
475 | add eax, 13 |
||
476 | add eax, [win.y] |
||
477 | mov [nwin.y], eax |
||
478 | .vert_end: |
||
479 | mov byte[nwin.change_shape], 1 |
||
480 | |||
481 | cmp byte[win.state], 1 |
||
482 | je .end_cmp |
||
483 | |||
484 | mov edx, esp |
||
485 | add edx, 512 |
||
486 | mcall 51, 1, n_main |
||
487 | |||
488 | mcall 18, 7 |
||
489 | mov [win.psid], eax |
||
490 | |||
491 | mcall 18, 3, [win.sid] |
||
492 | |||
493 | mov byte[win.state], 1 |
||
494 | |||
495 | mov eax, [win.width_opn] |
||
496 | mov [win.width], eax |
||
497 | |||
498 | mov eax, [win.x_opn] |
||
499 | mov [win.x], eax |
||
500 | |||
501 | mov eax, [win.height_opn] |
||
502 | mov [win.height], eax |
||
503 | |||
504 | mov eax, [win.y_opn] |
||
505 | mov [win.y], eax |
||
506 | |||
507 | mcall 67, [win.x], [win.y], [win.width], [win.height] |
||
508 | |||
509 | call event_redraw |
||
510 | |||
511 | @@: |
||
512 | cmp byte[win.state], 0 |
||
513 | je .end_cmp |
||
514 | |||
515 | mov byte[nwin.close], 1 |
||
516 | |||
517 | mcall 18, 3, [win.psid] |
||
518 | |||
519 | mov byte[win.state], 0 |
||
520 | mov byte[win.button_index], -1 |
||
521 | |||
522 | mov eax, [win.width_hdn] |
||
523 | mov [win.width], eax |
||
524 | |||
525 | mov eax, [win.x_hdn] |
||
526 | mov [win.x], eax |
||
527 | |||
528 | mov eax, [win.height_hdn] |
||
529 | mov [win.height], eax |
||
530 | |||
531 | mov eax, [win.y_hdn] |
||
532 | mov [win.y], eax |
||
533 | |||
534 | mcall 67, [win.x], [win.y], [win.width], [win.height] |
||
535 | |||
536 | call event_redraw |
||
537 | |||
538 | .end_cmp: |
||
539 | jmp main_loop |
||
540 | endp |
||
541 | ;------------------------------------------------------------------------------- |
||
542 | proc sections_callback, _file_name, _section_name |
||
543 | mov eax, [_section_name] |
||
544 | cmp byte[eax], '@' |
||
545 | jne @f |
||
546 | |||
547 | dec dword[dock_items.count] |
||
548 | jmp .endproc |
||
549 | |||
550 | @@: |
||
551 | ; ==== GET NAME ==== |
||
552 | mov ebx, [dock_items.count] |
||
553 | imul ebx, 16 |
||
554 | add ebx, dock_items.name |
||
555 | |||
556 | mov eax, [_section_name] |
||
557 | |||
558 | mov edi, 0 |
||
559 | @@: |
||
560 | mov cl, byte[eax] |
||
561 | mov byte[ebx + edi], cl |
||
562 | |||
563 | inc eax |
||
564 | inc edi |
||
565 | cmp edi, 10 |
||
566 | jne @b |
||
567 | |||
568 | ; ==== GET PATH ==== |
||
569 | mov ebx, [dock_items.count] |
||
570 | imul ebx, 256 |
||
571 | add ebx, dock_items.path |
||
572 | |||
573 | invoke ini.get_str, [_file_name], [_section_name], ini_data.path_name, ebx, 256, 0 |
||
574 | |||
575 | ; === GET PARAM === |
||
576 | mov ebx, [dock_items.count] |
||
577 | imul ebx, 256 |
||
578 | add ebx, dock_items.param |
||
579 | |||
580 | invoke ini.get_str, [_file_name], [_section_name], ini_data.param_name, ebx, 256, 0 |
||
581 | |||
582 | ; ==== GET ICON ==== |
||
583 | invoke ini.get_int, [_file_name], [_section_name], ini_data.icon_name, 0 |
||
584 | |||
585 | mov ebx, [dock_items.count] |
||
586 | imul ebx, 4 |
||
587 | mov [dock_items.icon + ebx], eax |
||
588 | |||
589 | ; ==== GET SEPARATOR ==== |
||
590 | invoke ini.get_int, [_file_name], [_section_name], ini_data.separator_name, 0 |
||
591 | |||
592 | mov ebx, [dock_items.count] |
||
593 | mov byte[dock_items.separator + ebx], al |
||
594 | |||
595 | ; ====== END ======= |
||
596 | .endproc: |
||
597 | mov eax, 1 |
||
598 | inc dword[dock_items.count] |
||
599 | ret |
||
600 | endp |
||
601 | ;------------------------------------------------------------------------------- |
||
602 | n_main: |
||
603 | cmp dword[dock_items.location], 1 |
||
604 | je .top |
||
605 | cmp dword[dock_items.location], 4 |
||
606 | je .right |
||
607 | cmp dword[dock_items.location], 3 |
||
608 | je .bottom |
||
609 | jmp .left |
||
610 | .top: |
||
611 | mov eax, [win.height_opn] |
||
612 | add eax, 5 |
||
613 | mov [nwin.y], eax |
||
614 | jmp @f |
||
615 | .right: |
||
616 | mov eax, [win.x_opn] |
||
617 | sub eax, 73 |
||
618 | mov [nwin.x], eax |
||
619 | jmp @f |
||
620 | .bottom: |
||
621 | mov eax, [win.y_opn] |
||
622 | sub eax, 21 |
||
623 | mov [nwin.y], eax |
||
624 | jmp @f |
||
625 | .left: |
||
626 | mov eax, [win.width_opn] |
||
627 | add eax, 5 |
||
628 | mov [nwin.x], eax |
||
629 | @@: |
||
630 | mov dword[nwin.width], 68 |
||
631 | mov dword[nwin.height], 16 |
||
632 | |||
633 | mcall 40, 1b |
||
634 | |||
635 | mcall 9, win.procinfo, -1 |
||
636 | mov ecx, [win.procinfo + 30] |
||
637 | mcall 18, 21 |
||
638 | and eax, 0xFFFF |
||
639 | mov [nwin.sid], eax |
||
640 | ;------------------------------------------------------------------------------- |
||
641 | n_main_loop: |
||
642 | mcall 23, 1 |
||
643 | |||
644 | cmp eax, EV_IDLE |
||
645 | je n_event_idle |
||
646 | cmp eax, EV_REDRAW |
||
647 | je n_event_redraw |
||
648 | |||
649 | jmp n_main_loop |
||
650 | ;------------------------------------------------------------------------------- |
||
651 | n_event_idle: |
||
652 | cmp byte[nwin.close], 1 |
||
653 | jne @f |
||
654 | |||
655 | mov byte[nwin.close], 0 |
||
656 | mcall -1 |
||
657 | |||
658 | @@: |
||
659 | cmp byte[win.button_index], 100 |
||
660 | jne @f |
||
661 | |||
662 | mcall 67, 0, 0, 0, 0 |
||
663 | jmp .end |
||
664 | |||
665 | @@: |
||
666 | cmp byte[nwin.change_shape], 1 |
||
667 | jne .end |
||
668 | |||
669 | mov byte[nwin.change_shape], 0 |
||
670 | mcall 67, [nwin.x], [nwin.y], [nwin.width], [nwin.height] |
||
671 | |||
672 | .end: |
||
673 | jmp n_main_loop |
||
674 | ;------------------------------------------------------------------------------- |
||
675 | n_event_redraw: |
||
676 | mcall 12, 1 |
||
677 | |||
678 | mcall 0, <[nwin.x], [nwin.width]>, <[nwin.y], [nwin.height]>, [color.frame], [color.frame], [color.frame] |
||
679 | |||
680 | and ebx, 0x0000FFFF |
||
681 | add ebx, 0x00010000 |
||
682 | sub ebx, 0x00000001 |
||
683 | |||
684 | and ecx, 0x0000FFFF |
||
685 | add ecx, 0x00010000 |
||
686 | sub ecx, 0x00000001 |
||
687 | |||
688 | mcall 13, , , [color.framein] |
||
689 | |||
690 | |||
691 | add ebx, 0x00010000 |
||
692 | sub ebx, 0x00000002 |
||
693 | |||
694 | add ecx, 0x00010000 |
||
695 | sub ecx, 0x00000002 |
||
696 | |||
697 | mcall 13, , , [color.bg] |
||
698 | |||
699 | mov edx, [win.button_index] |
||
700 | imul edx, 16 |
||
701 | add edx, dock_items.name |
||
702 | |||
703 | mov eax, 0 |
||
704 | @@: |
||
705 | inc eax |
||
706 | cmp byte[edx+eax], 0 |
||
707 | jne @b |
||
708 | |||
709 | imul eax, 3 |
||
710 | mov ebx, 34 |
||
711 | sub ebx, eax |
||
712 | inc ebx |
||
713 | shl ebx, 16 |
||
714 | add ebx, 5 |
||
715 | |||
716 | mcall 4, , [color.text] |
||
717 | |||
718 | mcall 12, 2 |
||
719 | |||
720 | jmp n_main_loop |
||
721 | ;------------------------------------------------------------------------------- |
||
722 | img_data: |
||
723 | .file_name: |
||
724 | db "/sys/iconstrp.png", 0 |
||
725 | .cfg_text: |
||
726 | db "R", 0 |
||
727 | .ext_text: |
||
728 | db "X", 0 |
||
729 | ;------------------------------------------------------------------------------- |
||
730 | ini_data: |
||
731 | .file_name: |
||
732 | db "/sys/settings/Docky.ini", 0 |
||
733 | .path_name: |
||
734 | db "path", 0 |
||
735 | .param_name: |
||
736 | db "param", 0 |
||
737 | .icon_name: |
||
738 | db "icon", 0 |
||
739 | .separator_name: |
||
740 | db "separator", 0 |
||
741 | |||
742 | .settings_name: |
||
743 | db "@SETTINGS", 0 |
||
744 | .location_name: |
||
745 | db "location", 0 |
||
746 | .color_bg: |
||
747 | db "bg", 0 |
||
748 | .color_frame: |
||
749 | db "frame", 0 |
||
750 | .color_framein: |
||
751 | db "framein", 0 |
||
752 | .color_text: |
||
753 | db "text", 0 |
||
754 | ;------------------------------------------------------------------------------- |
||
755 | load_lib_start: |
||
756 | lib1 l_libs img.name, \ |
||
757 | sys_path, \ |
||
758 | file_name, \ |
||
759 | img.dir, \ |
||
760 | error, \ |
||
761 | error, \ |
||
762 | img, \ |
||
763 | error, \ |
||
764 | error |
||
765 | |||
766 | lib2 l_libs ini.name, \ |
||
767 | sys_path, \ |
||
768 | file_name, \ |
||
769 | ini.dir, \ |
||
770 | error, \ |
||
771 | error, \ |
||
772 | ini, \ |
||
773 | error, \ |
||
774 | error |
||
775 | load_lib_end: |
||
776 | ;------------------------------------------------------------------------------- |
||
777 | img: |
||
778 | .init \ |
||
779 | dd .init_T |
||
780 | .toRGB \ |
||
781 | dd .toRGB_T |
||
782 | .decode \ |
||
783 | dd .decode_T |
||
784 | .destroy \ |
||
785 | dd .destroy_T |
||
786 | |||
787 | dd 0, 0 |
||
788 | |||
789 | .init_T: |
||
790 | db "lib_init", 0 |
||
791 | .toRGB_T: |
||
792 | db "img_to_rgb2", 0 |
||
793 | .decode_T: |
||
794 | db "img_decode", 0 |
||
795 | .destroy_T: |
||
796 | db "img_destroy", 0 |
||
797 | |||
798 | .dir: |
||
799 | db "/sys/lib/" |
||
800 | .name: |
||
801 | db "libimg.obj", 0 |
||
802 | ;------------------------------------------------------------------------------- |
||
803 | ini: |
||
804 | .init \ |
||
805 | dd .init_T |
||
806 | .sections \ |
||
807 | dd .sections_T |
||
808 | .get_int \ |
||
809 | dd .get_int_T |
||
810 | .get_str \ |
||
811 | dd .get_str_T |
||
812 | .get_color\ |
||
813 | dd .get_color_T |
||
814 | |||
815 | dd 0, 0 |
||
816 | |||
817 | .init_T: |
||
818 | db "lib_init", 0 |
||
819 | .sections_T: |
||
820 | db "ini_enum_sections", 0 |
||
821 | .get_int_T: |
||
822 | db "ini_get_int", 0 |
||
823 | .get_str_T: |
||
824 | db "ini_get_str", 0 |
||
825 | .get_color_T: |
||
826 | db "ini_get_color", 0 |
||
827 | |||
828 | .dir: |
||
829 | db "/sys/lib/" |
||
830 | .name: |
||
831 | db "libini.obj", 0 |
||
832 | ;------------------------------------------------------------------------------- |
||
833 | error: |
||
834 | db 0 |
||
835 | ;------------------------------------------------------------------------------- |
||
836 | __dataend: |
||
837 | ;================================================================================ |
||
838 | rb 1024 |
||
839 | __stackend: |
||
840 | ;================================================================================ |
||
841 | color: |
||
842 | .bg: |
||
843 | rd 1 |
||
844 | .frame: |
||
845 | rd 1 |
||
846 | .framein: |
||
847 | rd 1 |
||
848 | .text: |
||
849 | rd 1 |
||
850 | ;------------------------------------------------------------------------------- |
||
851 | win: |
||
852 | .x: |
||
853 | rd 1 |
||
854 | .y: |
||
855 | rd 1 |
||
856 | .width: |
||
857 | rd 1 |
||
858 | .height: |
||
859 | rd 1 |
||
860 | |||
861 | .x_hdn: |
||
862 | rd 1 |
||
863 | .y_hdn: |
||
864 | rd 1 |
||
865 | .width_hdn: |
||
866 | rd 1 |
||
867 | .height_hdn: |
||
868 | rd 1 |
||
869 | |||
870 | .x_opn: |
||
871 | rd 1 |
||
872 | .y_opn: |
||
873 | rd 1 |
||
874 | .width_opn: |
||
875 | rd 1 |
||
876 | .height_opn: |
||
877 | rd 1 |
||
878 | |||
879 | .sid: |
||
880 | rd 1 |
||
881 | .psid: |
||
882 | rd 1 |
||
883 | .procinfo: |
||
884 | rb 1024 |
||
885 | .state: |
||
886 | rb 1 |
||
887 | .button_index: |
||
888 | rd 1 |
||
889 | |||
890 | .isvert: |
||
891 | rb 1 |
||
892 | ;------------------------------------------------------------------------------- |
||
893 | nwin: |
||
894 | .x: |
||
895 | rd 1 |
||
896 | .y: |
||
897 | rd 1 |
||
898 | .width: |
||
899 | rd 1 |
||
900 | .height: |
||
901 | rd 1 |
||
902 | |||
903 | .visible: |
||
904 | rd 1 |
||
905 | .sid: |
||
906 | rd 1 |
||
907 | .change_shape: |
||
908 | rb 1 |
||
909 | .close: |
||
910 | rb 1 |
||
911 | ;------------------------------------------------------------------------------- |
||
912 | img_data.object: |
||
913 | rd 1 |
||
914 | img_data.rgb_object: |
||
915 | rd 1 |
||
916 | img_data.file: |
||
917 | .proc: |
||
918 | rd 1 |
||
919 | .position: |
||
920 | rd 1 |
||
921 | rd 1 |
||
922 | .size: |
||
923 | rd 1 |
||
924 | .buffer: |
||
925 | rd 1 |
||
926 | rb 1 |
||
927 | .name: |
||
928 | rd 1 |
||
929 | ;------------------------------------------------------------------------------- |
||
930 | file_exec: |
||
931 | .proc: |
||
932 | rd 1 |
||
933 | rd 1 |
||
934 | .param: |
||
935 | rd 1 |
||
936 | rd 1 |
||
937 | rd 1 |
||
938 | rb 1 |
||
939 | .file: |
||
940 | rd 1 |
||
941 | ;------------------------------------------------------------------------------- |
||
942 | dock_items: |
||
943 | .count: |
||
944 | rd 1 |
||
945 | .name: |
||
946 | rb 16 * 20 |
||
947 | .path: |
||
948 | rb 256 * 20 |
||
949 | .param: |
||
950 | rb 256 * 20 |
||
951 | .icon: |
||
952 | rd 1 * 20 |
||
953 | .separator: |
||
954 | rb 1 * 20 |
||
955 | .location: |
||
956 | rd 1 |
||
957 | ;------------------------------------------------------------------------------- |
||
958 | sys_path: |
||
959 | rb 4096 |
||
960 | file_name: |
||
961 | rb 4096 |
||
962 | ;------------------------------------------------------------------------------- |
||
963 | __memend: |
||
964 | ;================================================================================[nwin.y],>[nwin.x],>32,>1,>1,>0,>1,>1,>0,>0,>0,>[win.y],>[win.x],> |