Subversion Repositories Kolibri OS

Rev

Rev 6687 | 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
;--- другие макросы ---
9568 IgorA 4
include '../../../KOSfuncs.inc'
5
include '../../../load_lib.mac'
1373 IgorA 6
include '../../../develop/libraries/box_lib/trunk/box_lib.mac'
493 Lrz 7
include 'txtbut.inc'
8
include '../../../macros.inc'
9
include 'run.mac'
309 heavyiron 10
include 'lang.inc'
3634 fedesco 11
use32
9568 IgorA 12
    org 0
1069 Lrz 13
    db 'MENUET01'
9568 IgorA 14
    dd 1
1069 Lrz 15
    dd start
16
    dd i_end
17
    dd mem
18
    dd mem
19
    dd par
20
    dd cur_dir_path
21
 
22
 
23
;        meos_app_start
24
;        use_edit_box
25
	@use_library
1373 IgorA 26
	use_txt_button
1069 Lrz 27
;        code
28
;load system lib
29
align 4
30
start:
9568 IgorA 31
sys_load_library  library_name, library_path, system_path, myimport
1373 IgorA 32
	cmp	eax,-1
33
	jz	close
1069 Lrz 34
 
1373 IgorA 35
	cmp	[par],byte 0
36
	jne	read_par
9568 IgorA 37
	mcall	SF_SET_EVENTS_MASK, EVM_MOUSE+EVM_BUTTON+EVM_KEY+EVM_REDRAW+EVM_MOUSE_FILTER
205 heavyiron 38
red:
9568 IgorA 39
	mcall	SF_STYLE_SETTINGS,SSF_GET_COLORS,sc,40
1373 IgorA 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:				;основной обработчик
9568 IgorA 46
	mcall	SF_WAIT_EVENT
1373 IgorA 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:
9568 IgorA 59
	mcall	SF_GET_KEY
1373 IgorA 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:
9568 IgorA 68
	mcall	SF_GET_BUTTON
1373 IgorA 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:
9568 IgorA 136
	mcall	SF_FILE,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:
9568 IgorA 144
	mcall SF_TERMINATE_PROCESS
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:
9568 IgorA 161
	mcall	SF_STYLE_SETTINGS,SSF_GET_SCREEN_AREA
1373 IgorA 162
	mov	si,bx
31 halyavin 163
 
9568 IgorA 164
	mcall	SF_REDRAW, SSF_BEGIN_DRAW
165
	mcall	SF_STYLE_SETTINGS,SSF_GET_SKIN_HEIGHT
1373 IgorA 166
	mov	dx,ax
9568 IgorA 167
	mcall	SF_GET_SCREEN_SIZE
1373 IgorA 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
9568 IgorA 184
	mcall	SF_CREATE_WINDOW
31 halyavin 185
 
9568 IgorA 186
	mcall	SF_THREAD_INFO,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]
9568 IgorA 203
	; mcall	SF_DRAW_LINE
6687 leency 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
 
9568 IgorA 213
	mcall	SF_REDRAW, SSF_END_DRAW
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]
9568 IgorA 221
	mcall	SF_DRAW_RECT
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
9568 IgorA 233
	mcall	SF_DRAW_TEXT,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
 
289
 
3634 fedesco 290
myimport:
1069 Lrz 291
 
1373 IgorA 292
edit_box_draw	dd	aEdit_box_draw
293
edit_box_key	dd	aEdit_box_key
294
edit_box_mouse	dd	aEdit_box_mouse
295
version_ed	dd	aVersion_ed
1069 Lrz 296
 
9568 IgorA 297
		dd	0,0
1069 Lrz 298
 
9568 IgorA 299
aEdit_box_draw	db 'edit_box_draw',0
1373 IgorA 300
aEdit_box_key	db 'edit_box_key',0
1069 Lrz 301
aEdit_box_mouse db 'edit_box_mouse',0
1373 IgorA 302
aVersion_ed	db 'version_ed',0
1069 Lrz 303
 
304
 
305
 
306
 
205 heavyiron 307
file_info:
9568 IgorA 308
.mode dd SSF_START_APP
205 heavyiron 309
.flags dd 0
310
.par dd run_par
311
dd 0,0
312
.name rb 512
31 halyavin 313
 
1228 Lrz 314
flags rw 1
31 halyavin 315
 
493 Lrz 316
sc system_colors
451 heavyiron 317
 
493 Lrz 318
procinfo process_information
31 halyavin 319
 
205 heavyiron 320
run_par rb 256
321
par rb 256
493 Lrz 322
fn rb 512
1214 Lrz 323
mouse_dd	rd 1
1069 Lrz 324
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1373 IgorA 325
cur_dir_path	rb 4096
326
library_path	rb 4096
1069 Lrz 327
i_end:
328
rb 1024
329
mem:
330
;meos_app_end
331
;udata