Subversion Repositories Kolibri OS

Rev

Rev 589 | Rev 997 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 589 Rev 814
Line 6... Line 6...
6
; ”« £¨:
6
; ”« £¨:
7
; ¡¨â 0: ¨á¯®«ì§®¢ âì áâ ­¤ àâ­ë¥ æ¢¥â  ¤¨ «®£ 
7
; ¡¨â 0: ¨á¯®«ì§®¢ âì áâ ­¤ àâ­ë¥ æ¢¥â  ¤¨ «®£ 
8
; ¡¨â 1: ¨á¯®«ì§®¢ âì áâ ­¤ àâ­ë¥ æ¢¥â  ¯à¥¤ã¯à¥¦¤¥­¨ï/®è¨¡ª¨
8
; ¡¨â 1: ¨á¯®«ì§®¢ âì áâ ­¤ àâ­ë¥ æ¢¥â  ¯à¥¤ã¯à¥¦¤¥­¨ï/®è¨¡ª¨
9
; (¥á«¨ «î¡®© ¨§ íâ¨å ¡¨â®¢ ãáâ ­®¢«¥­, ¯®«ï main_color,border_color,header_color
9
; (¥á«¨ «î¡®© ¨§ íâ¨å ¡¨â®¢ ãáâ ­®¢«¥­, ¯®«ï main_color,border_color,header_color
10
;  ¨£­®à¨àãîâáï)
10
;  ¨£­®à¨àãîâáï)
-
 
11
; ¡¨â 2: ­¥ à¨á®¢ âì ⥭ì
11
.flags          dd      ?
12
.flags          dd      ?
12
.x              dd      ?
13
.x              dd      ?
13
.y              dd      ?
14
.y              dd      ?
14
.width          dd      ?
15
.width          dd      ?
15
.height         dd      ?
16
.height         dd      ?
Line 18... Line 19...
18
.title          dd      ?
19
.title          dd      ?
19
.main_color     db      ?
20
.main_color     db      ?
20
.border_color   db      ?
21
.border_color   db      ?
21
.header_color   db      ?
22
.header_color   db      ?
22
                db      ?       ; align
23
                db      ?       ; align
-
 
24
.dataptr        dd      ?       ; used internally, ignored on input
23
.size = $
25
.size = $
24
end virtual
26
end virtual
Line 25... Line 27...
25
 
27
 
-
 
28
GenericBox:
-
 
29
        push    [cursor_x]
-
 
30
        push    [cursor_y]
-
 
31
        push    dword [esp+8+8]
-
 
32
        push    dword [esp+8+8]
-
 
33
        call    ShowGenericBox
-
 
34
        test    eax, eax
-
 
35
        jz      @f
-
 
36
        pop     [cursor_y]
-
 
37
        pop     [cursor_x]
-
 
38
        ret
-
 
39
@@:
-
 
40
        pushad
-
 
41
; message loop
-
 
42
.event:
-
 
43
        push    10
-
 
44
        pop     eax
-
 
45
        int     40h
-
 
46
        dec     eax
-
 
47
        jz      .redraw
-
 
48
        dec     eax
-
 
49
        jz      .key
-
 
50
        jmp     exit
-
 
51
.redraw:
-
 
52
        call    draw_window
-
 
53
        jmp     .event
-
 
54
.key:
-
 
55
        mov     al, 2
-
 
56
        int     40h
-
 
57
        shr     eax, 8
-
 
58
        cmp     al, 0xE0
-
 
59
        jnz     @f
-
 
60
        mov     [bWasE0], 1
-
 
61
        jmp     .event
-
 
62
@@:
-
 
63
        xchg    ah, [bWasE0]
-
 
64
        cmp     al, 0x1D
-
 
65
        jz      .ctrl_down
-
 
66
        cmp     al, 0x9D
-
 
67
        jz      .ctrl_up
-
 
68
        cmp     al, 0x2A
-
 
69
        jz      .lshift_down
-
 
70
        cmp     al, 0xAA
-
 
71
        jz      .lshift_up
-
 
72
        cmp     al, 0x36
-
 
73
        jz      .rshift_down
-
 
74
        cmp     al, 0xB6
-
 
75
        jz      .rshift_up
-
 
76
        cmp     al, 0x38
-
 
77
        jz      .alt_down
-
 
78
        cmp     al, 0xB8
-
 
79
        jz      .alt_up
-
 
80
        mov     ebx, [esp+24h+8]
-
 
81
        mov     ecx, [esp+28h+8]
-
 
82
        push    0
-
 
83
        push    eax
-
 
84
        push    2
-
 
85
        push    ebx
-
 
86
        call    ecx
-
 
87
        test    eax, eax
-
 
88
        jz      .event
-
 
89
        mov     [esp+28], eax
-
 
90
        jmp     .exit
-
 
91
.ctrl_down:
-
 
92
        test    ah, ah
-
 
93
        jnz     .rctrl_down
-
 
94
        or      [ctrlstate], 4
-
 
95
        jmp     .event
-
 
96
.rctrl_down:
-
 
97
        or      [ctrlstate], 8
-
 
98
        jmp     .event
-
 
99
.ctrl_up:
-
 
100
        test    ah, ah
-
 
101
        jnz     .rctrl_up
-
 
102
        and     [ctrlstate], not 4
-
 
103
        jmp     .event
-
 
104
.rctrl_up:
-
 
105
        and     [ctrlstate], not 8
-
 
106
        jmp     .event
-
 
107
.lshift_down:
-
 
108
        test    ah, ah
-
 
109
        jnz     @f
-
 
110
        or      [ctrlstate], 1
-
 
111
@@:     jmp     .event
-
 
112
.lshift_up:
-
 
113
        test    ah, ah
-
 
114
        jnz     @b
-
 
115
        and     [ctrlstate], not 1
-
 
