Subversion Repositories Kolibri OS

Rev

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

Rev 814 Rev 997
Line 121... Line 121...
121
	ret
121
	ret
122
@@:
122
@@:
123
	mov	[ebp + editor_data.memsize], ebx
123
	mov	[ebp + editor_data.memsize], ebx
124
	mov	al, [EditEOLStyle]
124
	mov	al, [EditEOLStyle]
125
	mov	[ebp + editor_data.eol], al
125
	mov	[ebp + editor_data.eol], al
126
	mov	eax, [esi + panel1_hPlugin - panel1_data]
126
	mov	eax, dword [esi + panel1_hPlugin - panel1_dir]
127
	mov	[ebp + editor_data.hPlugin], eax
127
	mov	[ebp + editor_data.hPlugin], eax
128
	test	eax, eax
128
	test	eax, eax
129
	jz	.nocopyhostname
129
	jz	.nocopyhostname
130
	lea	edi, [ebp + editor_data.hostname]
130
	lea	edi, [ebp + editor_data.hostname]
131
	push	esi
131
	push	esi
Line 194... Line 194...
194
	pushad
194
	pushad
195
	push	O_READ
195
	push	O_READ
196
	push	dword [ebx+21]
196
	push	dword [ebx+21]
197
	push	[ebp + editor_data.hFile]
197
	push	[ebp + editor_data.hFile]
198
	call	[edx + PluginInfo.open]
198
	call	[edx + PluginInfo.open]
-
 
199
	mov	[esp+1Ch], eax
199
	popad
200
	popad
200
	test	eax, eax
201
	test	eax, eax
201
	jz	..openerr_in_screen
202
	jz	..openerr_in_screen
202
	mov	ebx, eax
203
	mov	ebx, eax
203
@@:
204
@@:
Line 208... Line 209...
208
	pushad
209
	pushad
209
	push	16384
210
	push	16384
210
	push	[readinfo.data]
211
	push	[readinfo.data]
211
	push	ebx
212
	push	ebx
212
	call	[edx + PluginInfo.read]
213
	call	[edx + PluginInfo.read]
-
 
214
	mov	[esp+1Ch], eax
213
	popad
215
	popad
214
	cmp	eax, -1
216
	cmp	eax, -1
215
	jnz	.readok
217
	jnz	.readok
216
; let us hope that plugin says error itself
218
; let us hope that plugin says error itself
217
	push	ebp
219
	push	ebp
Line 257... Line 259...
257
	sub	ecx, ebp
259
	sub	ecx, ebp
258
	cmp	ecx, [ebp + editor_data.first_block]
260
	cmp	ecx, [ebp + editor_data.first_block]
259
	jnz	.readdone
261
	jnz	.readdone
260
@@:
262
@@:
261
	push	eax ebx
263
	push	eax ebx
262
	mov	ebx, [ebx+16]
264
	mov	ebx, [readinfo.data]
263
.loadloop:
265
.loadloop:
264
	mov	ecx, [EditBlockSize]
266
	mov	ecx, [EditBlockSize]
265
	cmp	eax, ecx
267
	cmp	eax, ecx
266
	ja	@f
268
	ja	@f
267
	mov	ecx, eax
269
	mov	ecx, eax
Line 1975... Line 1977...
1975
	call	editor_down_scroll
1977
	call	editor_down_scroll
1976
	jmp	.ret2
1978
	jmp	.ret2
Line 1977... Line 1979...
1977
 
1979
 
1978
.left:
1980
.left:
1979
	call	editor_cursor_left
1981
	call	editor_cursor_left
1980
	jc	.redraw_status
1982
	jnc	.redraw_status
1981
	jmp	editor_draw_text
1983
	jmp	editor_draw_text
1982
.ret3:
1984
.ret3:
Line 1983... Line 1985...
1983
	ret
1985
	ret
Line 2154... Line 2156...
2154
	dec	[ebp + editor_data.numlines]
2156
	dec	[ebp + editor_data.numlines]
2155
	call	editor_test_cursor_y
2157
	call	editor_test_cursor_y
2156
.del1:
2158
.del1:
2157
	jmp	editor_draw_text
2159
	jmp	editor_draw_text
Line -... Line 2160...
-
 
