Subversion Repositories Kolibri OS

Rev

Rev 3942 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
6687 leency 1
window_h=85
2
window_w=430
493 Lrz 3
;--- другие макросы ---
1110 Lrz 4
include '../../../develop/libraries/box_lib/load_lib.mac'
1373 IgorA 5
include '../../../develop/libraries/box_lib/trunk/box_lib.mac'
493 Lrz 6
include 'txtbut.inc'
7
include '../../../macros.inc'
8
include 'run.mac'
309 heavyiron 9
include 'lang.inc'
3634 fedesco 10
use32
1069 Lrz 11
    org 0x0
12
    db 'MENUET01'
13
    dd 0x1
14
    dd start
15
    dd i_end
16
    dd mem
17
    dd mem
18
    dd par
19
    dd cur_dir_path
20
 
21
 
22
;        meos_app_start
23
;        use_edit_box
24
	@use_library
1373 IgorA 25
	use_txt_button
1069 Lrz 26
;        code
27
;load system lib
28
align 4
29
start:
30
sys_load_library  library_name, cur_dir_path, library_path, system_path, \
31
err_message_found_lib, head_f_l, myimport, err_message_import, head_f_i
1373 IgorA 32
	cmp	eax,-1
33
	jz	close
1069 Lrz 34
 
1373 IgorA 35
	cmp	[par],byte 0
36
	jne	read_par
3942 mario79 37
	mcall	40,EVM_MOUSE+EVM_BUTTON+EVM_KEY+EVM_REDRAW+EVM_MOUSE_FILTER
205 heavyiron 38
red:
1373 IgorA 39
	mcall	48,3,sc,40
40
	edit_boxes_set_sys_color input_fn,input_fn_end,sc
41
	set_sys_colors_txt_button run_but,sc
42
	push	dword [sc.work_graph]
43
	pop	[input_fn.focus_border_color]
44
	call	draw_window
3634 fedesco 45
still:				;основной обработчик
1373 IgorA 46
	mcall	10		;Ожидать события
47
	dec  eax
48
	jz   red
49
	dec  eax
50
	jz   key
51
	dec  eax
52
	jz   button
3634 fedesco 53
;        mouse_edit_box input_fn
1373 IgorA 54
	push	dword input_fn
55
	call	[edit_box_mouse]
1069 Lrz 56
 
1373 IgorA 57
	jmp still    ;если ничего из перечисленного то снова в цикл
205 heavyiron 58
key:
1373 IgorA 59
	mcall	2
60
	cmp	ah,13
61
	je	run
1069 Lrz 62
;        key_edit_box input_fn
1373 IgorA 63
	push	dword input_fn
64
	call	[edit_box_key]
1069 Lrz 65
 
1373 IgorA 66
	jmp	still
205 heavyiron 67
button:
1373 IgorA 68
	mcall	17
69
	dec	ah
70
	jz	close
71
	dec	ah
72
	jz	run
73
	jmp	still
31 halyavin 74
 
205 heavyiron 75
read_par:
1373 IgorA 76
	mov	esi,par
77
	mov	edi,fn
78
	mov	ecx,256
79
	rep	movsb
205 heavyiron 80
run:
1373 IgorA 81
	xor	eax,eax
82
	mov	edi,file_info.name
83
	mov	ecx,512
84
	rep	stosb
85
	mov	edi,run_par
86
	mov	ecx,256
87
	rep	stosb
31 halyavin 88
 
1373 IgorA 89
	mov	esi,fn
90
	mov	edi,file_info.name
91
	cmp	[esi],byte '"'
92
	je	copy_fn_with_spaces
205 heavyiron 93
copy_fn:
1373 IgorA 94
	cmp	[esi],byte ' '
95
	je	.stop
96
	cmp	[esi],byte 0
97
	je	.stop
98
	mov	al,[esi]
99
	mov	[edi],al
100
	inc	esi
101
	inc	edi
102
	jmp	copy_fn
205 heavyiron 103
.stop:
31 halyavin 104
 
1373 IgorA 105
	jmp	copy_par
31 halyavin 106
 
205 heavyiron 107
copy_fn_with_spaces:
1373 IgorA 108
	inc	esi
205 heavyiron 109
@@:
1373 IgorA 110
	cmp	[esi],byte '"'
111
	je	.stop
112
	cmp	[esi],byte 0
113
	je	.stop
114
	mov	al,[esi]
115
	mov	[edi],al
116
	inc	esi
117
	inc	edi
118
	jmp	@b
205 heavyiron 119
.stop:
31 halyavin 120
 
205 heavyiron 121
copy_par:
122
@@:
1373 IgorA 123
	inc	esi
124
	cmp	[esi],byte ' '
125
	je	@b