116
        jmp     @b
-
 
117
.rshift_down:
-
 
118
        or      [ctrlstate], 2
-
 
119
        jmp     .event
-
 
120
.rshift_up:
-
 
121
        and     [ctrlstate], not 2
-
 
122
        jmp     .event
-
 
123
.alt_down:
-
 
124
        test    ah, ah
-
 
125
        jnz     .ralt_down
-
 
126
        or      [ctrlstate], 0x10
-
 
127
        jmp     .event
-
 
128
.ralt_down:
-
 
129
        or      [ctrlstate], 0x20
-
 
130
        jmp     .event
-
 
131
.alt_up:
-
 
132
        test    ah, ah
-
 
133
        jnz     .ralt_up
-
 
134
        and     [ctrlstate], not 0x10
-
 
135
        jmp     .event
-
 
136
.ralt_up:
-
 
137
        and     [ctrlstate], not 0x20
-
 
138
        jmp     .event
-
 
139
.exit:
-
 
140
        popad
-
 
141
        push    eax
-
 
142
        push    0
-
 
143
        push    dword [esp+12+8]
-
 
144
        call    HideGenericBox
-
 
145
        pop     eax
-
 
146
        pop     [cursor_y]
-
 
147
        pop     [cursor_x]
-
 
148
        pushad
-
 
149
        call    draw_image
-
 
150
        popad
-
 
151
        ret     8
-
 
152
 
-
 
153
; int __stdcall ShowGenericBox(DLGTEMPLATE* dlg, void* DlgProc);
26
GenericBox:
154
ShowGenericBox:
27
        pushad
155
        pushad
28
        mov     ebx, [esp+20h+4]
156
        mov     ebx, [esp+20h+4]
29
; center window if required
157
; center window if required
30
        push    [ebx+dlgtemplate.x]
158
        push    [ebx+dlgtemplate.x]
Line 84... Line 212...
84
        mov     al, [edi + dialog_header_color-dialog_colors]
212
        mov     al, [edi + dialog_header_color-dialog_colors]
85
        mov     [ebx+dlgtemplate.header_color], al
213
        mov     [ebx+dlgtemplate.header_color], al
86
@@:
214
@@:
87
; allocate memory for data under dialog
215
; allocate memory for data under dialog
88
; for 'No memory' dialog use static data area
216
; for 'No memory' dialog use static data area
89
        mov     ebp, nomem_dlgsavearea
217
        mov     eax, nomem_dlgsavearea
90
        cmp     ebx, nomem_dlgdata
218
        cmp     ebx, nomem_dlgdata
91
        jz      .allocated
219
        jz      .allocated
92
        mov     eax, [ebx+dlgtemplate.width]
220
        mov     eax, [ebx+dlgtemplate.width]
93
        add     eax, [ebx+dlgtemplate.border_size_x]
221
        add     eax, [ebx+dlgtemplate.border_size_x]
94
        add     eax, [ebx+dlgtemplate.border_size_x]
222
        add     eax, [ebx+dlgtemplate.border_size_x]
Line 97... Line 225...
97
        mov     edx, [ebx+dlgtemplate.height]
225
        mov     edx, [ebx+dlgtemplate.height]
98
        add     edx, [ebx+dlgtemplate.border_size_y]
226
        add     edx, [ebx+dlgtemplate.border_size_y]
99
        add     edx, [ebx+dlgtemplate.border_size_y]
227
        add     edx, [ebx+dlgtemplate.border_size_y]
100
        inc     edx
228
        inc     edx
101
        mul     edx
229
        mul     edx
102
        lea     ecx, [eax*2]
230
        lea     ecx, [eax*2+8]
103
        call    xpgalloc
231
        call    xpgalloc
104
        test    eax, eax
232
        test    eax, eax
105
        jnz     @f
233
        jnz     @f
106
        pop     [ebx+dlgtemplate.y]
234
        pop     [ebx+dlgtemplate.y]
107
        pop     [ebx+dlgtemplate.x]
235
        pop     [ebx+dlgtemplate.x]
108
        popad
236
        popad
109
        or      eax, -1
237
        or      eax, -1
110
        ret     8
238
        ret     8
111
@@:
239
@@:
112
        mov     ebp, eax
-
 
113
.allocated:
240
.allocated:
-
 
241
        mov     [ebx+dlgtemplate.dataptr], eax
-
 
242
        pop     dword [eax+4]
-
 
243
        pop     dword [eax]
-
 
244
        lea     ebp, [eax+8]
114
; save data
245
; save data
115
        mov     eax, [ebx+dlgtemplate.y]
246
        mov     eax, [ebx+dlgtemplate.y]
116
        add     eax, [ebx+dlgtemplate.height]
247
        add     eax, [ebx+dlgtemplate.height]
117
        add     eax, [ebx+dlgtemplate.border_size_y]
248
        add     eax, [ebx+dlgtemplate.border_size_y]
118
        inc     eax
249
        inc     eax
Line 129... Line 260...
129
        mov     eax, [ebx+dlgtemplate.x]
260
        mov     eax, [ebx+dlgtemplate.x]
130
        sub     eax, [ebx+dlgtemplate.border_size_x]
261
        sub     eax, [ebx+dlgtemplate.border_size_x]
131
        push    eax
262
        push    eax
132
        call    save_console_data
263
        call    save_console_data
133
; draw shadow
264
; draw shadow
-
 
265
        test    byte [ebx+dlgtemplate.flags], 4
-
 
266
        jnz     .noshadow
134
        mov     eax, [ebx+dlgtemplate.x]
267
        mov     eax, [ebx+dlgtemplate.x]
135
        sub     eax, [ebx+dlgtemplate.border_size_x]
268
        sub     eax, [ebx+dlgtemplate.border_size_x]
136
        ja      @f
269
        ja      @f
