Subversion Repositories Kolibri OS

Rev

Rev 1049 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1049 Rev 1199
Line 1... Line 1...
1
;**************************************************************
1
;**************************************************************
2
; MenuBar Macro for Kolibri OS
2
; MenuBar Macro for Kolibri OS
3
; Copyright (c) 2009, Mario79
3
; Copyright (c) 2009, Marat Zakiyanov aka Mario79, aka Mario
4
; All rights reserved.
4
; All rights reserved.
5
;
5
;
6
; Redistribution and use in source and binary forms, with or without
6
; Redistribution and use in source and binary forms, with or without
7
; modification, are permitted provided that the following conditions are met:
7
; modification, are permitted provided that the following conditions are met:
8
;     * Redistributions of source code must retain the above copyright
8
;     * Redistributions of source code must retain the above copyright
Line 12... Line 12...
12
;       documentation and/or other materials provided with the distribution.
12
;       documentation and/or other materials provided with the distribution.
13
;     * Neither the name of the  nor the
13
;     * Neither the name of the  nor the
14
;       names of its contributors may be used to endorse or promote products
14
;       names of its contributors may be used to endorse or promote products
15
;       derived from this software without specific prior written permission.
15
;       derived from this software without specific prior written permission.
16
;
16
;
17
; THIS SOFTWARE IS PROVIDED BY Mario79 ''AS IS'' AND ANY
17
; THIS SOFTWARE IS PROVIDED BY Marat Zakiyanov ''AS IS'' AND ANY
18
; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18
; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19
; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19
; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
; DISCLAIMED. IN NO EVENT SHALL  BE LIABLE FOR ANY
20
; DISCLAIMED. IN NO EVENT SHALL  BE LIABLE FOR ANY
21
; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21
; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22
; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22
; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
Line 32... Line 32...
32
}
32
}
33
;*****************************************************************************
33
;*****************************************************************************
34
macro use_menu_bar
34
macro use_menu_bar
35
{
35
{
36
menu_bar:
36
menu_bar:
37
m_type				equ [edi]
37
m_type			equ [edi]
38
m_size_x			equ [edi+4]
38
m_size_x		equ [edi+4]
39
m_start_x			equ [edi+6]
39
m_start_x		equ [edi+6]
40
m_size_y			equ [edi+8]
40
m_size_y		equ [edi+8]
41
m_start_y			equ [edi+10]
41
m_start_y		equ [edi+10]
42
m_text_pointer		equ [edi+12]
42
m_text_pointer		equ [edi+12]
43
m_pos_pointer		equ [edi+16]
43
m_pos_pointer		equ [edi+16]
44
m_text_end			equ [edi+20]
44
m_text_end		equ [edi+20]
45
m_mouse_pos			equ [edi+24]
45
m_ret_key		equ [edi+24]
46
m_mouse_keys		equ [edi+28]
46
m_mouse_keys		equ [edi+28]
47
m_size_x1			equ [edi+32]
47
m_size_x1		equ [edi+32]
48
m_start_x1			equ [edi+34]
48
m_start_x1		equ [edi+34]
49
m_size_y1			equ [edi+36]	
49
m_size_y1		equ [edi+36]
50
m_start_y1			equ [edi+38]
50
m_start_y1		equ [edi+38]
51
m_bckg_col			equ [edi+40]
51
m_bckg_col		equ [edi+40]
52
m_frnt_col			equ [edi+44]
52
m_frnt_col		equ [edi+44]
53
m_menu_col			equ [edi+48]
53
m_menu_col		equ [edi+48]
54
m_select			equ [edi+52]
54
m_select		equ [edi+52]
55
m_out_select		equ [edi+56]
55
m_out_select		equ [edi+56]
56
m_buf_adress		equ [edi+60]
56
m_buf_adress		equ [edi+60]
57
m_procinfo			equ [edi+64]
57
m_procinfo		equ [edi+64]
58
m_click				equ [edi+68]
58
m_click			equ [edi+68]
59
m_cursor			equ [edi+72]
59
m_cursor		equ [edi+72]
60
m_cursor_old		equ [edi+76]
60
m_cursor_old		equ [edi+76]
61
m_interval			equ [edi+80]
61
m_interval		equ [edi+80]
62
m_cursor_max		equ [edi+84]
62
m_cursor_max		equ [edi+84]
63
m_extended_key		equ [edi+88]
63
m_extended_key		equ [edi+88]
64
m_menu_sel_col		equ [edi+92]
64
m_menu_sel_col		equ [edi+92]
65
m_bckg_text_col		equ [edi+96]
65
m_bckg_text_col		equ [edi+96]
66
m_frnt_text_col		equ [edi+100]
66
m_frnt_text_col		equ [edi+100]
Line 72... Line 72...
72
;*****************************************************************************
72
;*****************************************************************************
73
; draw event
73
; draw event
74
;*****************************************************************************
74
;*****************************************************************************
75
;*****************************************************************************
75
;*****************************************************************************
76
.draw:
76
.draw:
77
    pusha
77
	pusha
78
	mov   edi,dword [esp+36]
78
	mov	edi,dword [esp+36]
79
    call  .draw_1
79
	call	.draw_1
80
menu_bar_exit
80
	menu_bar_exit
81
.draw_1:
81
.draw_1:
82
    call   .calc_m_cursor_max
82
	call	.calc_m_cursor_max
83
	dec    dword m_cursor_max
83
	dec	dword m_cursor_max
84
	mov    eax,m_cursor_max
84
	mov	eax,m_cursor_max
85
    imul   eax,m_interval
85
	imul	eax,m_interval
86
	mov    m_size_y1,ax
86
	mov	m_size_y1,ax
87
	
87
	
88
    mov    ebx,m_size_x
88
	mov	ebx,m_size_x
89
	mov    ecx,m_size_y
89
	mov	ecx,m_size_y
90
	cmp    m_select,dword 1
90
	cmp	m_select,dword 1
91
	je     .active
91
	je	.active
92
	mov    edx,m_bckg_col
92
	mov	edx,m_bckg_col
93
	jmp   @f
93
	jmp	@f
94
.active:
94
.active:
95
	mov    edx,m_frnt_col
95
	mov	edx,m_frnt_col
96
@@:
96
@@:
97
	mcall  13
97
	mcall	13
98
	shr    ecx,16
98
	shr	ecx,16
99
	mov    bx,cx
99
	mov	bx,cx
100
	movzx  eax,word m_size_y
100
	movzx	eax,word m_size_y
101
    call   .calculate_font_offset
101
	call	.calculate_font_offset
102
	cmp    m_select,dword 1
102
	cmp	m_select,dword 1
103
	je     .active_1
103
	je	.active_1
104
	mov    ecx,m_bckg_text_col
104
	mov	ecx,m_bckg_text_col
105
	add    ecx,0x80000000
105
	add	ecx,0x80000000
106
	jmp   @f
106
	jmp	@f
107
.active_1:
107
.active_1:
108
	mov    ecx,m_frnt_text_col
108
	mov	ecx,m_frnt_text_col
109
	add    ecx,0x80000000
109
	add	ecx,0x80000000
110
@@:
110
@@:
111
	mov    edx,m_text_pointer
111
	mov	edx,m_text_pointer
112
	mcall  4
112
	mcall	4
113
    ret
113
	ret
Line 114... Line 114...
114
 
114
 
115
.draw_2:
115
.draw_2:
116
    mov    ebx,m_size_x1
116
	mov	ebx,m_size_x1
117
	mov    ecx,m_size_y1
117
	mov	ecx,m_size_y1
118
	mov    edx,m_menu_col
118
	mov	edx,m_menu_col
119
	mcall  13
119
	mcall	13
Line 120... Line 120...
120
	ret
120
	ret
121
 
121
 
122
.calculate_font_offset:
122
.calculate_font_offset:
123
	sub    eax,m_font_height
123
	sub	eax,m_font_height
124
	shr    eax,1
124
	shr	eax,1
125
	add    ebx,eax
125
	add	ebx,eax
Line 126... Line 126...
126
	add    ebx,4 shl 16
126
	add	ebx,4 shl 16
127
    ret
127
	ret
128
	
128
	
Line 129... Line 129...
129
.draw_3:
129
.draw_3:
130
    mov    ebx,m_size_x1
130
	mov	ebx,m_size_x1
131
	mov    ecx,m_size_y1
131
	mov	ecx,m_size_y1
132
 
132
 
133
	push   ebx ecx
133
	push	ebx ecx
134
    mov    eax,m_cursor_old
134
	mov	eax,m_cursor_old
135
    imul   eax,m_interval
135
	imul	eax,m_interval
136
    shl    eax,16
136
	shl	eax,16
137
    add    ecx,eax
137
	add	ecx,eax
Line 138... Line 138...
138
    mov    cx,m_interval
138
	mov	cx,m_interval
139
	mov    edx,m_menu_col
139
	mov	edx,m_menu_col
140
	mcall  13
140
	mcall	13
141
    pop    ecx ebx
141
	pop	ecx ebx
142
    
142
    
143
	push   ebx ecx
143
	push	ebx ecx
144
    mov    eax,m_cursor
144
	mov	eax,m_cursor
145
    imul   eax,m_interval
145
	imul	eax,m_interval
146
    shl    eax,16
146
	shl	eax,16
147
    add    ecx,eax
147
	add	ecx,eax
148
    mov    cx,m_interval
148
	mov	cx,m_interval
149
    mov    edx,m_menu_sel_col
149
	mov	edx,m_menu_sel_col
150
	mcall  13
150
	mcall	13
151
    pop    ecx ebx
151
	pop	ecx ebx
152
	
152
	
153
	shr    ecx,16
153
	shr	ecx,16
154
	mov    bx,cx
154
	mov	bx,cx
155
	mov    eax,m_interval
155
	mov	eax,m_interval
156
    call   .calculate_font_offset
156
	call	.calculate_font_offset
157
	mov    edx,m_pos_pointer
157
	mov	edx,m_pos_pointer
158
	xor    ebp,ebp
158
	xor	ebp,ebp
159
@@:
159
@@:
160
    cmp    ebp,m_cursor
160
	cmp	ebp,m_cursor
161
	jne    .no_active_text
161
	jne	.no_active_text
162
	mov    ecx,m_frnt_text_col
162
	mov	ecx,m_frnt_text_col
163
	jmp    .active_text
163
	jmp	.active_text
164
.no_active_text:
164
.no_active_text:
165
	mov    ecx,m_bckg_text_col
165
	mov	ecx,m_bckg_text_col
166
.active_text:
166
.active_text:
167
	add    ecx,0x80000000
167
	add	ecx,0x80000000
168
	mcall  4
168
	mcall	4
169
    call   .get_next_text
169
	call	.get_next_text
Line 170... Line 170...
170
	inc    ebp
170
	inc	ebp
171
    add    ebx,m_interval
171
	add	ebx,m_interval
172
	jmp    @r
172
	jmp	@r
173
.draw_end:
173
.draw_end:
174
    ret
174
	ret
175
	
175
	
176
.calc_m_cursor_max:
176
.calc_m_cursor_max:
177
	mov    edx,m_pos_pointer
177
	mov	edx,m_pos_pointer
178
    mov    m_cursor_max,dword 0
178
	mov	m_cursor_max,dword 0
179
@@:
179
@@:
180
	inc    dword m_cursor_max
180
	inc	dword m_cursor_max
181
    call   .get_next_text
181
	call	.get_next_text
182
	jmp    @r
182
	jmp	@r
183
;*****************************************************************************
183
;*****************************************************************************
184
.get_next_text:
184
.get_next_text:
185
    mov    esi,edx
185
	mov	esi,edx
186
@@:
186
@@:
187
	cmp    esi,m_text_end
187
	cmp	esi,m_text_end
188
	je    .get_next_text_end
188
	je	.get_next_text_end
189
	cld
189
	cld
190
	lodsb
190
	lodsb
191
	test  al,al
191
	test	al,al
192
	jnz   @r
192
	jnz	@r
193
	mov   edx,esi
193
	mov	edx,esi
194
    ret
194
	ret
195
.get_next_text_end:
195
.get_next_text_end:
196
    add   esp,4
196
	add	esp,4
-
 
197
	ret
-
 
198
;*****************************************************************************
-
 
199
;*****************************************************************************
-
 
200
; mouse event
197
	ret
201
;*****************************************************************************
198
;*****************************************************************************
202
;*****************************************************************************
199
;*****************************************************************************
203
.activate:
200
; mouse event
-
 
201
;*****************************************************************************
-
 
202
;*****************************************************************************
-
 
203
.mouse:
204
	pusha
204
	pusha
205
	mov	edi,dword [esp+36]
205
	mov   edi,dword [esp+36]
206
	jmp	.start_loop
206
;.mouse_1:
207
.mouse:
207
;	mov   eax,m_mouse_pos
208
	pusha
208
;	cmp    m_get_mouse_flag,dword 0
209
	mov	edi,dword [esp+36]
209
;	je    @f
210
 
210
	call  .processing_real_mouse
211
	call	.processing_real_mouse
211
;@@:
212
 
212
     test  eax,0x80000000
213
	test	eax,0x80000000
213
     jnz   .exit_menu
214
	jnz	.exit_menu
214
     test  eax,0x8000
215
	test	eax,0x8000
215
     jnz   .exit_menu
216
	jnz	.exit_menu
216
 
217
 
217
     mov   ebx,eax
218
	mov	ebx,eax
218
     shr   ebx,16   ; x position
219
	shr	ebx,16   ; x position
Line 219... Line 220...
219
     shl   eax,16
220
	shl	eax,16
220
     shr   eax,16   ; y position
221
	shr	eax,16   ; y position
221
	 
222
	 
222
     mov   cx,m_start_x
223
	mov	cx,m_start_x
223
     cmp   bx,cx
224
	cmp	bx,cx
224
     jb    .exit_menu
225
	jb	.exit_menu
225
     
226
     
226
     add   cx,m_size_x
227
	add	cx,m_size_x
Line 227... Line 228...
227
	 dec   cx
228
	dec	cx
228
     cmp   bx,cx
229
	cmp	bx,cx
229
     ja    .exit_menu
230
	ja	.exit_menu
230
 
231
 
231
     mov   cx,m_start_y
232
	mov	cx,m_start_y
232
     cmp   ax,cx
233
	cmp	ax,cx
233
     jb    .exit_menu
234
	jb	.exit_menu
234
     
235
     
235
     add   cx,m_size_y
236
	add	cx,m_size_y
236
     cmp   ax,cx
237
	cmp	ax,cx
237
     ja    .exit_menu
238
	ja	.exit_menu
238
 
239
 
239
	 test   m_mouse_keys,dword 1b
240
	test	m_mouse_keys,dword 1b
240
	 jnz   @f
241
	jnz	@f
241
	 cmp   m_select,dword 1
242
	cmp	m_select,dword 1
242
	 je    .exit_menu_1
243
	je	.exit_menu_1
243
	 mov   m_select,dword 1
244
	mov	m_select,dword 1
244
	 call  .draw_1
245
	call	.draw_1
245
	 jmp   .exit_menu_1
246
	jmp	.exit_menu_1
246
@@:
247
@@:
247
 
248
 
-
 
249
	cmp	m_get_mouse_flag,dword 1
248
	cmp    m_get_mouse_flag,dword 1
250
	mov	m_get_mouse_flag,dword 0
249
	mov    m_get_mouse_flag,dword 0
251
	je	@f
250
	je    @f
252
	
251
	
253
	mov	eax,m_mouse_keys
Line 252... Line 254...
252
	 mov   eax,m_mouse_keys
254
	cmp	eax,m_mouse_keys_old
253
     cmp   eax,m_mouse_keys_old
255
	je	.exit_menu_1
254
	 je    .exit_menu_1
256
@@:
255
@@:
257
.start_loop:
256
	 mov   m_select,dword 1
258
	mov	m_select,dword 1
257
	 call  .draw_1
259
	call	.draw_1
258
	 call  .allocate_menu_area
260
	call	.allocate_menu_area
259
	 call  .get_menu_area
261
	call	.get_menu_area
260
	 
262
	 
261
	 call  .draw_2
263
	call	.draw_2
262
.red:
264
.red:
263
    call  .draw_3
265
	call	.draw_3
264
.still:
266
.still:
265
    mcall 10
267
	mcall	10
Line 266... Line 268...
266
    cmp  eax,1
268
	cmp	eax,1
267
    je	 .exit_menu_3  ;red
269
	je	.exit_menu_3
-
 
270
	cmp	eax,2
268
    cmp  eax,2
271
	je	.key_menu
269
    je	 .key_menu
272
	cmp	eax,3
270
    cmp  eax,3
273
	je	.exit_menu_3
271
    je   .exit_menu_3
274
	cmp	eax,6
272
    cmp   eax,6
275
	je	.mouse_menu
273
    je    .mouse_menu
276
	jmp	.still
274
    jmp  .still
277
	
275
	
278
.key_menu:
276
.key_menu:
279
	mcall	2
277
    mcall 2
280
 
278
    cmp  m_extended_key,dword 1
281
	cmp	m_extended_key,dword 1
279
    je	 .extended_key
282
	je	.extended_key
280
    test al,al
283
	test	al,al
281
    jnz  .key_menu_end
284
	jnz	.key_menu_end
282
    cmp  ah, 0xE0
285
	cmp	ah, 0xE0
283
    jne  @f
286
	jne	@f
284
    mov  m_extended_key,dword 1
287
	mov	m_extended_key,dword 1
285
.key_menu_end:
288
.key_menu_end:
-
 
289
	jmp	.still
-
 
290
@@:
-
 
291
	cmp	ah,72  ;Arrow Up
-
 
292
	je	.menu_key_72_1
-
 
293
	cmp	ah,80 ; Arrow Down
286
    jmp  .still
294
	je	.menu_key_80_1
287
@@:
295
	cmp	ah,28  ; Enter
288
    cmp  ah,72  ;Arrow Up
296
	je	.menu_key_28_1
289
    je	.menu_key_72_1
297
	cmp	ah,1  ; Esc
290
    cmp  ah,80 ; Arrow Down
298
	je	.menu_key_1_1
291
    je	.menu_key_80_1
299
	cmp	ah,75  ; L-Arrow down
292
    cmp  ah,28  ; Enter
300
	je	.menu_key_75_1
293
    je	.menu_key_28_1
301
	cmp	ah,77  ; R-Arrow down
294
    cmp  ah,1  ; Esc
302
	je	.menu_key_77_1
295
    je	.menu_key_1_1
303
	
296
.key_menu_end_1:
304
.key_menu_end_1:
297
    cmp  ah,208 ; Arrow Down
305
	cmp	ah,208 ; Arrow Down
298
    je	.key_menu_end
306
	je	.key_menu_end
299
    cmp  ah,200 ; Arrow Up
307
	cmp	ah,200 ; Arrow Up
300
    je	.key_menu_end
308
	je	.key_menu_end
301
    cmp  ah,156 ; Enter
309
	cmp	ah,156 ; Enter
302
    je	.key_menu_end
310
	je	.key_menu_end
303
    cmp  ah,129 ; Esc
311
	cmp	ah,129 ; Esc
304
    je	.key_menu_end
312
	je	.key_menu_end
305
;    cmp  ah,184  ;Alt to Up
313
	cmp	ah,199  ;Home
306
;    je	.end_5
314
	je	.key_menu_end
307
;    cmp  ah,187 ; F1 to Up
315
	cmp	ah,207  ;End
308
;    je	.end_1
316
	je	.key_menu_end
309
;    cmp  ah,188 ; F2 to Up
317
	cmp	ah,201  ;Page UP
310
;    je	.end_1
318
	je	.key_menu_end
311
    cmp  ah,199  ;Home
319
	cmp	ah,209  ;Page Down
312
    je	.key_menu_end
320
	je	.key_menu_end
313
    cmp  ah,207  ;End
321
	cmp	ah,42	; NumLock ON
314
    je	.key_menu_end
322
	je	.key_menu_end
315
    cmp  ah,201  ;Page UP
323
	cmp	ah,170  ; NumLock ON
316
    je	.key_menu_end
324
	je	.key_menu_end
317
    cmp  ah,209  ;Page Down
325
	cmp	ah,210  ; Insert
318
    je	.key_menu_end
326
	je	.key_menu_end
319
    cmp  ah,42	; NumLock ON
327
	cmp	ah,211  ; Delete
320
    je	.key_menu_end
328
	je	.key_menu_end
321
    cmp  ah,170  ; NumLock ON
329
	cmp	ah,157  ; Ctrl up
322
    je	.key_menu_end
330
	je	.key_menu_end
323
    cmp  ah,210  ; Insert
331
	cmp	ah,184  ; Alt up
324
    je	.key_menu_end
-
 
325
    cmp  ah,211  ; Delete
-
 
326
    je	.key_menu_end
-
 
327
;    cmp  ah,56 ;Alt to Up
332
	je	.key_menu_end
Line 328... Line 333...
328
;    je	.end_4
333
	cmp	ah,170  ; L-Shift up
329
;    cmp  ah,59 ; F1 to Down
334
	je	.key_menu_end
330
;    je	.end_2
335
	cmp	ah,182  ; R-Shift up
331
;    cmp  ah,60 ; F2 to Down
336
	je	.key_menu_end
332
;    je	.end_3
337
	cmp	ah,203  ; L-Arrow up
333
 
338
	je	.key_menu_end
334
;.for_all_key:
339
	cmp	ah,205  ; R-Arrow up
335
;    mov [close_menu],1
340
	je	.key_menu_end
336
;    ret
341
 
337
    jmp  .exit_menu_3  ;.still
342
	jmp	.exit_menu_3
338
 
343
 
339
;---------------------------------------------------------------------
344
;---------------------------------------------------------------------
340
.extended_key:
345
.extended_key:
341
    mov  m_extended_key, dword 0
346
	mov	m_extended_key, dword 0
342
.menu_key_80:
347
.menu_key_80:
343
    cmp  ah,80	; arrow down
348
	cmp	ah,80	; arrow down
344
    jne  .menu_key_72
349
	jne	.menu_key_72
345
.menu_key_80_1:
350
.menu_key_80_1:
346
    mov  eax,m_cursor_max
351
	mov	eax,m_cursor_max
347
    dec  eax
352
	dec	eax
348
    cmp  eax,m_cursor
353
	cmp	eax,m_cursor
349
    je	 .still ;@f
354
	je	.still ;@f
350
	mov   ebx,m_cursor
355
	mov	ebx,m_cursor
351
	mov   m_cursor_old,ebx
356
	mov	m_cursor_old,ebx
352
    inc  dword m_cursor
357
	inc	dword m_cursor
353
;@@:
358
;@@:
354
    jmp  .red
359
	jmp	.red
355
;---------------------------------------------------------------------
360
;---------------------------------------------------------------------
356
.menu_key_72:
361
.menu_key_72:
357
    cmp  ah,72	;arrow up
362
	cmp	ah,72	;arrow up
358
    jne  .menu_key_71
363
	jne	.menu_key_71
359
.menu_key_72_1:
364
.menu_key_72_1:
360
    cmp  m_cursor,dword 0
365
	cmp	m_cursor,dword 0
361
    je	 .still  ;@f
366
	je	.still  ;@f
362
	mov   ebx,m_cursor
367
	mov	ebx,m_cursor
363
	mov   m_cursor_old,ebx
368
	mov	m_cursor_old,ebx
364
    dec  dword m_cursor
369
	dec	dword m_cursor
365
;@@:
370
;@@:
366
    jmp  .red
371
	jmp	.red
367
;---------------------------------------------------------------------
372
;---------------------------------------------------------------------
368
.menu_key_71:
373
.menu_key_71:
369
    cmp  ah,71    ;Home
374
	cmp	ah,71    ;Home
370
    je   @f
375
	je	@f
371
    cmp  ah,73    ;PageUp
376
	cmp	ah,73    ;PageUp
372
    jne  .menu_key_79
377
	jne	.menu_key_79
373
@@:
378
@@:
374
    cmp   m_cursor,dword 0
379
	cmp	m_cursor,dword 0
375
	je    .still
380
	je	.still
376
	mov   ebx,m_cursor
381
	mov	ebx,m_cursor
377
	mov   m_cursor_old,ebx
382
	mov	m_cursor_old,ebx
378
    mov   m_cursor,dword 0
383
	mov	m_cursor,dword 0
379
    jmp  .red
384
	jmp	.red
380
;---------------------------------------------------------------------
385
;---------------------------------------------------------------------
381
.menu_key_79:
386
.menu_key_79:
382
    cmp  ah,79    ; End
387
	cmp	ah,79    ; End
383
    je   @f
388
	je	@f
384
    cmp  ah,81    ; PageDown
389
	cmp	ah,81    ; PageDown
385
    jne  .menu_key_1
390
	jne	.menu_key_1
386
@@:
391
@@:
387
    mov  ecx,m_cursor_max
392
	mov	ecx,m_cursor_max
388
    dec  ecx
393
	dec	ecx
389
	cmp  m_cursor,ecx
394
	cmp	m_cursor,ecx
390
	je   .still
395
	je	.still
391
	mov   ebx,m_cursor
396
	mov	ebx,m_cursor
392
	mov   m_cursor_old,ebx
397
	mov	m_cursor_old,ebx
393
    mov   m_cursor,ecx
398
	mov	m_cursor,ecx
394
    jmp  .red
399
	jmp	.red
-
 
400
;---------------------------------------------------------------------
395
;---------------------------------------------------------------------
401
.menu_key_1:
396
.menu_key_1:
402
	cmp	ah,1 ; Esc
-
 
403
	jne	.menu_key_28
397
    cmp  ah,1 ; Esc
404
.menu_key_1_1:
-
 
405
	jmp	.exit_menu_3
-
 
406
;---------------------------------------------------------------------
-
 
407
.menu_key_28:
-
 
408
	cmp	ah,28 ; Enter
-
 
409
	jne	.menu_key_75
-
 
410
.menu_key_28_1:
-
 
411
	xor	eax,eax
-
 
412
	mov	m_mouse_keys_old,eax
398
    jne  .menu_key_28
413
	inc	eax
-
 
414
	mov	m_mouse_keys,eax
399
.menu_key_1_1:
415
	jmp	.exit_menu_2
-
 
416
;---------------------------------------------------------------------
-
 
417
.menu_key_75:
-
 
418
	cmp	ah,75  ; L-Arrow down
400
    jmp  .exit_menu_3
419
	jne	.menu_key_77
401
;---------------------------------------------------------------------
420
.menu_key_75_1:
402
.menu_key_28:
421
	mov	m_ret_key,dword 1
403
    cmp  ah,28 ; Enter
422
	jmp	.exit_menu_3
404
    jne  .menu_key_end
423
;---------------------------------------------------------------------
405
.menu_key_28_1:
424
.menu_key_77:
406
;    mov [press_enter_menu],1
425
	cmp	ah,77  ; R-Arrow down
407
;    ret
426
	jne	.key_menu_end_1
408
    jmp  .exit_menu_2
-
 
409
.menu_key_end:
427
.menu_key_77_1:
410
    jmp  .key_menu_end_1
428
	mov	m_ret_key,dword 2
411
;---------------------------------------------------------------------
429
	jmp	.exit_menu_3
412
.processing_real_mouse:
430
;---------------------------------------------------------------------
413
     mcall 37,2
431
.processing_real_mouse:
414
	 mov   ebx,m_mouse_keys
432
	mcall	37,2
415
	 mov   m_mouse_keys_old,ebx
433
	mov	ebx,m_mouse_keys
416
     mov   m_mouse_keys,eax  
434
	mov	m_mouse_keys_old,ebx
417
	 
435
	mov	m_mouse_keys,eax
418
     mcall 37,1
436
	 
419
     mov   m_mouse_pos,eax
437
	mcall 37,1
420
	 ret
438
	ret
421
;---------------------------------------------------------------------
439
;---------------------------------------------------------------------
422
.allocate_menu_area:
440
.allocate_menu_area:
423
      cmp     m_buf_adress,dword 0
441
	cmp	m_buf_adress,dword 0
424
	  je      @f
442
	je	@f
425
	  call    .free_menu_area
443
	call	.free_menu_area
426
@@:
444
@@:
427
	  movzx   ecx,word m_size_x1
445
	movzx	ecx,word m_size_x1
428
	  movzx   eax,word m_size_y1
446
	movzx	eax,word m_size_y1
429
	  imul    ecx,eax
447
	imul	ecx,eax
430
	  lea     ecx,[ecx*3]
448
	lea	ecx,[ecx*3]
431
	  mcall 68, 12
449
	mcall	68, 12
Line 432... Line 450...
432
	  mov   m_buf_adress,eax
450
	mov	m_buf_adress,eax
433
	  ret
451
	ret
434
;---------------------------------------------------------------------
452
;---------------------------------------------------------------------
435
.free_menu_area:
453
.free_menu_area:
436
	  mcall 68,13,m_buf_adress
454
	mcall	68,13,m_buf_adress
437
	  xor   eax,eax
455
	xor	eax,eax
438
	  mov  m_buf_adress,eax
456
	mov	m_buf_adress,eax
439
	  ret
457
	ret
440
;---------------------------------------------------------------------
458
;---------------------------------------------------------------------
441
.get_menu_area:
459
.get_menu_area:
442
	 mcall 9, m_procinfo,-1
460
	mcall	9, m_procinfo,-1
443
	 
461
	 
Line 444... Line 462...
444
	 mov   cx,m_size_x1
462
	mov	cx,m_size_x1
445
	 shl   ecx,16
463
	shl	ecx,16
446
	 mov   cx,m_size_y1
464
	mov	cx,m_size_y1
447
	 
465
	 
448
	 mov   dx,m_start_x1
466
	mov	dx,m_start_x1
449
	 mov   eax,m_procinfo
467
	mov	eax,m_procinfo
450
	 add   dx,[eax+34]
468
	add	dx,[eax+34]
451
	 add   dx,[eax+54]
469
	add	dx,[eax+54]
452
	 shl   edx,16
470
	shl	edx,16
453
	 mov   dx,m_start_y1
471
	mov	dx,m_start_y1
454
	 add   dx,[eax+38]
472
	add	dx,[eax+38]
Line 455... Line 473...
455
	 add   dx,[eax+58]
473
	add	dx,[eax+58]
456
	 
474
	 
457
     mcall 36, m_buf_adress
475
	mcall	36, m_buf_adress
458
	 ret
476
	ret
459
;---------------------------------------------------------------------
477
;---------------------------------------------------------------------
Line 460... Line 478...
460
.put_menu_area:
478
.put_menu_area:
461
	 mov   cx,m_size_x1
479
	mov	cx,m_size_x1
462
	 shl   ecx,16
480
	shl	ecx,16
463
	 mov   cx,m_size_y1
481
	mov	cx,m_size_y1
464
	 
482
	 
465
	 mov   dx,m_start_x1
483
	mov	dx,m_start_x1
466
	 shl   edx,16
484
	shl	edx,16
467
	 mov   dx,m_start_y1
485
	mov	dx,m_start_y1
468
	 
486
	 
469
     mcall 7, m_buf_adress
487
	mcall	7, m_buf_adress
470
	 ret
488
	ret
471
;---------------------------------------------------------------------
489
;---------------------------------------------------------------------
472
.mouse_menu:
490
.mouse_menu:
473
	call  .processing_real_mouse
491
	call	.processing_real_mouse
474
 
492
 
475
     test  eax,0x80000000
493
	test	eax,0x80000000
476
     jnz   .still
494
	jnz	.still
477
     test  eax,0x8000
495
	test	eax,0x8000
478
     jnz   .still
496
	jnz	.still
479
	 
497
	 
480
    mov   ebx,eax
498
	mov	ebx,eax
481
    shr   ebx,16
499
	shr	ebx,16
482
    shl   eax,16
500
	shl	eax,16
483
    shr   eax,16
501
	shr	eax,16
484
	 
502
	 
485
    xor   ecx,ecx
503
	xor	ecx,ecx
486
    mov   cx,m_start_y1
504
	mov	cx,m_start_y1
487
    cmp   ax,cx
505
	cmp	ax,cx
488
    jbe    .close
506
	jbe	.close
489
    add   cx,m_size_y1
507
	add	cx,m_size_y1
490
    cmp   ax,cx
508
	cmp	ax,cx
491
    jae    .close
509
	jae	.close
492
    mov   cx,m_start_x1
510
	mov	cx,m_start_x1
493
    cmp   bx,cx
511
	cmp	bx,cx
494
    jbe    .close
512
	jbe	.close
495
    add   cx,m_size_x1
513
	add	cx,m_size_x1
496
    cmp   bx,cx
514
	cmp	bx,cx
497
    jae    .close
515
	jae	.close
498
    sub   ax,m_start_y1
516
	sub	ax,m_start_y1
499
    mov   ebx,m_interval
517
	mov	ebx,m_interval
500
    xor   edx,edx
518
	xor	edx,edx
501
    div   ebx
519
	div	ebx
502
	mov   ebx,m_cursor
520
	mov	ebx,m_cursor
503
	cmp   eax,ebx
521
	cmp	eax,ebx
504
	je    .no_red
522
	je	.no_red
505
	mov   m_cursor_old,ebx
523
	mov	m_cursor_old,ebx
506
	cmp   eax,m_cursor_max
524
	cmp	eax,m_cursor_max
Line 507... Line 525...
507
	jb    @f
525
	jb	@f
508
	mov   eax,m_cursor_max
526
	mov	eax,m_cursor_max
509
@@:
527
@@:
510
    mov   m_cursor,eax
528
	mov	m_cursor,eax
511
	test   m_mouse_keys,dword 1b
529
	test	m_mouse_keys,dword 1b
512
    jz    .red
530
	jz	.red
513
    jmp   .exit_menu_2
-
 
-
 
531
	jmp	.exit_menu_2
514
.no_red:
532
.no_red:
515
	test   m_mouse_keys,dword 1b
533
	test	m_mouse_keys,dword 1b
Line 516... Line 534...
516
    jz    .still
534
	jz	.still
517
	jmp   .exit_menu_2
535
	jmp	.exit_menu_2
518
.close:
536
.close:
519
	test   m_mouse_keys,dword 1b
537
	test	m_mouse_keys,dword 1b
520
    jz    .still	 
538
	jz	.still
521
	jmp   .exit_menu_3
539
	jmp	.exit_menu_3
Line 522... Line 540...
522
	 
540
	 
523
.exit_menu:
541
.exit_menu:
524
	 cmp   m_select,dword 0
542
	cmp	m_select,dword 0
525
	 je    .exit_menu_1
543
	je	.exit_menu_1
526
	 mov   m_select,dword 0
544
	mov	m_select,dword 0
527
	 
545
	 
528
	 call  .draw_1
546
	call	.draw_1
529
;     jmp   .exit_menu_1
547
 
530
	 test   m_mouse_keys,dword 1b
548
	test	m_mouse_keys,dword 1b
531
	 jz   .exit_menu_1
549
	jz	.exit_menu_1
532
	 
550
	 
533
.exit_menu_3:
551
.exit_menu_3:
534
	 mov   m_select,dword 0
552
	mov	m_select,dword 0
535
    call  .put_menu_area
553
	call	.put_menu_area
536
	xor    eax,eax
554
	xor	eax,eax
537
	mov    m_cursor_out,eax
555
	mov	m_cursor_out,eax
538
	jmp    .exit
556
	jmp	.exit
539
	
557
	
540
.exit_menu_2:
558
.exit_menu_2:
541
	 mov   m_select,dword 0
559
	mov	m_select,dword 0
542
    call  .put_menu_area
560
	call	.put_menu_area
543
	mov    edx,m_pos_pointer
561
	mov	edx,m_pos_pointer
544
	
562
	
545
	mov    ebx,m_cursor
563
	mov	ebx,m_cursor
546
@@:
564
@@:
547
    cmp    ebx,0
565
	cmp	ebx,0
548
	jz     @f
566
	jz	@f
549
	dec    ebx
567
	dec	ebx
550
    call   .get_next_text
568
	call	.get_next_text
551
	jmp    @r
569
	jmp	@r
552
	
570
	
553
@@:
571
@@:
554
	mov    m_out_select,edx
572
	mov	m_out_select,edx