Subversion Repositories Kolibri OS

Rev

Rev 2121 | Rev 3634 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

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