137
        xor     eax, eax
270
        xor     eax, eax
138
@@:
271
@@:
139
        push    eax     ; save real window left
-
 
140
        inc     eax
272
        inc     eax
141
        inc     eax
273
        inc     eax
142
        mov     edx, [ebx+dlgtemplate.y]
274
        mov     edx, [ebx+dlgtemplate.y]
143
        sub     edx, [ebx+dlgtemplate.border_size_y]
275
        sub     edx, [ebx+dlgtemplate.border_size_y]
144
        ja      @f
276
        ja      @f
145
        xor     edx, edx
277
        xor     edx, edx
146
@@:
278
@@:
147
        push    edx     ; save real window top
-
 
148
        inc     edx
279
        inc     edx
149
        call    get_console_ptr
280
        call    get_console_ptr
150
        mov     ecx, [ebx+dlgtemplate.y]
281
        mov     ecx, [ebx+dlgtemplate.y]
151
        add     ecx, [ebx+dlgtemplate.height]
282
        add     ecx, [ebx+dlgtemplate.height]
152
        add     ecx, [ebx+dlgtemplate.border_size_y]
283
        add     ecx, [ebx+dlgtemplate.border_size_y]
Line 183... Line 314...
183
        pop     edi
314
        pop     edi
184
        add     edi, [cur_width]
315
        add     edi, [cur_width]
185
        add     edi, [cur_width]
316
        add     edi, [cur_width]
186
        dec     edx
317
        dec     edx
187
        jnz     .shadow_loop
318
        jnz     .shadow_loop
-
 
319
.noshadow:
-
 
320
        popad
-
 
321
        push    dword [esp+8]
-
 
322
        push    dword [esp+8]
-
 
323
        call    DrawGenericBox
-
 
324
        xor     eax, eax
-
 
325
        ret     8
-
 
326
 
-
 
327
; void __stdcall DrawGenericBox(DLGDATA* dlg, void* DlgProc)
-
 
328
DrawGenericBox:
-
 
329
        pushad
-
 
330
        mov     ebx, [esp+24h]
188
; draw area background
331
; draw area background
-
 
332
        mov     eax, [ebx+dlgtemplate.x]
-
 
333
        sub     eax, [ebx+dlgtemplate.border_size_x]
189
        pop     edx
334
        ja      @f
-
 
335
        xor     eax, eax
-
 
336
@@:
-
 
337
        mov     edx, [ebx+dlgtemplate.y]
-
 
338
        sub     edx, [ebx+dlgtemplate.border_size_y]
190
        pop     eax
339
        ja      @f
-
 
340
        xor     edx, edx
-
 
341
@@:
191
        call    get_console_ptr
342
        call    get_console_ptr
192
        mov     ecx, [ebx+dlgtemplate.x]
343
        mov     ecx, [ebx+dlgtemplate.x]
193
        add     ecx, [ebx+dlgtemplate.width]
344
        add     ecx, [ebx+dlgtemplate.width]
194
        add     ecx, [ebx+dlgtemplate.border_size_x]
345
        add     ecx, [ebx+dlgtemplate.border_size_x]
195
        cmp     ecx, [cur_width]
346
        cmp     ecx, [cur_width]
Line 300... Line 451...
300
        add     edi, [cur_width]
451
        add     edi, [cur_width]
301
        add     edi, [cur_width]
452
        add     edi, [cur_width]
302
        dec     edx
453
        dec     edx
303
        jnz     @b
454
        jnz     @b
304
; send redraw message
455
; send redraw message
305
        mov     eax, [esp+28h+8]
456
        mov     eax, [esp+28h]
306
        push    ebx ebp
-
 
307
        push    0
457
        push    0
308
        push    0
458
        push    0
309
        push    1
459
        push    1
310
        push    ebx
460
        push    ebx
311
        call    eax
461
        call    eax
312
        call    draw_image
462
        call    draw_image
313
        pop     ebp ebx
-
 
314
; message loop
-
 
315
.event:
-
 
316
        push    10
-
 
317
        pop     eax
463
        popad
318
        int     40h
-
 
319
        dec     eax
-
 
320
        jz      .redraw
-
 
321
        dec     eax
-
 
322
        jz      .key
-
 
323
        jmp     exit
-
 
324
.redraw:
-
 
325
        push    ebx ebp
-
 
326
        call    draw_window
-
 
327
        pop     ebp ebx
-
 
328
        jmp     .event
-
 
329
.key:
-
 
330
        mov     al, 2
-
 
331
        int     40h
464
        ret     8
332
        shr     eax, 8
-
 
333
        cmp     al, 0xE0
-
 
334
        jnz     @f
-
 
335
        mov     [bWasE0], 1
-
 
336
        jmp     .event
-
 
337
@@:
465
 
338
        xchg    ah, [bWasE0]
-
 
339
        cmp     al, 0x1D
-
 
340
        jz      .ctrl_down
-
 
341
        cmp     al, 0x9D
-
 
342
        jz      .ctrl_up
-
 
343
        cmp     al, 0x2A
-
 
344
        jz      .lshift_down
-
 
345
        cmp     al, 0xAA
-
 
346
        jz      .lshift_up
-
 
347
        cmp     al, 0x36
-
 
348
        jz      .rshift_down
-
 
349
        cmp     al, 0xB6
-
 
350
        jz      .rshift_up
-
 
351
        cmp     al, 0x38
-
 
352
        jz      .alt_down
-
 
353
        cmp     al, 0xB8
-
 
354
        jz      .alt_up
-
 
355
        mov     ecx, [esp+28h+8]
466
; void __stdcall HideGenericBox(DLGTEMPLATE* dlg, int bRedrawWindow);
356
        push    ebx ebp
-
 
357
        push    0
-
 
358
        push    eax
-
 
359
        push    2
-
 
360
        push    ebx
