Subversion Repositories Kolibri OS

Rev

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

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