Subversion Repositories Kolibri OS

Rev

Rev 592 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 592 Rev 617
Line 1... Line 1...
1
;-----------------------------------------------------------------------------
1
;-----------------------------------------------------------------------------
2
func save_file ;//////////////////////////////////////////////////////////////
2
proc save_file ;//////////////////////////////////////////////////////////////
3
;-----------------------------------------------------------------------------
3
;-----------------------------------------------------------------------------
4
	mov	esi,tb_opensave.text
4
	mov	esi,tb_opensave.text
5
	mov	edi,f_info.path
5
	mov	edi,f_info.path
6
	movzx	ecx,[tb_opensave.length]
6
	movzx	ecx,[tb_opensave.length]
7
	mov	[f_info.length],ecx
7
	mov	[f_info.length],ecx
Line 19... Line 19...
19
	lea	esi,[esi+eax+4]
19
	lea	esi,[esi+eax+4]
20
	loop	@b
20
	loop	@b
21
	mov	eax,[cur_editor.Lines.Count]
21
	mov	eax,[cur_editor.Lines.Count]
22
	shl	eax,1
22
	shl	eax,1
23
	lea	eax,[eax+ebx+1024]
23
	lea	eax,[eax+ebx+1024]
24
	call	mem.Alloc
24
	stdcall	mem.Alloc,eax
25
	push	eax
25
	push	eax
26
	mov	esi,[cur_editor.Lines]
26
	mov	esi,[cur_editor.Lines]
27
	mov	edi,eax
27
	mov	edi,eax
Line 28... Line 28...
28
 
28
 
Line 53... Line 53...
53
	ret
53
	ret
Line 54... Line 54...
54
 
54
 
55
  .exit.2:
55
  .exit.2:
56
	stc
56
	stc
57
	ret
57
	ret
Line 58... Line 58...
58
endf
58
endp
59
 
59
 
60
;-----------------------------------------------------------------------------
60
;-----------------------------------------------------------------------------
61
func save_string ;////////////////////////////////////////////////////////////
61
proc save_string ;////////////////////////////////////////////////////////////
62
;-----------------------------------------------------------------------------
62
;-----------------------------------------------------------------------------
63
	movzx	ecx,word[esi]
63
	movzx	ecx,word[esi]
64
	test	dword[esi],0x00010000
64
	test	dword[esi],0x00010000
Line 124... Line 124...
124
	mov	eax,0x0A0D
124
	mov	eax,0x0A0D
125
	stosw
125
	stosw
126
	movzx	eax,word[esi-4]
126
	movzx	eax,word[esi-4]
127
	add	esi,eax;[esi-4]
127
	add	esi,eax;[esi-4]
128
	ret
128
	ret
129
endf
129
endp
Line 130... Line 130...
130
 
130
 
131
func set_status_fs_error
131
proc set_status_fs_error
132
	push	eax
132
	push	eax
133
	mov	esi,s_fs_error
133
	mov	esi,s_fs_error
134
    @@: dec	eax
134
    @@: dec	eax
135
	js	@f
135
	js	@f
Line 139... Line 139...
139
    @@: inc	esi
139
    @@: inc	esi
140
	mov	[s_status],esi
140
	mov	[s_status],esi
141
	pop	eax
141
	pop	eax
142
	call	draw_statusbar
142
	call	draw_statusbar
143
	ret
143
	ret
144
endf
144
endp
Line 145... Line 145...
145
 
145
 
146
;-----------------------------------------------------------------------------
146
;-----------------------------------------------------------------------------
147
func load_file ;//////////////////////////////////////////////////////////////
147
proc load_file ;//////////////////////////////////////////////////////////////
148
;-----------------------------------------------------------------------------
148
;-----------------------------------------------------------------------------
149
	cmp	[tb_opensave.length],0
149
	cmp	[tb_opensave.length],0
150
	jne	@f
150
	jne	@f
151
	stc
151
	stc
Line 169... Line 169...
169
	mov	[f_info70+21],f_info.path
169
	mov	[f_info70+21],f_info.path
170
	mcall	70,f_info70
170
	mcall	70,f_info70
171
	mov	[f_info70+0],0
171
	mov	[f_info70+0],0
172
	mov	eax,dword[file_info.Size]