-
 
361
        call    ecx
-
 
362
        pop     ebp ebx
-
 
363
        test    eax, eax
-
 
364
        jz      .event
-
 
365
        mov     [esp+8+28], eax
-
 
366
        jmp     .exit
-
 
367
.ctrl_down:
-
 
368
        test    ah, ah
-
 
369
        jnz     .rctrl_down
-
 
370
        or      [ctrlstate], 4
-
 
371
        jmp     .event
-
 
372
.rctrl_down:
467
HideGenericBox:
373
        or      [ctrlstate], 8
-
 
374
        jmp     .event
-
 
375
.ctrl_up:
-
 
376
        test    ah, ah
-
 
377
        jnz     .rctrl_up
-
 
378
        and     [ctrlstate], not 4
-
 
379
        jmp     .event
-
 
380
.rctrl_up:
-
 
381
        and     [ctrlstate], not 8
468
; void __stdcall HideDialogBox(DLGDATA* dlg, int bRedrawWindow);
382
        jmp     .event
-
 
383
.lshift_down:
469
HideDialogBox:
384
        test    ah, ah
-
 
385
        jnz     @f
-
 
386
        or      [ctrlstate], 1
-
 
387
@@:     jmp     .event
-
 
388
.lshift_up:
-
 
389
        test    ah, ah
-
 
390
        jnz     @b
-
 
391
        and     [ctrlstate], not 1
-
 
392
        jmp     @b
470
        pushad
393
.rshift_down:
-
 
394
        or      [ctrlstate], 2
471
        mov     ebx, [esp+24h]
395
        jmp     .event
-
 
396
.rshift_up:
-
 
397
        and     [ctrlstate], not 2
-
 
398
        jmp     .event
-
 
399
.alt_down:
-
 
400
        test    ah, ah
-
 
401
        jnz     .ralt_down
-
 
402
        or      [ctrlstate], 0x10
-
 
403
        jmp     .event
-
 
404
.ralt_down:
-
 
405
        or      [ctrlstate], 0x20
472
        mov     ebp, [ebx+dlgtemplate.dataptr]
406
        jmp     .event
-
 
407
.alt_up:
-
 
408
        test    ah, ah
473
        add     ebp, 8
409
        jnz     .ralt_up
-
 
410
        and     [ctrlstate], not 0x10
-
 
411
        jmp     .event
-
 
412
.ralt_up:
-
 
413
        and     [ctrlstate], not 0x20
-
 
414
        jmp     .event
-
 
415
.exit:
-
 
416
; restore data
474
; restore data
417
        mov     eax, [ebx+dlgtemplate.y]
475
        mov     eax, [ebx+dlgtemplate.y]
418
        add     eax, [ebx+dlgtemplate.height]
476
        add     eax, [ebx+dlgtemplate.height]
419
        add     eax, [ebx+dlgtemplate.border_size_y]
477
        add     eax, [ebx+dlgtemplate.border_size_y]
420
        inc     eax
478
        inc     eax
Line 431... Line 489...
431
        mov     eax, [ebx+dlgtemplate.x]
489
        mov     eax, [ebx+dlgtemplate.x]
432
        sub     eax, [ebx+dlgtemplate.border_size_x]
490
        sub     eax, [ebx+dlgtemplate.border_size_x]
433
        push    eax
491
        push    eax
434
        call    restore_console_data
492
        call    restore_console_data
435
        call    draw_keybar
493
        call    draw_keybar
-
 
494
        lea     ecx, [ebp-8]
-
 
495
        push    dword [ecx]
-
 
496
        push    dword [ecx+4]
-
 
497
        pop     [ebx+dlgtemplate.y]
-
 
498
        pop     [ebx+dlgtemplate.x]
436
        cmp     ebx, nomem_dlgdata
499
        cmp     ebx, nomem_dlgdata
437
        jz      @f
500
        jz      @f
438
        mov     ecx, ebp
-
 
439
        call    pgfree
501
        call    pgfree
440
@@:
502
@@:
441
        pop     [ebx+dlgtemplate.y]
-
 
442
        pop     [ebx+dlgtemplate.x]
-
 
443
        or      [cursor_x], -1
503
        or      [cursor_x], -1
444
        or      [cursor_y], -1
504
        or      [cursor_y], -1
-
 
505
        cmp     dword [esp+28h], 0
-
 
506
        jz      @f
445
        call    draw_image
507
        call    draw_image
-
 
508
@@:
446
        popad
509
        popad
447
        ret     8
510
        ret     8
Line 448... Line 511...
448
 
511
 
449
save_console_data:
512
save_console_data:
Line 553... Line 616...
553
 
616
 
554
; int __stdcall menu_centered_in(unsigned left, unsigned top, unsigned width, unsigned height,
617
; int __stdcall menu_centered_in(unsigned left, unsigned top, unsigned width, unsigned height,
555
;       void* variants, const char* title, unsigned flags);
618
;       void* variants, const char* title, unsigned flags);
556
menu_centered_in:
619
menu_centered_in:
557
        pushad
620
        pushad
558
        mov     ecx, 56
621
        mov     ecx, 60
559
; 36 bytes for dlgtemplate + additional:
622
; 40 bytes for dlgtemplate + additional:
560
; +36: dd cur_variant
623
; +40: dd cur_variant
561
; +40: dd num_variants
624
; +44: dd num_variants
562
; +44: dd begin_variant
625
; +48: dd begin_variant
563
; +48: dd end_variant
626
; +52: dd end_variant
564
; +52: dd cur_variant_idx
627
; +56: dd cur_variant_idx
565
        call    xpgalloc
628
        call    xpgalloc
566
        test    eax, eax
629
        test    eax, eax
567
        jnz     @f
630
        jnz     @f
568
.ret_bad:
631
.ret_bad:
Line 582... Line 645...
582
        mov     [ebx+dlgtemplate.border_size_y], eax