2160
 
-
 
2161
.f7:
-
 
2162
	call	find_in_file_dlg
-
 
2163
	jz	.shift_f7
-
 
2164
.f7.ret:
-
 
2165
	ret
-
 
2166
.shift_f7:
-
 
2167
; search string SearchString in file starting from current cursor position
-
 
2168
	mov	ebx, SearchString
-
 
2169
	xor	eax, eax
-
 
2170
	cmp	byte [ebx], al
-
 
2171
	jz	.f7.ret
-
 
2172
	mov	esi, tolower_table
-
 
2173
	test	[find_in_file_dlgdata.flags_case], 10h
-
 
2174
	jz	@f
-
 
2175
	mov	esi, identical_table
-
 
2176
@@:
-
 
2177
	test	[find_in_file_dlgdata.flags_whole], 10h
-
 
2178
	setnz	al
-
 
2179
	push	eax
-
 
2180
	push	dword [ebp+editor_data.encoding]; always cp866 for now
-
 
2181
				; needs to be revisited after Unicode support in editor
-
 
2182
	call	search_string_pre
-
 
2183
	mov	esi, [ebp + editor_data.cur_block]
-
 
2184
	add	esi, ebp
-
 
2185
	mov	ebx, [ebp + editor_data.cur_offs]
-
 
2186
	call	editor_normalize_offs
-
 
2187
	jnc	.f7.notfound
-
 
2188
	xor	edi, edi
-
 
2189
	push	ebx esi
-
 
2190
	push	edi
-
 
2191
	push	edi
-
 
2192
	test	[find_in_file_dlgdata.flags_whole], 10h
-
 
2193
	jnz	@f
-
 
2194
	movzx	eax, byte [esi+ebx]
-
 
2195
	jmp	.search_loop_next
-
 
2196
@@:
-
 
2197
	mov	edi, edx
-
 
2198
.search_loop:
-
 
2199
; edx -> FSM, ecx = last state, esi:ebx -> current data,
-
 
2200
; edi = current state
-
 
2201
; [esp] = row, [esp+4] = delta in lines
-
 
2202
; get current symbol
-
 
2203
	movzx	eax, byte [esi+ebx]
-
 
2204
; calculate next state
-
 
2205
	movzx	edi, byte [edi+eax]
-
 
2206
; done?
-
 
2207
	cmp	edi, ecx
-
 
2208
	jz	.f7.found
-
 
2209
.search_loop_next:
-
 
2210
; no; proceed to next symbol
-
 
2211
	add	ebx, 1
-
 
2212
	shl	edi, 8
-
 
2213
	add	dword [esp], 1
-
 
2214
	add	edi, edx
-
 
2215
	cmp	ebx, [esi + edit_block_header.limit]
-
 
2216
	jae	.f7.nextblock
-
 
2217
.f7.nonextblock:
-
 
2218
	cmp	al, 10
-
 
2219
	jz	.f7.newline
-
 
2220
	cmp	al, 13
-
 
2221
	jnz	.search_loop
-
 
2222
	cmp	byte [esi+ebx], 10
-
 
2223
	jnz	.f7.newline
-
 
2224
	call	editor_step_forward
-
 
2225
	jnc	.f7.notfound_pop
-
 
2226
.f7.newline:
-
 
2227
	mov	dword [esp], 0
-
 
2228
	add	dword [esp+4], 1
-
 
2229
	mov	dword [esp+8], esi
-
 
2230
	mov	dword [esp+12], ebx
-
 
2231
	jmp	.search_loop
-
 
2232
.f7.nextblock:
-
 
2233
	call	editor_normalize_offs
-
 
2234
	jc	.f7.nonextblock
-
 
2235
.f7.notfound_pop:
-
 
2236
; last chance - if we are looking for a whole word, EOF is ok for last symbol
-
 
2237
	test	[find_in_file_dlgdata.flags_whole], 10h
-
 
2238
	jz	@f
-
 
2239
	mov	esi, [ebp + editor_data.last_block]
-
 
2240
	add	esi, ebp
-
 
2241
	mov	ebx, [esi + edit_block_header.limit]
-
 
2242
	movzx	edi, byte [edi+' ']
-
 
2243
	cmp	edi, ecx
-
 