172
	mov	eax,dword[file_info.Size]
173
	mov	[f_info70+12],eax
173
	mov	[f_info70+12],eax
174
	call	mem.Alloc
174
	stdcall	mem.Alloc,eax
175
	mov	[f_info70+16],eax
175
	mov	[f_info70+16],eax
176
	mcall	70,f_info70
176
	mcall	70,f_info70
Line 177... Line 177...
177
 
177
 
Line 183... Line 183...
183
	test	ebx,ebx
183
	test	ebx,ebx
184
	je	.file_found
184
	je	.file_found
185
	cmp	ebx,6		 ;// ATV driver fix (6 instead of 5)
185
	cmp	ebx,6		 ;// ATV driver fix (6 instead of 5)
186
	je	.file_found
186
	je	.file_found
Line 187... Line 187...
187
 
187
 
188
	mov	eax,[f_info70+16]
-
 
189
	call	mem.Free
188
	stdcall	mem.Free,[f_info70+16]
190
	stc
189
	stc
Line 191... Line 190...
191
	ret
190
	ret
192
 
191
 
Line 219... Line 218...
219
	jne	@b
218
	jne	@b
220
    @@: mov	[ebp+TABITEM.Editor.FileName],ecx
219
    @@: mov	[ebp+TABITEM.Editor.FileName],ecx
221
	call	flush_cur_tab
220
	call	flush_cur_tab
222
	pop	edi esi ecx
221
	pop	edi esi ecx
223
	call	load_from_memory
222
	call	load_from_memory
224
	mov	eax,[f_info70+16]
223
	stdcall	mem.Free,[f_info70+16]
225
	call	mem.Free
-
 
Line 226... Line 224...
226
 
224
 
227
	xor	eax,eax
225
	xor	eax,eax
228
	mov	[cur_editor.TopLeft.Y],eax
226
	mov	[cur_editor.TopLeft.Y],eax
229
	mov	[cur_editor.TopLeft.X],eax
227
	mov	[cur_editor.TopLeft.X],eax
Line 249... Line 247...
249
    .nocol:
247
    .nocol:
250
	call	update_caption
248
	call	update_caption
Line 251... Line 249...
251
 
249
 
252
	clc
250
	clc
253
	ret
251
	ret
Line 254... Line 252...
254
endf
252
endp
255
 
253
 
256
;-----------------------------------------------------------------------------
254
;-----------------------------------------------------------------------------
257
func load_from_memory ;///////////////////////////////////////////////////////
255
proc load_from_memory ;///////////////////////////////////////////////////////
258
;-----------------------------------------------------------------------------
256
;-----------------------------------------------------------------------------
259
; ECX = data length
257
; ECX = data length
260
; ESI = data pointer
258
; ESI = data pointer
261
; EBP = EDITOR*
259
; EBP = EDITOR*
262
;-----------------------------------------------------------------------------
260
;-----------------------------------------------------------------------------
263
	call	get_lines_in_file
261
	call	get_lines_in_file
264
	mov	[ebp+EDITOR.Lines.Count],eax
262
	mov	[ebp+EDITOR.Lines.Count],eax
265
	lea	edx,[ebx+ecx]
263
	lea	edx,[ebx+ecx]
266
	imul	ebx,eax,14
-
 
267
	add	ebx,edx
264
	imul	ebx,eax,14
268
	mov	eax,[ebp+EDITOR.Lines]
265
	add	ebx,edx
269
	mov	[ebp+EDITOR.Lines.Size],ebx
266
	mov	[ebp+EDITOR.Lines.Size],ebx
Line 270... Line 267...
270
	call	mem.ReAlloc
267
	stdcall	mem.ReAlloc,[ebp+EDITOR.Lines],ebx
271
	mov	[ebp+EDITOR.Lines],eax
268
	mov	[ebp+EDITOR.Lines],eax
272
 
269
 
Line 333... Line 330...
333
	and	ecx,not(ATABW-1)
330
	and	ecx,not(ATABW-1)
334
	sub	ecx,eax
331
	sub	ecx,eax
335
	mov	al,' '
332
	mov	al,' '
336
	rep	stosb
333
	rep	stosb
337
	jmp	.next_char
334
	jmp	.next_char
338
endf
335
endp