645
        mov     [ebx+dlgtemplate.border_size_y], eax
583
;  å®¤¨¬ è¨à¨­ã ¨ ¢ëá®âã ®ª­ 
646
;  å®¤¨¬ è¨à¨­ã ¨ ¢ëá®âã ®ª­ 
584
        xor     eax, eax
647
        xor     eax, eax
585
        xor     ecx, ecx
648
        xor     ecx, ecx
586
        mov     esi, [esp+20h+20]
649
        mov     esi, [esp+20h+20]
587
        mov     [ebx+36], esi
650
        mov     [ebx+40], esi
588
        and     dword [ebx+52], 0
651
        and     dword [ebx+56], 0
589
@@:
652
@@:
590
        cmp     dword [esi+4], 0
653
        cmp     dword [esi+4], 0
591
        jz      .find_width
654
        jz      .find_width
592
        mov     esi, [esi+4]
655
        mov     esi, [esi+4]
593
        inc     dword [ebx+52]
656
        inc     dword [ebx+56]
594
        jmp     @b
657
        jmp     @b
595
.find_width:
658
.find_width:
596
        mov     [ebx+44], esi
659
        mov     [ebx+48], esi
597
        add     esi, 8
660
        add     esi, 8
598
        push    esi
661
        push    esi
599
        xor     edx, edx
662
        xor     edx, edx
600
.fw1:
663
.fw1:
601
        cmp     byte [esi], '&'
664
        cmp     byte [esi], '&'
Line 626... Line 689...
626
@@:
689
@@:
627
        sub     eax, [ebx+dlgtemplate.border_size_x]
690
        sub     eax, [ebx+dlgtemplate.border_size_x]
628
        sub     eax, [ebx+dlgtemplate.border_size_x]
691
        sub     eax, [ebx+dlgtemplate.border_size_x]
629
        mov     [ebx+dlgtemplate.width], eax
692
        mov     [ebx+dlgtemplate.width], eax
630
        mov     [ebx+dlgtemplate.height], ecx
693
        mov     [ebx+dlgtemplate.height], ecx
631
        mov     [ebx+40], ecx
694
        mov     [ebx+44], ecx
632
        sub     eax, [esp+20h+12]
695
        sub     eax, [esp+20h+12]
633
        neg     eax
696
        neg     eax
634
        sar     eax, 1
697
        sar     eax, 1
635
        add     eax, [esp+20h+4]
698
        add     eax, [esp+20h+4]
636
        cmp     eax, [ebx+dlgtemplate.border_size_x]
699
        cmp     eax, [ebx+dlgtemplate.border_size_x]
Line 675... Line 738...
675
        jbe     .small_height
738
        jbe     .small_height
676
        mov     [ebx+dlgtemplate.height], eax
739
        mov     [ebx+dlgtemplate.height], eax
677
        mov     [ebx+dlgtemplate.y], 3
740
        mov     [ebx+dlgtemplate.y], 3
678
.small_height:
741
.small_height:
679
        mov     ecx, [ebx+dlgtemplate.height]
742
        mov     ecx, [ebx+dlgtemplate.height]
680
        mov     eax, [ebx+36]
743
        mov     eax, [ebx+40]
681
        mov     [ebx+44], eax
744
        mov     [ebx+48], eax
682
        dec     ecx
745
        dec     ecx
683
        jz      .skip
746
        jz      .skip
684
        push    ecx
747
        push    ecx
685
@@:
748
@@:
686
        cmp     dword [eax+4], 0
749
        cmp     dword [eax+4], 0
687
        jz      @f
750
        jz      @f
688
        mov     eax, [eax+4]
751
        mov     eax, [eax+4]
689
        loop    @b
752
        loop    @b
690
@@:
753
@@:
691
        mov     [ebx+44], eax
754
        mov     [ebx+48], eax
692
        pop     ecx
755
        pop     ecx
693
.loop:
756
.loop:
694
        mov     eax, [eax]
757
        mov     eax, [eax]
695
        loop    .loop
758
        loop    .loop
696
.skip:
759
.skip:
697
        mov     [ebx+48], eax
760
        mov     [ebx+52], eax
698
        mov     eax, [esp+20h+24]
761
        mov     eax, [esp+20h+24]
699
        mov     [ebx+dlgtemplate.title], eax
762
        mov     [ebx+dlgtemplate.title], eax
700
        mov     al, [menu_normal_color]
763
        mov     al, [menu_normal_color]
701
        mov     [ebx+dlgtemplate.main_color], al
764
        mov     [ebx+dlgtemplate.main_color], al
702
        mov     al, [menu_border_color]
765
        mov     al, [menu_border_color]
Line 721... Line 784...
721
        ret     16
784
        ret     16
722
.draw:
785
.draw:
723
        call    .dodraw
786
        call    .dodraw
724
        ret     16
787
        ret     16
725
.prev:
788
.prev:
726
        mov     eax, [ebx+36]
789
        mov     eax, [ebx+40]
727
        cmp     dword [eax+4], 0
790
        cmp     dword [eax+4], 0
728
        jz      .end
791
        jz      .end
729
        call    .line_prev
792
        call    .line_prev
730
.posret:
793
.posret:
731
        mov     [ebx+36], eax
794
        mov     [ebx+40], eax
732
.redraw:
795
.redraw:
733
        call    .dodraw
796
        call    .dodraw
734
        call    draw_image
797
        call    draw_image
735
        xor     eax, eax
798
        xor     eax, eax
736
        ret     16
799
        ret     16
737
.next:
800
.next:
738
        mov     eax, [ebx+36]
801
        mov     eax, [ebx+40]
739
        cmp     dword [eax], 0
802
        cmp     dword [eax], 0
740
        jz      .home
803
        jz      .home
