Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
308 Lrz 1
; 01.02.07 - обновлён editbox
2
; 31.01.07 - исправлена некорректная отрисовка при большом значении высоты скина
3
;            выравнивание снизу относительно рабочей области экрана
4
window_y=67
205 heavyiron 5
;window_x=320
308 Lrz 6
window_x=640
205 heavyiron 7
include 'macros.inc'
309 heavyiron 8
include 'lang.inc'
205 heavyiron 9
	meos_header par
10
	use_edit_box
11
	use_txt_button
12
	app_start
13
	cmp	[par],byte 0
14
	jne	read_par
15
	set_events_mask evm_mouse+evm_button+evm_key+evm_redraw
16
red:
17
	get_sys_colors sc
18
	set_sys_colors_txt_button run_but,sc
19
	push	dword [sc.work_graph]
20
	pop	[input_fn.focus_border_color]
21
	call	draw_window
22
still:
23
	wait_event red,key,button,mouse,,still
24
key:
25
	get_key
26
	cmp	ah,13
27
	je	run
28
	key_edit_box input_fn
29
	jmp	still
30
button:
31
	get_pressed_button
32
	dec	ah
33
	jz	close
34
	dec	ah
35
	jz	run
36
	jmp	still
37
mouse:
38
	mouse_edit_box input_fn
39
	jmp	still
31 halyavin 40
 
205 heavyiron 41
read_par:
42
	mov	esi,par
43
	mov	edi,fn
44
	mov	ecx,256
45
	rep	movsb
46
run:
47
	xor	eax,eax
48
	mov	edi,file_info.name
49
	mov	ecx,512
50
	rep	stosb
51
	mov	edi,run_par
52
	mov	ecx,256
53
	rep	stosb
31 halyavin 54
 
205 heavyiron 55
	mov	esi,fn
56
	mov	edi,file_info.name
57
	cmp	[esi],byte '"'
58
	je	copy_fn_with_spaces
59
copy_fn:
60
	cmp	[esi],byte ' '
61
	je	.stop
62
	cmp	[esi],byte 0
63
	je	.stop
64
	mov	al,[esi]
65
	mov	[edi],al
66
	inc	esi
67
	inc	edi
68
	jmp	copy_fn
69
.stop:
31 halyavin 70
 
205 heavyiron 71
	jmp	copy_par
31 halyavin 72
 
205 heavyiron 73
copy_fn_with_spaces:
74
	inc	esi
75
@@:
76
	cmp	[esi],byte '"'
77
	je	.stop
78
	cmp	[esi],byte 0
79
	je	.stop
80
	mov	al,[esi]
81
	mov	[edi],al
82
	inc	esi
83
	inc	edi
84
	jmp	@b
85
.stop:
31 halyavin 86
 
205 heavyiron 87
copy_par:
88
@@:
89
	inc	esi
90
	cmp	[esi],byte ' '
91
	je	@b
92
	mov	edi,run_par
93
@@:
94
	cmp	[esi],byte 0
95
	je	.stop
96
	mov	al,[esi]
97
	mov	[edi],al
98
	inc	esi
99
	inc	edi
100
	jmp	@b
101
.stop:
31 halyavin 102
 
205 heavyiron 103
	mov	eax,70
104
	mov	ebx,file_info
105
	int	0x40
31 halyavin 106
 
308 Lrz 107
	cmp	eax,0
108
	jl	error
109
	mov	[status],run_ok
110
	call	draw_status
111
	jmp	still
205 heavyiron 112
close:
113
	app_close
31 halyavin 114
 
205 heavyiron 115
error:
31 halyavin 116
 
205 heavyiron 117
macro cmp_err code,text_ptr
118
{
119
	cmp	al,code
120
	jne	@f
121
	mov	[status],text_ptr
122
@@:
123
}
124
	neg	eax
31 halyavin 125
 
205 heavyiron 126
	cmp_err 3,bad_file_sys
31 halyavin 127
 
205 heavyiron 128
	cmp_err 5,file_not_find
31 halyavin 129
 
205 heavyiron 130
	cmp_err 9,bad_fat_table
31 halyavin 131
 
205 heavyiron 132
	cmp_err 10,acces_denyied
31 halyavin 133
 
205 heavyiron 134
	cmp_err 11,device_error
31 halyavin 135
 
205 heavyiron 136
	cmp_err 30,out_of_memory
31 halyavin 137
 
205 heavyiron 138
	cmp_err 31,file_not_executable
31 halyavin 139
 
205 heavyiron 140
	cmp_err 32,many_processes
31 halyavin 141
 
308 Lrz 142
 
205 heavyiron 143
	call	draw_status
144
	jmp	still
31 halyavin 145
 
146
draw_window:
308 Lrz 147
	push	48
148
	pop	eax
149
	mov	ebx,5
150
	int	0x40
151
	mov	si,bx
205 heavyiron 152
	start_draw_window
308 Lrz 153
	get_skin_height
154
	mov	dx,ax
205 heavyiron 155
	get_screen_size
308 Lrz 156
	xor	ecx,ecx