126
	mov	edi,run_par
205 heavyiron 127
@@:
1373 IgorA 128
	cmp	[esi],byte 0
129
	je	.stop
130
	mov	al,[esi]
131
	mov	[edi],al
132
	inc	esi
133
	inc	edi
134
	jmp	@b
205 heavyiron 135
.stop:
1373 IgorA 136
	mcall	70,file_info
31 halyavin 137
 
1373 IgorA 138
	cmp	eax,0
139
	jl	error
140
	mov	[status],run_ok
141
	call	draw_status
142
	jmp	still
205 heavyiron 143
close:
1373 IgorA 144
	mcall -1
31 halyavin 145
 
205 heavyiron 146
error:
1373 IgorA 147
	neg	eax
148
	cmp_err 3,bad_file_sys
149
	cmp_err 5,file_not_find
150
	cmp_err 9,bad_fat_table
151
	cmp_err 10,acces_denyied
152
	cmp_err 11,device_error
153
	cmp_err 30,out_of_memory
154
	cmp_err 31,file_not_executable
155
	cmp_err 32,many_processes
31 halyavin 156
 
1373 IgorA 157
	call	draw_status
158
	jmp	still
31 halyavin 159
 
160
draw_window:
1373 IgorA 161
	mcall	48,5
162
	mov	si,bx
31 halyavin 163
 
1373 IgorA 164
	mcall	12,1
165
	mcall	48,4
166
	mov	dx,ax
167
	mcall	14
168
	xor	ecx,ecx
6687 leency 169
	sub	cx,window_h+40
1373 IgorA 170
	sub	cx,dx
171
	add	cx,si
172
	shl	ecx,16
173
	mov	cx,dx
6687 leency 174
	add	cx,window_h
1373 IgorA 175
	shr	eax,16
176
	mov	bx,ax
6687 leency 177
	sub	bx,window_w
1373 IgorA 178
	shl	ebx,15
6687 leency 179
	mov	bx,window_w
1373 IgorA 180
	mov	edx,[sc.work]
181
	or	edx,0x33000000
182
	xor	esi,esi
183
	mov	edi,grab_text
184
	mcall	0
31 halyavin 185
 
1373 IgorA 186
	mcall	9,procinfo,-1
31 halyavin 187
 
1373 IgorA 188
	mov	eax,[procinfo.box.width]
189
	sub	eax,20
190
	mov	[input_fn.width],eax
191
	mov	[run_but.width],ax
31 halyavin 192
 
6687 leency 193
	; ; draw line
194
	; xor	bx,bx
195
	; shl	ebx,16
196
	; mov	bx,ax
197
	; add	bx,10
198
	; mov	cx,58
199
	; push	cx
200
	; shl	ecx,16
201
	; pop	cx
202
	; mov	edx,[sc.work_graph]
203
	; mcall	38
204
 
205
	; draw_edit_box input_fn
1373 IgorA 206
	push	dword input_fn
207
	call	[edit_box_draw]
1069 Lrz 208
 
1373 IgorA 209
	draw_txt_button run_but
31 halyavin 210
 
1373 IgorA 211
	call	draw_status_text
31 halyavin 212
 
1373 IgorA 213
	mcall	12,2
31 halyavin 214
ret
215
 
205 heavyiron 216
draw_status:
1373 IgorA 217
	mov	ebx,[procinfo.box.width]
218
	sub	bx,10
6687 leency 219
	mov	ecx,(60)*65536+15
1373 IgorA 220
	mov	edx,[sc.work]
221
	mcall	13
205 heavyiron 222
draw_status_text:
1373 IgorA 223
	mov	edx,[status]
224
	xor	esi,esi
205 heavyiron 225
@@:
1373 IgorA 226
	cmp	[edx+esi],byte 0
227
	je	@f
228
	inc	esi
229
	jmp	@b
205 heavyiron 230
@@:
1373 IgorA 231
	mov	ecx,[sc.work_text]
6687 leency 232
	or  ecx,0x90000000
233
	mcall	4,5*65536+(60)
31 halyavin 234
ret
235
 
6687 leency 236
run_but txt_button 0,5,20,33,2,0,0x90000000,run_but_text,
237
input_fn edit_box 0,5,5,0xffffff,0x6a9480,0,0xaaaaaa,0x90000000,511,fn,mouse_dd,ed_focus+ed_always_focus
1069 Lrz 238
;mouse_flag: dd 0x0
1228 Lrz 239
input_fn_end:
309 heavyiron 240
if lang eq ru
3634 fedesco 241
	hello db 'Введите полный путь к файлу и нажмите Enter',0
242
	bad_file_sys db 'Неизвестная файловая система',0 ; 3