741
        call    .line_next
804
        call    .line_next
742
        jmp     .posret
805
        jmp     .posret
743
.pgdn:
806
.pgdn:
744
        mov     eax, [ebx+36]
807
        mov     eax, [ebx+40]
745
        mov     ecx, [ebx+dlgtemplate.height]
808
        mov     ecx, [ebx+dlgtemplate.height]
746
.pgdnl:
809
.pgdnl:
747
        cmp     dword [eax], 0
810
        cmp     dword [eax], 0
748
        jz      .posret
811
        jz      .posret
749
        call    .line_next
812
        call    .line_next
Line 773... Line 836...
773
        jz      .pgup
836
        jz      .pgup
774
        cmp     al, 0x52
837
        cmp     al, 0x52
775
        jz      .ins
838
        jz      .ins
776
        cmp     al, 0x53
839
        cmp     al, 0x53
777
        jz      .del
840
        jz      .del
778
        mov     edx, [ebx+36]
841
        mov     edx, [ebx+40]
779
@@:
842
@@:
780
        cmp     dword [edx+4], 0
843
        cmp     dword [edx+4], 0
781
        jz      @f
844
        jz      @f
782
        mov     edx, [edx+4]
845
        mov     edx, [edx+4]
783
        jmp     @b
846
        jmp     @b
Line 801... Line 864...
801
        jnz     .l
864
        jnz     .l
802
.ret:
865
.ret:
803
        xor     eax, eax
866
        xor     eax, eax
804
        ret     16
867
        ret     16
805
.pgup:
868
.pgup:
806
        mov     eax, [ebx+36]
869
        mov     eax, [ebx+40]
807
        mov     ecx, [ebx+dlgtemplate.height]
870
        mov     ecx, [ebx+dlgtemplate.height]
808
.pgupl:
871
.pgupl:
809
        cmp     dword [eax+4], 0
872
        cmp     dword [eax+4], 0
810
        jz      .posret
873
        jz      .posret
811
        call    .line_prev
874
        call    .line_prev
812
        loop    .pgupl
875
        loop    .pgupl
813
        jmp     .posret
876
        jmp     .posret
814
.home:
877
.home:
815
        mov     eax, [ebx+36]
878
        mov     eax, [ebx+40]
816
@@:
879
@@:
817
        cmp     dword [eax+4], 0
880
        cmp     dword [eax+4], 0
818
        jz      @f
881
        jz      @f
819
        mov     eax, [eax+4]
882
        mov     eax, [eax+4]
820
        jmp     @b
883
        jmp     @b
821
@@:
884
@@:
822
        mov     [ebx+44], eax
885
        mov     [ebx+48], eax
823
        push    eax
886
        push    eax
824
        mov     ecx, [ebx+dlgtemplate.height]
887
        mov     ecx, [ebx+dlgtemplate.height]
825
        dec     ecx
888
        dec     ecx
826
        jz      .h1
889
        jz      .h1
827
.h2:
890
.h2:
828
        mov     eax, [eax]
891
        mov     eax, [eax]
829
        loop    .h2
892
        loop    .h2
830
.h1:
893
.h1:
831
        mov     [ebx+48], eax
894
        mov     [ebx+52], eax
832
        pop     eax
895
        pop     eax
833
        and     dword [ebx+52], 0
896
        and     dword [ebx+56], 0
834
        jmp     .posret
897
        jmp     .posret
835
.end:
898
.end:
836
        mov     eax, [ebx+36]
899
        mov     eax, [ebx+40]
837
@@:
900
@@:
838
        cmp     dword [eax], 0
901
        cmp     dword [eax], 0
839
        jz      @f
902
        jz      @f
840
        mov     eax, [eax]
903
        mov     eax, [eax]
841
        jmp     @b
904
        jmp     @b
842
@@:
905
@@:
843
        mov     [ebx+48], eax
906
        mov     [ebx+52], eax
844
        push    eax
907
        push    eax
845
        mov     ecx, [ebx+dlgtemplate.height]
908
        mov     ecx, [ebx+dlgtemplate.height]
846
        dec     ecx
909
        dec     ecx
847
        jz      .e1
910
        jz      .e1
848
.e2:
911
.e2:
849
        mov     eax, [eax+4]
912
        mov     eax, [eax+4]
850
        loop    .e2
913
        loop    .e2
851
.e1:
914
.e1:
852
        mov     [ebx+44], eax
915
        mov     [ebx+48], eax
853
        mov     eax, [ebx+40]
916
        mov     eax, [ebx+44]
854
        dec     eax
917
        dec     eax
855
        mov     [ebx+52], eax
918
        mov     [ebx+56], eax
856
        pop     eax
919
        pop     eax
857
        jmp     .posret
920
        jmp     .posret
858
.esc:
921
.esc:
859
        or      eax, -1
922
        or      eax, -1
860
        ret     16
923
        ret     16
861
.enter:
924
.enter:
862
        mov     eax, [ebx+36]
925
        mov     eax, [ebx+40]
863
        ret     16
926
        ret     16
864
.ins:
927
.ins:
865
        push    5
928
        push    5
866
        pop     edx
929
        pop     edx
867
        jmp     @f
930
        jmp     @f
868
.del:
931
.del:
869
        push    4
932
        push    4
870
        pop     edx
933
        pop     edx
871
@@:
934
@@:
872
        mov     eax, [ebx+36]
935
        mov     eax, [ebx+40]
873
        cmp     byte [eax+8], '/'
936
        cmp     byte [eax+8], '/'
874
        jnz     @f
937
        jnz     @f
875
        cmp     word [eax+9], 'cd'
938
        cmp     word [eax+9], 'cd'
876
        jnz     @f
939
        jnz     @f
877
        movzx   ecx, byte [eax+11]
940
        movzx   ecx, byte [eax+11]