157
	sub	cx,window_y+2
158
	sub	cx,dx
159
	add	cx,si
205 heavyiron 160
	shl	ecx,16
308 Lrz 161
	mov	cx,dx
162
	add	cx,window_y
205 heavyiron 163
	shr	eax,16
164
	mov	bx,ax
165
	sub	bx,window_x
166
	shl	ebx,15
167
	mov	bx,window_x
168
	mov	edx,[sc.work]
308 Lrz 169
	or	edx,0x33000000
205 heavyiron 170
	xor	eax,eax
308 Lrz 171
	xor	esi,esi
172
	mov	edi,grab_text
205 heavyiron 173
	int	0x40
31 halyavin 174
 
205 heavyiron 175
	get_procinfo app
31 halyavin 176
 
308 Lrz 177
	mov	eax,[app.width]
178
	sub	eax,20
305 Lrz 179
	mov	[input_fn.width],eax
205 heavyiron 180
	mov	[run_but.width],ax
31 halyavin 181
 
308 Lrz 182
	xor	bx,bx
183
	shl	ebx,16
205 heavyiron 184
	mov	bx,ax
305 Lrz 185
	add	bx,10
308 Lrz 186
	mov	cx,45
205 heavyiron 187
	push	cx
188
	shl	ecx,16
189
	pop	cx
190
	mov	edx,[sc.work_graph]
191
	mov	eax,38
192
	int	0x40
31 halyavin 193
 
205 heavyiron 194
	draw_edit_box input_fn
195
	draw_txt_button run_but
31 halyavin 196
 
205 heavyiron 197
	call	draw_status_text
31 halyavin 198
 
205 heavyiron 199
	stop_draw_window
31 halyavin 200
ret
201
 
205 heavyiron 202
draw_status:
308 Lrz 203
	mov	ebx,[app.width]
204
	sub	bx,10
205
	mov	ecx,(50)*65536+12
205 heavyiron 206
	mov	edx,[sc.work]
207
	mov	eax,13
208
	int	0x40
209
draw_status_text:
210
	mov	edx,[status]
211
	xor	esi,esi
212
@@:
213
	cmp	[edx+esi],byte 0
214
	je	@f
215
	inc	esi
216
	jmp	@b
217
@@:
308 Lrz 218
	mov	ebx,5*65536+(50)
219
	mov	ecx,[sc.work_text]
205 heavyiron 220
	mov	eax,4
221
	int	0x40
31 halyavin 222
ret
223
 
308 Lrz 224
run_but txt_button 0,5,15,25,2,0,0,run_but_text,
225
input_fn edit_box 0,5,5,0xffffff,0,0xaaaaaa,0,511,fn,ed_focus+\
205 heavyiron 226
ed_always_focus
31 halyavin 227
 
309 heavyiron 228
if lang eq ru
205 heavyiron 229
hello db 'Введите полный путь к файлу и нажмите Enter',0
230
bad_file_sys db 'Неизвестная файловая система',0 ; 3
231
file_not_find db 'Файл не найден',0		 ; 5
232
bad_fat_table db 'Таблица FAT разрушена',0	 ; 9
233
acces_denyied db 'Доступ запрещен',0		 ; 10
234
device_error db 'Ошибка устройства',0		 ; 11
235
out_of_memory db 'Недостаточно памяти',0	 ; 30
236
file_not_executable db 'Файл не является исполняемым',0 ; 31
237
many_processes db 'Слишком много процессов',0	 ; 32
308 Lrz 238
run_ok db 'Программа успешно запущена',0
239
grab_text db 'ЗАПУСК ПРОГРАММЫ',0
309 heavyiron 240
run_but_text db 'ЗАПУСТИТЬ',0
241
else
242
hello db 'Enter full path to file and press ',0
243
bad_file_sys db 'Unknown file system',0                ; 3
244
file_not_find db 'File not found',0                    ; 5
245
bad_fat_table db 'FAT table corrupted',0               ; 9
246
acces_denyied db 'Access denied',0                     ; 10
247
device_error db 'Device error',0                       ; 11
248
out_of_memory db 'Out of memory',0                     ; 30
249
file_not_executable db 'File is not executable',0      ; 31
250
many_processes db 'Too many processes',0               ; 32
251
run_ok db 'The program was started successfully',0
252
grab_text db 'RUN',0
253
run_but_text db 'RUN',0
254
end if
31 halyavin 255
 
451 heavyiron 256
mouse_flag: dd 0x0
309 heavyiron 257
 
205 heavyiron 258
status dd hello
31 halyavin 259
 
205 heavyiron 260
file_info:
261
.mode dd 7
262
.flags dd 0
263
.par dd run_par
264
dd 0,0
265
.name rb 512
31 halyavin 266
 
205 heavyiron 267
flags dw ?
31 halyavin 268
 
451 heavyiron 269
structure_of_potock:
270
rb 100
271
 
205 heavyiron 272
fn rb 512
31 halyavin 273
 
205 heavyiron 274
sc sys_color_table
275
app procinfo
276
run_par rb 256
277
par rb 256
278
	app_end