2244
	jz	.f7.found
-
 
2245
@@:
-
 
2246
	add	esp, 10h
-
 
2247
.f7.notfound:
-
 
2248
	jmp	search_failed
-
 
2249
.f7.found:
-
 
2250
	or	[ebp + editor_data.cur_delta], -1
-
 
2251
	sub	ebx, ecx
-
 
2252
	inc	ebx
-
 
2253
	test	[find_in_file_dlgdata.flags_whole], 10h
-
 
2254
	jz	@f
-
 
2255
	inc	ebx
-
 
2256
@@:
-
 
2257
	cmp	ebx, [EditBlockStart]
-
 
2258
	jge	@f
-
 
2259
	sub	ebx, [EditBlockStart]
-
 
2260
	mov	esi, [esi + edit_block_header.prev]
-
 
2261
	add	esi, ebp
-
 
2262
	add	ebx, [esi + edit_block_header.limit]
-
 
2263
	jmp	@b
-
 
2264
@@:
-
 
2265
	sub	esi, ebp
-
 
2266
	mov	[ebp + editor_data.cur_block], esi
-
 
2267
	add	esi, ebp
-
 
2268
	mov	[ebp + editor_data.cur_offs], ebx
-
 
2269
	push	ecx
-
 
2270
	mov	ecx, edx
-
 
2271
	call	pgfree
-
 
2272
	pop	ecx
-
 
2273
	pop	eax
-
 
2274
	pop	edi
-
 
2275
; esi:ebx -> last symbol of match, eax = row, edi = delta in lines
-
 
2276
	pop	esi ebx
-
 
2277
	test	[find_in_file_dlgdata.flags_whole], 10h
-
 
2278
	jz	@f
-
 
2279
	dec	ecx
-
 
2280
@@:
-
 
2281
	push	ebx esi
-
 
2282
	sub	eax, ecx
-
 
2283
	lea	edx, [eax+1]
-
 
2284
	mov	eax, [ebp + editor_data.curcol]
-
 
2285
	add	eax, [ebp + editor_data.cursor_x]
-
 
2286
	test	edi, edi
-
 
2287
	jz	@f
-
 
2288
	xor	eax, eax
-
 
2289
@@:
-
 
2290
	test	edx, edx
-
 
2291
	jz	.f7.foundpos1
-
 
2292
.f7.findpos1:
-
 
2293
	cmp	byte [ebx+esi], 9
-
 
2294
	jz	.f7.findpos1.tab
-
 
2295
	inc	eax
-
 
2296
	call	editor_step_forward
-
 
2297
	dec	edx
-
 
2298
	jnz	.f7.findpos1
-
 
2299
	jmp	.f7.foundpos1
-
 
2300
.f7.findpos1.tab:
-
 
2301
	push	edx eax
-
 
2302
	xor	edx, edx
-
 
2303
	div	[editor_tabsize]
-
 
2304
	pop	eax
-
 
2305
	sub	edx, [editor_tabsize]
-
 
2306
	sub	eax, edx
-
 
2307
	call	editor_step_forward
-
 
2308
	pop	edx
-
 
2309
	dec	edx
-
 
2310
	jnz	.f7.findpos1
-
 
2311
.f7.foundpos1:
-
 
2312
	pop	esi ebx
-
 
2313
	push	eax
-
 
2314
	cmp	eax, [ebp + editor_data.curcol]
-
 
2315
	jb	.f7.scrollleft
-
 
2316
	sub	eax, [ebp + editor_data.curcol]
-
 
2317
	sub	eax, [cur_width]
-
 
2318
	jb	.f7.xset
-
 
2319
	inc	eax
-
 
2320
	inc	edx
-
 
2321
	add	[ebp + editor_data.curcol], eax
-
 
2322
	jmp	.f7.xset
-
 
2323
.f7.scrollleft:
-
 
2324
	inc	edx
-
 
2325
	mov	[ebp + editor_data.curcol], eax
-
 
2326
.f7.xset:
-
 
2327
	pop	eax
-
 
2328
	push	edx
-
 
2329
	sub	eax, [ebp + editor_data.curcol]
-
 
2330
	mov	[ebp + editor_data.cursor_x], eax
-
 
2331
	mov	[cursor_x], eax