Line 883... Line 946...
883
@@:
946
@@:
884
        xor     eax, eax
947
        xor     eax, eax
885
        ret     16
948
        ret     16
Line 886... Line 949...
886
 
949
 
887
.line_prev:
950
.line_prev:
888
        cmp     eax, [ebx+44]
951
        cmp     eax, [ebx+48]
889
        jnz     @f
-
 
890
        mov     edx, [ebx+44]
-
 
891
        mov     edx, [edx+4]
-
 
892
        mov     [ebx+44], edx
952
        jnz     @f
893
        mov     edx, [ebx+48]
953
        mov     edx, [ebx+48]
894
        mov     edx, [edx+4]
954
        mov     edx, [edx+4]
-
 
955
        mov     [ebx+48], edx
-
 
956
        mov     edx, [ebx+52]
-
 
957
        mov     edx, [edx+4]
895
        mov     [ebx+48], edx
958
        mov     [ebx+52], edx
896
@@:
959
@@:
897
        mov     eax, [eax+4]
960
        mov     eax, [eax+4]
898
        dec     dword [ebx+52]
961
        dec     dword [ebx+56]
899
        ret
962
        ret
900
.line_next:
963
.line_next:
901
        cmp     eax, [ebx+48]
964
        cmp     eax, [ebx+52]
902
        jnz     @f
-
 
903
        mov     edx, [ebx+44]
-
 
904
        mov     edx, [edx]
-
 
905
        mov     [ebx+44], edx
965
        jnz     @f
906
        mov     edx, [ebx+48]
966
        mov     edx, [ebx+48]
907
        mov     edx, [edx]
967
        mov     edx, [edx]
-
 
968
        mov     [ebx+48], edx
-
 
969
        mov     edx, [ebx+52]
-
 
970
        mov     edx, [edx]
908
        mov     [ebx+48], edx
971
        mov     [ebx+52], edx
909
@@:
972
@@:
910
        mov     eax, [eax]
973
        mov     eax, [eax]
911
        inc     dword [ebx+52]
974
        inc     dword [ebx+56]
Line 912... Line 975...
912
        ret
975
        ret
913
 
976
 
914
.dodraw:
977
.dodraw:
915
        mov     eax, [ebx+dlgtemplate.x]
978
        mov     eax, [ebx+dlgtemplate.x]
916
        mov     edx, [ebx+dlgtemplate.y]
979
        mov     edx, [ebx+dlgtemplate.y]
917
        call    get_console_ptr
980
        call    get_console_ptr
918
        mov     esi, [ebx+44]
981
        mov     esi, [ebx+48]
919
.0:
982
.0:
920
        xor     edx, edx
983
        xor     edx, edx
921
        mov     ah, [menu_selected_color]
984
        mov     ah, [menu_selected_color]
922
        cmp     esi, [ebx+36]
985
        cmp     esi, [ebx+40]
923
        jz      @f
986
        jz      @f
924
        mov     ah, [menu_normal_color]
987
        mov     ah, [menu_normal_color]
925
@@:
988
@@:
Line 945... Line 1008...
945
        lodsb
1008
        lodsb
946
        push    eax
1009
        push    eax
947
        mov     ah, [menu_selected_highlight_color]
1010
        mov     ah, [menu_selected_highlight_color]
948
        push    ecx
1011
        push    ecx
949
        mov     ecx, [esp+8]
1012
        mov     ecx, [esp+8]
950
        cmp     ecx, [ebx+36]
1013
        cmp     ecx, [ebx+40]
951
        pop     ecx
1014
        pop     ecx
952
        jz      .amp1
1015
        jz      .amp1
953
        mov     ah, [menu_highlight_color]
1016
        mov     ah, [menu_highlight_color]
954
.amp1:
1017
.amp1:
955
        stosw
1018
        stosw
Line 971... Line 1034...
971
        mov     al, ' '
1034
        mov     al, ' '
972
        rep     stosw
1035
        rep     stosw
973
        pop     esi edi
1036
        pop     esi edi
974
        add     edi, [cur_width]
1037
        add     edi, [cur_width]
975
        add     edi, [cur_width]
1038
        add     edi, [cur_width]
976
        cmp     esi, [ebx+48]
1039
        cmp     esi, [ebx+52]
977
        jz      @f
1040
        jz      @f
978
        mov     esi, [esi]
1041
        mov     esi, [esi]
979
        test    esi, esi
1042
        test    esi, esi
980
        jnz     .0
1043
        jnz     .0
981
@@:
1044
@@:
982
; ‹¨­¥©ª  ¯à®ªàã⪨
1045
; ‹¨­¥©ª  ¯à®ªàã⪨
983
        mov     ecx, [ebx+dlgtemplate.height]
1046
        mov     ecx, [ebx+dlgtemplate.height]
984
        cmp     ecx, [ebx+40]
1047
        cmp     ecx, [ebx+44]
985
        jz      .noscrollbar
1048
        jz      .noscrollbar
986
        sub     ecx, 2
1049
        sub     ecx, 2
987
        jbe     .noscrollbar
1050
        jbe     .noscrollbar
988
        mov     eax, [ebx+52]
1051
        mov     eax, [ebx+56]
989
        mul     ecx
1052
        mul     ecx
990
        div     dword [ebx+40]
1053
        div     dword [ebx+44]
991
        push    eax
1054
        push    eax
992
        mov     eax, [ebx+dlgtemplate.x]
1055
        mov     eax, [ebx+dlgtemplate.x]
993
        add     eax, [ebx+dlgtemplate.width]
1056
        add     eax, [ebx+dlgtemplate.width]
994
        mov     edx, [ebx+dlgtemplate.y]
1057
        mov     edx, [ebx+dlgtemplate.y]
995
        call    get_console_ptr
1058
        call    get_console_ptr
