Subversion Repositories Kolibri OS

Rev

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

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