-
 
2332
	add	edi, [ebp + editor_data.cursor_y]
-
 
2333
	push	edi
-
 
2334
	inc	edi
-
 
2335
	cmp	edi, [cur_height]
-
 
2336
	pop	edi
-
 
2337
	jae	.f7.newview
-
 
2338
	mov	[ebp + editor_data.cursor_y], edi
-
 
2339
	mov	[cursor_y], edi
-
 
2340
	jmp	.f7.yset
-
 
2341
.f7.newview:
-
 
2342
	dec	edi
-
 
2343
	mov	[ebp + editor_data.linedata_start + editor_line.block], esi
-
 
2344
	mov	[ebp + editor_data.linedata_start + editor_line.offs], bx
-
 
2345
	add	[ebp + editor_data.curline], edi
-
 
2346
	xor	eax, eax
-
 
2347
	inc	eax
-
 
2348
	mov	[ebp + editor_data.cursor_y], eax
-
 
2349
	mov	[cursor_y], eax
-
 
2350
	call	editor_init_lines
-
 
2351
	call	editor_test_cursor_y
-
 
2352
	inc	dword [esp]
-
 
2353
.f7.yset:
-
 
2354
	pop	eax
-
 
2355
	test	eax, eax
-
 
2356
	jz	.redraw_status
-
 
2357
	jmp	editor_draw_text
2158
 
2358
 
2159
editor_cursor_left:
2359
editor_cursor_left:
2160
	cmp	[ebp + editor_data.cur_delta], -1
2360
	cmp	[ebp + editor_data.cur_delta], -1
2161
	jz	.in_text
2361
	jz	.in_text
2162
	dec	[ebp + editor_data.cur_delta]
2362
	dec	[ebp + editor_data.cur_delta]
Line 2290... Line 2490...
2290
	jz	@f
2490
	jz	@f
2291
	mov	ebx, [ebp+editor_data.hFile]
2491
	mov	ebx, [ebp+editor_data.hFile]
2292
	call	close_handle_if_unused
2492
	call	close_handle_if_unused
2293
@@:
2493
@@:
2294
	ret
2494
	ret
-
 
2495
 
-
 
2496
find_in_file_dlg:
-
 
2497
        mov     ebx, find_in_file_dlgdata
-
 
2498
        mov     eax, [cur_width]
-
 
2499
        sub     eax, 12
-
 
2500
        mov     [ebx + dlgtemplate.width], eax
-
 
2501
        dec     eax
-
 
2502
        dec     eax
-
 
2503
        mov     [ebx - find_in_file_dlgdata + find_in_file_dlgdata.width2], eax
-
 
2504
        shr     eax, 1
-
 
2505
        dec     eax
-
 
2506
        dec     eax
-
 
2507
        mov     [ebx - find_in_file_dlgdata + find_in_file_dlgdata.search_x2], eax
-
 
2508
        sub     eax, aSearchBLength-1
-
 
2509
        mov     [ebx - find_in_file_dlgdata + find_in_file_dlgdata.search_x1], eax
-
 
2510
        add     eax, aSearchBLength+3
-
 
2511
        mov     [ebx - find_in_file_dlgdata + find_in_file_dlgdata.cnl_x1], eax
-
 
2512
        add     eax, aCancelBLength - 1
-
 
2513
        mov     [ebx - find_in_file_dlgdata + find_in_file_dlgdata.cnl_x2], eax
-
 
2514
        mov     byte [ebx - find_in_file_dlgdata + find_in_file_dlgdata.flags0], 0xC
-
 
2515
        and     byte [ebx - find_in_file_dlgdata + find_in_file_dlgdata.flags1], not 4
-
 
2516
        and     byte [ebx - find_in_file_dlgdata + find_in_file_dlgdata.flags2], not 4
-
 
2517
	and	byte [ebx - find_in_file_dlgdata + find_in_file_dlgdata.flags_case], not 4
-
 
2518
	and	byte [ebx - find_in_file_dlgdata + find_in_file_dlgdata.flags_whole], not 4
-
 
2519
        push    ebx
-
 
2520
        call    DialogBox
-
 
2521
	cmp	eax, find_in_file_dlgdata.search_btn
-
 
2522
	ret