Rev 4124 | Rev 4134 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4124 | eAndrew | 1 | ;;; Docky v0.4.3 by eAndrew |
4120 | 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 |
||
4124 | eAndrew | 21 | IMAGE_FILE_SIZE equ ICON_SIZE * 29 |
4120 | eAndrew | 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 | |||
4124 | eAndrew | 288 | mov eax, 13 |
289 | |||
4120 | eAndrew | 290 | and ebx, 0x0000FFFF |
291 | add ebx, 0x00010000 |
||
292 | sub ebx, 0x00000001 |
||
293 | |||
294 | and ecx, 0x0000FFFF |
||
295 | add ecx, 0x00010000 |
||
296 | sub ecx, 0x00000001 |
||
297 | |||
4124 | eAndrew | 298 | mcall , , , [color.framein] |
4120 | eAndrew | 299 | |
300 | |||
301 | add ebx, 0x00010000 |
||
302 | sub ebx, 0x00000002 |
||
303 | |||
304 | add ecx, 0x00010000 |
||
305 | sub ecx, 0x00000002 |
||
306 | |||
4124 | eAndrew | 307 | mcall , , , [color.bg] |
4120 | eAndrew | 308 | |
309 | mov edi, 0 |
||
310 | @@: |
||
311 | cmp edi, [dock_items.count] |
||
312 | je @f |
||
313 | |||
314 | push edi |
||
4124 | eAndrew | 315 | mov eax, 8 |
316 | mov edx, 0x60000002 |
||
317 | mov esi, [color.bg] |
||
318 | imul edi, 42 |
||
319 | shl edi, 16 |
||
320 | add edi, 41 |
||
4120 | eAndrew | 321 | cmp byte[win.isvert], 1 |
322 | je .vert_btn |
||
4124 | eAndrew | 323 | mcall , edi, <0, 42> |
4120 | eAndrew | 324 | jmp .endbtn |
325 | .vert_btn: |
||
4124 | eAndrew | 326 | mcall , <0, 42>, edi |
4120 | eAndrew | 327 | .endbtn: |
328 | pop edi |
||
329 | |||
330 | cmp byte[dock_items.separator + edi], 1 |
||
331 | je .draw_separator |
||
332 | jmp .end_separator |
||
333 | |||
334 | .draw_separator: |
||
335 | push ebx |
||
336 | push ecx |
||
4124 | eAndrew | 337 | mov eax, 13 |
4120 | eAndrew | 338 | mov ebx, edi |
339 | imul ebx, 42 |
||
340 | add ebx, 41 |
||
341 | shl ebx, 16 |
||
342 | add ebx, 1 |
||
343 | cmp byte[win.isvert], 1 |
||
344 | je .vert_draw_sep |
||
4124 | eAndrew | 345 | mcall , , <0, 43>, [color.frame] |
4120 | eAndrew | 346 | sub ebx, 0x00010000 |
4124 | eAndrew | 347 | mov edx, [color.framein] |
348 | mcall , , <1, 41> |
||
4120 | eAndrew | 349 | add ebx, 0x00020000 |
4124 | eAndrew | 350 | mcall , , <1, 41> |
4120 | eAndrew | 351 | jmp .end_inner_sep |
352 | .vert_draw_sep: |
||
353 | mov ecx, ebx |
||
4124 | eAndrew | 354 | mcall , <0, 43>, , [color.frame] |
4120 | eAndrew | 355 | sub ecx, 0x00010000 |
4124 | eAndrew | 356 | mov edx, [color.framein] |
357 | mcall , <1, 41> |
||
4120 | eAndrew | 358 | add ecx, 0x00020000 |
4124 | eAndrew | 359 | mcall , <1, 41> |
4120 | eAndrew | 360 | .end_inner_sep: |
361 | pop ecx |
||
362 | pop ebx |
||
363 | .end_separator: |
||
364 | |||
365 | cmp byte[win.isvert], 1 |
||
366 | je .vert_dig |
||
367 | mov edx, ebx |
||
368 | and edx, 0xFFFF0000 |
||
369 | add edx, 0x00050005 |
||
370 | jmp .digend |
||
371 | .vert_dig: |
||
372 | mov edx, ecx |
||
373 | and edx, 0xFFFF0000 |
||
374 | shr edx, 16 |
||
375 | add edx, 0x00050005 |
||
376 | .digend: |
||
377 | |||
378 | imul ebx, edi, 4 |
||
379 | add ebx, dock_items.icon |
||
380 | mov ebx, [ebx] |
||
381 | imul ebx, ICON_SIZE |
||
382 | add ebx, [img_data.rgb_object] |
||
383 | |||
384 | mcall 7, , <32, 32> |
||
385 | |||
386 | inc edi |
||
387 | jmp @b |
||
388 | @@: |
||
389 | |||
390 | mcall 12, 2 |
||
391 | |||
392 | jmp main_loop |
||
393 | endp |
||
394 | ;------------------------------------------------------------------------------- |
||
395 | proc event_button |
||
396 | mcall 17 |
||
397 | |||
398 | cmp ah, 1 |
||
399 | je .button_close |
||
400 | |||
401 | cmp ah, 2 |
||
402 | je .button_dock |
||
403 | |||
404 | jmp @f |
||
405 | |||
406 | .button_close: |
||
407 | jmp exit |
||
408 | |||
409 | .button_dock: |
||
410 | mov edi, [win.button_index] |
||
411 | imul edi, 256 |
||
412 | |||
413 | mov esi, edi |
||
414 | add esi, dock_items.path |
||
415 | mov dword[file_exec.file], esi |
||
416 | |||
417 | mov esi, edi |
||
418 | add esi, dock_items.param |
||
419 | mov dword[file_exec.param], esi |
||
420 | |||
421 | mcall 70, file_exec |
||
422 | |||
423 | @@: |
||
424 | jmp main_loop |
||
425 | endp |
||
426 | ;------------------------------------------------------------------------------- |
||
427 | proc event_mouse |
||
428 | mcall 37, 1 |
||
429 | mov edi, eax |
||
430 | mov esi, eax |
||
431 | shr edi, 16 |
||
432 | and esi, 0xFFFF |
||
433 | |||
434 | cmp edi, 0 |
||
435 | jl @f |
||
436 | dec edi |
||
437 | cmp edi, [win.width] |
||
438 | jg @f |
||
439 | cmp esi, 0 |
||
440 | jl @f |
||
441 | dec esi |
||
442 | cmp esi, [win.height] |
||
443 | jg @f |
||
444 | |||
445 | mov eax, [dock_items.location] |
||
446 | and eax, 1b |
||
447 | cmp eax, 1 |
||
448 | jne .vert |
||
449 | mov eax, edi |
||
450 | jmp .nxt |
||
451 | |||
452 | .vert: |
||
453 | mov eax, esi |
||
454 | |||
455 | .nxt: |
||
456 | mov edx, 0 |
||
457 | mov ebx, 42 |
||
458 | div ebx |
||
459 | |||
460 | cmp eax, [dock_items.count] |
||
461 | jge .set0 |
||
462 | jmp .nxtcmp |
||
463 | |||
464 | .set0: |
||
465 | mov eax, 100 |
||
466 | |||
467 | .nxtcmp: |
||
468 | cmp [win.button_index], eax |
||
469 | je .nxt2 |
||
470 | |||
471 | mov [win.button_index], eax |
||
472 | |||
473 | .nxt2: |
||
474 | mov eax, [win.button_index] |
||
475 | imul eax, 42 |
||
476 | cmp byte[win.isvert], 1 |
||
477 | je .vert_name |
||
478 | sub eax, 13 |
||
479 | add eax, [win.x] |
||
480 | mov [nwin.x], eax |
||
481 | jmp .vert_end |
||
482 | .vert_name: |
||
483 | add eax, 13 |
||
484 | add eax, [win.y] |
||
485 | mov [nwin.y], eax |
||
486 | .vert_end: |
||
487 | mov byte[nwin.change_shape], 1 |
||
488 | |||
489 | cmp byte[win.state], 1 |
||
490 | je .end_cmp |
||
491 | |||
492 | mov edx, esp |
||
493 | add edx, 512 |
||
494 | mcall 51, 1, n_main |
||
495 | |||
4124 | eAndrew | 496 | mov eax, 18 |
497 | |||
498 | mcall , 7 |
||
4120 | eAndrew | 499 | mov [win.psid], eax |
500 | |||
4129 | eAndrew | 501 | mcall 18, 3, [win.sid] |
4120 | eAndrew | 502 | |
503 | mov byte[win.state], 1 |
||
504 | |||
505 | mov eax, [win.width_opn] |
||
506 | mov [win.width], eax |
||
507 | |||
508 | mov eax, [win.x_opn] |
||
509 | mov [win.x], eax |
||
510 | |||
511 | mov eax, [win.height_opn] |
||
512 | mov [win.height], eax |
||
513 | |||
514 | mov eax, [win.y_opn] |
||
515 | mov [win.y], eax |
||
516 | |||
517 | mcall 67, [win.x], [win.y], [win.width], [win.height] |
||
518 | |||
519 | call event_redraw |
||
520 | |||
521 | @@: |
||
522 | cmp byte[win.state], 0 |
||
523 | je .end_cmp |
||
524 | |||
525 | mov byte[nwin.close], 1 |
||
526 | |||
527 | mcall 18, 3, [win.psid] |
||
528 | |||
529 | mov byte[win.state], 0 |
||
530 | mov byte[win.button_index], -1 |
||
531 | |||
532 | mov eax, [win.width_hdn] |
||
533 | mov [win.width], eax |
||
534 | |||
535 | mov eax, [win.x_hdn] |
||
536 | mov [win.x], eax |
||
537 | |||
538 | mov eax, [win.height_hdn] |
||
539 | mov [win.height], eax |
||
540 | |||
541 | mov eax, [win.y_hdn] |
||
542 | mov [win.y], eax |
||
543 | |||
544 | mcall 67, [win.x], [win.y], [win.width], [win.height] |
||
545 | |||
546 | call event_redraw |
||
547 | |||
548 | .end_cmp: |
||
549 | jmp main_loop |
||
550 | endp |
||
551 | ;------------------------------------------------------------------------------- |
||
552 | proc sections_callback, _file_name, _section_name |
||
553 | mov eax, [_section_name] |
||
554 | cmp byte[eax], '@' |
||
555 | jne @f |
||
556 | |||
557 | dec dword[dock_items.count] |
||
558 | jmp .endproc |
||
559 | |||
560 | @@: |
||
561 | ; ==== GET NAME ==== |
||
562 | mov ebx, [dock_items.count] |
||
563 | imul ebx, 16 |
||
564 | add ebx, dock_items.name |
||
565 | |||
566 | mov eax, [_section_name] |
||
567 | |||
568 | mov edi, 0 |
||
569 | @@: |
||
570 | mov cl, byte[eax] |
||
571 | mov byte[ebx + edi], cl |
||
572 | |||
573 | inc eax |
||
574 | inc edi |
||
575 | cmp edi, 10 |
||
576 | jne @b |
||
577 | |||
578 | ; ==== GET PATH ==== |
||
579 | mov ebx, [dock_items.count] |
||
580 | imul ebx, 256 |
||
581 | add ebx, dock_items.path |
||
582 | |||
583 | invoke ini.get_str, [_file_name], [_section_name], ini_data.path_name, ebx, 256, 0 |
||
584 | |||
585 | ; === GET PARAM === |
||
586 | mov ebx, [dock_items.count] |
||
587 | imul ebx, 256 |
||
588 | add ebx, dock_items.param |
||
589 | |||
590 | invoke ini.get_str, [_file_name], [_section_name], ini_data.param_name, ebx, 256, 0 |
||
591 | |||
592 | ; ==== GET ICON ==== |
||
593 | invoke ini.get_int, [_file_name], [_section_name], ini_data.icon_name, 0 |
||
594 | |||
595 | mov ebx, [dock_items.count] |
||
596 | imul ebx, 4 |
||
597 | mov [dock_items.icon + ebx], eax |
||
598 | |||
599 | ; ==== GET SEPARATOR ==== |
||
600 | invoke ini.get_int, [_file_name], [_section_name], ini_data.separator_name, 0 |
||
601 | |||
602 | mov ebx, [dock_items.count] |
||
603 | mov byte[dock_items.separator + ebx], al |
||
604 | |||
605 | ; ====== END ======= |
||
606 | .endproc: |
||
607 | mov eax, 1 |
||
608 | inc dword[dock_items.count] |
||
609 | ret |
||
610 | endp |
||
611 | ;------------------------------------------------------------------------------- |
||
612 | n_main: |
||
613 | cmp dword[dock_items.location], 1 |
||
614 | je .top |
||
615 | cmp dword[dock_items.location], 4 |
||
616 | je .right |
||
617 | cmp dword[dock_items.location], 3 |
||
618 | je .bottom |
||
619 | jmp .left |
||
620 | .top: |
||
621 | mov eax, [win.height_opn] |
||
622 | add eax, 5 |
||
623 | mov [nwin.y], eax |
||
624 | jmp @f |
||
625 | .right: |
||
626 | mov eax, [win.x_opn] |
||
627 | sub eax, 73 |
||
628 | mov [nwin.x], eax |
||
629 | jmp @f |
||
630 | .bottom: |
||
631 | mov eax, [win.y_opn] |
||
632 | sub eax, 21 |
||
633 | mov [nwin.y], eax |
||
634 | jmp @f |
||
635 | .left: |
||
636 | mov eax, [win.width_opn] |
||
637 | add eax, 5 |
||
638 | mov [nwin.x], eax |
||
639 | @@: |
||
640 | mov dword[nwin.width], 68 |
||
641 | mov dword[nwin.height], 16 |
||
642 | |||
643 | mcall 40, 1b |
||
644 | |||
645 | mcall 9, win.procinfo, -1 |
||
646 | mov ecx, [win.procinfo + 30] |
||
647 | mcall 18, 21 |
||
648 | and eax, 0xFFFF |
||
649 | mov [nwin.sid], eax |
||
650 | ;------------------------------------------------------------------------------- |
||
651 | n_main_loop: |
||
652 | mcall 23, 1 |
||
653 | |||
654 | cmp eax, EV_IDLE |
||
655 | je n_event_idle |
||
656 | cmp eax, EV_REDRAW |
||
657 | je n_event_redraw |
||
658 | |||
659 | jmp n_main_loop |
||
660 | ;------------------------------------------------------------------------------- |
||
661 | n_event_idle: |
||
662 | cmp byte[nwin.close], 1 |
||
663 | jne @f |
||
664 | |||
665 | mov byte[nwin.close], 0 |
||
666 | mcall -1 |
||
667 | |||
668 | @@: |
||
669 | cmp byte[win.button_index], 100 |
||
670 | jne @f |
||
671 | |||
672 | mcall 67, 0, 0, 0, 0 |
||
673 | jmp .end |
||
674 | |||
675 | @@: |
||
676 | cmp byte[nwin.change_shape], 1 |
||
677 | jne .end |
||
678 | |||
679 | mov byte[nwin.change_shape], 0 |
||
680 | mcall 67, [nwin.x], [nwin.y], [nwin.width], [nwin.height] |
||
681 | |||
682 | .end: |
||
683 | jmp n_main_loop |
||
684 | ;------------------------------------------------------------------------------- |
||
685 | n_event_redraw: |
||
686 | mcall 12, 1 |
||
687 | |||
688 | mcall 0, <[nwin.x], [nwin.width]>, <[nwin.y], [nwin.height]>, [color.frame], [color.frame], [color.frame] |
||
689 | |||
4124 | eAndrew | 690 | mov eax, 13 |
691 | |||
4120 | eAndrew | 692 | and ebx, 0x0000FFFF |
693 | add ebx, 0x00010000 |
||
694 | sub ebx, 0x00000001 |
||
695 | |||
696 | and ecx, 0x0000FFFF |
||
697 | add ecx, 0x00010000 |
||
698 | sub ecx, 0x00000001 |
||
699 | |||
4124 | eAndrew | 700 | mcall , , , [color.framein] |
4120 | eAndrew | 701 | |
702 | |||
703 | add ebx, 0x00010000 |
||
704 | sub ebx, 0x00000002 |
||
705 | |||
706 | add ecx, 0x00010000 |
||
707 | sub ecx, 0x00000002 |
||
708 | |||
4124 | eAndrew | 709 | mcall , , , [color.bg] |
4120 | eAndrew | 710 | |
711 | mov edx, [win.button_index] |
||
712 | imul edx, 16 |
||
713 | add edx, dock_items.name |
||
714 | |||
715 | mov eax, 0 |
||
716 | @@: |
||
717 | inc eax |
||
718 | cmp byte[edx+eax], 0 |
||
719 | jne @b |
||
720 | |||
721 | imul eax, 3 |
||
722 | mov ebx, 34 |
||
723 | sub ebx, eax |
||
724 | inc ebx |
||
725 | shl ebx, 16 |
||
726 | add ebx, 5 |
||
727 | |||
728 | mcall 4, , [color.text] |
||
729 | |||
730 | mcall 12, 2 |
||
731 | |||
732 | jmp n_main_loop |
||
733 | ;------------------------------------------------------------------------------- |
||
734 | img_data: |
||
735 | .file_name: |
||
736 | db "/sys/iconstrp.png", 0 |
||
737 | .cfg_text: |
||
738 | db "R", 0 |
||
739 | .ext_text: |
||
740 | db "X", 0 |
||
741 | ;------------------------------------------------------------------------------- |
||
742 | ini_data: |
||
743 | .file_name: |
||
744 | db "/sys/settings/Docky.ini", 0 |
||
745 | .path_name: |
||
746 | db "path", 0 |
||
747 | .param_name: |
||
748 | db "param", 0 |
||
749 | .icon_name: |
||
750 | db "icon", 0 |
||
751 | .separator_name: |
||
752 | db "separator", 0 |
||
753 | |||
754 | .settings_name: |
||
755 | db "@SETTINGS", 0 |
||
756 | .location_name: |
||
757 | db "location", 0 |
||
758 | .color_bg: |
||
759 | db "bg", 0 |
||
760 | .color_frame: |
||
761 | db "frame", 0 |
||
762 | .color_framein: |
||
763 | db "framein", 0 |
||
764 | .color_text: |
||
765 | db "text", 0 |
||
766 | ;------------------------------------------------------------------------------- |
||
767 | load_lib_start: |
||
768 | lib1 l_libs img.name, \ |
||
769 | sys_path, \ |
||
770 | file_name, \ |
||
771 | img.dir, \ |
||
772 | error, \ |
||
773 | error, \ |
||
774 | img, \ |
||
775 | error, \ |
||
776 | error |
||
777 | |||
778 | lib2 l_libs ini.name, \ |
||
779 | sys_path, \ |
||
780 | file_name, \ |
||
781 | ini.dir, \ |
||
782 | error, \ |
||
783 | error, \ |
||
784 | ini, \ |
||
785 | error, \ |
||
786 | error |
||
787 | load_lib_end: |
||
788 | ;------------------------------------------------------------------------------- |
||
789 | img: |
||
790 | .init \ |
||
791 | dd .init_T |
||
792 | .toRGB \ |
||
793 | dd .toRGB_T |
||
794 | .decode \ |
||
795 | dd .decode_T |
||
796 | .destroy \ |
||
797 | dd .destroy_T |
||
798 | |||
799 | dd 0, 0 |
||
800 | |||
801 | .init_T: |
||
802 | db "lib_init", 0 |
||
803 | .toRGB_T: |
||
804 | db "img_to_rgb2", 0 |
||
805 | .decode_T: |
||
806 | db "img_decode", 0 |
||
807 | .destroy_T: |
||
808 | db "img_destroy", 0 |
||
809 | |||
810 | .dir: |
||
811 | db "/sys/lib/" |
||
812 | .name: |
||
813 | db "libimg.obj", 0 |
||
814 | ;------------------------------------------------------------------------------- |
||
815 | ini: |
||
816 | .init \ |
||
817 | dd .init_T |
||
818 | .sections \ |
||
819 | dd .sections_T |
||
820 | .get_int \ |
||
821 | dd .get_int_T |
||
822 | .get_str \ |
||
823 | dd .get_str_T |
||
824 | .get_color\ |
||
825 | dd .get_color_T |
||
826 | |||
827 | dd 0, 0 |
||
828 | |||
829 | .init_T: |
||
830 | db "lib_init", 0 |
||
831 | .sections_T: |
||
832 | db "ini_enum_sections", 0 |
||
833 | .get_int_T: |
||
834 | db "ini_get_int", 0 |
||
835 | .get_str_T: |
||
836 | db "ini_get_str", 0 |
||
837 | .get_color_T: |
||
838 | db "ini_get_color", 0 |
||
839 | |||
840 | .dir: |
||
841 | db "/sys/lib/" |
||
842 | .name: |
||
843 | db "libini.obj", 0 |
||
844 | ;------------------------------------------------------------------------------- |
||
845 | error: |
||
846 | db 0 |
||
847 | ;------------------------------------------------------------------------------- |
||
848 | __dataend: |
||
849 | ;================================================================================ |
||
850 | rb 1024 |
||
851 | __stackend: |
||
852 | ;================================================================================ |
||
853 | color: |
||
854 | .bg: |
||
855 | rd 1 |
||
856 | .frame: |
||
857 | rd 1 |
||
858 | .framein: |
||
859 | rd 1 |
||
860 | .text: |
||
861 | rd 1 |
||
862 | ;------------------------------------------------------------------------------- |
||
863 | win: |
||
864 | .x: |
||
865 | rd 1 |
||
866 | .y: |
||
867 | rd 1 |
||
868 | .width: |
||
869 | rd 1 |
||
870 | .height: |
||
871 | rd 1 |
||
872 | |||
873 | .x_hdn: |
||
874 | rd 1 |
||
875 | .y_hdn: |
||
876 | rd 1 |
||
877 | .width_hdn: |
||
878 | rd 1 |
||
879 | .height_hdn: |
||
880 | rd 1 |
||
881 | |||
882 | .x_opn: |
||
883 | rd 1 |
||
884 | .y_opn: |
||
885 | rd 1 |
||
886 | .width_opn: |
||
887 | rd 1 |
||
888 | .height_opn: |
||
889 | rd 1 |
||
890 | |||
891 | .sid: |
||
892 | rd 1 |
||
893 | .psid: |
||
894 | rd 1 |
||
895 | .procinfo: |
||
896 | rb 1024 |
||
897 | .state: |
||
898 | rb 1 |
||
899 | .button_index: |
||
900 | rd 1 |
||
901 | |||
902 | .isvert: |
||
903 | rb 1 |
||
904 | ;------------------------------------------------------------------------------- |
||
905 | nwin: |
||
906 | .x: |
||
907 | rd 1 |
||
908 | .y: |
||
909 | rd 1 |
||
910 | .width: |
||
911 | rd 1 |
||
912 | .height: |
||
913 | rd 1 |
||
914 | |||
915 | .visible: |
||
916 | rd 1 |
||
917 | .sid: |
||
918 | rd 1 |
||
919 | .change_shape: |
||
920 | rb 1 |
||
921 | .close: |
||
922 | rb 1 |
||
923 | ;------------------------------------------------------------------------------- |
||
924 | img_data.object: |
||
925 | rd 1 |
||
926 | img_data.rgb_object: |
||
927 | rd 1 |
||
928 | img_data.file: |
||
929 | .proc: |
||
930 | rd 1 |
||
931 | .position: |
||
932 | rd 1 |
||
933 | rd 1 |
||
934 | .size: |
||
935 | rd 1 |
||
936 | .buffer: |
||
937 | rd 1 |
||
938 | rb 1 |
||
939 | .name: |
||
940 | rd 1 |
||
941 | ;------------------------------------------------------------------------------- |
||
942 | file_exec: |
||
943 | .proc: |
||
944 | rd 1 |
||
945 | rd 1 |
||
946 | .param: |
||
947 | rd 1 |
||
948 | rd 1 |
||
949 | rd 1 |
||
950 | rb 1 |
||
951 | .file: |
||
952 | rd 1 |
||
953 | ;------------------------------------------------------------------------------- |
||
954 | dock_items: |
||
955 | .count: |
||
956 | rd 1 |
||
957 | .name: |
||
958 | rb 16 * 20 |
||
959 | .path: |
||
960 | rb 256 * 20 |
||
961 | .param: |
||
962 | rb 256 * 20 |
||
963 | .icon: |
||
964 | rd 1 * 20 |
||
965 | .separator: |
||
966 | rb 1 * 20 |
||
967 | .location: |
||
968 | rd 1 |
||
969 | ;------------------------------------------------------------------------------- |
||
970 | sys_path: |
||
971 | rb 4096 |
||
972 | file_name: |
||
973 | rb 4096 |
||
974 | ;------------------------------------------------------------------------------- |
||
975 | __memend: |
||
976 | ;================================================================================[nwin.y],>[nwin.x],>32,>1,>1,>0,>1,>1,>0,>0,>0,>[win.y],>[win.x],> |