Subversion Repositories Kolibri OS

Rev

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