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