Line 1013... Line 1076...
1013
        mov     al, 0x1F
1076
        mov     al, 0x1F
1014
        stosw
1077
        stosw
1015
.noscrollbar:
1078
.noscrollbar:
1016
        ret
1079
        ret
Line -... Line 1080...
-
 
1080
 
-
 
1081
get_ascii_char:
-
 
1082
; query keyboard layout
-
 
1083
        pushad
-
 
1084
        mov     al, [ctrlstate]
-
 
1085
        and     al, 3
-
 
1086
        xor     ecx, ecx
-
 
1087
        cmp     al, 1
-
 
1088
        sbb     ecx, -2
-
 
1089
        push    26
-
 
1090
        pop     eax
-
 
1091
        push    2
-
 
1092
        pop     ebx
-
 
1093
        mov     edx, layout
-
 
1094
        int     0x40
-
 
1095
        popad
-
 
1096
; translate scancode to ASCII
-
 
1097
        movzx   eax, byte [layout+eax]
-
 
1098
        ret
1017
 
1099
 
1018
virtual at 0
1100
virtual at 0
1019
dlgitemtemplate:
1101
dlgitemtemplate:
1020
; «¥¬¥­âë:
1102
; «¥¬¥­âë:
1021
;       1 = áâ â¨ç¥áª¨© ⥪áâ
1103
;       1 = áâ â¨ç¥áª¨© ⥪áâ
Line 1058... Line 1140...
1058
        push    ManagerDlgProc
1140
        push    ManagerDlgProc
1059
        push    dword [esp+8]
1141
        push    dword [esp+8]
1060
        call    GenericBox
1142
        call    GenericBox
1061
        ret     4
1143
        ret     4
Line -... Line 1144...
-
 
1144
 
-
 
1145
; int __stdcall ShowDialogBox(DLGDATA* dlg);
-
 
1146
ShowDialogBox:
-
 
1147
        push    ManagerDlgProc
-
 
1148
        push    dword [esp+8]
-
 
1149
        call    ShowGenericBox
-
 
1150
        ret     4
-
 
1151
 
-
 
1152
; void __stdcall DrawDialogBox(DLGDATA* dlg);
-
 
1153
DrawDialogBox:
-
 
1154
        push    ManagerDlgProc
-
 
1155
        push    dword [esp+8]
-
 
1156
        call    DrawGenericBox
-
 
1157
        ret     4
1062
 
1158
 
1063
ManagerDlgProc:
1159
ManagerDlgProc:
1064
        mov     ebp, ebx
1160
        mov     ebp, ebx
1065
        mov     eax, [esp+8]
1161
        mov     eax, [esp+8]
1066
        dec     eax
1162
        dec     eax
Line 1253... Line 1349...
1253
        jnz     @b
1349
        jnz     @b
1254
        jmp     .ret_test
1350
        jmp     .ret_test
1255
.editor_char:
1351
.editor_char:
1256
        test    [ctrlstate], 0x3C
1352
        test    [ctrlstate], 0x3C
1257
        jnz     .ret_draw
1353
        jnz     .ret_draw
1258
; query keyboard layout
-
 
1259
        pushad
-
 
1260
        push    26
-
 
1261
        pop     eax
-
 
1262
        push    2
-
 
1263
        pop     ebx
-
 
1264
        xor     ecx, ecx
-
 
1265
        cmp     [ctrlstate], 1
-
 
1266
        sbb     ecx, -2
-
 
1267
        mov     edx, layout
-
 
1268
        int     0x40
-
 
1269
        popad
-
 
1270
; translate scancode to ASCII
-
 
1271
        movzx   eax, al
1354
        movzx   eax, al
1272
        movzx   eax, byte [layout+eax]
1355
        call    get_ascii_char
1273
        push    eax
1356
        push    eax
1274
; insert entered symbol
1357
; insert entered symbol
1275
        xor     eax, eax
1358
        xor     eax, eax
1276
        lea     edi, [edx+12]
1359
        lea     edi, [edx+12]
1277
        or      ecx, -1
1360
        or      ecx, -1
Line 1480... Line 1563...
1480
;                      int num_buttons, const char* buttons[]);
1563
;                      int num_buttons, const char* buttons[]);
1481
SayErr:
1564
SayErr:
1482
        pop     eax
1565
        pop     eax
1483
        push    aError
1566
        push    aError
1484
        push    eax
1567
        push    eax
-
 
1568
; int __stdcall SayErrTitle(const char* title,
-
 
1569
;                       int num_strings, const char* strings[],
-
 
1570
;                       int num_buttons, const char* buttons[]);
-
 
1571
SayErrTitle:
1485
        push    2
1572
        push    2
1486
        jmp     @f
1573
        jmp     @f
Line 1487... Line 1574...
1487
 
1574
 
1488
; int __stdcall Message(const char* title,
1575
; int __stdcall Message(const char* title,
Line 1569... Line 1656...
1569
        stosd                           ; dlgtemplate.border_size_y
1656
        stosd                           ; dlgtemplate.border_size_y
1570
        mov     eax, [esp+32+4]
1657
        mov     eax, [esp+32+4]
1571
        stosd                           ; dlgtemplate.title
1658
        stosd                           ; dlgtemplate.title
1572
        xor     eax, eax
1659
        xor     eax, eax
1573
        stosd                           ; (ignored)
1660
        stosd                           ; (ignored)
-
 
1661
        stosd                           ; (ignored)
1574
        stosd                           ; DlgProc
1662
        stosd                           ; DlgProc
1575
        stosd                           ; userdata
1663
        stosd                           ; userdata
1576
        mov     eax, [esp+32+8]
1664
        mov     eax, [esp+32+8]
1577
        add     eax, [esp+32+16]
1665
        add     eax, [esp+32+16]
1578
        stosd                           ; num_items
1666
        stosd                           ; num_items