243
	file_not_find db 'Файл не найден',0		 ; 5
244
	bad_fat_table db 'Таблица FAT разрушена',0	 ; 9
245
	acces_denyied db 'Доступ запрещен',0		 ; 10
246
	device_error db 'Ошибка устройства',0		 ; 11
247
	out_of_memory db 'Недостаточно памяти',0	 ; 30
248
	file_not_executable db 'Файл не является исполняемым',0 ; 31
249
	many_processes db 'Слишком много процессов',0	 ; 32
250
	run_ok db 'Программа успешно запущена',0
251
	grab_text db 'Запуск программы',0
252
	run_but_text db 'ЗАПУСТИТЬ',0
253
else if lang eq it
254
	hello db 'Inserisci percorso completo al file e premi ',0
255
	bad_file_sys db 'Filesysrem sconosciuto',0 	       ; 3
256
	file_not_find db 'File non trovato',0		       ; 5
257
	bad_fat_table db 'Tabella FAT corrotta',0	       ; 9
258
	acces_denyied db 'Accesso negato',0		       ; 10
259
	device_error db 'Device error',0		       ; 11
260
	out_of_memory db 'Out of memory',0		       ; 30
261
	file_not_executable db 'File non eseguibile',0      ; 31
262
	many_processes db 'Troppo processi',0	       ; 32
263
	run_ok db 'Il programma eseguito correttamente',0
264
	grab_text db 'RUN',0
265
	run_but_text db 'Esegui',0
309 heavyiron 266
else
3634 fedesco 267
	hello db 'Enter full path to file and press ',0
268
	bad_file_sys db 'Unknown file system',0 	       ; 3
269
	file_not_find db 'File not found',0		       ; 5
270
	bad_fat_table db 'FAT table corrupted',0	       ; 9
271
	acces_denyied db 'Access denied',0		       ; 10
272
	device_error db 'Device error',0		       ; 11
273
	out_of_memory db 'Out of memory',0		       ; 30
274
	file_not_executable db 'File is not executable',0      ; 31
275
	many_processes db 'Too many processes',0	       ; 32
276
	run_ok db 'The program was started successfully',0
277
	grab_text db 'RUN',0
278
	run_but_text db 'RUN',0
309 heavyiron 279
end if
205 heavyiron 280
status dd hello
31 halyavin 281
 
1069 Lrz 282
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
283
;DATA данные
284
;Всегда соблюдать последовательность в имени.
1373 IgorA 285
system_path	 db '/sys/lib/'
286
library_name	 db 'box_lib.obj',0
1069 Lrz 287
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
288
 
1373 IgorA 289
if lang eq ru
290
err_message_found_lib	db 'Ошибка при поиске box_lib.obj',0
1069 Lrz 291
head_f_i:
1373 IgorA 292
head_f_l	db 'Системная ошибка',0
293
err_message_import	db 'Ошибка при импорте box_lib.obj',0
294
else
295
err_message_found_lib	db 'Sorry I cannot load library box_lib.obj',0
296
head_f_i:
297
head_f_l	db 'System error',0
298
err_message_import	db 'Error on load import library box_lib.obj',0
299
end if
1069 Lrz 300
 
3634 fedesco 301
myimport:
1069 Lrz 302
 
1373 IgorA 303
edit_box_draw	dd	aEdit_box_draw
304
edit_box_key	dd	aEdit_box_key
305
edit_box_mouse	dd	aEdit_box_mouse
306
version_ed	dd	aVersion_ed
1069 Lrz 307
 
1373 IgorA 308
		dd	0
309
		dd	0
1069 Lrz 310
 
1373 IgorA 311
aEdit_box_draw	db 'edit_box',0
312
aEdit_box_key	db 'edit_box_key',0
1069 Lrz 313
aEdit_box_mouse db 'edit_box_mouse',0
1373 IgorA 314
aVersion_ed	db 'version_ed',0
1069 Lrz 315
 
316
 
317
 
318
 
205 heavyiron 319
file_info:
320
.mode dd 7
321
.flags dd 0
322
.par dd run_par
323
dd 0,0
324
.name rb 512
31 halyavin 325
 
1228 Lrz 326
flags rw 1
31 halyavin 327
 
493 Lrz 328
sc system_colors
451 heavyiron 329
 
493 Lrz 330
procinfo process_information
31 halyavin 331
 
205 heavyiron 332
run_par rb 256
333
par rb 256
493 Lrz 334
fn rb 512
1214 Lrz 335
mouse_dd	rd 1
1069 Lrz 336
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1373 IgorA 337
cur_dir_path	rb 4096
338
library_path	rb 4096
1069 Lrz 339
i_end:
340
rb 1024
341
mem:
342
;meos_app_end
343
;udata