Subversion Repositories Kolibri OS

Rev

Rev 6687 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

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