Rev 3899 | Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
3853 | GerdtR | 1 | idbChange equ 2 |
2 | idbCreate equ 3 |
||
3 | idbLeft equ 4 |
||
4 | idbRight equ 5 |
||
5 | idbCancel equ 1 |
||
6 | |||
7 | DlgAdd: |
||
8 | DlgProp: |
||
9 | mov eax,[SelIcon] |
||
10 | cmp eax,-1 |
||
11 | jne SetProp |
||
12 | |||
13 | m2m dword[AddX],dword[MouseX] |
||
14 | m2m dword[AddY],dword[MouseY] |
||
15 | |||
16 | mov ecx,NAME_LENGTH |
||
17 | mov edi,DAreaName |
||
18 | xor al,al |
||
19 | rep stosb |
||
20 | mov dword[edtName.size],0 |
||
21 | mov dword[edtName.pos],0 |
||
22 | |||
23 | mov ecx,256 |
||
24 | mov edi,DAreaPath |
||
25 | rep stosb |
||
26 | mov dword[edtExePath.size],0 |
||
27 | mov dword[edtExePath.pos],0 |
||
28 | |||
29 | mov ecx,256 |
||
30 | mov edi,DAreaParams |
||
31 | rep stosb |
||
32 | mov dword[edtParams.size],0 |
||
33 | mov dword[edtParams.pos],0 |
||
34 | |||
35 | mov ecx,256 |
||
36 | mov edi,DAreaIcon |
||
37 | rep stosb |
||
38 | mov dword[edtIcon.size],0 |
||
39 | mov dword[edtIcon.pos],0 |
||
40 | |||
41 | jmp startDlg |
||
42 | ;-------- |
||
43 | SetProp: |
||
44 | mov esi,[IconsOffs+eax*4] |
||
45 | mov edi,DAreaName |
||
46 | xor ecx,ecx |
||
47 | @@: |
||
48 | lodsb |
||
49 | stosb |
||
50 | inc ecx |
||
51 | test al,al |
||
52 | jnz @b |
||
53 | dec ecx |
||
54 | mov dword[edtName.size],ecx |
||
55 | mov dword[edtName.pos],ecx |
||
56 | |||
57 | xor ecx,ecx |
||
58 | mov edi,DAreaPath |
||
59 | @@: |
||
60 | lodsb |
||
61 | stosb |
||
62 | inc ecx |
||
63 | test al,al |
||
64 | jnz @b |
||
65 | dec ecx |
||
66 | mov dword[edtExePath.size],ecx |
||
67 | mov dword[edtExePath.pos],ecx |
||
68 | |||
69 | xor ecx,ecx |
||
70 | mov edi,DAreaParams |
||
71 | @@: |
||
72 | lodsb |
||
73 | stosb |
||
74 | inc ecx |
||
75 | test al,al |
||
76 | jnz @b |
||
77 | dec ecx |
||
78 | mov dword[edtParams.size],ecx |
||
79 | mov dword[edtParams.pos],ecx |
||
80 | |||
81 | xor ecx,ecx |
||
82 | mov edi,DAreaIcon |
||
83 | @@: |
||
84 | lodsb |
||
85 | stosb |
||
86 | inc ecx |
||
87 | test al,al |
||
88 | jnz @b |
||
89 | dec ecx |
||
90 | mov dword[edtIcon.size],ecx |
||
91 | mov dword[edtIcon.pos],ecx |
||
92 | |||
93 | |||
94 | startDlg: |
||
95 | or [edtName.flags],ed_focus |
||
96 | |||
97 | mcall 40,100111b ;SetMaskMessage 100111b |
||
98 | xor eax,eax |
||
99 | mov dword[MaxPage],0 |
||
100 | @@: |
||
101 | add eax,ICONS_DRAW_COUNTW |
||
102 | inc dword[MaxPage] |
||
103 | cmp eax,[icon_count] |
||
104 | jb @b |
||
105 | dec dword[MaxPage] |
||
106 | cmp dword[MaxPage],0 |
||
107 | jne @f |
||
108 | mov dword[MaxPage],1 |
||
109 | @@: |
||
110 | |||
111 | stdcall [OpenDialog_Init],OpenDialog_data |
||
112 | |||
113 | DReDraw: |
||
114 | mcall 48,3,sc,40 |
||
115 | |||
116 | mov eax,[sc.work] |
||
117 | rol eax,16 |
||
118 | add al,9 |
||
119 | jnc @f |
||
120 | mov al,0FFh |
||
121 | @@: |
||
122 | rol eax,16 |
||
123 | add al,9 |
||
124 | jnc @f |
||
125 | mov al,0FFh |
||
126 | @@: |
||
127 | add ah,9 |
||
128 | jnc @f |
||
129 | mov ah,0FFh |
||
130 | @@: |
||
131 | |||
132 | mov [sbIcons.bckg_col],eax |
||
133 | m2m [sbIcons.frnt_col],[sc.work] |
||
134 | m2m [sbIcons.line_col],[sc.work_graph] |
||
135 | |||
136 | edit_boxes_set_sys_color edtName,edtExePath,sc |
||
137 | edit_boxes_set_sys_color edtExePath,edtParams,sc |
||
138 | edit_boxes_set_sys_color edtParams,edtIcon,sc |
||
139 | edit_boxes_set_sys_color edtIcon,endEdits,sc |
||
140 | |||
141 | call DRedraw |
||
142 | |||
143 | DMessages: |
||
144 | mcall 10 ;WaitMessage |
||
145 | |||
146 | dec eax |
||
147 | jz DReDraw |
||
148 | dec eax |
||
149 | jz DKey |
||
150 | dec eax |
||
151 | jz DButton |
||
152 | sub eax,3 |
||
153 | jz DMouse |
||
154 | |||
155 | jmp DMessages |
||
156 | |||
157 | |||
158 | ;--------------------------------------------------------------------- |
||
159 | DKey: |
||
160 | mcall 2 ;GetKeyPressed |
||
161 | cmp ah,1Bh |
||
162 | je DExit |
||
163 | cmp ah,9 ;Tab |
||
164 | je DNextEdit |
||
165 | stdcall [edit_box_key],edtName |
||
166 | stdcall [edit_box_key],edtExePath |
||
167 | stdcall [edit_box_key],edtParams |
||
168 | stdcall [edit_box_key],edtIcon |
||
169 | |||
170 | jmp DMessages |
||
171 | |||
172 | |||
173 | DNextEdit: |
||
174 | test [edtName.flags],ed_focus |
||
175 | jne .DNE1 |
||
176 | test [edtExePath.flags],ed_focus |
||
177 | jne .DNE2 |
||
178 | test [edtParams.flags],ed_focus |
||
179 | jne .DNE3 |
||
180 | test [edtIcon.flags],ed_focus |
||
181 | jne .DNE4 |
||
182 | jmp DMessages |
||
183 | |||
184 | .DNE1: |
||
185 | and [edtName.flags],not ed_focus |
||
186 | or [edtExePath.flags],ed_focus |
||
187 | stdcall [edit_box_draw],edtName |
||
188 | stdcall [edit_box_draw],edtExePath |
||
189 | jmp DMessages |
||
190 | |||
191 | .DNE2: |
||
192 | and [edtExePath.flags],not ed_focus |
||
193 | or [edtParams.flags],ed_focus |
||
194 | stdcall [edit_box_draw],edtExePath |
||
195 | stdcall [edit_box_draw],edtParams |
||
196 | jmp DMessages |
||
197 | |||
198 | .DNE3: |
||
199 | and [edtParams.flags],not ed_focus |
||
200 | or [edtIcon.flags],ed_focus |
||
201 | stdcall [edit_box_draw],edtParams |
||
202 | stdcall [edit_box_draw],edtIcon |
||
203 | jmp DMessages |
||
204 | |||
205 | .DNE4: |
||
206 | and [edtIcon.flags],not ed_focus |
||
207 | or [edtName.flags],ed_focus |
||
208 | stdcall [edit_box_draw],edtName |
||
209 | stdcall [edit_box_draw],edtIcon |
||
210 | jmp DMessages |
||
211 | ;--------------------------------------------------------------------- |
||
212 | DButton: |
||
213 | mcall 17 ;GetButtonPressed |
||
214 | cmp ah, idbCancel |
||
215 | je DExit |
||
216 | cmp ah,idbChange |
||
217 | je DSetExePath |
||
218 | cmp ah,idbCreate |
||
219 | je DSaveIcon |
||
220 | |||
221 | jmp DMessages |
||
222 | ;------------------------------------------------------------------------------- |
||
223 | DMouse: |
||
224 | stdcall [edit_box_mouse],edtName |
||
225 | stdcall [edit_box_mouse],edtExePath |
||
226 | stdcall [edit_box_mouse],edtParams |
||
227 | stdcall [edit_box_mouse],edtIcon |
||
228 | |||
229 | push [sbIcons.position] |
||
230 | stdcall [scrollbar_h_mouse],sbIcons |
||
231 | pop eax |
||
232 | cmp eax,[sbIcons.position] |
||
233 | je @f |
||
234 | call DrawStdIcons |
||
235 | @@: |
||
236 | |||
237 | mcall 37,2 ;GetMouseKey |
||
238 | test eax,1 |
||
239 | jz DMessages |
||
240 | mcall 37,1 ;GetMouseWinPos |
||
241 | |||
242 | test eax,10001000h |
||
243 | jne DMessages |
||
244 | xor edx,edx |
||
245 | mov dx,ax ;y |
||
246 | shr eax,16 ;x |
||
247 | |||
248 | sub eax,ICONSX |
||
249 | js DMessages |
||
250 | sub edx,ICONSY |
||
251 | js DMessages |
||
252 | |||
253 | cmp eax,(IMG_SIZE+SPCW)*ICONS_DRAW_COUNTW-SPCW |
||
254 | ja DMessages |
||
255 | cmp edx,(IMG_SIZE+SPCH)*ICONS_DRAW_COUNTH-SPCH |
||
256 | ja DMessages |
||
257 | |||
258 | xor ebx,ebx |
||
259 | mov ecx,[sbIcons.position] |
||
260 | test ecx,ecx |
||
261 | jz .DM |
||
262 | @@: |
||
263 | add ebx,ICONS_DRAW_COUNTH |
||
264 | loop @b |
||
265 | .DM: |
||
266 | |||
267 | sub eax,IMG_SIZE+SPCW |
||
268 | js .DM1 |
||
269 | @@: |
||
270 | add ebx,ICONS_DRAW_COUNTH |
||
271 | sub eax,IMG_SIZE+SPCW |
||
272 | jns @b |
||
273 | .DM1: |
||
274 | |||
275 | |||
276 | sub edx,IMG_SIZE+SPCH |
||
277 | js .DM2 |
||
278 | @@: |
||
279 | inc ebx |
||
280 | sub edx,IMG_SIZE+SPCH |
||
281 | jns @b |
||
282 | .DM2: |
||
283 | |||
284 | mov eax,ebx |
||
285 | |||
286 | cmp eax,[icon_count] |
||
287 | jae DMessages |
||
288 | |||
289 | mov bl,10 |
||
290 | div bl |
||
291 | |||
292 | add ah,30h |
||
293 | test al,al |
||
294 | jz @f |
||
295 | |||
296 | add al,30h |
||
297 | mov byte[DAreaIcon],al |
||
298 | mov byte[DAreaIcon+1],ah |
||
299 | mov byte[DAreaIcon+2],0 |
||
300 | mov dword[edtIcon.size],2 |
||
301 | jmp .RedrawNum |
||
302 | |||
303 | @@: |
||
304 | mov byte[DAreaIcon],ah |
||
305 | mov byte[DAreaIcon+1],0 |
||
306 | mov dword[edtIcon.size],1 |
||
307 | jmp .RedrawNum |
||
308 | .RedrawNum: |
||
309 | |||
310 | |||
311 | stdcall [edit_box_draw],edtIcon |
||
312 | |||
313 | |||
314 | call DrawSelIcon |
||
315 | jmp DReDraw;DMessages; |
||
316 | ;------------------------------------------------------------------------------- |
||
317 | DSetExePath: |
||
318 | stdcall [OpenDialog_Start],OpenDialog_data |
||
319 | mov edi,DAreaPath |
||
320 | xor al,al |
||
321 | or ecx,-1 |
||
322 | repne scasb |
||
323 | sub edi,DAreaPath |
||
324 | dec edi |
||
325 | mov dword[edtExePath+12*4],edi |
||
326 | |||
327 | jmp DMessages;DReDraw; |
||
328 | |||
329 | DSaveIcon: |
||
330 | mov dword[fiRunProg+8],WarningSave |
||
331 | mov dword[fiRunProg+21],pthNotify |
||
332 | mcall 70,fiRunProg |
||
333 | |||
334 | |||
335 | cmp [SelIcon],-1 |
||
336 | je @f |
||
337 | ;удаляем из ini старую иконку |
||
338 | mov ebx,[SelIcon] |
||
339 | mov eax,[IconsOffs+ebx*4] |
||
340 | stdcall [ini_del_section],IconIni,eax |
||
341 | |||
342 | stdcall EditIcon,[SelIcon],DAreaIcon,DAreaName,DAreaPath,DAreaParams |
||
343 | jmp DExitAndSave |
||
344 | @@: |
||
345 | stdcall AddIcon,[AddX],[AddY],DAreaIcon,DAreaName,DAreaPath,DAreaParams |
||
346 | ;jmp DExitAndSave |
||
347 | ;------------------------------------------------------------------------------- |
||
348 | DExitAndSave: |
||
349 | |||
350 | stdcall [ini_set_str],IconIni,DAreaName,keyPath,DAreaPath,dword[edtExePath.size] |
||
351 | stdcall [ini_set_str],IconIni,DAreaName,keyParams,DAreaParams,dword[edtParams.size] |
||
352 | stdcall [ini_set_str],IconIni,DAreaName,keyIco,DAreaIcon,dword[edtIcon.size] |
||
353 | stdcall [ini_set_int],IconIni,DAreaName,keyX,[MouseX] |
||
354 | stdcall [ini_set_int],IconIni,DAreaName,keyY,[MouseY] |
||
355 | |||
356 | DExit: |
||
357 | mcall -1 ;ExitProcess |
||
358 | |||
359 | ;################################################################## |
||
360 | proc DRedraw |
||
361 | mcall 12,1 ;RedrawWinBeg |
||
362 | mov edx,[sc.work] |
||
363 | or edx,33000000h |
||
364 | mcall 0,<100,400>,<100,(IMG_SIZE+SPCH)*ICONS_DRAW_COUNTH+185>,,,DTitle |
||
365 | |||
366 | stdcall [edit_box_draw],edtName |
||
367 | stdcall [edit_box_draw],edtExePath |
||
368 | stdcall [edit_box_draw],edtParams |
||
369 | stdcall [edit_box_draw],edtIcon |
||
370 | |||
371 | call DrawStdIcons |
||
372 | |||
373 | |||
374 | stdcall [scrollbar_h_draw],sbIcons |
||
375 | mcall 38, |
||
376 |
|
||
377 | [sc.work_graph] |
||
378 | mcall , |
||
379 |
|
||
380 | [sc.work_graph] |
||
381 | |||
382 | mcall , |
||
383 |
|
||
384 | [sc.work_graph] |
||
385 | mcall , |
||
386 |
|
||
387 | [sc.work_graph] |
||
388 | |||
389 | ;BUTTONS |
||
390 | mcall 8,<250,49>,<30+END_ICONS_AREAH,16>,idbCreate,[sc.work_button] |
||
391 | mcall ,<305,54>, ,idbCancel |
||
392 | mcall ,<351,14>,<26,14> ,idbChange |
||
393 | |||
394 | ;CAPTIONS |
||
395 | mov ecx,[sc.work_text] |
||
396 | or ecx,80000000h |
||
397 | mcall 4,<30+IMG_SIZE,10>,,DCaptName |
||
398 | mcall ,<30+IMG_SIZE,30>,,DCaptPath |
||
399 | mcall ,<30+IMG_SIZE,50>,,DCaptParams |
||
400 | mcall ,<30+IMG_SIZE,70>,,DCaptIcon |
||
401 | |||
402 | if lang eq ru |
||
403 | mov ecx,[sc.work_button_text] |
||
404 | or ecx,80000000h |
||
405 | mcall ,<309,35+END_ICONS_AREAH>,,DCaptCancel |
||
406 | |||
407 | cmp [SelIcon],-1 |
||
408 | jne @f |
||
409 | mpack ebx,255,35+END_ICONS_AREAH |
||
410 | mov edx,DCaptCreate |
||
411 | jmp .DRD1 |
||
412 | @@: |
||
413 | mpack ebx,252,35+END_ICONS_AREAH |
||
414 | mov edx,DCaptProperties |
||
415 | .DRD1: |
||
416 | else |
||
417 | mov ecx,[sc.work_button_text] |
||
418 | or ecx,80000000h |
||
419 | mcall ,<315,35+END_ICONS_AREAH>,,DCaptCancel |
||
420 | |||
421 | |||
422 | cmp [SelIcon],-1 |
||
423 | jne @f |
||
424 | mpack ebx,257,35+END_ICONS_AREAH |
||
425 | mov edx,DCaptCreate |
||
426 | jmp .DRD1 |
||
427 | @@: |
||
428 | mpack ebx,257,35+END_ICONS_AREAH |
||
429 | mov edx,DCaptProperties |
||
430 | .DRD1: |
||
431 | end if |
||
432 | mcall |
||
433 | |||
434 | mcall 1,351+4 ,26+10,[sc.work_button_text] |
||
435 | mcall ,351+4+3,26+10, |
||
436 | mcall ,351+4+6,26+10, |
||
437 | |||
438 | call DrawSelIcon |
||
439 | |||
440 | mcall 12,2 ;RedrawWinEnd |
||
441 | ret |
||
442 | endp |
||
443 | |||
444 | |||
445 | proc DrawStdIcons |
||
446 | local IcoX:DWORD,\ |
||
447 | IcoY:DWORD,\ |
||
448 | iIcon:DWORD |
||
449 | |||
450 | mov ecx,[sbIcons.position] |
||
451 | xor eax,eax |
||
452 | m2m dword[iIcon],0 |
||
453 | |||
454 | test ecx,ecx |
||
455 | jz .DST1 |
||
456 | @@: |
||
457 | add [iIcon],ICONS_DRAW_COUNTH |
||
458 | add eax,IMG_SIZE*IMG_SIZE*4*ICONS_DRAW_COUNTH |
||
459 | loop @b |
||
460 | .DST1: |
||
461 | |||
462 | lea esi,[eax+44] |
||
463 | add esi,[raw_pointer] |
||
464 | |||
465 | mov [IcoX],ICONSX |
||
466 | |||
467 | |||
468 | mov ecx,ICONS_DRAW_COUNTW |
||
469 | .DrawIcons: |
||
470 | push ecx |
||
471 | |||
472 | mov [IcoY],ICONSY |
||
473 | |||
474 | mov ecx,ICONS_DRAW_COUNTH |
||
475 | .DrawIcoStolb: |
||
476 | push ecx |
||
477 | |||
478 | mov edi,IconArea |
||
479 | mov edx,IMG_SIZE |
||
480 | |||
481 | .DrawLine: |
||
482 | |||
483 | |||
484 | mov ecx,IMG_SIZE |
||
485 | .DrawPix: |
||
486 | |||
487 | lodsd |
||
488 | test eax,0FF000000h |
||
489 | jnz @f |
||
490 | mov eax,[sc.work] |
||
491 | @@: |
||
492 | |||
493 | mov word[edi],ax |
||
494 | shr eax,16 |
||
495 | mov [edi+2],al |
||
496 | add edi,3 |
||
497 | |||
498 | loop .DrawPix |
||
499 | |||
500 | dec edx |
||
501 | jnz .DrawLine |
||
502 | |||
503 | mov edx,[IcoX] |
||
504 | shl edx,16 |
||
505 | mov dx,word[IcoY] |
||
506 | mcall 7,IconArea, |
||
507 | |||
508 | inc [iIcon] |
||
509 | mov eax,[iIcon] |
||
510 | cmp eax,[icon_count] |
||
511 | jae .endDrawIcon |
||
512 | |||
513 | add dword[IcoY],IMG_SIZE+SPCH |
||
514 | pop ecx |
||
515 | loop .DrawIcoStolb |
||
516 | |||
517 | add dword[IcoX],IMG_SIZE+SPCW |
||
518 | pop ecx |
||
519 | loop .DrawIcons |
||
520 | jmp .endProc |
||
521 | |||
522 | .endDrawIcon: |
||
523 | |||
524 | mov ecx,IMG_SIZE*IMG_SIZE |
||
525 | mov edi,IconArea |
||
526 | mov eax,[sc.work] |
||
527 | mov ebx,eax |
||
528 | shr ebx,16 |
||
529 | @@: |
||
530 | mov word[edi],ax |
||
531 | mov [edi+2],bl |
||
532 | add edi,3 |
||
533 | loop @b |
||
534 | |||
535 | ;затирание не использованых мест |
||
536 | jmp .Dalee |
||
537 | |||
538 | .DrawIcons2: |
||
539 | push ecx |
||
540 | |||
541 | mov [IcoY],ICONSY |
||
542 | mov ecx,ICONS_DRAW_COUNTH |
||
543 | .DrawIcoStolb2: |
||
544 | push ecx |
||
545 | |||
546 | mov edx,[IcoX] |
||
547 | shl edx,16 |
||
548 | mov dx,word[IcoY] |
||
549 | mcall 7,IconArea, |
||
550 | |||
551 | .Dalee: |
||
552 | add dword[IcoY],IMG_SIZE+SPCH |
||
553 | pop ecx |
||
554 | loop .DrawIcoStolb2 |
||
555 | |||
556 | add dword[IcoX],IMG_SIZE+SPCW |
||
557 | pop ecx |
||
558 | loop .DrawIcons2 |
||
559 | |||
560 | .endProc: |
||
561 | ret |
||
562 | endp |
||
563 | |||
564 | proc DrawSelIcon |
||
565 | mov edi,DAreaIcon |
||
566 | cmp byte[edi],0 |
||
567 | jne @f |
||
568 | ret |
||
569 | @@: |
||
570 | |||
571 | mov al,[edi] |
||
572 | cmp al,'9' |
||
573 | ja .PathToIcon |
||
574 | cmp al,'/' |
||
575 | jne .GetIconInd |
||
576 | .PathToIcon: |
||
577 | mov al,30h ;заглушка!!!!!!!!!!!!! |
||
578 | mov byte[edi+1],0 |
||
579 | .GetIconInd: |
||
580 | ;int3 |
||
581 | sub al,30h |
||
582 | cmp byte[edi+1],0 |
||
583 | je @f |
||
584 | shl eax,1 |
||
585 | lea eax,[eax*4+eax] |
||
586 | xor edx,edx |
||
587 | mov dl,[edi+1] |
||
588 | sub dl,30h |
||
589 | add eax,edx |
||
590 | @@: ;eax=num icon |
||
591 | cmp eax,[icon_count] |
||
592 | jb @f |
||
593 | xor eax,eax |
||
594 | @@: |
||
595 | test eax,eax |
||
596 | je .DI1 |
||
597 | mov ecx,eax |
||
598 | xor eax,eax |
||
599 | @@: |
||
600 | add eax,IMG_SIZE*IMG_SIZE*4 |
||
601 | loop @b |
||
602 | .DI1: |
||
603 | mov esi,eax |
||
604 | add esi,[raw_pointer] |
||
605 | add esi,44 |
||
606 | |||
607 | mov edi,IconArea |
||
608 | mov edx,IMG_SIZE |
||
609 | .DrawLine: |
||
610 | |||
611 | mov ecx,IMG_SIZE |
||
612 | .DrawPix: |
||
613 | |||
614 | lodsd |
||
615 | test eax,0FF000000h |
||
616 | jnz @f |
||
617 | mov eax,[sc.work] |
||
618 | @@: |
||
619 | |||
620 | mov word[edi],ax |
||
621 | shr eax,16 |
||
622 | mov [edi+2],al |
||
623 | add edi,3 |
||
624 | |||
625 | loop .DrawPix |
||
626 | |||
627 | dec edx |
||
628 | jnz .DrawLine |
||
629 | |||
630 | mcall 7,IconArea, |
||
631 | |||
632 | ret |
||
633 | endp15,25>315,35+END_ICONS_AREAH>309,35+END_ICONS_AREAH>30+IMG_SIZE,70>30+IMG_SIZE,50>30+IMG_SIZE,30>30+IMG_SIZE,10>26,14>351,14>305,54>30+END_ICONS_AREAH,16>250,49>100,(IMG_SIZE+SPCH)*ICONS_DRAW_COUNTH+185>100,400> |