Rev 314 | Rev 517 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 314 | Rev 474 | ||
---|---|---|---|
Line 25... | Line 25... | ||
25 | 25 | ||
26 | GenericBox: |
26 | GenericBox: |
27 | pushad |
27 | pushad |
28 | mov ebx, [esp+20h+4] |
28 | mov ebx, [esp+20h+4] |
- | 29 | ; center window if required |
|
- | 30 | push [ebx+dlgtemplate.x] |
|
29 | ; center window if required |
31 | push [ebx+dlgtemplate.y] |
30 | cmp [ebx+dlgtemplate.x], -1 |
32 | cmp [ebx+dlgtemplate.x], -1 |
31 | jnz @f |
33 | jnz @f |
32 | mov eax, [cur_width] |
34 | mov eax, [cur_width] |
33 | sub eax, [ebx+dlgtemplate.width] |
35 | sub eax, [ebx+dlgtemplate.width] |
Line 57... | Line 59... | ||
57 | cmp [ebx+dlgtemplate.border_size_x], 1 |
59 | cmp [ebx+dlgtemplate.border_size_x], 1 |
58 | jl .sizeerr |
60 | jl .sizeerr |
59 | cmp [ebx+dlgtemplate.border_size_y], 1 |
61 | cmp [ebx+dlgtemplate.border_size_y], 1 |
60 | jge .sizeok |
62 | jge .sizeok |
61 | .sizeerr: |
63 | .sizeerr: |
- | 64 | pop [ebx+dlgtemplate.y] |
|
- | 65 | pop [ebx+dlgtemplate.x] |
|
62 | popad |
66 | popad |
63 | or eax, -1 |
67 | or eax, -1 |
64 | ret 8 |
68 | ret 8 |
65 | .sizeok: |
69 | .sizeok: |
66 | ; set color if required |
70 | ; set color if required |
Line 71... | Line 75... | ||
71 | @@: |
75 | @@: |
72 | test byte [ebx+dlgtemplate.flags], 2 |
76 | test byte [ebx+dlgtemplate.flags], 2 |
73 | jz @f |
77 | jz @f |
74 | mov edi, warning_colors |
78 | mov edi, warning_colors |
75 | .setcolor: |
79 | .setcolor: |
76 | mov al, [dialog_main_color-dialog_colors+edi] |
80 | mov al, [edi + dialog_main_color-dialog_colors] |
77 | mov [ebx+dlgtemplate.main_color], al |
81 | mov [ebx+dlgtemplate.main_color], al |
78 | mov al, [dialog_border_color-dialog_colors+edi] |
82 | mov al, [edi + dialog_border_color-dialog_colors] |
79 | mov [ebx+dlgtemplate.border_color], al |
83 | mov [ebx+dlgtemplate.border_color], al |
80 | mov al, [dialog_header_color-dialog_colors+edi] |
84 | mov al, [edi + dialog_header_color-dialog_colors] |
81 | mov [ebx+dlgtemplate.header_color], al |
85 | mov [ebx+dlgtemplate.header_color], al |
82 | @@: |
86 | @@: |
83 | ; allocate memory for data under dialog |
87 | ; allocate memory for data under dialog |
84 | ; for 'No memory' dialog use static data area |
88 | ; for 'No memory' dialog use static data area |
85 | mov ebp, nomem_dlgsavearea |
89 | mov ebp, nomem_dlgsavearea |
Line 93... | Line 97... | ||
93 | mov edx, [ebx+dlgtemplate.height] |
97 | mov edx, [ebx+dlgtemplate.height] |
94 | add edx, [ebx+dlgtemplate.border_size_y] |
98 | add edx, [ebx+dlgtemplate.border_size_y] |
95 | add edx, [ebx+dlgtemplate.border_size_y] |
99 | add edx, [ebx+dlgtemplate.border_size_y] |
96 | inc edx |
100 | inc edx |
97 | mul edx |
101 | mul edx |
98 | add eax, eax |
102 | lea ecx, [eax*2] |
99 | call mf_alloc |
103 | call xpgalloc |
100 | test eax, eax |
104 | test eax, eax |
101 | jnz @f |
105 | jnz @f |
- | 106 | pop [ebx+dlgtemplate.y] |
|
- | 107 | pop [ebx+dlgtemplate.x] |
|
102 | popad |
108 | popad |
103 | or eax, -1 |
109 | or eax, -1 |
104 | ret 8 |
110 | ret 8 |
105 | @@: |
111 | @@: |
106 | mov ebp, eax |
112 | mov ebp, eax |
Line 294... | Line 300... | ||
294 | add edi, [cur_width] |
300 | add edi, [cur_width] |
295 | add edi, [cur_width] |
301 | add edi, [cur_width] |
296 | dec edx |
302 | dec edx |
297 | jnz @b |
303 | jnz @b |
298 | ; send redraw message |
304 | ; send redraw message |
299 | mov eax, [esp+20h+8] |
305 | mov eax, [esp+28h+8] |
300 | push ebx ebp |
306 | push ebx ebp |
301 | push 0 |
307 | push 0 |
302 | push 0 |
308 | push 0 |
303 | push 1 |
309 | push 1 |
304 | push ebx |
310 | push ebx |
Line 345... | Line 351... | ||
345 | jz .rshift_up |
351 | jz .rshift_up |
346 | cmp al, 0x38 |
352 | cmp al, 0x38 |
347 | jz .alt_down |
353 | jz .alt_down |
348 | cmp al, 0xB8 |
354 | cmp al, 0xB8 |
349 | jz .alt_up |
355 | jz .alt_up |
350 | mov ecx, [esp+20h+8] |
356 | mov ecx, [esp+28h+8] |
351 | push ebx ebp |
357 | push ebx ebp |
352 | push 0 |
358 | push 0 |
353 | push eax |
359 | push eax |
354 | push 2 |
360 | push 2 |
355 | push ebx |
361 | push ebx |
356 | call ecx |
362 | call ecx |
357 | pop ebp ebx |
363 | pop ebp ebx |
358 | test eax, eax |
364 | test eax, eax |
359 | jz .event |
365 | jz .event |
360 | mov [esp+28], eax |
366 | mov [esp+8+28], eax |
361 | jmp .exit |
367 | jmp .exit |
362 | .ctrl_down: |
368 | .ctrl_down: |
363 | test ah, ah |
369 | test ah, ah |
364 | jnz .rctrl_down |
370 | jnz .rctrl_down |
365 | or [ctrlstate], 4 |
371 | or [ctrlstate], 4 |
Line 428... | Line 434... | ||
428 | push eax |
434 | push eax |
429 | call restore_console_data |
435 | call restore_console_data |
430 | call draw_keybar |
436 | call draw_keybar |
431 | cmp ebx, nomem_dlgdata |
437 | cmp ebx, nomem_dlgdata |
432 | jz @f |
438 | jz @f |
433 | mov eax, ebp |
439 | mov ecx, ebp |
434 | call mf_free |
440 | call pgfree |
435 | @@: |
441 | @@: |
- | 442 | pop [ebx+dlgtemplate.y] |
|
- | 443 | pop [ebx+dlgtemplate.x] |
|
436 | or [cursor_x], -1 |
444 | or [cursor_x], -1 |
437 | or [cursor_y], -1 |
445 | or [cursor_y], -1 |
438 | call draw_image |
446 | call draw_image |
439 | popad |
447 | popad |
440 | ret 8 |
448 | ret 8 |
Line 546... | Line 554... | ||
546 | 554 | ||
547 | ; int __stdcall menu_centered_in(unsigned left, unsigned top, unsigned width, unsigned height, |
555 | ; int __stdcall menu_centered_in(unsigned left, unsigned top, unsigned width, unsigned height, |
548 | ; void* variants, const char* title, unsigned flags); |
556 | ; void* variants, const char* title, unsigned flags); |
549 | menu_centered_in: |
557 | menu_centered_in: |
550 | pushad |
558 | pushad |
551 | mov eax, 56 |
559 | mov ecx, 56 |
552 | ; 36 bytes for dlgtemplate + additional: |
560 | ; 36 bytes for dlgtemplate + additional: |
553 | ; +36: dd cur_variant |
561 | ; +36: dd cur_variant |
554 | ; +40: dd num_variants |
562 | ; +40: dd num_variants |
555 | ; +44: dd begin_variant |
563 | ; +44: dd begin_variant |
556 | ; +48: dd end_variant |
564 | ; +48: dd end_variant |
557 | ; +52: dd cur_variant_idx |
565 | ; +52: dd cur_variant_idx |
558 | call xmalloc |
566 | call xpgalloc |
559 | test eax, eax |
567 | test eax, eax |
560 | jnz @f |
568 | jnz @f |
561 | .ret_bad: |
569 | .ret_bad: |
562 | popad |
570 | popad |
Line 698... | Line 706... | ||
698 | mov [ebx+dlgtemplate.header_color], al |
706 | mov [ebx+dlgtemplate.header_color], al |
699 | push MenuDlgProc |
707 | push MenuDlgProc |
700 | push ebx |
708 | push ebx |
701 | call GenericBox |
709 | call GenericBox |
702 | mov [esp+28], eax |
710 | mov [esp+28], eax |
703 | mov eax, ebx |
711 | mov ecx, ebx |
704 | call mf_free |
712 | call pgfree |
705 | popad |
713 | popad |
706 | ret 28 |
714 | ret 28 |
Line 707... | Line 715... | ||
707 | 715 | ||
708 | MenuDlgProc: |
716 | MenuDlgProc: |
Line 713... | Line 721... | ||
713 | jz .key |
721 | jz .key |
714 | ret 16 |
722 | ret 16 |
715 | .draw: |
723 | .draw: |
716 | call .dodraw |
724 | call .dodraw |
717 | ret 16 |
725 | ret 16 |
- | 726 | .prev: |
|
- | 727 | mov eax, [ebx+36] |
|
- | 728 | cmp dword [eax+4], 0 |
|
- | 729 | jz .end |
|
- | 730 | call .line_prev |
|
- | 731 | .posret: |
|
- | 732 | mov [ebx+36], eax |
|
- | 733 | .redraw: |
|
- | 734 | call .dodraw |
|
- | 735 | call draw_image |
|
- | 736 | xor eax, eax |
|
- | 737 | ret 16 |
|
- | 738 | .next: |
|
- | 739 | mov eax, [ebx+36] |
|
- | 740 | cmp dword [eax], 0 |
|
- | 741 | jz .home |
|
- | 742 | call .line_next |
|
- | 743 | jmp .posret |
|
- | 744 | .pgdn: |
|
- | 745 | mov eax, [ebx+36] |
|
- | 746 | mov ecx, [ebx+dlgtemplate.height] |
|
- | 747 | .pgdnl: |
|
- | 748 | cmp dword [eax], 0 |
|
- | 749 | jz .posret |
|
- | 750 | call .line_next |
|
- | 751 | loop .pgdnl |
|
- | 752 | jmp .posret |
|
718 | .key: |
753 | .key: |
719 | mov al, [esp+12] |
754 | mov al, [esp+12] |
720 | cmp al, 0x48 |
755 | cmp al, 0x48 |
721 | jz .prev |
756 | jz .prev |
722 | cmp al, 0x4B |
757 | cmp al, 0x4B |
Line 771... | Line 806... | ||
771 | cmp dword [eax+4], 0 |
806 | cmp dword [eax+4], 0 |
772 | jz .posret |
807 | jz .posret |
773 | call .line_prev |
808 | call .line_prev |
774 | loop .pgupl |
809 | loop .pgupl |
775 | jmp .posret |
810 | jmp .posret |
776 | .prev: |
- | |
777 | mov eax, [ebx+36] |
- | |
778 | cmp dword [eax+4], 0 |
- | |
779 | jz .end |
- | |
780 | call .line_prev |
- | |
781 | .posret: |
- | |
782 | mov [ebx+36], eax |
- | |
783 | .redraw: |
- | |
784 | call .dodraw |
- | |
785 | call draw_image |
- | |
786 | xor eax, eax |
- | |
787 | ret 16 |
- | |
788 | .next: |
- | |
789 | mov eax, [ebx+36] |
- | |
790 | cmp dword [eax], 0 |
- | |
791 | jz .home |
- | |
792 | call .line_next |
- | |
793 | jmp .posret |
- | |
794 | .pgdn: |
- | |
795 | mov eax, [ebx+36] |
- | |
796 | mov ecx, [ebx+dlgtemplate.height] |
- | |
797 | .pgdnl: |
- | |
798 | cmp dword [eax], 0 |
- | |
799 | jz .posret |
- | |
800 | call .line_next |
- | |
801 | loop .pgdnl |
- | |
802 | jmp .posret |
- | |
803 | .home: |
811 | .home: |
804 | mov eax, [ebx+36] |
812 | mov eax, [ebx+36] |
805 | @@: |
813 | @@: |
806 | cmp dword [eax+4], 0 |
814 | cmp dword [eax+4], 0 |
807 | jz @f |
815 | jz @f |
Line 1081... | Line 1089... | ||
1081 | .enter_found: |
1089 | .enter_found: |
1082 | mov eax, ebx |
1090 | mov eax, ebx |
1083 | ret 16 |
1091 | ret 16 |
1084 | @@: |
1092 | @@: |
1085 | lea ebx, [ebp+dlgtemplate.size+12] |
1093 | lea ebx, [ebp+dlgtemplate.size+12] |
- | 1094 | mov ecx, [ebx-4] |
|
1086 | .enter_find: |
1095 | .enter_find: |
1087 | cmp [ebx+dlgitemtemplate.type], 2 |
1096 | cmp [ebx+dlgitemtemplate.type], 2 |
1088 | jnz @f |
1097 | jnz @f |
1089 | test [ebx+dlgitemtemplate.flags], 0x10 |
1098 | test [ebx+dlgitemtemplate.flags], 0x10 |
1090 | jnz .enter_found |
1099 | jnz .enter_found |
1091 | @@: |
1100 | @@: |
1092 | add ebx, dlgitemtemplate.size |
1101 | add ebx, dlgitemtemplate.size |
- | 1102 | loop .enter_find |
|
1093 | jmp .enter_find |
1103 | jmp .enter_found |
1094 | .tab: |
1104 | .tab: |
1095 | test [ctrlstate], 3 |
1105 | test [ctrlstate], 3 |
1096 | jnz .shift_tab |
1106 | jnz .shift_tab |
1097 | .right: |
1107 | .right: |
1098 | .down: |
1108 | .down: |
Line 1157... | Line 1167... | ||
1157 | cmp al, 0x4F |
1167 | cmp al, 0x4F |
1158 | jz .editor_end |
1168 | jz .editor_end |
1159 | cmp al, 0x0E |
1169 | cmp al, 0x0E |
1160 | jz .editor_backspace |
1170 | jz .editor_backspace |
1161 | cmp al, 0x53 |
1171 | cmp al, 0x53 |
1162 | jz .editor_del |
1172 | jnz .editor_char |
1163 | test [ctrlstate], 0x3C |
- | |
1164 | jnz .ret_draw |
- | |
1165 | ; query keyboard layout |
- | |
1166 | pushad |
- | |
1167 | push 26 |
- | |
1168 | pop eax |
- | |
1169 | push 2 |
- | |
1170 | pop ebx |
- | |
1171 | xor ecx, ecx |
- | |
1172 | cmp [ctrlstate], 1 |
- | |
1173 | sbb ecx, -2 |
- | |
1174 | mov edx, layout |
- | |
1175 | int 0x40 |
- | |
1176 | popad |
1173 | .editor_del: |
1177 | ; translate scancode to ASCII |
- | |
1178 | movzx eax, al |
- | |
1179 | movzx eax, byte [layout+eax] |
- | |
1180 | push eax |
- | |
1181 | ; insert entered symbol |
- | |
1182 | xor eax, eax |
- | |
1183 | lea edi, [edx+12] |
- | |
1184 | or ecx, -1 |
- | |
1185 | repnz scasb |
- | |
1186 | not ecx |
- | |
1187 | pop eax |
- | |
1188 | cmp ecx, [edx] |
1174 | mov ecx, [edx+4] |
1189 | ja .ret_test ; buffer capacity exceeded |
- | |
1190 | lea edi, [edx+ecx+12-1] |
1175 | lea edi, [ecx+edx+12] |
1191 | mov esi, [edx+4] |
- | |
1192 | lea esi, [edx+esi+12] |
1176 | lea esi, [edi+1] |
1193 | @@: |
- | |
1194 | mov cl, [edi] |
1177 | cmp byte [edi], 0 |
1195 | mov [edi+1], cl |
- | |
1196 | dec edi |
- | |
1197 | cmp edi, esi |
1178 | jz .ret_test |
1198 | jae @b |
- | |
1199 | mov [esi], al |
- | |
1200 | inc dword [edx+4] |
- | |
1201 | @@: jmp .ret_test |
1179 | jmp .copy_and_ret_test |
1202 | .editor_left: |
1180 | .editor_left: |
1203 | mov ecx, [edx+4] |
1181 | mov ecx, [edx+4] |
1204 | jecxz @f |
1182 | jecxz @f |
1205 | dec dword [edx+4] |
1183 | dec dword [edx+4] |
1206 | @@: jmp .ret_test |
1184 | @@: jmp .ret_test |
Line 1246... | Line 1224... | ||
1246 | lodsb |
1224 | lodsb |
1247 | stosb |
1225 | stosb |
1248 | test al, al |
1226 | test al, al |
1249 | jnz @b |
1227 | jnz @b |
1250 | jmp .ret_test |
1228 | jmp .ret_test |
1251 | .editor_del: |
1229 | .editor_char: |
- | 1230 | test [ctrlstate], 0x3C |
|
- | 1231 | jnz .ret_draw |
|
- | 1232 | ; query keyboard layout |
|
- | 1233 | pushad |
|
- | 1234 | push 26 |
|
- | 1235 | pop eax |
|
- | 1236 | push 2 |
|
- | 1237 | pop ebx |
|
- | 1238 | xor ecx, ecx |
|
- | 1239 | cmp [ctrlstate], 1 |
|
- | 1240 | sbb ecx, -2 |
|
- | 1241 | mov edx, layout |
|
- | 1242 | int 0x40 |
|
- | 1243 | popad |
|
- | 1244 | ; translate scancode to ASCII |
|
- | 1245 | movzx eax, al |
|
- | 1246 | movzx eax, byte [layout+eax] |
|
- | 1247 | push eax |
|
- | 1248 | ; insert entered symbol |
|
- | 1249 | xor eax, eax |
|
- | 1250 | lea edi, [edx+12] |
|
- | 1251 | or ecx, -1 |
|
- | 1252 | repnz scasb |
|
- | 1253 | not ecx |
|
- | 1254 | pop eax |
|
1252 | mov ecx, [edx+4] |
1255 | cmp ecx, [edx] |
- | 1256 | ja .ret_test ; buffer capacity exceeded |
|
1253 | lea edi, [ecx+edx+12] |
1257 | lea edi, [edx+ecx+12-1] |
- | 1258 | mov esi, [edx+4] |
|
1254 | lea esi, [edi+1] |
1259 | lea esi, [edx+esi+12] |
- | 1260 | @@: |
|
1255 | cmp byte [edi], 0 |
1261 | mov cl, [edi] |
- | 1262 | mov [edi+1], cl |
|
- | 1263 | dec edi |
|
1256 | jz .ret_test |
1264 | cmp edi, esi |
- | 1265 | jae @b |
|
- | 1266 | mov [esi], al |
|
- | 1267 | inc dword [edx+4] |
|
1257 | jmp .copy_and_ret_test |
1268 | @@: jmp .ret_test |
Line 1258... | Line 1269... | ||
1258 | 1269 | ||
1259 | .dodraw: |
1270 | .dodraw: |
1260 | or [cursor_x], -1 |
1271 | or [cursor_x], -1 |
1261 | or [cursor_y], -1 |
1272 | or [cursor_y], -1 |
Line 1432... | Line 1443... | ||
1432 | 1443 | ||
1433 | ; int __stdcall SayErr(const char* title, int x, int y, |
1444 | ; int __stdcall SayErr(const char* title, int x, int y, |
1434 | ; int num_strings, const char* strings[], |
1445 | ; int num_strings, const char* strings[], |
1435 | ; int num_buttons, const char* buttons[]); |
1446 | ; int num_buttons, const char* buttons[]); |
- | 1447 | ; may be x=-1 and/or y=-1 |
|
- | 1448 | SayErr: |
|
- | 1449 | push 2 |
|
- | 1450 | jmp @f |
|
- | 1451 | ||
- | 1452 | ; int __stdcall Message(const char* title, int x, int y, |
|
- | 1453 | ; int num_strings, const char* strings[], |
|
- | 1454 | ; int num_buttons, const char* buttons[]); |
|
- | 1455 | Message: |
|
- | 1456 | push 1 |
|
1436 | ; may be x=-1 and/or y=-1 |
1457 | @@: |
1437 | ; [esp+4] = title |
1458 | ; [esp+4] = title |
1438 | ; [esp+8] = x |
1459 | ; [esp+8] = x |
1439 | ; [esp+12] = y |
1460 | ; [esp+12] = y |
1440 | ; [esp+16] = num_strings |
1461 | ; [esp+16] = num_strings |
1441 | ; [esp+20] = strings |
1462 | ; [esp+20] = strings |
1442 | ; [esp+24] = num_buttons |
1463 | ; [esp+24] = num_buttons |
- | 1464 | ; [esp+28] = buttons |
|
1443 | ; [esp+28] = buttons |
1465 | pop eax |
1444 | SayErr: |
1466 | pushad |
1445 | mov eax, [esp+16] |
1467 | mov ecx, [esp+4+16] |
1446 | add eax, [esp+24] |
1468 | add ecx, [esp+4+24] |
1447 | imul eax, dlgitemtemplate.size |
1469 | imul ecx, dlgitemtemplate.size |
1448 | add eax, dlgtemplate.size+12 |
1470 | add ecx, dlgtemplate.size+12 |
1449 | call xmalloc |
1471 | call xpgalloc |
1450 | test eax, eax |
1472 | test eax, eax |
- | 1473 | jnz @f |
|
1451 | jnz @f |
1474 | popad |
1452 | or eax, -1 |
1475 | or eax, -1 |
1453 | ret 28 |
1476 | ret 28 |
1454 | @@: |
- | |
1455 | pushad |
1477 | @@: |
1456 | mov ebx, eax |
1478 | mov ebx, eax |
1457 | mov edi, eax |
1479 | mov edi, eax |
1458 | mov eax, 2 |
1480 | mov eax, [esp+28] |
1459 | stosd ; dlgtemplate.flags |
1481 | stosd ; dlgtemplate.flags |
1460 | mov eax, [esp+32+8] |
1482 | mov eax, [esp+32+8] |
1461 | stosd ; dlgtemplate.x |
1483 | stosd ; dlgtemplate.x |
1462 | mov eax, [esp+32+12] |
1484 | mov eax, [esp+32+12] |
Line 1590... | Line 1612... | ||
1590 | mov ecx, dlgitemtemplate.size |
1612 | mov ecx, dlgitemtemplate.size |
1591 | div ecx |
1613 | div ecx |
1592 | sub eax, [esp+32+16] |
1614 | sub eax, [esp+32+16] |
1593 | @@: |
1615 | @@: |
1594 | mov [esp+28], eax |
1616 | mov [esp+28], eax |
1595 | mov eax, ebx |
1617 | mov ecx, ebx |
1596 | call mf_free |
1618 | call pgfree |
1597 | popad |
1619 | popad |
1598 | ret 28 |
1620 | ret 28 |