Subversion Repositories Kolibri OS

Rev

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

Rev 7036 Rev 7497
1
; ¬ ªà®á ¤«ï á¨á⥬­®© ¡¨¡«¨®â¥ª¨ box_lib.obj
1
; ¬ ªà®á ¤«ï á¨á⥬­®© ¡¨¡«¨®â¥ª¨ box_lib.obj
2
; í«¥¬¥­â TextEditor ¤«ï Kolibri OS
2
; í«¥¬¥­â TextEditor ¤«ï Kolibri OS
3
; ä ©« ¯®á«¥¤­¨© à § ¨§¬¥­ï«áï 20.02.2016 IgorA
3
; ä ©« ¯®á«¥¤­¨© à § ¨§¬¥­ï«áï 21.10.2018 IgorA
4
; ­  ª®¤ ¯à¨¬¥­¥­  GPL2 «¨æ¥­§¨ï
4
; ­  ª®¤ ¯à¨¬¥­¥­  GPL2 «¨æ¥­§¨ï
5
 
5
 
6
;input:
6
;input:
7
; edi = pointer to tedit struct
7
; edi = pointer to tedit struct
8
; reg = index
8
; reg = index
9
;output:
9
;output:
10
; reg = pointer to 'tex' struct
10
; reg = pointer to 'tex' struct
11
macro ConvertIndexToPointer reg {
11
macro ConvertIndexToPointer reg {
12
	imul reg,sizeof.symbol
12
	imul reg,sizeof.symbol
13
	add reg,ted_tex
13
	add reg,ted_tex
14
}
14
}
15
 
15
 
16
;--- out_reg = ted_key_words_data[ind_reg].Text[0] ---
16
;--- out_reg = ted_key_words_data[ind_reg].Text[0] ---
17
macro ColToIndexOffset ind_reg,out_reg {
17
macro ColToIndexOffset ind_reg,out_reg {
18
	mov out_reg,ind_reg
18
	mov out_reg,ind_reg
19
	imul out_reg,sizeof.TexColViv
19
	imul out_reg,sizeof.TexColViv
20
	add out_reg,ted_key_words_data
20
	add out_reg,ted_key_words_data
21
}
21
}
22
 
22
 
23
TED_PANEL_NULL	 equ 0 ;­¥â ®âªàë⮩ ¯ ­¥«¨
23
TED_PANEL_NULL	 equ 0 ;­¥â ®âªàë⮩ ¯ ­¥«¨
24
TED_PANEL_FIND	 equ 1 ;¯ ­¥«ì ¯®¨áª 
24
TED_PANEL_FIND	 equ 1 ;¯ ­¥«ì ¯®¨áª 
25
TED_PANEL_SYNTAX equ 2 ;¯ ­¥«ì ¢ë¡®à  ä ©«®¢ ¯®¤á¢¥âª¨
25
TED_PANEL_SYNTAX equ 2 ;¯ ­¥«ì ¢ë¡®à  ä ©«®¢ ¯®¤á¢¥âª¨
26
TED_PANEL_WIDTH  equ 150 ;è¨à¨­  ¯ ­¥«¨
26
TED_PANEL_WIDTH  equ 150 ;è¨à¨­  ¯ ­¥«¨
27
 
27
 
28
TED_LINES_IN_NEW_FILE equ 30 ;ç¨á«® áâப ¢ ­®¢®¬ ä ©«¥
28
TED_LINES_IN_NEW_FILE equ 30 ;ç¨á«® áâப ¢ ­®¢®¬ ä ©«¥
29
MAX_COLOR_WORD_LEN equ 40
29
MAX_COLOR_WORD_LEN equ 40
30
;------------------------------------------------------------------------------
30
;------------------------------------------------------------------------------
31
struct TexSelect
31
struct TexSelect
32
	x0 dd ?
32
	x0 dd ?
33
	y0 dd ?
33
	y0 dd ?
34
	x1 dd ?
34
	x1 dd ?
35
	y1 dd ?
35
	y1 dd ?
36
ends
36
ends
37
 
37
 
38
struct TexColViv
38
struct TexColViv
39
	Text  rb MAX_COLOR_WORD_LEN ; á«®¢® ¤«ï ¯®¤á¢¥âª¨
39
	Text  rb MAX_COLOR_WORD_LEN ; á«®¢® ¤«ï ¯®¤á¢¥âª¨
40
	f1    dd 0 ; á¯à ¢ª  ¯® á«®¢ã
40
	f1    dd 0 ; á¯à ¢ª  ¯® á«®¢ã
41
	flags db ? ; f1+4 ä« £¨ ¨á¯®«ì§ã¥¬ë¥ ¯à¨ ¢ë¤¥«¥­¨¨
41
	flags db ? ; f1+4 ä« £¨ ¨á¯®«ì§ã¥¬ë¥ ¯à¨ ¢ë¤¥«¥­¨¨
42
	endc  db ? ; f1+5 ᨬ¢®« ª®­æ  ¢ë¤¥«¥­¨ï (¨á¯®«ì§ã¥âáï ¯à¨ flags&4)
42
	endc  db ? ; f1+5 ᨬ¢®« ª®­æ  ¢ë¤¥«¥­¨ï (¨á¯®«ì§ã¥âáï ¯à¨ flags&4)
43
	escc  db ? ; f1+6 íªà ­¨àãî騩 ᨬ¢®« (¨á¯®«ì§ã¥âáï ¯à¨ flags&4)
43
	escc  db ? ; f1+6 íªà ­¨àãî騩 ᨬ¢®« (¨á¯®«ì§ã¥âáï ¯à¨ flags&4)
44
	color db ? ; f1+7 ­®¬¥à 梥â 
44
	color db ? ; f1+7 ­®¬¥à 梥â 
45
ends
45
ends
46
 
46
 
47
struct symbol
47
struct symbol
48
	c db ?    ;  +0 ᨬ¢®«
48
	c db ?    ;  +0 ᨬ¢®«
49
	col db ?  ;  +1 梥â
49
	col db ?  ;  +1 梥â
50
	perv dd ? ;  +2
50
	perv dd ? ;  +2
51
	next dd ? ;  +6 㪠§ â¥«¨
51
	next dd ? ;  +6 㪠§ â¥«¨
52
	tc dd ?   ; +10 ¢à¥¬. ᮧ¤ ­¨ï
52
	tc dd ?   ; +10 ¢à¥¬. ᮧ¤ ­¨ï
53
	td dd ?   ; +14 ¢à¥¬. 㤠«¥­¨ï
53
	td dd ?   ; +14 ¢à¥¬. 㤠«¥­¨ï
54
ends
54
ends
55
;------------------------------------------------------------------------------
55
;------------------------------------------------------------------------------
56
 
56
 
57
ted_symbol_space db 32 ;ascii ª®¤ ¯à®¡¥« , ¨­®£¤  ¡ë¢ ¥â ­ã¦¥­ ¢ ª®¤¥
57
ted_symbol_space db 32 ;ascii ª®¤ ¯à®¡¥« , ¨­®£¤  ¡ë¢ ¥â ­ã¦¥­ ¢ ª®¤¥
58
ted_symbol_tab db 26 ;ascii ª®¤ áâ५ª¨ ¢¯à ¢®, ¨á¯®«ì§ã¥âáï ¤«ï à¨á®¢ ­¨ï â ¡ã«ï樨 ¢ ०¨¬¥ ¯®ª §  ­¥¢¨¤¨¬ëå ᨬ¢®«®¢
58
ted_symbol_tab db 26 ;ascii ª®¤ áâ५ª¨ ¢¯à ¢®, ¨á¯®«ì§ã¥âáï ¤«ï à¨á®¢ ­¨ï â ¡ã«ï樨 ¢ ०¨¬¥ ¯®ª §  ­¥¢¨¤¨¬ëå ᨬ¢®«®¢
59
 
59
 
60
if lang eq ru
60
if lang eq ru
61
 
61
 
62
txtRow db '‘âப ',0
62
txtRow db '‘âப ',0
63
txtCol db '‡­ ª',0
63
txtCol db '‡­ ª',0
64
txtOtm db 'Žâ¬¥­ë',0
64
txtOtm db 'Žâ¬¥­ë',0
65
txtBuf db 'ãä¥à:',0
65
txtBuf db 'ãä¥à:',0
66
 
66
 
67
else
67
else
68
 
68
 
69
txtRow db 'Rows',0
69
txtRow db 'Rows',0
70
txtCol db 'Cols',0
70
txtCol db 'Cols',0
71
txtOtm db 'Undo',0
71
txtOtm db 'Undo',0
72
txtBuf db 'Buffer:',0
72
txtBuf db 'Buffer:',0
73
 
73
 
74
end if
74
end if
75
 
75
 
76
;EvChar - â ¡«¨æ  ¤«ï 䨫ìâ஢ ­¨ï ¤®¡ ¢«ï¥¬ëå ᨬ¢®«®¢, çâ®-¡ë ­¥ ¯®¯ «¨ «¨è­¨¥ §­ ª¨
76
;EvChar - â ¡«¨æ  ¤«ï 䨫ìâ஢ ­¨ï ¤®¡ ¢«ï¥¬ëå ᨬ¢®«®¢, çâ®-¡ë ­¥ ¯®¯ «¨ «¨è­¨¥ §­ ª¨
77
align 16
77
align 16
78
EvChar db 0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0
78
EvChar db 0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0
79
    db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
79
    db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
80
    db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
80
    db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
81
    db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
81
    db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
82
    db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
82
    db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
83
    db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
83
    db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
84
    db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
84
    db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
85
    db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0
85
    db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0
86
    db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
86
    db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
87
    db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
87
    db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
88
    db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
88
    db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
89
    db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
89
    db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
90
    db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
90
    db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
91
    db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
91
    db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
92
    db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
92
    db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
93
    db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
93
    db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
94
 
94
 
95
KM_SHIFT equ 0x00010000
95
KM_SHIFT equ 0x00010000
96
KM_CTRL equ 0x00020000
96
KM_CTRL equ 0x00020000
97
KM_ALT equ 0x00040000
97
KM_ALT equ 0x00040000
98
KM_NUMLOCK equ 0x00080000
98
KM_NUMLOCK equ 0x00080000
99
 
99
 
100
; KEY CODES
100
; KEY CODES
101
KEY_F1 equ 0x0000003B
101
KEY_F1 equ 0x0000003B
102
KEY_F2 equ 0x0000003C
102
KEY_F2 equ 0x0000003C
103
KEY_F3 equ 0x0000003D
103
KEY_F3 equ 0x0000003D
104
 
104
 
105
 
105
 
106
 
106
 
107
align 16
107
align 16
108
proc ted_init uses eax ecx edi, edit:dword
108
proc ted_init uses eax ecx edi, edit:dword
109
	mov edi,[edit]
109
	mov edi,[edit]
110
 
110
 
111
	mov ecx,sizeof.symbol
111
	mov ecx,sizeof.symbol
112
	imul ecx,ted_max_chars
112
	imul ecx,ted_max_chars
113
	invoke mem.alloc,ecx ;¢ë¤¥«ï¥¬ ¯ ¬ïâì
113
	invoke mem.alloc,ecx ;¢ë¤¥«ï¥¬ ¯ ¬ïâì
114
	mov ted_tex,eax
114
	mov ted_tex,eax
115
	mov ted_tex_1,eax
115
	mov ted_tex_1,eax
116
	add ted_tex_1,sizeof.symbol
116
	add ted_tex_1,sizeof.symbol
117
	add eax,ecx
117
	add eax,ecx
118
	mov ted_tex_end,eax
118
	mov ted_tex_end,eax
119
 
119
 
120
	stdcall ted_clear, edi,1
120
	stdcall ted_clear, edi,1
121
 
121
 
122
;-------------------------------------------------
122
;-------------------------------------------------
123
	mov ecx,1024 ;1024 - ¤«ï ¬ áᨢ  ted_arr_key_pos
123
	mov ecx,1024 ;1024 - ¤«ï ¬ áᨢ  ted_arr_key_pos
124
	add ecx,ted_syntax_file_size
124
	add ecx,ted_syntax_file_size
125
	invoke mem.alloc,ecx
125
	invoke mem.alloc,ecx
126
	mov ted_arr_key_pos,eax
126
	mov ted_arr_key_pos,eax
127
	add eax,1024
127
	add eax,1024
128
	mov ted_syntax_file,eax
128
	mov ted_syntax_file,eax
129
 
129
 
130
	stdcall ted_init_scroll_bars,edi,3
130
	stdcall ted_init_scroll_bars,edi,3
131
	ret
131
	ret
132
endp
132
endp
133
 
133
 
134
MIN_W_SCRL_ARE equ 3 ;¬¨­¨¬ «ì­ ï ®â®¡à ¦ ¥¬ ï ®¡« áâì ¤«ï ¢¥àâ. áªà®««¨­£ 
134
MIN_W_SCRL_ARE equ 3 ;¬¨­¨¬ «ì­ ï ®â®¡à ¦ ¥¬ ï ®¡« áâì ¤«ï ¢¥àâ. áªà®««¨­£ 
135
MIN_H_SCRL_ARE equ 3 ;¬¨­¨¬ «ì­ ï ®â®¡à ¦ ¥¬ ï ®¡« áâì ¤«ï £®à¨§. áªà®««¨­£ 
135
MIN_H_SCRL_ARE equ 3 ;¬¨­¨¬ «ì­ ï ®â®¡à ¦ ¥¬ ï ®¡« áâì ¤«ï £®à¨§. áªà®««¨­£ 
136
;input:
136
;input:
137
; opt = 1 - ¬¥­ïâì 梥â áªà®««¨­£®¢, 2 - ¨§¬¥­¨«¨áì à §¬¥àë ®ª­ ,
137
; opt = 1 - ¬¥­ïâì 梥â áªà®««¨­£®¢, 2 - ¨§¬¥­¨«¨áì à §¬¥àë ®ª­ ,
138
;  4 - ¨§¬¥­¨«¨áì à §¬¥àë ¤®ªã¬¥­â 
138
;  4 - ¨§¬¥­¨«¨áì à §¬¥àë ¤®ªã¬¥­â 
139
align 16
139
align 16
140
proc ted_init_scroll_bars, edit:dword, opt:dword
140
proc ted_init_scroll_bars, edit:dword, opt:dword
141
	pushad
141
	pushad
142
	mov edi,[edit]
142
	mov edi,[edit]
143
	mov esi,ted_scr_w
143
	mov esi,ted_scr_w
144
	mov ebx,ted_scr_h
144
	mov ebx,ted_scr_h
145
	bt dword[opt],0
145
	bt dword[opt],0
146
	jae @f
146
	jae @f
147
		mov ecx,ted_color_wnd_work
147
		mov ecx,ted_color_wnd_work
148
		mov dword[esi+sb_offs_bckg_col],ecx
148
		mov dword[esi+sb_offs_bckg_col],ecx
149
		mov dword[ebx+sb_offs_bckg_col],ecx
149
		mov dword[ebx+sb_offs_bckg_col],ecx
150
		mov ecx,ted_color_wnd_capt
150
		mov ecx,ted_color_wnd_capt
151
		mov dword[esi+sb_offs_frnt_col],ecx
151
		mov dword[esi+sb_offs_frnt_col],ecx
152
		mov dword[ebx+sb_offs_frnt_col],ecx
152
		mov dword[ebx+sb_offs_frnt_col],ecx
153
		mov ecx,ted_color_wnd_bord
153
		mov ecx,ted_color_wnd_bord
154
		mov dword[esi+sb_offs_line_col],ecx
154
		mov dword[esi+sb_offs_line_col],ecx
155
		mov dword[ebx+sb_offs_line_col],ecx
155
		mov dword[ebx+sb_offs_line_col],ecx
156
	@@:
156
	@@:
157
	bt dword[opt],2 ; ¨§¬¥­¨«¨áì à §¬¥àë ¤®ªã¬¥­â  ?
157
	bt dword[opt],2 ; ¨§¬¥­¨«¨áì à §¬¥àë ¤®ªã¬¥­â  ?
158
	jae .doc_resize
158
	jae .doc_resize
159
		call ted_get_num_lines
159
		call ted_get_num_lines
160
		cmp eax,TED_LINES_IN_NEW_FILE
160
		cmp eax,TED_LINES_IN_NEW_FILE
161
		jge @f
161
		jge @f
162
			mov eax,TED_LINES_IN_NEW_FILE
162
			mov eax,TED_LINES_IN_NEW_FILE
163
		@@:
163
		@@:
164
		mov dword[esi+sb_offs_max_area],eax
164
		mov dword[esi+sb_offs_max_area],eax
165
	.doc_resize:
165
	.doc_resize:
166
	bt dword[opt],1 ; ¨§¬¥­¨«¨áì à §¬¥àë ®ª­  ?
166
	bt dword[opt],1 ; ¨§¬¥­¨«¨áì à §¬¥àë ®ª­  ?
167
	jae .no_size
167
	jae .no_size
168
			mov edx,ted_wnd_l
168
			mov edx,ted_wnd_l
169
			add edx,ted_rec_l
169
			add edx,ted_rec_l
170
			mov word[ebx+sb_offs_start_x],dx ;¢ëáâ ¢«ï¥¬ «¥¢ë© ®âáâ㯠£®à¨§. áªà®««¨­£ 
170
			mov word[ebx+sb_offs_start_x],dx ;¢ëáâ ¢«ï¥¬ «¥¢ë© ®âáâ㯠£®à¨§. áªà®««¨­£ 
171
			mov eax,ted_wnd_h ;calculate lines in page
171
			mov eax,ted_wnd_h ;calculate lines in page
172
			mov edx,ted_wnd_t
172
			mov edx,ted_wnd_t
173
			add edx,eax
173
			add edx,eax
174
			mov word[ebx+sb_offs_start_y],dx ;¢ëáâ ¢«ï¥¬ ¢¥àå­¨© ®âáâ㯠£®à¨§. áªà®««¨­£ 
174
			mov word[ebx+sb_offs_start_y],dx ;¢ëáâ ¢«ï¥¬ ¢¥àå­¨© ®âáâ㯠£®à¨§. áªà®««¨­£ 
175
		sub eax,ted_rec_t
175
		sub eax,ted_rec_t
176
		xor edx,edx
176
		xor edx,edx
177
		mov ecx,ted_rec_h
177
		mov ecx,ted_rec_h
178
		div ecx
178
		div ecx
179
		cmp eax,MIN_W_SCRL_ARE
179
		cmp eax,MIN_W_SCRL_ARE
180
		jg @f
180
		jg @f
181
			mov eax,MIN_W_SCRL_ARE
181
			mov eax,MIN_W_SCRL_ARE
182
		@@:
182
		@@:
183
		mov dword[esi+sb_offs_cur_area],eax
183
		mov dword[esi+sb_offs_cur_area],eax
184
 
184
 
185
		mov eax,ted_wnd_w ;calculate cols in page
185
		mov eax,ted_wnd_w ;calculate cols in page
186
			mov edx,ted_wnd_l ;«¥¢ë© ®âáâ㯠®ª­ 
186
			mov edx,ted_wnd_l ;«¥¢ë© ®âáâ㯠®ª­ 
187
			add edx,eax ;¤®¡ ¢«ï¥¬ è¨à¨­ã ®ª­ 
187
			add edx,eax ;¤®¡ ¢«ï¥¬ è¨à¨­ã ®ª­ 
188
			mov word[esi+sb_offs_start_x],dx ;¢ëáâ ¢«ï¥¬ «¥¢ë© ®âáâ㯠¢¥àâ. áªà®««¨­£ 
188
			mov word[esi+sb_offs_start_x],dx ;¢ëáâ ¢«ï¥¬ «¥¢ë© ®âáâ㯠¢¥àâ. áªà®««¨­£ 
189
			mov edx,ted_wnd_t
189
			mov edx,ted_wnd_t
190
			mov word[esi+sb_offs_start_y],dx ;¢ëáâ ¢«ï¥¬ ¢¥àå­¨© ®âáâ㯠¢¥àâ. áªà®««¨­£ 
190
			mov word[esi+sb_offs_start_y],dx ;¢ëáâ ¢«ï¥¬ ¢¥àå­¨© ®âáâ㯠¢¥àâ. áªà®««¨­£ 
191
			mov edx,ted_wnd_h
191
			mov edx,ted_wnd_h
192
			mov word[esi+sb_offs_size_y],dx ;¢ëáâ ¢«ï¥¬ ¢ëá®âã ¢¥àâ. áªà®««¨­£ 
192
			mov word[esi+sb_offs_size_y],dx ;¢ëáâ ¢«ï¥¬ ¢ëá®âã ¢¥àâ. áªà®««¨­£ 
193
		sub eax,ted_rec_l
193
		sub eax,ted_rec_l
194
			mov word[ebx+sb_offs_size_x],ax ;¢ëáâ ¢«ï¥¬ è¨à¨­ã £®à¨§. áªà®««¨­£ 
194
			mov word[ebx+sb_offs_size_x],ax ;¢ëáâ ¢«ï¥¬ è¨à¨­ã £®à¨§. áªà®««¨­£ 
195
		xor edx,edx
195
		xor edx,edx
196
		mov ecx,ted_rec_w
196
		mov ecx,ted_rec_w
197
		div ecx
197
		div ecx
198
		cmp eax,MIN_H_SCRL_ARE
198
		cmp eax,MIN_H_SCRL_ARE
199
		jg @f
199
		jg @f
200
			mov eax,MIN_H_SCRL_ARE
200
			mov eax,MIN_H_SCRL_ARE
201
		@@:
201
		@@:
202
		dec eax
202
		dec eax
203
		mov dword[ebx+sb_offs_cur_area],eax ;ãáâ ­ ¢«¨¢ ¥¬ ç¨á«® ᨬ¢®«®¢, ª®â®àë¥ ¢« §ïâ ¢ íªà ­ ¤«ï £®à¨§. áªà®««¨­£ 
203
		mov dword[ebx+sb_offs_cur_area],eax ;ãáâ ­ ¢«¨¢ ¥¬ ç¨á«® ᨬ¢®«®¢, ª®â®àë¥ ¢« §ïâ ¢ íªà ­ ¤«ï £®à¨§. áªà®««¨­£ 
204
	.no_size:
204
	.no_size:
205
	popad
205
	popad
206
	ret
206
	ret
207
endp
207
endp
208
 
208
 
209
align 16
209
align 16
210
proc ted_delete uses edi, edit:dword
210
proc ted_delete uses edi, edit:dword
211
	mov edi,[edit]
211
	mov edi,[edit]
212
	invoke mem.free,ted_tex
212
	invoke mem.free,ted_tex
213
	invoke mem.free,ted_arr_key_pos ;ted_syntax_file
213
	invoke mem.free,ted_arr_key_pos ;ted_syntax_file
214
	ret
214
	ret
215
endp
215
endp
216
 
216
 
217
 
217
 
218
;input:
218
;input:
219
; eax = key kodes
219
; eax = key kodes
220
align 16
220
align 16
221
proc ted_key, edit:dword, table:dword, control:dword
221
proc ted_key, edit:dword, table:dword, control:dword
222
	pushad
222
	pushad
223
	mov edi,[edit]
223
	mov edi,[edit]
224
	mov esi,ted_el_focus
224
	mov esi,ted_el_focus
225
	cmp dword[esi],edi
225
	cmp dword[esi],edi
226
	jne .end_key_fun ;í«¥¬¥­â ­¥ ¢ 䮪ãᥠ¢ë室¨¬ ¨§ ä㭪樨
226
	jne .end_key_fun ;í«¥¬¥­â ­¥ ¢ 䮪ãᥠ¢ë室¨¬ ¨§ ä㭪樨
227
	mov esi,dword[control]
227
	mov esi,dword[control]
228
 
228
 
229
	cmp ah,KEY_F1 ;[F1]
229
	cmp ah,KEY_F1 ;[F1]
230
	jne @f
230
	jne @f
231
		stdcall ted_show_help_f1,edi
231
		stdcall ted_show_help_f1,edi
232
		jmp .end_key_fun
232
		jmp .end_key_fun
233
	@@:
233
	@@:
234
	cmp ah,KEY_F3 ;[F3]
234
	cmp ah,KEY_F3 ;[F3]
235
	jne @f
235
	jne @f
236
		stdcall ted_but_find_next,edi
236
		stdcall ted_but_find_next,edi
237
		jmp .end_key_fun
237
		jmp .end_key_fun
238
	@@:
238
	@@:
239
 
239
 
240
	test esi,KM_CTRL ;Ctrl+...
240
	test esi,KM_CTRL ;Ctrl+...
241
	jz .key_Ctrl
241
	jz .key_Ctrl
242
		; *** ¢ë§®¢ ¢­¥è­¨å ä㭪権 ª®â®àë¥ âॡãîâ ®ª­  ®âªàëâ¨ï/á®åà ­¥­¨ï/¯®¨áª /...
242
		; *** ¢ë§®¢ ¢­¥è­¨å ä㭪権 ª®â®àë¥ âॡãîâ ®ª­  ®âªàëâ¨ï/á®åà ­¥­¨ï/¯®¨áª /...
243
		cmp ah,24 ;Ctrl+O
243
		cmp ah,24 ;Ctrl+O
244
		jne @f
244
		jne @f
245
			cmp ted_fun_on_key_ctrl_o,0
245
			cmp ted_fun_on_key_ctrl_o,0
246
			je @f
246
			je @f
247
				call ted_fun_on_key_ctrl_o
247
				call ted_fun_on_key_ctrl_o
248
		@@:
248
		@@:
249
		cmp ah,31 ;Ctrl+S
249
		cmp ah,31 ;Ctrl+S
250
		jne @f
250
		jne @f
251
			cmp ted_fun_on_key_ctrl_s,0
251
			cmp ted_fun_on_key_ctrl_s,0
252
			je @f
252
			je @f
253
				call ted_fun_on_key_ctrl_s
253
				call ted_fun_on_key_ctrl_s
254
		@@:
254
		@@:
255
		cmp ah,33 ;Ctrl+F
255
		cmp ah,33 ;Ctrl+F
256
		jne @f
256
		jne @f
257
		cmp ted_panel_id,TED_PANEL_FIND
257
		cmp ted_panel_id,TED_PANEL_FIND
258
		je @f
258
		je @f
259
			cmp ted_fun_on_key_ctrl_f,0
259
			cmp ted_fun_on_key_ctrl_f,0
260
			je @f
260
			je @f
261
				call ted_fun_on_key_ctrl_f
261
				call ted_fun_on_key_ctrl_f
262
		@@:
262
		@@:
263
		cmp ah,49 ;Ctrl+N
263
		cmp ah,49 ;Ctrl+N
264
		jne @f
264
		jne @f
265
			cmp ted_fun_on_key_ctrl_n,0
265
			cmp ted_fun_on_key_ctrl_n,0
266
			je @f
266
			je @f
267
				call ted_fun_on_key_ctrl_n
267
				call ted_fun_on_key_ctrl_n
268
		@@:
268
		@@:
269
		; *** ¢ë§®¢ ¢­ãâ७­¨å ä㭪権
269
		; *** ¢ë§®¢ ¢­ãâ७­¨å ä㭪権
270
		cmp ah,30 ;Ctrl+A
270
		cmp ah,30 ;Ctrl+A
271
		jne @f
271
		jne @f
272
			call ted_sel_all
272
			call ted_sel_all
273
		@@:
273
		@@:
274
		cmp ah,44 ;Ctrl+Z
274
		cmp ah,44 ;Ctrl+Z
275
		jne @f
275
		jne @f
276
			stdcall ted_but_undo,edi
276
			stdcall ted_but_undo,edi
277
		@@:
277
		@@:
-
 
278
		cmp ah,45 ;Ctrl+X
-
 
279
		jne @f
-
 
280
			stdcall ted_but_cut,edi
-
 
281
		@@:
278
		cmp ah,46 ;Ctrl+C
282
		cmp ah,46 ;Ctrl+C
279
		jne @f
283
		jne @f
280
			stdcall ted_but_copy,edi
284
			stdcall ted_but_copy,edi
281
		@@:
285
		@@:
282
		cmp ah,47 ;Ctrl+V
286
		cmp ah,47 ;Ctrl+V
283
		jne @f
287
		jne @f
284
			stdcall ted_but_paste,edi
288
			stdcall ted_but_paste,edi
285
		@@:
289
		@@:
286
		cmp ah,199 ;Ctrl+Home
290
		cmp ah,199 ;Ctrl+Home
287
		jne @f
291
		jne @f
288
			call ted_key_ctrl_home
292
			call ted_key_ctrl_home
289
		@@:
293
		@@:
290
		cmp ah,207 ;Ctrl+End
294
		cmp ah,207 ;Ctrl+End
291
		jne @f
295
		jne @f
292
			call ted_key_ctrl_end
296
			call ted_key_ctrl_end
293
		@@:
297
		@@:
294
		jmp .end_key_fun
298
		jmp .end_key_fun
295
	.key_Ctrl:
299
	.key_Ctrl:
296
 
300
 
297
	test esi,KM_SHIFT ;Shift+...
301
	test esi,KM_SHIFT ;Shift+...
298
	jz .key_Shift
302
	jz .key_Shift
299
		cmp ah,72 ;Shift+Up
303
		cmp ah,72 ;Shift+Up
300
		jne @f
304
		jne @f
301
			call ted_sel_key_up
305
			call ted_sel_key_up
302
		@@:
306
		@@:
303
		cmp ah,75 ;Shift+Left
307
		cmp ah,75 ;Shift+Left
304
		jne @f
308
		jne @f
305
			call ted_sel_key_left
309
			call ted_sel_key_left
306
		@@:
310
		@@:
307
		cmp ah,77 ;Shift+Right
311
		cmp ah,77 ;Shift+Right
308
		jne @f
312
		jne @f
309
			call ted_sel_key_right
313
			call ted_sel_key_right
310
		@@:
314
		@@:
311
		cmp ah,80 ;Shift+Down
315
		cmp ah,80 ;Shift+Down
312
		jne @f
316
		jne @f
313
			call ted_sel_key_down
317
			call ted_sel_key_down
314
		@@:
318
		@@:
315
		;mov ted_drag_k,1 ;­ ç¨­ ¥¬ ¢ë¤¥«¥­¨¥ ®â ª« ¢¨ âãàë
319
		;mov ted_drag_k,1 ;­ ç¨­ ¥¬ ¢ë¤¥«¥­¨¥ ®â ª« ¢¨ âãàë
316
		jmp .key_MoveCur
320
		jmp .key_MoveCur
317
	.key_Shift:
321
	.key_Shift:
318
;-------------------------------------------------
322
;-------------------------------------------------
319
	cmp ah,72 ;178 ;Up
323
	cmp ah,72 ;178 ;Up
320
	jne @f
324
	jne @f
321
		call ted_draw_cursor_sumb
325
		call ted_draw_cursor_sumb
322
		call ted_cur_move_up
326
		call ted_cur_move_up
323
		cmp dl,8
327
		cmp dl,8
324
		jne .no_red_0
328
		jne .no_red_0
325
			call ted_scroll_set_redraw
329
			call ted_scroll_set_redraw
326
			stdcall ted_draw,edi
330
			stdcall ted_draw,edi
327
			jmp @f
331
			jmp @f
328
		.no_red_0:
332
		.no_red_0:
329
		call ted_draw_main_cursor
333
		call ted_draw_main_cursor
330
		mov ted_drag_k,0 ;§ ª ­ç¨¢ ¥¬ ¢ë¤¥«¥­¨¥ ®â ª« ¢¨ âãàë
334
		mov ted_drag_k,0 ;§ ª ­ç¨¢ ¥¬ ¢ë¤¥«¥­¨¥ ®â ª« ¢¨ âãàë
331
	@@:
335
	@@:
332
	cmp ah,80 ;177 ;Down
336
	cmp ah,80 ;177 ;Down
333
	jne @f
337
	jne @f
334
		call ted_draw_cursor_sumb
338
		call ted_draw_cursor_sumb
335
		call ted_cur_move_down
339
		call ted_cur_move_down
336
		cmp dl,8
340
		cmp dl,8
337
		jne .no_red_1
341
		jne .no_red_1
338
			call ted_scroll_set_redraw
342
			call ted_scroll_set_redraw
339
			stdcall ted_draw,edi
343
			stdcall ted_draw,edi
340
			jmp @f
344
			jmp @f
341
		.no_red_1:
345
		.no_red_1:
342
		call ted_draw_main_cursor
346
		call ted_draw_main_cursor
343
		mov ted_drag_k,0 ;§ ª ­ç¨¢ ¥¬ ¢ë¤¥«¥­¨¥ ®â ª« ¢¨ âãàë
347
		mov ted_drag_k,0 ;§ ª ­ç¨¢ ¥¬ ¢ë¤¥«¥­¨¥ ®â ª« ¢¨ âãàë
344
	@@:
348
	@@:
345
	cmp ah,75 ;176 ;Left
349
	cmp ah,75 ;176 ;Left
346
	jne @f
350
	jne @f
347
		call ted_draw_cursor_sumb
351
		call ted_draw_cursor_sumb
348
		call ted_cur_move_left
352
		call ted_cur_move_left
349
		cmp dl,8
353
		cmp dl,8
350
		jne .no_red_2
354
		jne .no_red_2
351
			call ted_scroll_set_redraw
355
			call ted_scroll_set_redraw
352
			stdcall ted_draw,edi
356
			stdcall ted_draw,edi
353
			jmp @f
357
			jmp @f
354
		.no_red_2:
358
		.no_red_2:
355
		call ted_draw_main_cursor
359
		call ted_draw_main_cursor
356
		mov ted_drag_k,0 ;§ ª ­ç¨¢ ¥¬ ¢ë¤¥«¥­¨¥ ®â ª« ¢¨ âãàë
360
		mov ted_drag_k,0 ;§ ª ­ç¨¢ ¥¬ ¢ë¤¥«¥­¨¥ ®â ª« ¢¨ âãàë
357
	@@:
361
	@@:
358
	cmp ah,77 ;179 ;Right
362
	cmp ah,77 ;179 ;Right
359
	jne @f
363
	jne @f
360
		call ted_draw_cursor_sumb
364
		call ted_draw_cursor_sumb
361
		call ted_cur_move_right
365
		call ted_cur_move_right
362
		cmp dl,8
366
		cmp dl,8
363
		jne .no_red_3
367
		jne .no_red_3
364
			call ted_scroll_set_redraw
368
			call ted_scroll_set_redraw
365
			stdcall ted_draw,edi
369
			stdcall ted_draw,edi
366
			jmp @f
370
			jmp @f
367
		.no_red_3:
371
		.no_red_3:
368
		call ted_draw_main_cursor
372
		call ted_draw_main_cursor
369
		mov ted_drag_k,0 ;§ ª ­ç¨¢ ¥¬ ¢ë¤¥«¥­¨¥ ®â ª« ¢¨ âãàë
373
		mov ted_drag_k,0 ;§ ª ­ç¨¢ ¥¬ ¢ë¤¥«¥­¨¥ ®â ª« ¢¨ âãàë
370
	@@:
374
	@@:
371
	cmp ah,71 ;180 ;Home
375
	cmp ah,71 ;180 ;Home
372
	jne @f
376
	jne @f
373
		call ted_draw_cursor_sumb
377
		call ted_draw_cursor_sumb
374
		call ted_cur_move_x_first_char
378
		call ted_cur_move_x_first_char
375
		cmp dl,8
379
		cmp dl,8
376
		jne .no_red_4
380
		jne .no_red_4
377
			call ted_scroll_set_redraw
381
			call ted_scroll_set_redraw
378
			stdcall ted_draw,edi
382
			stdcall ted_draw,edi
379
			jmp @f
383
			jmp @f
380
		.no_red_4:
384
		.no_red_4:
381
		call ted_draw_main_cursor
385
		call ted_draw_main_cursor
382
		mov ted_drag_k,0 ;§ ª ­ç¨¢ ¥¬ ¢ë¤¥«¥­¨¥ ®â ª« ¢¨ âãàë
386
		mov ted_drag_k,0 ;§ ª ­ç¨¢ ¥¬ ¢ë¤¥«¥­¨¥ ®â ª« ¢¨ âãàë
383
	@@:
387
	@@:
384
	cmp ah,79 ;181 ;End
388
	cmp ah,79 ;181 ;End
385
	jne @f
389
	jne @f
386
		call ted_draw_cursor_sumb
390
		call ted_draw_cursor_sumb
387
		call ted_cur_move_x_last_char
391
		call ted_cur_move_x_last_char
388
		cmp dl,8
392
		cmp dl,8
389
		jne .no_red_5
393
		jne .no_red_5
390
			call ted_scroll_set_redraw
394
			call ted_scroll_set_redraw
391
			stdcall ted_draw,edi
395
			stdcall ted_draw,edi
392
			jmp @f
396
			jmp @f
393
		.no_red_5:
397
		.no_red_5:
394
		call ted_draw_main_cursor
398
		call ted_draw_main_cursor
395
		mov ted_drag_k,0 ;§ ª ­ç¨¢ ¥¬ ¢ë¤¥«¥­¨¥ ®â ª« ¢¨ âãàë
399
		mov ted_drag_k,0 ;§ ª ­ç¨¢ ¥¬ ¢ë¤¥«¥­¨¥ ®â ª« ¢¨ âãàë
396
	@@:
400
	@@:
397
	cmp ah,73 ;184 ;PageUp
401
	cmp ah,73 ;184 ;PageUp
398
	jne @f
402
	jne @f
399
		call ted_cur_move_page_up
403
		call ted_cur_move_page_up
400
		cmp dl,0
404
		cmp dl,0
401
		je @f
405
		je @f
402
		call ted_scroll_set_redraw
406
		call ted_scroll_set_redraw
403
		stdcall ted_draw,edi
407
		stdcall ted_draw,edi
404
	@@:
408
	@@:
405
	cmp ah,81 ;183 ;PageDown
409
	cmp ah,81 ;183 ;PageDown
406
	jne @f
410
	jne @f
407
		call ted_cur_move_page_down
411
		call ted_cur_move_page_down
408
		cmp dl,0
412
		cmp dl,0
409
		je @f
413
		je @f
410
		call ted_scroll_set_redraw
414
		call ted_scroll_set_redraw
411
		stdcall ted_draw,edi
415
		stdcall ted_draw,edi
412
		mov ted_drag_k,0 ;§ ª ­ç¨¢ ¥¬ ¢ë¤¥«¥­¨¥ ®â ª« ¢¨ âãàë
416
		mov ted_drag_k,0 ;§ ª ­ç¨¢ ¥¬ ¢ë¤¥«¥­¨¥ ®â ª« ¢¨ âãàë
413
	@@:
417
	@@:
414
;-------------------------------------------------
418
;-------------------------------------------------
415
	.key_MoveCur:
419
	.key_MoveCur:
416
 
420
 
417
	;­¨¦¥ ¯à®¯ã᪠îâáï á«ã¦¥¡­ë¥ ª« ¢¨è¨, ª®â®àë¥ ¬®£ãâ ¤ ¢ âì ¬ãá®à­ë¥ ᨬ¢®«ë ¢ ®ª­®
421
	;­¨¦¥ ¯à®¯ã᪠îâáï á«ã¦¥¡­ë¥ ª« ¢¨è¨, ª®â®àë¥ ¬®£ãâ ¤ ¢ âì ¬ãá®à­ë¥ ᨬ¢®«ë ¢ ®ª­®
418
	cmp ah,42 ;[L Shift] ª®£¤  ­ ¦ â ¡¥§ ¤àã£¨å ª­®¯®ª
422
	cmp ah,42 ;[L Shift] ª®£¤  ­ ¦ â ¡¥§ ¤àã£¨å ª­®¯®ª
419
	je .end_key_fun
423
	je .end_key_fun
420
	cmp ah,54 ;[R Shift] ª®£¤  ­ ¦ â ¡¥§ ¤àã£¨å ª­®¯®ª
424
	cmp ah,54 ;[R Shift] ª®£¤  ­ ¦ â ¡¥§ ¤àã£¨å ª­®¯®ª
421
	je .end_key_fun
425
	je .end_key_fun
422
	cmp ah,58 ;[Caps Lock]
426
	cmp ah,58 ;[Caps Lock]
423
	je .end_key_fun
427
	je .end_key_fun
424
	cmp ah,69 ;[Pause Break]
428
	cmp ah,69 ;[Pause Break]
425
	je .end_key_fun
429
	je .end_key_fun
426
	cmp ah,120 ;[Fn]
430
	cmp ah,120 ;[Fn]
427
	je .end_key_fun
431
	je .end_key_fun
428
	cmp ah,0x80 ;if key up
432
	cmp ah,0x80 ;if key up
429
	ja .end_key_fun
433
	ja .end_key_fun
430
 
434
 
431
	cmp dword[table],0
435
	cmp dword[table],0
432
	je @f
436
	je @f
433
		stdcall KeyConvertToASCII, dword[table]
437
		stdcall KeyConvertToASCII, dword[table]
434
	@@:
438
	@@:
435
 
439
 
436
	;mov ted_drag_k,0 ;§ ª ­ç¨¢ ¥¬ ¢ë¤¥«¥­¨¥ ®â ª« ¢¨ âãàë
440
	;mov ted_drag_k,0 ;§ ª ­ç¨¢ ¥¬ ¢ë¤¥«¥­¨¥ ®â ª« ¢¨ âãàë
437
 
441
 
438
	lea edx,[EvChar] ;¡¥à¥¬  ¤à¥á â ¡«¨æë á ¤®¯ãá⨬묨 ᨬ¢®« ¬¨
442
	lea edx,[EvChar] ;¡¥à¥¬  ¤à¥á â ¡«¨æë á ¤®¯ãá⨬묨 ᨬ¢®« ¬¨
439
	add dl,ah
443
	add dl,ah
440
	jae @f
444
	jae @f
441
		add edx,0x100 ;¥á«¨ ¡ë«® ¯¥à¥¯®«­¥­¨¥ ¯à¨ ¤®¡ ¢«¥­¨¨ ª®¤  ᨬ¢®« 
445
		add edx,0x100 ;¥á«¨ ¡ë«® ¯¥à¥¯®«­¥­¨¥ ¯à¨ ¤®¡ ¢«¥­¨¨ ª®¤  ᨬ¢®« 
442
	@@:
446
	@@:
443
	cmp byte[edx],1
447
	cmp byte[edx],1
444
	jne @f
448
	jne @f
445
		mov ted_key_new,ah
449
		mov ted_key_new,ah
446
		call ted_set_undo
450
		call ted_set_undo
447
		mov edx,ted_opt_ed_change_time+ted_opt_ed_move_cursor
451
		mov edx,ted_opt_ed_change_time+ted_opt_ed_move_cursor
448
		stdcall ted_sel_text_del,edx
452
		stdcall ted_sel_text_del,edx
449
		cmp al,1
453
		cmp al,1
450
		jne .del
454
		jne .del
451
			mov edx,ted_opt_ed_move_cursor
455
			mov edx,ted_opt_ed_move_cursor
452
		.del:
456
		.del:
453
		cmp ted_cur_ins,1
457
		cmp ted_cur_ins,1
454
		je .no_ins_mod
458
		je .no_ins_mod
455
			stdcall ted_text_del,edi,ted_opt_ed_change_time
459
			stdcall ted_text_del,edi,ted_opt_ed_change_time
456
			mov edx,ted_opt_ed_move_cursor
460
			mov edx,ted_opt_ed_move_cursor
457
		.no_ins_mod:
461
		.no_ins_mod:
458
		mov ecx,edi
462
		mov ecx,edi
459
		add ecx,ted_offs_key_new
463
		add ecx,ted_offs_key_new
460
		stdcall ted_text_add,edi,ecx,1,edx ;¤®¡ ¢«ï¥¬ ᨬ¢®« ¢¢¥¤¥­­ë© á ª« ¢¨ âãàë
464
		stdcall ted_text_add,edi,ecx,1,edx ;¤®¡ ¢«ï¥¬ ᨬ¢®« ¢¢¥¤¥­­ë© á ª« ¢¨ âãàë
461
		cmp ted_key_new,13
465
		cmp ted_key_new,13
462
		jne .dr_m_win
466
		jne .dr_m_win
463
			;¥á«¨ ¢áâ ¢¨«¨ ᨬ¢®« ­®¢®© áâப¨
467
			;¥á«¨ ¢áâ ¢¨«¨ ᨬ¢®« ­®¢®© áâப¨
464
			mov ecx,ted_scr_w
468
			mov ecx,ted_scr_w
465
			inc dword[ecx+sb_offs_max_area] ;㢥«¨ç¨¢ ¥¬ à §¬¥à ¢¥à⨪ «ì­®£® áªà®««¨­£ 
469
			inc dword[ecx+sb_offs_max_area] ;㢥«¨ç¨¢ ¥¬ à §¬¥à ¢¥à⨪ «ì­®£® áªà®««¨­£ 
466
			mov edx,ted_cur_y
470
			mov edx,ted_cur_y
467
			cmp edx,[ecx+sb_offs_cur_area]
471
			cmp edx,[ecx+sb_offs_cur_area]
468
			jl .no_change
472
			jl .no_change
469
				dec ted_cur_y ;ªãàá®à ®áâ ¢«ï¥¬ ­  ¬¥áâ¥
473
				dec ted_cur_y ;ªãàá®à ®áâ ¢«ï¥¬ ­  ¬¥áâ¥
470
				inc dword[ecx+sb_offs_position] ;ᤢ¨£ ¥¬ ¯®«§ã­®ª
474
				inc dword[ecx+sb_offs_position] ;ᤢ¨£ ¥¬ ¯®«§ã­®ª
471
			.no_change:
475
			.no_change:
472
			stdcall ted_draw,edi
476
			stdcall ted_draw,edi
473
			jmp .dr_cur_l
477
			jmp .dr_cur_l
474
		.dr_m_win:
478
		.dr_m_win:
475
			stdcall ted_draw_cur_line,edi
479
			stdcall ted_draw_cur_line,edi
476
		.dr_cur_l:
480
		.dr_cur_l:
477
		cmp ted_fun_draw_panel_buttons,0
481
		cmp ted_fun_draw_panel_buttons,0
478
		je @f
482
		je @f
479
			call ted_fun_draw_panel_buttons
483
			call ted_fun_draw_panel_buttons
480
	@@:
484
	@@:
481
 
485
 
482
	cmp ah,8 ;[<-]
486
	cmp ah,8 ;[<-]
483
	jne @f
487
	jne @f
484
		call ted_set_undo
488
		call ted_set_undo
485
		stdcall ted_sel_text_del,ted_opt_ed_change_time
489
		stdcall ted_sel_text_del,ted_opt_ed_change_time
486
		cmp al,1
490
		cmp al,1
487
		je .del_one_b
491
		je .del_one_b
488
			stdcall ted_text_del,edi,ted_opt_ed_change_time+ted_opt_ed_move_cursor
492
			stdcall ted_text_del,edi,ted_opt_ed_change_time+ted_opt_ed_move_cursor
489
		.del_one_b:
493
		.del_one_b:
490
		stdcall ted_draw,edi
494
		stdcall ted_draw,edi
491
		cmp ted_fun_draw_panel_buttons,0
495
		cmp ted_fun_draw_panel_buttons,0
492
		je .end_key_fun
496
		je .end_key_fun
493
			call ted_fun_draw_panel_buttons
497
			call ted_fun_draw_panel_buttons
494
		jmp .end_key_fun
498
		jmp .end_key_fun
495
align 4
499
align 4
496
	@@:
500
	@@:
497
 
501
 
498
	cmp ah,182 ;Delete
502
	cmp ah,182 ;Delete
499
	jne @f
503
	jne @f
500
		call ted_set_undo
504
		call ted_set_undo
501
		stdcall ted_sel_text_del,ted_opt_ed_change_time
505
		stdcall ted_sel_text_del,ted_opt_ed_change_time
502
		cmp al,1
506
		cmp al,1
503
		je .del_one_d
507
		je .del_one_d
504
			stdcall ted_text_del,edi,ted_opt_ed_change_time
508
			stdcall ted_text_del,edi,ted_opt_ed_change_time
505
		.del_one_d:
509
		.del_one_d:
506
		stdcall ted_draw,edi
510
		stdcall ted_draw,edi
507
		cmp ted_fun_draw_panel_buttons,0
511
		cmp ted_fun_draw_panel_buttons,0
508
		je .end_key_fun
512
		je .end_key_fun
509
			call ted_fun_draw_panel_buttons
513
			call ted_fun_draw_panel_buttons
510
		jmp .end_key_fun
514
		jmp .end_key_fun
511
	@@:
515
	@@:
512
 
516
 
513
	cmp ah,185 ;Ins
517
	cmp ah,185 ;Ins
514
	jne @f
518
	jne @f
515
		call ted_draw_cursor_sumb
519
		call ted_draw_cursor_sumb
516
		xor ted_cur_ins,1
520
		xor ted_cur_ins,1
517
		call ted_draw_main_cursor
521
		call ted_draw_main_cursor
518
	@@:
522
	@@:
519
 
523
 
520
	.end_key_fun:
524
	.end_key_fun:
521
	popad
525
	popad
522
	ret
526
	ret
523
endp
527
endp
524
 
528
 
525
;output:
529
;output:
526
; al = 1 - can save
530
; al = 1 - can save
527
align 16
531
align 16
528
proc ted_can_save uses ecx edi, edit:dword
532
proc ted_can_save uses ecx edi, edit:dword
529
	mov edi,[edit]
533
	mov edi,[edit]
530
 
534
 
531
	mov ecx,ted_tim_ch
535
	mov ecx,ted_tim_ch
532
	sub ecx,ted_tim_undo
536
	sub ecx,ted_tim_undo
533
	mov al,1
537
	mov al,1
534
	cmp ted_tim_ls,ecx
538
	cmp ted_tim_ls,ecx
535
	jne @f
539
	jne @f
536
		dec al
540
		dec al
537
	@@:
541
	@@:
538
	ret
542
	ret
539
endp
543
endp
540
 
544
 
541
;input:
545
;input:
542
; edi = pointer to tedit struct
546
; edi = pointer to tedit struct
543
;output:
547
;output:
544
; al = 1 - selected
548
; al = 1 - selected
545
align 16
549
align 16
546
proc ted_is_select uses ebx
550
proc ted_is_select uses ebx
547
	xor al,al
551
	xor al,al
548
	cmp ted_drag_m,1
552
	cmp ted_drag_m,1
549
	je @f
553
	je @f
550
		mov al,1
554
		mov al,1
551
		mov ebx,ted_sel_x0
555
		mov ebx,ted_sel_x0
552
		cmp ebx,ted_sel_x1
556
		cmp ebx,ted_sel_x1
553
		jne @f
557
		jne @f
554
		mov ebx,ted_sel_y0
558
		mov ebx,ted_sel_y0
555
		cmp ebx,ted_sel_y1
559
		cmp ebx,ted_sel_y1
556
		jne @f
560
		jne @f
557
		xor al,al
561
		xor al,al
558
	@@:
562
	@@:
559
	ret
563
	ret
560
endp
564
endp
561
 
565
 
562
;input:
566
;input:
563
; edi = pointer to tedit struct
567
; edi = pointer to tedit struct
564
align 16
568
align 16
565
proc ted_sel_normalize uses ecx esi
569
proc ted_sel_normalize uses ecx esi
566
	push edi
570
	push edi
567
		mov esi,edi
571
		mov esi,edi
568
		add esi,ted_offs_sel
572
		add esi,ted_offs_sel
569
		add edi,ted_offs_seln
573
		add edi,ted_offs_seln
570
		mov ecx,sizeof.TexSelect
574
		mov ecx,sizeof.TexSelect
571
		rep movsb
575
		rep movsb
572
	pop edi
576
	pop edi
573
 
577
 
574
	jmp @f
578
	jmp @f
575
		.swp_f:
579
		.swp_f:
576
		mov ecx,ted_seln_x0
580
		mov ecx,ted_seln_x0
577
		m2m ted_seln_x0,ted_seln_x1
581
		m2m ted_seln_x0,ted_seln_x1
578
		mov ted_seln_x1,ecx
582
		mov ted_seln_x1,ecx
579
 
583
 
580
		mov ecx,ted_seln_y0
584
		mov ecx,ted_seln_y0
581
		cmp ecx,ted_seln_y1 ;(sel_y0>sel_y1)
585
		cmp ecx,ted_seln_y1 ;(sel_y0>sel_y1)
582
		jle .end_f
586
		jle .end_f
583
		m2m ted_seln_y0,ted_seln_y1
587
		m2m ted_seln_y0,ted_seln_y1
584
		mov ted_seln_y1,ecx
588
		mov ted_seln_y1,ecx
585
 
589
 
586
		jmp .end_f
590
		jmp .end_f
587
align 4
591
align 4
588
	@@:
592
	@@:
589
 
593
 
590
	mov ecx,ted_seln_y0
594
	mov ecx,ted_seln_y0
591
	cmp ecx,ted_seln_y1 ;(sel_y0>sel_y1)
595
	cmp ecx,ted_seln_y1 ;(sel_y0>sel_y1)
592
	jg .swp_f
596
	jg .swp_f
593
 
597
 
594
	cmp ecx,ted_seln_y1 ;(sel_y0==sel_y1)
598
	cmp ecx,ted_seln_y1 ;(sel_y0==sel_y1)
595
	jne .end_f
599
	jne .end_f
596
		mov ecx,ted_seln_x0
600
		mov ecx,ted_seln_x0
597
		cmp ecx,ted_seln_x1 ;(sel_x0>sel_x1)
601
		cmp ecx,ted_seln_x1 ;(sel_x0>sel_x1)
598
		jg .swp_f
602
		jg .swp_f
599
 
603
 
600
	.end_f:
604
	.end_f:
601
	ret
605
	ret
602
endp
606
endp
603
 
607
 
604
;input:
608
;input:
605
; edi = pointer to tedit struct
609
; edi = pointer to tedit struct
606
;description:
610
;description:
607
; ”ã­ªæ¨ï ¢ë§ë¢ ¥¬ ï ¯à¨ ­ ç «¥ ¢ë¤¥«¥­¨ï
611
; ”ã­ªæ¨ï ¢ë§ë¢ ¥¬ ï ¯à¨ ­ ç «¥ ¢ë¤¥«¥­¨ï
608
align 16
612
align 16
609
proc ted_sel_start uses eax ecx
613
proc ted_sel_start uses eax ecx
610
	mov eax,ted_scr_h
614
	mov eax,ted_scr_h
611
	mov ecx,ted_cur_x
615
	mov ecx,ted_cur_x
612
	add ecx,dword[eax+sb_offs_position]
616
	add ecx,[eax+sb_offs_position]
613
	mov ted_sel_x0,ecx
617
	mov ted_sel_x0,ecx
614
	mov ted_sel_x1,ecx
618
	mov ted_sel_x1,ecx
615
 
619
 
616
	mov eax,ted_scr_w
620
	mov eax,ted_scr_w
617
	mov ecx,ted_cur_y
621
	mov ecx,ted_cur_y
618
	add ecx,dword[eax+sb_offs_position]
622
	add ecx,[eax+sb_offs_position]
619
	mov ted_sel_y0,ecx
623
	mov ted_sel_y0,ecx
620
	mov ted_sel_y1,ecx
624
	mov ted_sel_y1,ecx
621
	ret
625
	ret
622
endp
626
endp
623
 
627
 
624
;input:
628
;input:
625
; edi = pointer to tedit struct
629
; edi = pointer to tedit struct
626
;description:
630
;description:
627
; ”ã­ªæ¨ï ¢ë§ë¢ ¥¬ ï ¯à¨ ¯¥à¥¬¥é¥­¨¨ ¢ë¤¥«¥­¨ï
631
; ”ã­ªæ¨ï ¢ë§ë¢ ¥¬ ï ¯à¨ ¯¥à¥¬¥é¥­¨¨ ¢ë¤¥«¥­¨ï
628
align 16
632
align 16
629
proc ted_sel_move
633
proc ted_sel_move
630
	push eax ecx
634
	push eax ecx
631
		mov ecx,ted_cur_x
635
		mov ecx,ted_cur_x
632
		mov eax,ted_scr_h
636
		mov eax,ted_scr_h
633
		add ecx,dword[eax+sb_offs_position]
637
		add ecx,[eax+sb_offs_position]
634
		mov ted_sel_x1,ecx
638
		mov ted_sel_x1,ecx
635
 
639
 
636
		mov eax,ted_scr_w
640
		mov eax,ted_scr_w
637
		mov ecx,ted_cur_y
641
		mov ecx,ted_cur_y
638
		add ecx,dword[eax+sb_offs_position]
642
		add ecx,[eax+sb_offs_position]
639
		mov ted_sel_y1,ecx
643
		mov ted_sel_y1,ecx
640
	pop ecx eax
644
	pop ecx eax
641
	cmp ted_fun_draw_panel_buttons,0 ;redraw toolbar (need to button Copy)
645
	cmp ted_fun_draw_panel_buttons,0 ;redraw toolbar (need to button Copy)
642
	je @f
646
	je @f
643
		call ted_fun_draw_panel_buttons
647
		call ted_fun_draw_panel_buttons
644
	@@:
648
	@@:
645
	ret
649
	ret
646
endp
650
endp
647
 
651
 
648
;input:
652
;input:
649
; edi = pointer to tedit struct
653
; edi = pointer to tedit struct
650
;description:
654
;description:
651
; ”ã­ªæ¨ï ¢ë§ë¢ ¥¬ ï ¯à¨ ¢ë¤¥«¥­¨¨ ¢á¥£® ¤®ªã¬¥­â 
655
; ”ã­ªæ¨ï ¢ë§ë¢ ¥¬ ï ¯à¨ ¢ë¤¥«¥­¨¨ ¢á¥£® ¤®ªã¬¥­â 
652
align 16
656
align 16
653
proc ted_sel_all
657
proc ted_sel_all
654
	push eax
658
	push eax
655
		xor eax,eax
659
		xor eax,eax
656
		mov ted_sel_x0,eax
660
		mov ted_sel_x0,eax
657
		mov ted_sel_y0,eax
661
		mov ted_sel_y0,eax
658
 
662
 
659
		mov ted_sel_x1,eax ;???
663
		mov ted_sel_x1,eax ;???
660
		call ted_get_num_lines
664
		call ted_get_num_lines
661
		mov ted_sel_y1,eax
665
		mov ted_sel_y1,eax
662
	pop eax
666
	pop eax
663
	stdcall ted_draw,edi
667
	stdcall ted_draw,edi
664
	cmp ted_fun_draw_panel_buttons,0 ;redraw toolbar (need to button Copy)
668
	cmp ted_fun_draw_panel_buttons,0 ;redraw toolbar (need to button Copy)
665
	je @f
669
	je @f
666
		call ted_fun_draw_panel_buttons
670
		call ted_fun_draw_panel_buttons
667
	@@:
671
	@@:
668
	ret
672
	ret
669
endp
673
endp
670
 
674
 
671
;input:
675
;input:
672
; cl_al_mem = 1 - clear all memory
676
; cl_al_mem = 1 - clear all memory
673
align 16
677
align 16
674
proc ted_clear uses ecx edi, edit:dword, cl_al_mem:dword
678
proc ted_clear uses ecx edi, edit:dword, cl_al_mem:dword
675
	mov edi,[edit]
679
	mov edi,[edit]
676
 
680
 
677
	mov ted_cur_x,0
681
	mov ted_cur_x,0
678
	mov ted_cur_y,0
682
	mov ted_cur_y,0
679
	mov ted_tim_ch,0
683
	mov ted_tim_ch,0
680
	mov ted_tim_ls,0
684
	mov ted_tim_ls,0
681
	mov ted_tim_co,0
685
	mov ted_tim_co,0
682
	mov ted_tim_undo,0
686
	mov ted_tim_undo,0
683
	mov ted_help_id,-1
687
	mov ted_help_id,-1
684
	mov ecx,sizeof.symbol
688
	mov ecx,sizeof.symbol
685
	shl ecx,1
689
	shl ecx,1
686
	add ecx,ted_tex
690
	add ecx,ted_tex
687
	mov ted_ptr_free_symb,ecx
691
	mov ted_ptr_free_symb,ecx
688
 
692
 
689
	mov ecx,ted_scr_w
693
	mov ecx,ted_scr_w
690
	mov dword[ecx+sb_offs_position],0
694
	mov dword[ecx+sb_offs_position],0
691
	mov dword[ecx+sb_offs_max_area],100 ;ç¨á«® áâப ¢¨¤¨¬ëå ¢ ­®¢®¬ ¤®ªã¬¥­â¥
695
	mov dword[ecx+sb_offs_max_area],100 ;ç¨á«® áâப ¢¨¤¨¬ëå ¢ ­®¢®¬ ¤®ªã¬¥­â¥
692
	mov dword[ecx+sb_offs_redraw],1
696
	mov dword[ecx+sb_offs_redraw],1
693
	mov ecx,ted_scr_h
697
	mov ecx,ted_scr_h
694
	mov dword[ecx+sb_offs_position],0
698
	mov dword[ecx+sb_offs_position],0
695
	mov dword[ecx+sb_offs_max_area],100 ;ç¨á«® ᨬ¢®«®¢ ¢¨¤¨¬ëå ¢ ­®¢®¬ ¤®ªã¬¥­â¥
699
	mov dword[ecx+sb_offs_max_area],100 ;ç¨á«® ᨬ¢®«®¢ ¢¨¤¨¬ëå ¢ ­®¢®¬ ¤®ªã¬¥­â¥
696
 
700
 
697
	mov ted_sel_x0,0
701
	mov ted_sel_x0,0
698
	mov ted_sel_y0,0
702
	mov ted_sel_y0,0
699
	mov ted_sel_x1,0
703
	mov ted_sel_x1,0
700
	mov ted_sel_y1,0
704
	mov ted_sel_y1,0
701
 
705
 
702
	cmp dword[cl_al_mem],0
706
	cmp dword[cl_al_mem],0
703
	je .exit
707
	je .exit
704
 
708
 
705
	push edx
709
	push edx
706
	mov ecx,sizeof.symbol
710
	mov ecx,sizeof.symbol
707
	imul ecx,ted_max_chars
711
	imul ecx,ted_max_chars
708
	mov edx,ted_tex
712
	mov edx,ted_tex
709
	@@:
713
	@@:
710
		mov byte [edx],0
714
		mov byte [edx],0
711
		inc edx
715
		inc edx
712
	loop @b
716
	loop @b
713
	mov edx,ted_tex
717
	mov edx,ted_tex
714
	mov dword [edx+6],1
718
	mov dword [edx+6],1
715
	pop edx
719
	pop edx
716
 
720
 
717
	.exit:
721
	.exit:
718
	ret
722
	ret
719
endp
723
endp
720
 
724
 
721
 
725
 
722
align 16
726
align 16
723
proc ted_init_syntax_file, edit:dword
727
proc ted_init_syntax_file, edit:dword
724
	pushad
728
	pushad
725
	mov edi,[edit]
729
	mov edi,[edit]
726
 
730
 
727
	mov ecx,0x100
731
	mov ecx,0x100
728
	mov edx,ted_arr_key_pos
732
	mov edx,ted_arr_key_pos
729
	@@:
733
	@@:
730
		mov dword[edx],-1
734
		mov dword[edx],-1
731
		add edx,4
735
		add edx,4
732
	loop @b
736
	loop @b
733
 
737
 
734
	;init: ted_colors_text_count, ted_key_words_count, ...
738
	;init: ted_colors_text_count, ted_key_words_count, ...
735
	mov ted_colors_text_count,1
739
	mov ted_colors_text_count,1
736
	mov ted_key_words_count,0
740
	mov ted_key_words_count,0
737
	mov ted_help_text_f1,0
741
	mov ted_help_text_f1,0
738
	mov ted_help_id,-1 ;¨¤¥­â¨ä¨ª â®à á«®¢  ¤«ï á¯à ¢ª¨
742
	mov ted_help_id,-1 ;¨¤¥­â¨ä¨ª â®à á«®¢  ¤«ï á¯à ¢ª¨
739
 
743
 
740
	mov eax,edi ;á®å࠭塞 §­ ç¥­¨¥ edi
744
	mov eax,edi ;á®å࠭塞 §­ ç¥­¨¥ edi
741
	mov esi,ted_syntax_file
745
	mov esi,ted_syntax_file
742
	add edi,ted_offs_count_colors
746
	add edi,ted_offs_count_colors
743
	mov ecx,9*4
747
	mov ecx,9*4
744
	rep movsb
748
	rep movsb
745
	mov edi,eax ;¢®áâ ­ ¢«¨¢ ¥¬ §­ ç¥­¨¥ edi
749
	mov edi,eax ;¢®áâ ­ ¢«¨¢ ¥¬ §­ ç¥­¨¥ edi
746
 
750
 
747
	mov eax,ted_syntax_file
751
	mov eax,ted_syntax_file
748
	add eax,32
752
	add eax,32
749
	mov ted_text_colors,eax
753
	mov ted_text_colors,eax
750
 
754
 
751
	mov eax,ted_colors_text_count ;init: count_colors_text (offset to key words)
755
	mov eax,ted_colors_text_count ;init: count_colors_text (offset to key words)
752
	add eax,8
756
	add eax,8
753
	shl eax,2
757
	shl eax,2
754
	add eax,ted_syntax_file
758
	add eax,ted_syntax_file
755
	mov ted_key_words_data,eax
759
	mov ted_key_words_data,eax
756
 
760
 
757
	mov ecx,ted_key_words_count ;init: ted_arr_key_pos (first key positions)
761
	mov ecx,ted_key_words_count ;init: ted_arr_key_pos (first key positions)
758
	xor eax,eax
762
	xor eax,eax
759
	@@:
763
	@@:
760
		ColToIndexOffset eax,edx
764
		ColToIndexOffset eax,edx
761
		xor ebx,ebx
765
		xor ebx,ebx
762
		mov bl,byte[edx]
766
		mov bl,byte[edx]
763
		shl bx,2
767
		shl bx,2
764
		mov esi,ted_arr_key_pos
768
		mov esi,ted_arr_key_pos
765
		add esi,ebx
769
		add esi,ebx
766
		cmp dword[esi],-1
770
		cmp dword[esi],-1
767
		jne .no_ch_key
771
		jne .no_ch_key
768
			mov dword[esi],eax
772
			mov dword[esi],eax
769
		.no_ch_key:
773
		.no_ch_key:
770
		inc eax
774
		inc eax
771
	loop @b
775
	loop @b
772
 
776
 
773
	;init: ted_help_text_f1
777
	;init: ted_help_text_f1
774
	mov ecx,ted_key_words_count ;ª®«¨ç¥á⢮ ª«î祢ëå á«®¢
778
	mov ecx,ted_key_words_count ;ª®«¨ç¥á⢮ ª«î祢ëå á«®¢
775
	imul ecx,sizeof.TexColViv   ;à §¬¥à áâàãªâãàë á 1-¬ ª«. á«.
779
	imul ecx,sizeof.TexColViv   ;à §¬¥à áâàãªâãàë á 1-¬ ª«. á«.
776
	add ecx,ted_key_words_data  ;­ ç «® ä ©«  á ª«. á«.
780
	add ecx,ted_key_words_data  ;­ ç «® ä ©«  á ª«. á«.
777
	mov ted_help_text_f1,ecx    ;¬¥âª  ¢ ¯ ¬ïâ¨, £¤¥ ­ ç¨­¥âáï ⥪áâ á® á¯à ¢ª®©
781
	mov ted_help_text_f1,ecx    ;¬¥âª  ¢ ¯ ¬ïâ¨, £¤¥ ­ ç¨­¥âáï ⥪áâ á® á¯à ¢ª®©
778
 
782
 
779
	stdcall ted_init_scroll_bars,edi,1 ;¬¥­ï¥¬ æ¢¥â  áªà®««¨­£®¢
783
	stdcall ted_init_scroll_bars,edi,1 ;¬¥­ï¥¬ æ¢¥â  áªà®««¨­£®¢
780
	.no_colors:
784
	.no_colors:
781
	popad
785
	popad
782
	ret
786
	ret
783
endp
787
endp
784
 
788
 
785
;input:
789
;input:
786
; ebx = file size
790
; ebx = file size
787
; edi = pointer to tedit struct
791
; edi = pointer to tedit struct
788
;description:
792
;description:
789
; ”ã­ªæ¨ï ¢ë§ë¢ ¥âáï ¯à¨ ®âªàë⨨ ä ©« 
793
; ”ã­ªæ¨ï ¢ë§ë¢ ¥âáï ¯à¨ ®âªàë⨨ ä ©« 
790
align 16
794
align 16
791
proc ted_on_open_file
795
proc ted_on_open_file
792
	push eax ;destination
796
	push eax ;destination
793
	push ecx ;for cycle
797
	push ecx ;for cycle
794
	push edx ;source
798
	push edx ;source
795
	push esi
799
	push esi
796
 
800
 
797
	stdcall ted_clear,edi,0 ;ç¨á⨬ ­¥ ¢áî ¯ ¬ïâì, ¯®â®¬ã çâ® ­¨¦¥ ¡ã¤¥¬ ¥¥ § ¯®«­ïâì ­®¢ë¬¨ ¤ ­ë¬¨
801
	stdcall ted_clear,edi,0 ;ç¨á⨬ ­¥ ¢áî ¯ ¬ïâì, ¯®â®¬ã çâ® ­¨¦¥ ¡ã¤¥¬ ¥¥ § ¯®«­ïâì ­®¢ë¬¨ ¤ ­ë¬¨
798
 
802
 
799
	;ª®£¤  ᨬ¢®« § ¢¥à襭¨ï áâப¨ ⮫쪮 10 (¡¥§ 13)
803
	;ª®£¤  ᨬ¢®« § ¢¥à襭¨ï áâப¨ ⮫쪮 10 (¡¥§ 13)
800
	mov edx,ted_tex
804
	mov edx,ted_tex
801
	mov ecx,ebx
805
	mov ecx,ebx
802
	@@:
806
	@@:
803
		cmp byte[edx],13
807
		cmp byte[edx],13
804
		je .no_10 ;¥á«¨ ­ ©¤¥­ ᨬ¢®« 13, â® 10-¥ ¨£­®à¨à㥬
808
		je .no_10 ;¥á«¨ ­ ©¤¥­ ᨬ¢®« 13, â® 10-¥ ¨£­®à¨à㥬
805
		inc edx
809
		inc edx
806
		loop @b
810
		loop @b
807
	mov edx,ted_tex
811
	mov edx,ted_tex
808
	mov ecx,ebx
812
	mov ecx,ebx
809
	.s_10:
813
	.s_10:
810
		cmp byte[edx],10
814
		cmp byte[edx],10
811
		jne @f
815
		jne @f
812
			mov byte[edx],13 ;¬¥­ï¥¬ 10-© ᨬ¢®« ª®­æ  áâப¨
816
			mov byte[edx],13 ;¬¥­ï¥¬ 10-© ᨬ¢®« ª®­æ  áâப¨
813
		@@:
817
		@@:
814
		inc edx
818
		inc edx
815
		loop .s_10
819
		loop .s_10
816
	.no_10:
820
	.no_10:
817
 
821
 
818
	;¯¥à¥¢®¤¨¬ ®âªàëâë© ä ©« ¢­ãâàì í«¥¬¥­â  t_edit
822
	;¯¥à¥¢®¤¨¬ ®âªàëâë© ä ©« ¢­ãâàì í«¥¬¥­â  t_edit
819
	mov eax,ebx
823
	mov eax,ebx
820
	mov ecx,ebx
824
	mov ecx,ebx
821
	add eax,2
825
	add eax,2
822
	ConvertIndexToPointer eax
826
	ConvertIndexToPointer eax
823
	mov edx,ted_tex
827
	mov edx,ted_tex
824
	add edx,ebx
828
	add edx,ebx
825
	push ebx
829
	push ebx
826
	@@:
830
	@@:
827
		mov ebx,[edx]
831
		mov ebx,[edx]
828
		mov byte [eax],bl
832
		mov byte [eax],bl
829
		mov dword [eax+2],ecx
833
		mov dword [eax+2],ecx
830
		inc dword [eax+2]
834
		inc dword [eax+2]
831
		mov dword [eax+6],ecx
835
		mov dword [eax+6],ecx
832
		add dword [eax+6],3
836
		add dword [eax+6],3
833
		;mov byte[eax+1],0 ;col=0
837
		;mov byte[eax+1],0 ;col=0
834
		mov dword [eax+10],-1 ;tc=-1
838
		mov dword [eax+10],-1 ;tc=-1
835
		mov dword [eax+14],0 ;td=0
839
		mov dword [eax+14],0 ;td=0
836
 
840
 
837
		cmp ecx,0
841
		cmp ecx,0
838
		je @f
842
		je @f
839
		dec ecx
843
		dec ecx
840
		dec edx
844
		dec edx
841
		sub eax,sizeof.symbol
845
		sub eax,sizeof.symbol
842
		jmp @b
846
		jmp @b
843
	@@:
847
	@@:
844
	pop ebx
848
	pop ebx
845
	add eax,2
849
	add eax,2
846
	mov dword [eax],0 ; first sumbol 'perv=0'
850
	mov dword [eax],0 ; first sumbol 'perv=0'
847
 
851
 
848
	mov edx,ted_tex ; ­ áâனª¨ ­ ç «ì­®£® á«ã¦¥¡­®£® ᨬ¢®« 
852
	mov edx,ted_tex ; ­ áâனª¨ ­ ç «ì­®£® á«ã¦¥¡­®£® ᨬ¢®« 
849
	; begining sumbol 'perv=0' 'next=2'
853
	; begining sumbol 'perv=0' 'next=2'
850
	mov dword [edx+2],0
854
	mov dword [edx+2],0
851
	mov dword [edx+6],2
855
	mov dword [edx+6],2
852
 
856
 
853
	add edx,sizeof.symbol ; ­ áâனª¨ ª®­¥ç­®£® á«ã¦¥¡­®£® ᨬ¢®« 
857
	add edx,sizeof.symbol ; ­ áâனª¨ ª®­¥ç­®£® á«ã¦¥¡­®£® ᨬ¢®« 
854
	mov dword [edx+6],0 ; last sumbol 'next=0'
858
	mov dword [edx+6],0 ; last sumbol 'next=0'
855
	mov dword [edx+2],ebx ; last sumbol 'perv=last'
859
	mov dword [edx+2],ebx ; last sumbol 'perv=last'
856
	inc dword [edx+2]
860
	inc dword [edx+2]
857
	mov dword [edx+10],0 ; áâ ¢¨¬ ¢à¥¬ï ᮧ¤ ­¨ï à ¢­®¥ 0, çâ® ¡ë ᨬ¢®« ¯à ¢¨«ì­® ®¡à ¡ â뢠«áï ¯à¨ ®âªàë⨨ ä ©«®¢ ¡®«ìè¨å 28 ¡ ©â
861
	mov dword [edx+10],0 ; áâ ¢¨¬ ¢à¥¬ï ᮧ¤ ­¨ï à ¢­®¥ 0, çâ® ¡ë ᨬ¢®« ¯à ¢¨«ì­® ®¡à ¡ â뢠«áï ¯à¨ ®âªàë⨨ ä ©«®¢ ¡®«ìè¨å 28 ¡ ©â
858
 
862
 
859
	mov edx,ebx
863
	mov edx,ebx
860
	inc edx ;2 = rezerv sumbols
864
	inc edx ;2 = rezerv sumbols
861
	imul edx,sizeof.symbol
865
	imul edx,sizeof.symbol
862
	add edx,ted_tex
866
	add edx,ted_tex
863
	mov dword [edx+6],1 ; last sumbol 'next=1'
867
	mov dword [edx+6],1 ; last sumbol 'next=1'
864
 
868
 
865
	@@: ;clear memory, need if before was open big file
869
	@@: ;clear memory, need if before was open big file
866
		add edx,sizeof.symbol
870
		add edx,sizeof.symbol
867
		cmp edx,ted_tex_end
871
		cmp edx,ted_tex_end
868
		jge @f
872
		jge @f
869
			mov dword[edx+10],0
873
			mov dword[edx+10],0
870
			mov dword[edx+14],0
874
			mov dword[edx+14],0
871
		jmp @b
875
		jmp @b
872
	@@:
876
	@@:
873
 
877
 
874
	call ted_get_num_lines
878
	call ted_get_num_lines
875
	cmp eax,TED_LINES_IN_NEW_FILE
879
	cmp eax,TED_LINES_IN_NEW_FILE
876
	jge @f
880
	jge @f
877
		mov eax,TED_LINES_IN_NEW_FILE
881
		mov eax,TED_LINES_IN_NEW_FILE
878
	@@:
882
	@@:
879
	mov esi,ted_scr_w
883
	mov esi,ted_scr_w
880
	mov dword[esi+sb_offs_max_area],eax
884
	mov dword[esi+sb_offs_max_area],eax
881
	pop esi edx ecx eax
885
	pop esi edx ecx eax
882
 
886
 
883
	call ted_text_colored
887
	call ted_text_colored
884
	stdcall ted_draw,edi
888
	stdcall ted_draw,edi
885
	cmp ted_fun_draw_panel_buttons,0
889
	cmp ted_fun_draw_panel_buttons,0
886
	je @f
890
	je @f
887
		call ted_fun_draw_panel_buttons
891
		call ted_fun_draw_panel_buttons
888
	@@:
892
	@@:
889
	ret
893
	ret
890
endp
894
endp
891
 
895
 
892
;input:
896
;input:
893
; edx = pointer to symbol struct
897
; edx = pointer to symbol struct
894
; edi = pointer to tedit struct
898
; edi = pointer to tedit struct
895
;output:
899
;output:
896
; edx = pointer to 'perv' visible symbol struct
900
; edx = pointer to 'perv' visible symbol struct
897
align 16
901
align 16
898
ted_iterat_perv:
902
ted_iterat_perv:
899
	cmp ted_tim_undo,0
903
	cmp ted_tim_undo,0
900
	je .else
904
	je .else
901
	push ebx
905
	push ebx
902
	@@:
906
	@@:
903
		mov edx,dword[edx+2]
907
		mov edx,[edx+2]
904
		cmp edx,0
908
		cmp edx,0
905
		je @f
909
		je @f
906
		imul edx,sizeof.symbol
910
		imul edx,sizeof.symbol
907
		add edx,ted_tex
911
		add edx,ted_tex
908
		call ted_symbol_not_vis
912
		call ted_symbol_not_vis
909
		cmp bl,1
913
		cmp bl,1
910
		je @b
914
		je @b
911
		cmp byte[edx],10 ;¯à®¯ã᪠ᨬ¢®«  á ª®¤®¬ 10
915
		cmp byte[edx],10 ;¯à®¯ã᪠ᨬ¢®«  á ª®¤®¬ 10
912
		je @b
916
		je @b
913
	pop ebx
917
	pop ebx
914
	ret
918
	ret
915
	@@:
919
	@@:
916
	mov edx,ted_tex ;­ ç «® ä ©« 
920
	mov edx,ted_tex ;­ ç «® ä ©« 
917
	pop ebx
921
	pop ebx
918
	ret
922
	ret
919
	.else:
923
	.else:
920
		mov edx,dword[edx+2]
924
		mov edx,[edx+2]
921
		cmp edx,0
925
		cmp edx,0
922
		je @f
926
		je @f
923
		imul edx,sizeof.symbol
927
		imul edx,sizeof.symbol
924
		add edx,ted_tex
928
		add edx,ted_tex
925
		cmp dword [edx+14],0
929
		cmp dword [edx+14],0
926
		jne .else
930
		jne .else
927
		cmp byte[edx],10 ;¯à®¯ã᪠ᨬ¢®«  á ª®¤®¬ 10
931
		cmp byte[edx],10 ;¯à®¯ã᪠ᨬ¢®«  á ª®¤®¬ 10
928
		je .else
932
		je .else
929
	ret
933
	ret
930
	@@:
934
	@@:
931
	mov edx,ted_tex ;­ ç «® ä ©« 
935
	mov edx,ted_tex ;­ ç «® ä ©« 
932
	ret
936
	ret
933
 
937
 
934
 
938
 
935
;input:
939
;input:
936
; edx = pointer to symbol struct
940
; edx = pointer to symbol struct
937
; edi = pointer to tedit struct
941
; edi = pointer to tedit struct
938
;output:
942
;output:
939
; edx = pointer to 'next' visible symbol struct
943
; edx = pointer to 'next' visible symbol struct
940
align 16
944
align 16
941
ted_iterat_next:
945
ted_iterat_next:
942
	cmp ted_tim_undo,0
946
	cmp ted_tim_undo,0
943
	je .else
947
	je .else
944
	push ebx
948
	push ebx
945
	@@:
949
	@@:
946
		mov edx,dword[edx+6]
950
		mov edx,[edx+6]
947
		cmp edx,1
951
		cmp edx,1
948
		jle @f
952
		jle @f
949
		imul edx,sizeof.symbol
953
		imul edx,sizeof.symbol
950
		add edx,ted_tex
954
		add edx,ted_tex
951
 
955
 
952
		call ted_symbol_not_vis
956
		call ted_symbol_not_vis
953
		cmp bl,1
957
		cmp bl,1
954
		je @b
958
		je @b
955
		cmp byte[edx],10 ;¯à®¯ã᪠ᨬ¢®«  á ª®¤®¬ 10
959
		cmp byte[edx],10 ;¯à®¯ã᪠ᨬ¢®«  á ª®¤®¬ 10
956
		je @b
960
		je @b
957
	pop ebx
961
	pop ebx
958
	ret
962
	ret
959
	@@:
963
	@@:
960
	mov edx,ted_tex_1 ;ª®­¥æ ä ©« 
964
	mov edx,ted_tex_1 ;ª®­¥æ ä ©« 
961
	pop ebx
965
	pop ebx
962
	ret
966
	ret
963
	.else:
967
	.else:
964
		mov edx,dword[edx+6]
968
		mov edx,[edx+6]
965
		cmp edx,1
969
		cmp edx,1
966
		jle @f
970
		jle @f
967
		imul edx,sizeof.symbol
971
		imul edx,sizeof.symbol
968
		add edx,ted_tex
972
		add edx,ted_tex
969
 
973
 
970
		cmp dword [edx+14],0
974
		cmp dword [edx+14],0
971
		jne .else
975
		jne .else
972
		cmp byte[edx],10 ;¯à®¯ã᪠ᨬ¢®«  á ª®¤®¬ 10
976
		cmp byte[edx],10 ;¯à®¯ã᪠ᨬ¢®«  á ª®¤®¬ 10
973
		je .else
977
		je .else
974
	ret
978
	ret
975
	@@:
979
	@@:
976
	mov edx,ted_tex_1 ;ª®­¥æ ä ©« 
980
	mov edx,ted_tex_1 ;ª®­¥æ ä ©« 
977
	ret
981
	ret
978
 
982
 
979
;input:
983
;input:
980
; bl = symbol end of select
984
; bl = symbol end of select
981
; bh = íªà ­¨àãî騩 ᨬ¢®« (= 0 ¥á«¨ ­¥â ¯à®¢¥àª¨ ­  ­¨å)
985
; bh = íªà ­¨àãî騩 ᨬ¢®« (= 0 ¥á«¨ ­¥â ¯à®¢¥àª¨ ­  ­¨å)
982
; edx = pointer to symbol struct
986
; edx = pointer to symbol struct
983
; edi = pointer to tedit struct
987
; edi = pointer to tedit struct
984
;description:
988
;description:
985
; ­ ©â¨ á«¥¤ãîéãî ¯®§¨æ¨î 㪠§ ­­®£® ᨬ¢®« 
989
; ­ ©â¨ á«¥¤ãîéãî ¯®§¨æ¨î 㪠§ ­­®£® ᨬ¢®« 
986
align 16
990
align 16
987
ted_iterat_next_pos_char:
991
ted_iterat_next_pos_char:
988
	push ax
992
	push ax
989
	mov al,1 ;¯à¥¤ë¤ã騩 ᨬ¢®«, á«ã¦¨â ¤«ï áà ¢­¥­¨ï á ᨬ¢®«®¬ bh
993
	mov al,1 ;¯à¥¤ë¤ã騩 ᨬ¢®«, á«ã¦¨â ¤«ï áà ¢­¥­¨ï á ᨬ¢®«®¬ bh
990
	@@:
994
	@@:
991
		cmp bl,byte[edx]
995
		cmp bl,byte[edx]
992
		je .found
996
		je .found
993
		.no_found:
997
		.no_found:
994
		cmp edx,ted_tex_1
998
		cmp edx,ted_tex_1
995
		jle @f
999
		jle @f
996
			mov al,byte[edx]
1000
			mov al,byte[edx]
997
			call ted_iterat_next
1001
			call ted_iterat_next
998
			jmp @b
1002
			jmp @b
999
	.found:
1003
	.found:
1000
		cmp bh,al
1004
		cmp bh,al
1001
		je .no_found
1005
		je .no_found
1002
	@@:
1006
	@@:
1003
	call ted_iterat_next
1007
	call ted_iterat_next
1004
	pop ax
1008
	pop ax
1005
	ret
1009
	ret
1006
 
1010
 
1007
;input:
1011
;input:
1008
; edx = pointer to symbol struct
1012
; edx = pointer to symbol struct
1009
; edi = pointer to tedit struct
1013
; edi = pointer to tedit struct
1010
align 16
1014
align 16
1011
ted_iterat_perv_color_tag:
1015
ted_iterat_perv_color_tag:
1012
	@@:
1016
	@@:
1013
		cmp byte[edx+1],0
1017
		cmp byte[edx+1],0
1014
		jne @f
1018
		jne @f
1015
		call ted_iterat_perv
1019
		call ted_iterat_perv
1016
		cmp edx,ted_tex_1
1020
		cmp edx,ted_tex_1
1017
		jle @f
1021
		jle @f
1018
		jmp @b
1022
		jmp @b
1019
align 4
1023
align 4
1020
	@@:
1024
	@@:
1021
	ret
1025
	ret
1022
 
1026
 
1023
;input:
1027
;input:
1024
; edx = pointer to symbol struct
1028
; edx = pointer to symbol struct
1025
; edi = pointer to tedit struct
1029
; edi = pointer to tedit struct
1026
align 16
1030
align 16
1027
ted_iterat_next_color_tag:
1031
ted_iterat_next_color_tag:
1028
	@@:
1032
	@@:
1029
		call ted_iterat_next
1033
		call ted_iterat_next
1030
		cmp byte[edx+1],0
1034
		cmp byte[edx+1],0
1031
		jne @f
1035
		jne @f
1032
		cmp edx,ted_tex_1
1036
		cmp edx,ted_tex_1
1033
		jle @f
1037
		jle @f
1034
		jmp @b
1038
		jmp @b
1035
align 4
1039
align 4
1036
	@@:
1040
	@@:
1037
	ret
1041
	ret
1038
 
1042
 
1039
;input:
1043
;input:
1040
; edx = pointer to symbol struct
1044
; edx = pointer to symbol struct
1041
; edi = pointer to tedit struct
1045
; edi = pointer to tedit struct
1042
;output:
1046
;output:
1043
; bl = 1 if sumbol not visible
1047
; bl = 1 if sumbol not visible
1044
; (tex[i].td+ted_tim_undo<=ted_tim_ch && tex[i].td) || (tex[i].tc>ted_tim_ch-ted_tim_undo)
1048
; (tex[i].td+ted_tim_undo<=ted_tim_ch && tex[i].td) || (tex[i].tc>ted_tim_ch-ted_tim_undo)
1045
align 16
1049
align 16
1046
ted_symbol_not_vis:
1050
ted_symbol_not_vis:
1047
	push eax
1051
	push eax
1048
 
1052
 
1049
	xor bl,bl
1053
	xor bl,bl
1050
 
1054
 
1051
	cmp dword [edx+14],0
1055
	cmp dword [edx+14],0
1052
	je @f
1056
	je @f
1053
	mov eax,[edx+14] ;eax=tex[i].td
1057
	mov eax,[edx+14] ;eax=tex[i].td
1054
	add eax,ted_tim_undo
1058
	add eax,ted_tim_undo
1055
	cmp eax,ted_tim_ch
1059
	cmp eax,ted_tim_ch
1056
	jg @f
1060
	jg @f
1057
		mov bl,1
1061
		mov bl,1
1058
		pop eax
1062
		pop eax
1059
		ret
1063
		ret
1060
	@@:
1064
	@@:
1061
 
1065
 
1062
	mov eax,ted_tim_ch
1066
	mov eax,ted_tim_ch
1063
	sub eax,ted_tim_undo
1067
	sub eax,ted_tim_undo
1064
	cmp [edx+10],eax
1068
	cmp [edx+10],eax
1065
	jle @f
1069
	jle @f
1066
		or bl,1
1070
		or bl,1
1067
	@@:
1071
	@@:
1068
 
1072
 
1069
	pop eax
1073
	pop eax
1070
	ret
1074
	ret
1071
 
1075
 
1072
;input:
1076
;input:
1073
; text:dword - pointer to text string
1077
; text:dword - pointer to text string
1074
; add_opt:dword - options
1078
; add_opt:dword - options
1075
align 16
1079
align 16
1076
proc ted_text_add, edit:dword, text:dword, t_len:dword, add_opt:dword
1080
proc ted_text_add, edit:dword, text:dword, t_len:dword, add_opt:dword
1077
	locals
1081
	locals
1078
		new_spc dd ? ;count new spaces
1082
		new_spc dd ? ;count new spaces
1079
		new_lin dd ? ;count new lines
1083
		new_lin dd ? ;count new lines
1080
	endl
1084
	endl
1081
;¨á¯®«ì§®¢ ­¨¥ ॣ¨áâ஢ ¢­ãâਠä㭪樨:
1085
;¨á¯®«ì§®¢ ­¨¥ ॣ¨áâ஢ ¢­ãâਠä㭪樨:
1082
;eax - ¯®§¨æ¨ï ¤«ï ¢áâ ¢ª¨ ⥪áâ 
1086
;eax - ¯®§¨æ¨ï ¤«ï ¢áâ ¢ª¨ ⥪áâ 
1083
;ebx - ¤«ï ¢à¥¬¥­­ëå ­ã¦¤, ¤«¨­­  ¢áâ ¢«ï¥¬®£® ⥪áâ 
1087
;ebx - ¤«ï ¢à¥¬¥­­ëå ­ã¦¤, ¤«¨­­  ¢áâ ¢«ï¥¬®£® ⥪áâ 
1084
;ecx - ¤«ï ¢à¥¬¥­­ëå ­ã¦¤
1088
;ecx - ¤«ï ¢à¥¬¥­­ëå ­ã¦¤
1085
;edx - 㪠§ â¥«ì ­  áâàãªâãàã ᨬ¢®« 
1089
;edx - 㪠§ â¥«ì ­  áâàãªâãàã ᨬ¢®« 
1086
	pushad
1090
	pushad
1087
	cmp dword[t_len],1 ;¯à®¢¥à塞 ¤«¨­­ã ¤®¡¢«ï¥¬®£® ⥪áâ 
1091
	cmp dword[t_len],1 ;¯à®¢¥à塞 ¤«¨­­ã ¤®¡¢«ï¥¬®£® ⥪áâ 
1088
	jl .no_add ;ª®£¤  ¤«¨­­  <1 ¯à룠¥¬ ­  ª®­¥æ ä㭪樨, ¢® ¨§¡¥¦ ­¨¥ £«îª®¢
1092
	jl .no_add ;ª®£¤  ¤«¨­­  <1 ¯à룠¥¬ ­  ª®­¥æ ä㭪樨, ¢® ¨§¡¥¦ ­¨¥ £«îª®¢
1089
 
1093
 
1090
	mov edi,[edit]
1094
	mov edi,[edit]
1091
	mov esi,dword[text]
1095
	mov esi,[text]
1092
 
1096
 
1093
	call ted_get_pos_by_cursor
1097
	call ted_get_pos_by_cursor
1094
	call ted_get_text_perv_pos
1098
	call ted_get_text_perv_pos
1095
	call ted_get_text_arr_index ;eax=po_t
1099
	call ted_get_text_arr_index ;eax=po_t
1096
 
1100
 
1097
	mov dword[new_spc],0
1101
	mov dword[new_spc],0
1098
	cmp ted_gp_opt,2
1102
	cmp ted_gp_opt,2
1099
	je @f
1103
	je @f
1100
		push eax ;c_sp=cur[cn].x+Scroller->XPos-StrLen(cur[cn].y+Scroller->YPos);
1104
		push eax ;c_sp=cur[cn].x+Scroller->XPos-StrLen(cur[cn].y+Scroller->YPos);
1101
			mov eax,ted_scr_h
1105
			mov eax,ted_scr_h
1102
			mov eax,dword[eax+sb_offs_position]
1106
			mov eax,[eax+sb_offs_position]
1103
			add eax,ted_cur_x ;eax - ­®¬¥à ᨬ¢®« 
1107
			add eax,ted_cur_x ;eax - ­®¬¥à ᨬ¢®« 
1104
			mov dword[new_spc],eax
1108
			mov [new_spc],eax
1105
 
1109
 
1106
			mov eax,ted_scr_w
1110
			mov eax,ted_scr_w
1107
			mov eax,dword[eax+sb_offs_position]
1111
			mov eax,[eax+sb_offs_position]
1108
			add eax,ted_cur_y ;eax - ­®¬¥à áâப¨
1112
			add eax,ted_cur_y ;eax - ­®¬¥à áâப¨
1109
			call ted_strlen ;ebx = line len
1113
			call ted_strlen ;ebx = line len
1110
			sub dword[new_spc],ebx ;®â ¯®§¨æ¨¨ ªãàá®à  ®â­¨¬ ¥¬ ¤«¨­­ã áâப¨, 㧭 ¥¬ ª®««¨ç¥á⢮ ¤®¡ ¢«ï¥¬ëå ¯à®¡¥«®¢
1114
			sub [new_spc],ebx ;®â ¯®§¨æ¨¨ ªãàá®à  ®â­¨¬ ¥¬ ¤«¨­­ã áâப¨, 㧭 ¥¬ ª®««¨ç¥á⢮ ¤®¡ ¢«ï¥¬ëå ¯à®¡¥«®¢
1111
		pop eax
1115
		pop eax
1112
	@@:
1116
	@@:
1113
 
1117
 
1114
	mov ebx,dword[t_len]
1118
	mov ebx,[t_len]
1115
 
1119
 
1116
	mov dword[new_lin],0
1120
	mov dword[new_lin],0
1117
	cmp ted_gp_opt,0
1121
	cmp ted_gp_opt,0
1118
	jne @f
1122
	jne @f
1119
		push eax
1123
		push eax
1120
			mov eax,ted_scr_w
1124
			mov eax,ted_scr_w
1121
			mov eax,dword[eax+sb_offs_position]
1125
			mov eax,[eax+sb_offs_position]
1122
			add eax,ted_cur_y
1126
			add eax,ted_cur_y
1123
			inc eax
1127
			inc eax
1124
			mov dword[new_lin],eax
1128
			mov [new_lin],eax
1125
 
1129
 
1126
			call ted_get_num_lines
1130
			call ted_get_num_lines
1127
			sub dword[new_lin],eax
1131
			sub [new_lin],eax
1128
			;㢥«¨ç¨¢ ¥¬ «¨­¨¨ ¢ áªà®««¨­£¥ ­  ç¨á«® ¤®¡ ¢«¥­­ëå ¤®¯®«­¨â¥«ì­ëå áâப
1132
			;㢥«¨ç¨¢ ¥¬ «¨­¨¨ ¢ áªà®««¨­£¥ ­  ç¨á«® ¤®¡ ¢«¥­­ëå ¤®¯®«­¨â¥«ì­ëå áâப
1129
			mov ecx,ted_scr_w
1133
			mov ecx,ted_scr_w
1130
			add dword[ecx+sb_offs_max_area],eax ;㢥«¨ç¨¢ ¥¬ à §¬¥à ¢¥à⨪ «ì­®£® áªà®««¨­£ 
1134
			add [ecx+sb_offs_max_area],eax ;㢥«¨ç¨¢ ¥¬ à §¬¥à ¢¥à⨪ «ì­®£® áªà®««¨­£ 
1131
		pop eax
1135
		pop eax
1132
	@@:
1136
	@@:
1133
 
1137
 
1134
	mov edx,ted_ptr_free_symb
1138
	mov edx,ted_ptr_free_symb
1135
	.beg_cycle: ;for(i=...;i
1139
	.beg_cycle: ;for(i=...;i
1136
		cmp dword [edx+10],0 ;if(!tex[i].tc && !tex[i].td)
1140
		cmp dword [edx+10],0 ;if(!tex[i].tc && !tex[i].td)
1137
		jne .u1f
1141
		jne .u1f
1138
		cmp dword [edx+14],0
1142
		cmp dword [edx+14],0
1139
		jne .u1f
1143
		jne .u1f
1140
			test dword[add_opt],ted_opt_ed_change_time ;if(n_tim) ted_tim_ch++;
1144
			test dword[add_opt],ted_opt_ed_change_time ;if(n_tim) ted_tim_ch++;
1141
			jz .no_tim
1145
			jz .no_tim
1142
				inc ted_tim_ch
1146
				inc ted_tim_ch
1143
			.no_tim:
1147
			.no_tim:
1144
			test dword[add_opt],ted_opt_ed_move_cursor
1148
			test dword[add_opt],ted_opt_ed_move_cursor
1145
			jz .no_cur_mov
1149
			jz .no_cur_mov
1146
			cmp dword[new_lin],0 ;¥á«¨ ¥áâì ¤®¡ ¢®ç­ë¥ áâப¨, â® ªãàá®à ¥é¥ ­¥ ¤¢¨£ ¥¬
1150
			cmp dword[new_lin],0 ;¥á«¨ ¥áâì ¤®¡ ¢®ç­ë¥ áâப¨, â® ªãàá®à ¥é¥ ­¥ ¤¢¨£ ¥¬
1147
			jg .no_cur_mov
1151
			jg .no_cur_mov
1148
			cmp dword[new_spc],0 ;¥á«¨ ­¥â ¤®¡ ¢®ç­ëå ¯à®¡¥«®¢, â® ªãàá®à ⮦¥ ­¥ ¤¢¨£ ¥¬
1152
			cmp dword[new_spc],0 ;¥á«¨ ­¥â ¤®¡ ¢®ç­ëå ¯à®¡¥«®¢, â® ªãàá®à ⮦¥ ­¥ ¤¢¨£ ¥¬
1149
			jg .no_cur_mov
1153
			jg .no_cur_mov
1150
				inc ted_cur_x ;move cursor
1154
				inc ted_cur_x ;move cursor
1151
				;call ted_go_to_pos
1155
				;call ted_go_to_pos
1152
				cmp byte [esi],13
1156
				cmp byte [esi],13
1153
				jne .no_cur_mov
1157
				jne .no_cur_mov
1154
					mov ted_cur_x,0
1158
					mov ted_cur_x,0
1155
					inc ted_cur_y
1159
					inc ted_cur_y
1156
					;㢥«¨ç¨¢ ¥¬ «¨­¨¨ ¢ áªà®««¨­£¥ ­  ç¨á«® ¤®¡ ¢«¥­­ëå ¢ ⥪á⥠áâப
1160
					;㢥«¨ç¨¢ ¥¬ «¨­¨¨ ¢ áªà®««¨­£¥ ­  ç¨á«® ¤®¡ ¢«¥­­ëå ¢ ⥪á⥠áâப
1157
					mov ecx,ted_scr_w
1161
					mov ecx,ted_scr_w
1158
					inc dword[ecx+sb_offs_max_area] ;㢥«¨ç¨¢ ¥¬ à §¬¥à ¢¥à⨪ «ì­®£® áªà®««¨­£ 
1162
					inc dword[ecx+sb_offs_max_area] ;㢥«¨ç¨¢ ¥¬ à §¬¥à ¢¥à⨪ «ì­®£® áªà®««¨­£ 
1159
			.no_cur_mov:
1163
			.no_cur_mov:
1160
 
1164
 
1161
			; *** ¢áâ ¢ª  ⥪ã饣® ᨬ¢®«  ¨§ áâப¨ ***
1165
			; *** ¢áâ ¢ª  ⥪ã饣® ᨬ¢®«  ¨§ áâப¨ ***
1162
			mov ecx,ted_opt_ed_change_time
1166
			mov ecx,ted_opt_ed_change_time
1163
			not ecx
1167
			not ecx
1164
			and dword[add_opt],ecx ;n_tim=false;
1168
			and dword[add_opt],ecx ;n_tim=false;
1165
 
1169
 
1166
			mov cl,byte [esi] ;tex[i].c=ta[ns];
1170
			mov cl,byte [esi] ;tex[i].c=ta[ns];
1167
			mov byte [edx],cl
1171
			mov byte [edx],cl
1168
			m2m dword [edx+10],ted_tim_ch ;tex[i].tc=ted_tim_ch;
1172
			m2m dword [edx+10],ted_tim_ch ;tex[i].tc=ted_tim_ch;
1169
			mov [edx+2],eax ;tex[i].perv=po_t;
1173
			mov [edx+2],eax ;tex[i].perv=po_t;
1170
 
1174
 
1171
			mov ecx,eax
1175
			mov ecx,eax
1172
			imul ecx,sizeof.symbol
1176
			imul ecx,sizeof.symbol
1173
			add ecx,ted_tex ; *** ecx = tex[po_t] ***
1177
			add ecx,ted_tex ; *** ecx = tex[po_t] ***
1174
			add ecx,6   ; *** ecx = tex[po_t].next ***
1178
			add ecx,6   ; *** ecx = tex[po_t].next ***
1175
			m2m dword [edx+6],dword [ecx] ;tex[i].next=tex[po_t].next;
1179
			m2m dword [edx+6],dword [ecx] ;tex[i].next=tex[po_t].next;
1176
 
1180
 
1177
			call ted_get_text_arr_index ;*** eax = i ***
1181
			call ted_get_text_arr_index ;*** eax = i ***
1178
			mov [ecx],eax ;tex[po_t].next=i; // áá뫪¨ ¯¥à¥­ ¯à ¢«ï¥¬
1182
			mov [ecx],eax ;tex[po_t].next=i; // áá뫪¨ ¯¥à¥­ ¯à ¢«ï¥¬
1179
			mov ecx,[edx+6] ; *** ecx = tex[i].next ***
1183
			mov ecx,[edx+6] ; *** ecx = tex[i].next ***
1180
			imul ecx,sizeof.symbol
1184
			imul ecx,sizeof.symbol
1181
			add ecx,ted_tex ; *** ecx = tex[tex[i].next] ***
1185
			add ecx,ted_tex ; *** ecx = tex[tex[i].next] ***
1182
			mov [ecx+2],eax ;tex[tex[i].next].perv=i;
1186
			mov [ecx+2],eax ;tex[tex[i].next].perv=i;
1183
 
1187
 
1184
			; *** ¢áâ ¢ª  ¤®¯®«­¨â¥«ì­ëå áâப ¨ ¯à®¡¥«®¢
1188
			; *** ¢áâ ¢ª  ¤®¯®«­¨â¥«ì­ëå áâப ¨ ¯à®¡¥«®¢
1185
			; ¥á«¨ ªãàá®à ¢® ¢à¥¬ï ¢áâ ¢ª¨ ­ å®¤¨«áï §  ⥪á⮬ ***
1189
			; ¥á«¨ ªãàá®à ¢® ¢à¥¬ï ¢áâ ¢ª¨ ­ å®¤¨«áï §  ⥪á⮬ ***
1186
			cmp dword[new_lin],0 ;add lines or text
1190
			cmp dword[new_lin],0 ;add lines or text
1187
			jle .spc_add
1191
			jle .spc_add
1188
				dec dword[new_lin]
1192
				dec dword[new_lin]
1189
				mov byte [edx],13
1193
				mov byte [edx],13
1190
				jmp .u1f
1194
				jmp .u1f
1191
			.spc_add:
1195
			.spc_add:
1192
			cmp dword[new_spc],0 ;add spaces or text
1196
			cmp dword[new_spc],0 ;add spaces or text
1193
			jle .tex_add
1197
			jle .tex_add
1194
				dec dword[new_spc]
1198
				dec dword[new_spc]
1195
				mov byte [edx],' '
1199
				mov byte [edx],' '
1196
				jmp .u1f
1200
				jmp .u1f
1197
			.tex_add:
1201
			.tex_add:
1198
			inc esi ; ¯¥à¥å®¤ ª á«¥¤ãî饬㠢áâ ¢«ï¥¬®¬ã ᨬ¢®«ã
1202
			inc esi ; ¯¥à¥å®¤ ª á«¥¤ãî饬㠢áâ ¢«ï¥¬®¬ã ᨬ¢®«ã
1199
			dec ebx
1203
			dec ebx
1200
		.u1f:
1204
		.u1f:
1201
		add edx,sizeof.symbol
1205
		add edx,sizeof.symbol
1202
		cmp edx,ted_tex_end
1206
		cmp edx,ted_tex_end
1203
		jge @f ;out of memory
1207
		jge @f ;out of memory
1204
		cmp ebx,0
1208
		cmp ebx,0
1205
		jne .beg_cycle
1209
		jne .beg_cycle
1206
		mov ted_ptr_free_symb,edx ;¬¥­ï¥¬ 㪠§ â¥«ì ­  ᢮¡®¤­ë© ᨬ¢®«, ¤«ï ¡®«¥¥ ¡ëáâண® ¯®¨áª  ¯ ¬ïâ¨
1210
		mov ted_ptr_free_symb,edx ;¬¥­ï¥¬ 㪠§ â¥«ì ­  ᢮¡®¤­ë© ᨬ¢®«, ¤«ï ¡®«¥¥ ¡ëáâண® ¯®¨áª  ¯ ¬ïâ¨
1207
		jmp .add_all
1211
		jmp .add_all
1208
	@@:
1212
	@@:
1209
	cmp ted_increase_size,0
1213
	cmp ted_increase_size,0
1210
	je .add_all
1214
	je .add_all
1211
		call ted_memory_increase
1215
		call ted_memory_increase
1212
		cmp ebx,0
1216
		cmp ebx,0
1213
		jne .beg_cycle
1217
		jne .beg_cycle
1214
	.add_all: ;¢á¥ ᨬ¢®«ë ¤®¡ ¢«¥­ë
1218
	.add_all: ;¢á¥ ᨬ¢®«ë ¤®¡ ¢«¥­ë
1215
 
1219
 
1216
	call ted_text_colored
1220
	call ted_text_colored
1217
	.no_add:
1221
	.no_add:
1218
	popad
1222
	popad
1219
	ret
1223
	ret
1220
endp
1224
endp
1221
 
1225
 
1222
;input:
1226
;input:
1223
;  edx = pointer to sumbol, when insert
1227
;  edx = pointer to sumbol, when insert
1224
;  edi = pointer to tedit struct
1228
;  edi = pointer to tedit struct
1225
;output:
1229
;output:
1226
;  edx = new pointer to sumbol, when insert
1230
;  edx = new pointer to sumbol, when insert
1227
align 16
1231
align 16
1228
proc ted_memory_increase
1232
proc ted_memory_increase
1229
	cmp ted_increase_size,0
1233
	cmp ted_increase_size,0
1230
	je @f
1234
	je @f
1231
		push eax ebx ecx
1235
		push eax ebx ecx
1232
		mov ecx,ted_increase_size
1236
		mov ecx,ted_increase_size
1233
		add ecx,ted_max_chars
1237
		add ecx,ted_max_chars
1234
		mov ted_max_chars,ecx
1238
		mov ted_max_chars,ecx
1235
		imul ecx,sizeof.symbol
1239
		imul ecx,sizeof.symbol
1236
		invoke mem.realloc, ted_tex,ecx
1240
		invoke mem.realloc, ted_tex,ecx
1237
		mov ebx,ted_tex
1241
		mov ebx,ted_tex
1238
		mov ted_tex,eax
1242
		mov ted_tex,eax
1239
		mov ted_tex_1,eax
1243
		mov ted_tex_1,eax
1240
		add ted_tex_1,sizeof.symbol
1244
		add ted_tex_1,sizeof.symbol
1241
			sub edx,ebx
1245
			sub edx,ebx
1242
			add edx,eax
1246
			add edx,eax
1243
			mov ted_ptr_free_symb,edx
1247
			mov ted_ptr_free_symb,edx
1244
		add eax,ecx
1248
		add eax,ecx
1245
		mov ted_tex_end,eax
1249
		mov ted_tex_end,eax
1246
		pop ecx ebx eax
1250
		pop ecx ebx eax
1247
	@@:
1251
	@@:
1248
	ret
1252
	ret
1249
endp
1253
endp
1250
 
1254
 
1251
;input:
1255
;input:
1252
;  ecx = position to free insert cell
1256
;  ecx = position to free insert cell
1253
;  edx = pointer to sumbol, when insert
1257
;  edx = pointer to sumbol, when insert
1254
;  esi = added symbol
1258
;  esi = added symbol
1255
;  edi = pointer to tedit struct
1259
;  edi = pointer to tedit struct
1256
;output:
1260
;output:
1257
;  ecx = position to inserted cell
1261
;  ecx = position to inserted cell
1258
align 16
1262
align 16
1259
ted_char_add:
1263
ted_char_add:
1260
	.loop_b:
1264
	.loop_b:
1261
		cmp ecx,ted_tex_end
1265
		cmp ecx,ted_tex_end
1262
		jge .end_f
1266
		jge .end_f
1263
		cmp dword[ecx+10],0
1267
		cmp dword[ecx+10],0
1264
		jne @f
1268
		jne @f
1265
			cmp dword[ecx+14],0
1269
			cmp dword[ecx+14],0
1266
			je .loop_e
1270
			je .loop_e
1267
		@@:
1271
		@@:
1268
		add ecx,sizeof.symbol
1272
		add ecx,sizeof.symbol
1269
		jmp .loop_b
1273
		jmp .loop_b
1270
align 4
1274
align 4
1271
	.loop_e:
1275
	.loop_e:
1272
 
1276
 
1273
	push eax ebx
1277
	push eax ebx
1274
	mov eax,ted_tim_ch
1278
	mov eax,ted_tim_ch
1275
	mov dword[ecx+10],eax
1279
	mov dword[ecx+10],eax
1276
	mov ax,si
1280
	mov ax,si
1277
	mov byte[ecx],al
1281
	mov byte[ecx],al
1278
 
1282
 
1279
	call ted_get_text_arr_index ; *** eax=pos ***
1283
	call ted_get_text_arr_index ; *** eax=pos ***
1280
	mov [ecx+2],eax ;tex[i].perv=pos;
1284
	mov [ecx+2],eax ;tex[i].perv=pos;
1281
	m2m dword[ecx+6],dword[edx+6] ;tex[i].next=tex[pos].next;
1285
	m2m dword[ecx+6],dword[edx+6] ;tex[i].next=tex[pos].next;
1282
 
1286
 
1283
	push edx
1287
	push edx
1284
		mov edx,ecx
1288
		mov edx,ecx
1285
		call ted_get_text_arr_index ; *** eax=i ***
1289
		call ted_get_text_arr_index ; *** eax=i ***
1286
	pop edx
1290
	pop edx
1287
 
1291
 
1288
	mov [edx+6],eax ;tex[pos].next=i; // áá뫪¨ ¯¥à¥­ ¯à ¢«ï¥¬
1292
	mov [edx+6],eax ;tex[pos].next=i; // áá뫪¨ ¯¥à¥­ ¯à ¢«ï¥¬
1289
	mov ebx,[ecx+6]
1293
	mov ebx,[ecx+6]
1290
	ConvertIndexToPointer ebx
1294
	ConvertIndexToPointer ebx
1291
	mov [ebx+2],eax ;tex[tex[i].next].perv=i; // ...
1295
	mov [ebx+2],eax ;tex[tex[i].next].perv=i; // ...
1292
	pop ebx eax
1296
	pop ebx eax
1293
 
1297
 
1294
	.end_f:
1298
	.end_f:
1295
	call ted_text_colored
1299
	call ted_text_colored
1296
	ret
1300
	ret
1297
 
1301
 
1298
;description:
1302
;description:
1299
; äã­ªæ¨ï ¤«ï ᬥ­ë ª®¤¨à®¢®ª
1303
; äã­ªæ¨ï ¤«ï ᬥ­ë ª®¤¨à®¢®ª
1300
;input:
1304
;input:
1301
; table - â ¡«¨æ  ¤«ï ¯¥à¥ª®¤¨à®¢ª¨
1305
; table - â ¡«¨æ  ¤«ï ¯¥à¥ª®¤¨à®¢ª¨
1302
align 16
1306
align 16
1303
proc ted_but_convert_by_table uses eax edx edi esi, edit:dword, table:dword
1307
proc ted_but_convert_by_table uses eax edx edi esi, edit:dword, table:dword
1304
	mov edi,[edit]
1308
	mov edi,[edit]
1305
	mov esi,dword[table]
1309
	mov esi,[table]
1306
	mov edx,ted_tex
1310
	mov edx,ted_tex
1307
	.cycle:
1311
	.cycle:
1308
		;¯¥à¥å®¤¨¬ ­  á«¥¤ãî騩 ᨬ¢®«
1312
		;¯¥à¥å®¤¨¬ ­  á«¥¤ãî騩 ᨬ¢®«
1309
		mov edx,dword[edx+6]
1313
		mov edx,[edx+6]
1310
		cmp edx,1
1314
		cmp edx,1
1311
		jle .end_text
1315
		jle .end_text
1312
		imul edx,sizeof.symbol
1316
		imul edx,sizeof.symbol
1313
		add edx,ted_tex
1317
		add edx,ted_tex
1314
 
1318
 
1315
		movzx eax,byte[edx]
1319
		movzx eax,byte[edx]
1316
		add eax,esi
1320
		add eax,esi
1317
		mov al,byte[eax]
1321
		mov al,byte[eax]
1318
		cmp al,0
1322
		cmp al,0
1319
		je @f
1323
		je @f
1320
			mov byte[edx],al ;¬¥­ï¥¬ ª®¤¨à®¢ªã ᨬ¢®« 
1324
			mov byte[edx],al ;¬¥­ï¥¬ ª®¤¨à®¢ªã ᨬ¢®« 
1321
		@@:
1325
		@@:
1322
		jmp .cycle
1326
		jmp .cycle
1323
	.end_text:
1327
	.end_text:
1324
	;cmp esi,0
1328
	;cmp esi,0
1325
	;je @f
1329
	;je @f
1326
		stdcall ted_draw,edi ;®¡­®¢«ï¥¬ ®ª­®
1330
		stdcall ted_draw,edi ;®¡­®¢«ï¥¬ ®ª­®
1327
	;@@:
1331
	;@@:
1328
	ret
1332
	ret
1329
endp
1333
endp
1330
 
1334
 
1331
;input:
1335
;input:
1332
; edi = pointer to tedit struct
1336
; edi = pointer to tedit struct
1333
;output:
1337
;output:
1334
; esi = count converted symbols
1338
; esi = count converted symbols
1335
;description:
1339
;description:
1336
; ”ã­ªæ¨ï ¨á¯®«ì§ã¥âáï ¤«ï ᬥ­ë ॣ¨áâà  ¢ë¡à ­­ëå ᨬ¢®«®¢
1340
; ”ã­ªæ¨ï ¨á¯®«ì§ã¥âáï ¤«ï ᬥ­ë ॣ¨áâà  ¢ë¡à ­­ëå ᨬ¢®«®¢
1337
align 16
1341
align 16
1338
proc ted_convert_sel_text, conv_fun:dword
1342
proc ted_convert_sel_text, conv_fun:dword
1339
  locals
1343
  locals
1340
    conv_cou dd ?
1344
    conv_cou dd ?
1341
  endl
1345
  endl
1342
  mov dword[conv_cou],0
1346
  mov dword[conv_cou],0
1343
  pushad
1347
  pushad
1344
 
1348
 
1345
  call ted_is_select
1349
  call ted_is_select
1346
  cmp al,0
1350
  cmp al,0
1347
  je .end_f
1351
  je .end_f
1348
    call ted_set_undo
1352
    call ted_set_undo
1349
    call ted_sel_normalize
1353
    call ted_sel_normalize
1350
 
1354
 
1351
    mov esi,ted_seln_x0
1355
    mov esi,ted_seln_x0
1352
    mov ecx,ted_seln_y0
1356
    mov ecx,ted_seln_y0
1353
    call ted_get_pos_by_coords
1357
    call ted_get_pos_by_coords
1354
    mov eax,edx
1358
    mov eax,edx
1355
    mov esi,ted_seln_x1
1359
    mov esi,ted_seln_x1
1356
    mov ecx,ted_seln_y1
1360
    mov ecx,ted_seln_y1
1357
    call ted_get_pos_by_coords
1361
    call ted_get_pos_by_coords
1358
    ;call ted_get_text_perv_pos
1362
    ;call ted_get_text_perv_pos
1359
    mov ebx,edx
1363
    mov ebx,edx
1360
 
1364
 
1361
    cmp eax,ebx
1365
    cmp eax,ebx
1362
    je .end_f
1366
    je .end_f
1363
 
1367
 
1364
    inc ted_tim_ch
1368
    inc ted_tim_ch
1365
    mov edx,eax ;i=p0;
1369
    mov edx,eax ;i=p0;
1366
    mov ecx,ted_ptr_free_symb
1370
    mov ecx,ted_ptr_free_symb
1367
    @@:
1371
    @@:
1368
      push eax
1372
      push eax
1369
      mov al,byte[edx]
1373
      mov al,byte[edx]
1370
      call dword[conv_fun] ;¯à¥®¡à §®¢ ­¨¥ ᨬ¢®« 
1374
      call dword[conv_fun] ;¯à¥®¡à §®¢ ­¨¥ ᨬ¢®« 
1371
      mov esi,eax
1375
      mov esi,eax
1372
      cmp byte[edx],al
1376
      cmp byte[edx],al
1373
      pop eax
1377
      pop eax
1374
      je .no_change
1378
      je .no_change
1375
	m2m dword [edx+14],ted_tim_ch
1379
	m2m dword [edx+14],ted_tim_ch
1376
	call ted_char_add ;b_pos=ted_char_add(tex[i].c^32,i,false,b_pos);
1380
	call ted_char_add ;b_pos=ted_char_add(tex[i].c^32,i,false,b_pos);
1377
	call ted_get_text_next_pos ;go to added symbol
1381
	call ted_get_text_next_pos ;go to added symbol
1378
	inc dword[conv_cou]
1382
	inc dword[conv_cou]
1379
      .no_change:
1383
      .no_change:
1380
 
1384
 
1381
      call ted_iterat_next
1385
      call ted_iterat_next
1382
      cmp edx,ted_tex
1386
      cmp edx,ted_tex
1383
      je @f 
1387
      je @f 
1384
      cmp edx,ebx
1388
      cmp edx,ebx
1385
      je @f
1389
      je @f
1386
 
1390
 
1387
      jmp @b
1391
      jmp @b
1388
    @@:
1392
    @@:
1389
    cmp dword[conv_cou],0
1393
    cmp dword[conv_cou],0
1390
    jne @f
1394
    jne @f
1391
      dec ted_tim_ch
1395
      dec ted_tim_ch
1392
    @@:
1396
    @@:
1393
  .end_f:
1397
  .end_f:
1394
  popad
1398
  popad
1395
  mov esi,dword[conv_cou]
1399
  mov esi,dword[conv_cou]
1396
  ret
1400
  ret
1397
endp
1401
endp
1398
 
1402
 
1399
;output:
1403
;output:
1400
; bl = 0 - no delete
1404
; bl = 0 - no delete
1401
; bl = 1 - delete
1405
; bl = 1 - delete
1402
align 16
1406
align 16
1403
proc ted_text_del uses ecx edx edi, edit:dword, del_opt:dword
1407
proc ted_text_del uses ecx edx edi, edit:dword, del_opt:dword
1404
	mov edi,[edit]
1408
	mov edi,[edit]
1405
	mov ebx,dword[del_opt]
1409
	mov ebx,[del_opt]
1406
 
1410
 
1407
	xor cl,cl
1411
	xor cl,cl
1408
	test ebx,ted_opt_ed_move_cursor
1412
	test ebx,ted_opt_ed_move_cursor
1409
	jz @f
1413
	jz @f
1410
		call ted_cur_move_left
1414
		call ted_cur_move_left
1411
		cmp dl,0
1415
		cmp dl,0
1412
		je .no_del
1416
		je .no_del
1413
	@@:
1417
	@@:
1414
	call ted_get_pos_by_cursor
1418
	call ted_get_pos_by_cursor
1415
	cmp ted_gp_opt,1
1419
	cmp ted_gp_opt,1
1416
	je .no_del
1420
	je .no_del
1417
		test ebx,ted_opt_ed_change_time
1421
		test ebx,ted_opt_ed_change_time
1418
		jz @f
1422
		jz @f
1419
			inc ted_tim_ch
1423
			inc ted_tim_ch
1420
		@@:
1424
		@@:
1421
		m2m dword[edx+14], ted_tim_ch
1425
		m2m dword[edx+14], ted_tim_ch
1422
		mov cl,1
1426
		mov cl,1
1423
	.no_del:
1427
	.no_del:
1424
	mov bl,cl
1428
	mov bl,cl
1425
	ret
1429
	ret
1426
endp
1430
endp
1427
 
1431
 
1428
;input:
1432
;input:
1429
; edi = pointer to tedit struct
1433
; edi = pointer to tedit struct
1430
;output:
1434
;output:
1431
; al = 1 if delete
1435
; al = 1 if delete
1432
;description:
1436
;description:
1433
; ”ã­ªæ¨ï 㤠«ï¥â ¢ë¤¥«¥­­ë© ⥪áâ
1437
; ”ã­ªæ¨ï 㤠«ï¥â ¢ë¤¥«¥­­ë© ⥪áâ
1434
align 16
1438
align 16
1435
proc ted_sel_text_del uses ebx ecx edx esi, del_opt:dword
1439
proc ted_sel_text_del uses ebx ecx edx esi, del_opt:dword
1436
	call ted_is_select
1440
	call ted_is_select
1437
	cmp al,0
1441
	cmp al,0
1438
	je .end_f
1442
	je .end_f
1439
		call ted_sel_normalize
1443
		call ted_sel_normalize
1440
 
1444
 
1441
		mov esi,ted_seln_x1
1445
		mov esi,ted_seln_x1
1442
		mov ecx,ted_seln_y1
1446
		mov ecx,ted_seln_y1
1443
		call ted_get_pos_by_coords
1447
		call ted_get_pos_by_coords
1444
		mov ebx,edx
1448
		mov ebx,edx
1445
 
1449
 
1446
		mov esi,ted_seln_x0
1450
		mov esi,ted_seln_x0
1447
		mov ecx,ted_seln_y0
1451
		mov ecx,ted_seln_y0
1448
		call ted_get_pos_by_coords
1452
		call ted_get_pos_by_coords
1449
 
1453
 
1450
		test dword[del_opt],ted_opt_ed_change_time
1454
		test dword[del_opt],ted_opt_ed_change_time
1451
		jz @f
1455
		jz @f
1452
			inc ted_tim_ch
1456
			inc ted_tim_ch
1453
		@@:
1457
		@@:
1454
		cmp edx,ted_tex
1458
		cmp edx,ted_tex
1455
		je @f
1459
		je @f
1456
		cmp edx,ebx ;if(i==te)break;
1460
		cmp edx,ebx ;if(i==te)break;
1457
		je @f
1461
		je @f
1458
			m2m dword[edx+14],ted_tim_ch
1462
			m2m dword[edx+14],ted_tim_ch
1459
			mov esi,ted_opt_ed_change_time
1463
			mov esi,ted_opt_ed_change_time
1460
			not esi
1464
			not esi
1461
			and dword[del_opt],esi ;n_tim=false;
1465
			and dword[del_opt],esi ;n_tim=false;
1462
			call ted_iterat_next
1466
			call ted_iterat_next
1463
			jmp @b
1467
			jmp @b
1464
align 4
1468
align 4
1465
		@@:
1469
		@@:
1466
		test dword[del_opt],ted_opt_ed_change_time
1470
		test dword[del_opt],ted_opt_ed_change_time
1467
		jz @f
1471
		jz @f
1468
			dec ted_tim_ch
1472
			dec ted_tim_ch
1469
			xor al,al
1473
			xor al,al
1470
		@@:
1474
		@@:
1471
		test dword[del_opt],ted_opt_ed_change_time
1475
		test dword[del_opt],ted_opt_ed_change_time
1472
		jnz @f
1476
		jnz @f
1473
			mov ecx,ted_seln_x0
1477
			mov ecx,ted_seln_x0
1474
			mov edx,ted_seln_y0
1478
			mov edx,ted_seln_y0
1475
			call ted_go_to_pos
1479
			call ted_go_to_pos
1476
			mov ted_sel_x0,0
1480
			mov ted_sel_x0,0
1477
			mov ted_sel_y0,0
1481
			mov ted_sel_y0,0
1478
			mov ted_sel_x1,0
1482
			mov ted_sel_x1,0
1479
			mov ted_sel_y1,0
1483
			mov ted_sel_y1,0
1480
		@@:
1484
		@@:
1481
	.end_f:
1485
	.end_f:
1482
	ret
1486
	ret
1483
endp
1487
endp
1484
 
1488
 
1485
 
1489
 
1486
;input:
1490
;input:
1487
; eax = pointer to begin select
1491
; eax = pointer to begin select
1488
; ebx = pointer to end select
1492
; ebx = pointer to end select
1489
; edi = pointer to tedit struct
1493
; edi = pointer to tedit struct
1490
align 16
1494
align 16
1491
ted_revers:
1495
ted_revers:
1492
	cmp eax,ebx
1496
	cmp eax,ebx
1493
	jne @f
1497
	jne @f
1494
		ret
1498
		ret
1495
	@@:
1499
	@@:
1496
 
1500
 
1497
	push ecx edx
1501
	push ecx edx
1498
 
1502
 
1499
	mov edx,ted_tex_1
1503
	mov edx,ted_tex_1
1500
	cmp edx,ebx ;if(p1==1)p1=tex[1].perv;
1504
	cmp edx,ebx ;if(p1==1)p1=tex[1].perv;
1501
	jne @f
1505
	jne @f
1502
		call ted_get_text_perv_pos
1506
		call ted_get_text_perv_pos
1503
		mov ebx,edx
1507
		mov ebx,edx
1504
	@@:
1508
	@@:
1505
 
1509
 
1506
	push esi
1510
	push esi
1507
		mov edx,[eax+2] ; *** edx = tex[p0].perv ***
1511
		mov edx,[eax+2] ; *** edx = tex[p0].perv ***
1508
		ConvertIndexToPointer edx
1512
		ConvertIndexToPointer edx
1509
		add edx,6
1513
		add edx,6
1510
		mov ecx,[edx] ;tmp = tex[tex[p0].perv].next;
1514
		mov ecx,[edx] ;tmp = tex[tex[p0].perv].next;
1511
 
1515
 
1512
		mov esi,[ebx+6] ; *** esi = tex[p1].next ***
1516
		mov esi,[ebx+6] ; *** esi = tex[p1].next ***
1513
		ConvertIndexToPointer esi
1517
		ConvertIndexToPointer esi
1514
		add esi,2
1518
		add esi,2
1515
		m2m dword[edx],dword[esi] ;tex[tex[p0].perv].next = tex[tex[p1].next].perv;
1519
		m2m dword[edx],dword[esi] ;tex[tex[p0].perv].next = tex[tex[p1].next].perv;
1516
 
1520
 
1517
		mov [esi],ecx ;tex[tex[p1].next].perv = tmp;
1521
		mov [esi],ecx ;tex[tex[p1].next].perv = tmp;
1518
	pop esi
1522
	pop esi
1519
 
1523
 
1520
	mov ecx,[eax+2] ;tmp = tex[p0].perv;
1524
	mov ecx,[eax+2] ;tmp = tex[p0].perv;
1521
	m2m dword[eax+2],dword[ebx+6] ;tex[p0].perv = tex[p1].next;
1525
	m2m dword[eax+2],dword[ebx+6] ;tex[p0].perv = tex[p1].next;
1522
	mov [ebx+6],ecx ;tex[p1].next = tmp;
1526
	mov [ebx+6],ecx ;tex[p1].next = tmp;
1523
 
1527
 
1524
	mov edx,eax ;i=p0;
1528
	mov edx,eax ;i=p0;
1525
	@@:
1529
	@@:
1526
		mov ecx,[edx+6] ;tmp = tex[i].next;
1530
		mov ecx,[edx+6] ;tmp = tex[i].next;
1527
		m2m dword[edx+6],dword[edx+2] ;tex[i].next = tex[i].perv;
1531
		m2m dword[edx+6],dword[edx+2] ;tex[i].next = tex[i].perv;
1528
		mov [edx+2],ecx ;tex[i].perv = tmp;
1532
		mov [edx+2],ecx ;tex[i].perv = tmp;
1529
		cmp edx,ebx ;if(i==p1)break;
1533
		cmp edx,ebx ;if(i==p1)break;
1530
		je @f
1534
		je @f
1531
; ---
1535
; ---
1532
;cmp edx,ted_tex
1536
;cmp edx,ted_tex
1533
;je @f
1537
;je @f
1534
; ---
1538
; ---
1535
		mov edx,ecx ;i = tmp;
1539
		mov edx,ecx ;i = tmp;
1536
		ConvertIndexToPointer edx
1540
		ConvertIndexToPointer edx
1537
		jmp @b
1541
		jmp @b
1538
	@@:
1542
	@@:
1539
	pop edx ecx
1543
	pop edx ecx
1540
	call ted_text_colored
1544
	call ted_text_colored
1541
	ret
1545
	ret
1542
 
1546
 
1543
 
1547
 
1544
;input:
1548
;input:
1545
; edi = pointer to tedit struct
1549
; edi = pointer to tedit struct
1546
;output:
1550
;output:
1547
; dl = 0 not move
1551
; dl = 0 not move
1548
; dl = 2 if move up
1552
; dl = 2 if move up
1549
; dl = 8 if scroll move up
1553
; dl = 8 if scroll move up
1550
align 16
1554
align 16
1551
ted_cur_move_up:
1555
ted_cur_move_up:
1552
  cmp ted_cur_y,0
1556
  cmp ted_cur_y,0
1553
  je @f
1557
  je @f
1554
    dec ted_cur_y
1558
    dec ted_cur_y
1555
    mov dl,2
1559
    mov dl,2
1556
    ret
1560
    ret
1557
  @@:
1561
  @@:
1558
  push eax
1562
  push eax
1559
  mov eax,ted_scr_w
1563
  mov eax,ted_scr_w
1560
  cmp dword[eax+sb_offs_position],0
1564
  cmp dword[eax+sb_offs_position],0
1561
  je @f
1565
  je @f
1562
    dec dword[eax+sb_offs_position]
1566
    dec dword[eax+sb_offs_position]
1563
    mov dl,8
1567
    mov dl,8
1564
    jmp .ret_f
1568
    jmp .ret_f
1565
  @@:
1569
  @@:
1566
  mov dl,0
1570
  mov dl,0
1567
  .ret_f:
1571
  .ret_f:
1568
  pop eax
1572
  pop eax
1569
  ret
1573
  ret
1570
 
1574
 
1571
;input:
1575
;input:
1572
; edi = pointer to tedit struct
1576
; edi = pointer to tedit struct
1573
;output:
1577
;output:
1574
; dl = 0 not move
1578
; dl = 0 not move
1575
; dl = 2 if move down
1579
; dl = 2 if move down
1576
; dl = 8 if scroll move down
1580
; dl = 8 if scroll move down
1577
align 16
1581
align 16
1578
ted_cur_move_down:
1582
ted_cur_move_down:
1579
  push eax ebx
1583
  push eax ebx
1580
  mov ebx,ted_scr_w
1584
  mov ebx,ted_scr_w
1581
  mov dl,0
1585
  xor dl,dl
1582
  mov eax,dword[ebx+sb_offs_cur_area]
1586
  mov eax,[ebx+sb_offs_cur_area]
1583
  dec eax
1587
  dec eax
1584
  cmp ted_cur_y,eax
1588
  cmp ted_cur_y,eax
1585
  jge @f
1589
  jge @f
1586
    inc ted_cur_y
1590
    inc ted_cur_y
1587
    mov dl,2
1591
    mov dl,2
1588
    jmp .ret_f
1592
    jmp .ret_f
1589
  @@:
1593
  @@:
1590
  mov eax,ted_cur_y
1594
  mov eax,ted_cur_y
1591
  add eax,dword[ebx+sb_offs_position]
1595
  add eax,[ebx+sb_offs_position]
1592
  inc eax
1596
  inc eax
1593
  cmp dword[ebx+sb_offs_max_area],eax
1597
  cmp [ebx+sb_offs_max_area],eax
1594
  jle @f
1598
  jle @f
1595
    inc dword[ebx+sb_offs_position]
1599
    inc dword[ebx+sb_offs_position]
1596
    mov dl,8
1600
    mov dl,8
1597
  @@:
1601
  @@:
1598
  .ret_f:
1602
  .ret_f:
1599
  pop ebx eax
1603
  pop ebx eax
1600
  ret
1604
  ret
1601
 
1605
 
1602
 
1606
 
1603
;input:
1607
;input:
1604
; edi = pointer to tedit struct
1608
; edi = pointer to tedit struct
1605
;output:
1609
;output:
1606
; dl = 0 not move
1610
; dl = 0 not move
1607
; dl = 1 if move up
1611
; dl = 1 if move up
1608
align 16
1612
align 16
1609
ted_cur_move_page_up:
1613
ted_cur_move_page_up:
1610
  push eax ebx
1614
	push eax ebx
1611
  mov ebx,ted_scr_w
1615
	mov ebx,ted_scr_w
1612
  mov eax,dword[ebx+sb_offs_cur_area]
1616
	mov eax,[ebx+sb_offs_cur_area]
1613
  xor dl,dl
1617
	xor dl,dl
1614
  cmp eax,dword[ebx+sb_offs_position]
1618
	cmp eax,[ebx+sb_offs_position]
1615
  jg @f
1619
	jg @f
1616
    sub dword[ebx+sb_offs_position],eax
1620
		sub [ebx+sb_offs_position],eax
1617
    mov dl,1
1621
		mov dl,1
1618
  @@:
1622
	@@:
1619
  cmp dword[ebx+sb_offs_position],0
1623
	cmp dword[ebx+sb_offs_position],0
1620
  je @f
1624
	je @f
1621
  cmp dl,1
1625
	cmp dl,1
1622
  je @f
1626
	je @f
1623
    mov dword[ebx+sb_offs_position],0
1627
		mov dword[ebx+sb_offs_position],0
1624
    mov dl,1
1628
		mov dl,1
1625
  @@:
1629
	@@:
1626
  pop ebx eax
1630
	pop ebx eax
1627
  ret
1631
	ret
1628
 
1632
 
1629
;input:
1633
;input:
1630
; edi = pointer to tedit struct
1634
; edi = pointer to tedit struct
1631
align 16
1635
align 16
1632
ted_cur_move_page_down:
1636
ted_cur_move_page_down:
1633
	push eax ebx ecx
1637
	push eax ebx ecx
1634
	mov ecx,ted_scr_w
1638
	mov ecx,ted_scr_w
1635
 
1639
 
1636
	xor dl,dl
1640
	xor dl,dl
1637
	mov eax,dword[ecx+sb_offs_max_area]
1641
	mov eax,[ecx+sb_offs_max_area]
1638
	sub eax,dword[ecx+sb_offs_cur_area]
1642
	sub eax,[ecx+sb_offs_cur_area]
1639
	cmp dword[ecx+sb_offs_position],eax
1643
	cmp [ecx+sb_offs_position],eax
1640
	jge @f
1644
	jge @f
1641
		mov ebx,dword[ecx+sb_offs_cur_area]
1645
		mov ebx,[ecx+sb_offs_cur_area]
1642
		add dword[ecx+sb_offs_position],ebx
1646
		add [ecx+sb_offs_position],ebx
1643
		mov dl,1
1647
		mov dl,1
1644
		mov dword[ecx+sb_offs_redraw],1
1648
		mov dword[ecx+sb_offs_redraw],1
1645
		cmp dword[ecx+sb_offs_position],eax
1649
		cmp [ecx+sb_offs_position],eax
1646
		jle @f
1650
		jle @f
1647
			mov dword[ecx+sb_offs_position],eax
1651
			mov [ecx+sb_offs_position],eax
1648
	@@:
1652
	@@:
1649
	pop ecx ebx eax
1653
	pop ecx ebx eax
1650
	ret
1654
	ret
1651
 
1655
 
1652
;input:
1656
;input:
1653
; edi = pointer to tedit struct
1657
; edi = pointer to tedit struct
1654
;output:
1658
;output:
1655
; dl = 0 not move
1659
; dl = 0 not move
1656
; dl = 1 if move left
1660
; dl = 1 if move left
1657
; dl = 3 if move left and up
1661
; dl = 3 if move left and up
1658
; dl = 8 if scroll move up
1662
; dl = 8 if scroll move up
1659
align 16
1663
align 16
1660
ted_cur_move_left:
1664
ted_cur_move_left:
1661
	cmp ted_cur_x,0
1665
	cmp ted_cur_x,0
1662
	je @f
1666
	je @f
1663
		dec ted_cur_x
1667
		dec ted_cur_x
1664
		mov dl,1
1668
		mov dl,1
1665
		ret
1669
		ret
1666
	@@:
1670
	@@:
1667
	push eax
1671
	push eax
1668
	mov eax,ted_scr_h
1672
	mov eax,ted_scr_h
1669
	cmp dword[eax+sb_offs_position],0
1673
	cmp dword[eax+sb_offs_position],0
1670
	je @f
1674
	je @f
1671
		dec dword[eax+sb_offs_position]
1675
		dec dword[eax+sb_offs_position]
1672
		mov dl,8
1676
		mov dl,8
1673
		jmp .ret_f
1677
		jmp .ret_f
1674
	@@:
1678
	@@:
1675
	cmp ted_cur_y,0
1679
	cmp ted_cur_y,0
1676
	jne @f
1680
	jne @f
1677
		mov eax,ted_scr_w
1681
		mov eax,ted_scr_w
1678
		mov dl,0
1682
		mov dl,0
1679
		cmp dword[eax+sb_offs_position],0
1683
		cmp dword[eax+sb_offs_position],0
1680
		je .ret_f
1684
		je .ret_f
1681
			dec dword[eax+sb_offs_position]
1685
			dec dword[eax+sb_offs_position]
1682
			call ted_scroll_set_redraw
1686
			call ted_scroll_set_redraw
1683
			call ted_cur_move_x_last_char
1687
			call ted_cur_move_x_last_char
1684
			mov dl,8
1688
			mov dl,8
1685
			jmp .ret_f
1689
			jmp .ret_f
1686
	@@:
1690
	@@:
1687
	cmp ted_cur_y,0
1691
	cmp ted_cur_y,0
1688
	je @f
1692
	je @f
1689
		dec ted_cur_y
1693
		dec ted_cur_y
1690
		call ted_cur_move_x_last_char
1694
		call ted_cur_move_x_last_char
1691
		cmp dl,8
1695
		cmp dl,8
1692
		je .ret_f
1696
		je .ret_f
1693
		mov dl,3
1697
		mov dl,3
1694
		jmp .ret_f
1698
		jmp .ret_f
1695
	@@:
1699
	@@:
1696
	mov dl,0
1700
	mov dl,0
1697
	.ret_f:
1701
	.ret_f:
1698
	pop eax
1702
	pop eax
1699
	ret
1703
	ret
1700
 
1704
 
1701
;input:
1705
;input:
1702
; edi = pointer to tedit struct
1706
; edi = pointer to tedit struct
1703
align 16
1707
align 16
1704
ted_cur_move_right:
1708
ted_cur_move_right:
1705
	push eax ebx
1709
	push eax ebx
1706
	mov eax,ted_scr_h
1710
	mov eax,ted_scr_h
1707
	xor dl,dl
1711
	xor dl,dl
1708
	mov ebx,dword[eax+sb_offs_cur_area]
1712
	mov ebx,[eax+sb_offs_cur_area]
1709
	cmp ted_cur_x,ebx
1713
	cmp ted_cur_x,ebx
1710
	jge @f
1714
	jge @f
1711
		inc ted_cur_x
1715
		inc ted_cur_x
1712
		mov dl,1
1716
		mov dl,1
1713
		jmp .ret_f
1717
		jmp .ret_f
1714
	@@:
1718
	@@:
1715
		inc dword[eax+sb_offs_position]
1719
		inc dword[eax+sb_offs_position]
1716
		mov dl,8
1720
		mov dl,8
1717
	.ret_f:
1721
	.ret_f:
1718
	pop ebx eax
1722
	pop ebx eax
1719
	ret
1723
	ret
1720
 
1724
 
1721
;input:
1725
;input:
1722
; edi = pointer to tedit struct
1726
; edi = pointer to tedit struct
1723
align 16
1727
align 16
1724
ted_cur_move_x_last_char:
1728
ted_cur_move_x_last_char:
1725
;[hScr.position]
1729
;[hScr.position]
1726
;[hScr.cur_area]
1730
;[hScr.cur_area]
1727
;dl-???
1731
;dl-???
1728
  push eax ebx ecx
1732
  push eax ebx ecx
1729
  mov eax,ted_cur_y
1733
  mov eax,ted_cur_y
1730
  mov ecx,ted_scr_w
1734
  mov ecx,ted_scr_w
1731
  add eax,dword[ecx+sb_offs_position]
1735
  add eax,[ecx+sb_offs_position]
1732
  call ted_strlen
1736
  call ted_strlen
1733
  xor dl,dl
1737
  xor dl,dl
1734
 
1738
 
1735
  mov ecx,ted_scr_h
1739
  mov ecx,ted_scr_h
1736
  cmp ebx,dword[ecx+sb_offs_position]
1740
  cmp ebx,[ecx+sb_offs_position]
1737
  jge @f
1741
  jge @f
1738
    mov dl,8
1742
    mov dl,8
1739
    mov dword[ecx+sb_offs_position],ebx
1743
    mov [ecx+sb_offs_position],ebx
1740
  @@:
1744
  @@:
1741
  sub ebx,dword[ecx+sb_offs_position]
1745
  sub ebx,[ecx+sb_offs_position]
1742
 
1746
 
1743
  cmp ebx,dword[ecx+sb_offs_cur_area]
1747
  cmp ebx,[ecx+sb_offs_cur_area]
1744
  jle @f ; b---[---]---e
1748
  jle @f ; b---[---]---e
1745
    add dword[ecx+sb_offs_position],ebx
1749
    add [ecx+sb_offs_position],ebx
1746
    mov ebx,dword[ecx+sb_offs_cur_area]
1750
    mov ebx,[ecx+sb_offs_cur_area]
1747
    sub dword[ecx+sb_offs_position],ebx
1751
    sub [ecx+sb_offs_position],ebx
1748
    mov dl,8
1752
    mov dl,8
1749
  @@:
1753
  @@:
1750
  mov ted_cur_x,ebx
1754
  mov ted_cur_x,ebx
1751
  pop ecx ebx eax
1755
  pop ecx ebx eax
1752
  ret
1756
  ret
1753
 
1757
 
1754
;input:
1758
;input:
1755
; edi = pointer to tedit struct
1759
; edi = pointer to tedit struct
1756
;output:
1760
;output:
1757
; dl = 0 not move
1761
; dl = 0 not move
1758
; dl = 1 move cursor
1762
; dl = 1 move cursor
1759
; dl = 8 move cursor and scroll
1763
; dl = 8 move cursor and scroll
1760
align 16
1764
align 16
1761
ted_cur_move_x_first_char:
1765
ted_cur_move_x_first_char:
1762
	xor dl,dl
1766
	xor dl,dl
1763
	cmp ted_cur_x,0
1767
	cmp ted_cur_x,0
1764
	je @f
1768
	je @f
1765
		mov ted_cur_x,0
1769
		mov ted_cur_x,0
1766
		mov dl,1
1770
		mov dl,1
1767
	@@:
1771
	@@:
1768
	push eax
1772
	push eax
1769
	mov eax,ted_scr_h
1773
	mov eax,ted_scr_h
1770
	cmp dword[eax+sb_offs_position],0
1774
	cmp dword[eax+sb_offs_position],0
1771
	je @f
1775
	je @f
1772
		mov dword[eax+sb_offs_position],0
1776
		mov dword[eax+sb_offs_position],0
1773
		mov dl,8
1777
		mov dl,8
1774
	@@:
1778
	@@:
1775
	pop eax
1779
	pop eax
1776
	ret
1780
	ret
1777
 
1781
 
1778
;input:
1782
;input:
1779
; edx = pointer to symbol struct
1783
; edx = pointer to symbol struct
1780
; edi = pointer to tedit struct
1784
; edi = pointer to tedit struct
1781
;output:
1785
;output:
1782
; eax = array index
1786
; eax = array index
1783
align 16
1787
align 16
1784
ted_get_text_arr_index:
1788
ted_get_text_arr_index:
1785
	push ecx edx
1789
	push ecx edx
1786
		mov eax,edx
1790
		mov eax,edx
1787
		sub eax,ted_tex
1791
		sub eax,ted_tex
1788
		xor edx,edx
1792
		xor edx,edx
1789
		mov ecx,sizeof.symbol
1793
		mov ecx,sizeof.symbol
1790
		div ecx
1794
		div ecx
1791
	pop edx ecx
1795
	pop edx ecx
1792
	ret
1796
	ret
1793
 
1797
 
1794
;input:
1798
;input:
1795
; edx = pointer to symbol struct
1799
; edx = pointer to symbol struct
1796
; edi = pointer to tedit struct
1800
; edi = pointer to tedit struct
1797
;output:
1801
;output:
1798
; edx = pointer to 'perv' struct
1802
; edx = pointer to 'perv' struct
1799
align 16
1803
align 16
1800
ted_get_text_perv_pos:
1804
ted_get_text_perv_pos:
1801
	mov edx,dword[edx+2]
1805
	mov edx,[edx+2]
1802
	imul edx,sizeof.symbol
1806
	imul edx,sizeof.symbol
1803
	add edx,ted_tex
1807
	add edx,ted_tex
1804
	ret
1808
	ret
1805
 
1809
 
1806
;input:
1810
;input:
1807
; edx = pointer to symbol struct
1811
; edx = pointer to symbol struct
1808
;output:
1812
;output:
1809
; edx = pointer to 'next' symbol struct
1813
; edx = pointer to 'next' symbol struct
1810
align 16
1814
align 16
1811
ted_get_text_next_pos:
1815
ted_get_text_next_pos:
1812
	mov edx,dword[edx+6]
1816
	mov edx,[edx+6]
1813
	imul edx,sizeof.symbol
1817
	imul edx,sizeof.symbol
1814
	add edx,ted_tex
1818
	add edx,ted_tex
1815
	ret
1819
	ret
1816
 
1820
 
1817
;input:
1821
;input:
1818
; edi = pointer to tedit struct
1822
; edi = pointer to tedit struct
1819
;output:
1823
;output:
1820
; edx = symbol under cursor
1824
; edx = symbol under cursor
1821
; ted_gp_opt = 1,2
1825
; ted_gp_opt = 1,2
1822
; edx = tex[1].perv if error
1826
; edx = tex[1].perv if error
1823
; ted_gp_opt = 0
1827
; ted_gp_opt = 0
1824
align 16
1828
align 16
1825
ted_get_pos_by_cursor:
1829
ted_get_pos_by_cursor:
1826
	push eax ecx esi
1830
	push eax ecx esi
1827
		mov esi,ted_cur_x
1831
		mov esi,ted_cur_x
1828
		mov eax,ted_scr_h
1832
		mov eax,ted_scr_h
1829
		add esi,dword[eax+sb_offs_position]
1833
		add esi,[eax+sb_offs_position]
1830
		mov ecx,ted_cur_y
1834
		mov ecx,ted_cur_y
1831
		mov eax,ted_scr_w
1835
		mov eax,ted_scr_w
1832
		add ecx,dword[eax+sb_offs_position]
1836
		add ecx,[eax+sb_offs_position]
1833
		call ted_get_pos_by_coords
1837
		call ted_get_pos_by_coords
1834
	pop esi ecx eax
1838
	pop esi ecx eax
1835
	ret
1839
	ret
1836
 
1840
 
1837
;input:
1841
;input:
1838
; esi = XPos
1842
; esi = XPos
1839
; ecx = YPos
1843
; ecx = YPos
1840
; edi = pointer to tedit struct
1844
; edi = pointer to tedit struct
1841
;output:
1845
;output:
1842
; edx = symbol under cursor
1846
; edx = symbol under cursor
1843
; ted_gp_opt = 1 if found text line
1847
; ted_gp_opt = 1 if found text line
1844
; ted_gp_opt = 2 if found text line and column
1848
; ted_gp_opt = 2 if found text line and column
1845
; edx = tex[1] if error
1849
; edx = tex[1] if error
1846
; ted_gp_opt = 0 if text no found
1850
; ted_gp_opt = 0 if text no found
1847
align 16
1851
align 16
1848
ted_get_pos_by_coords:
1852
ted_get_pos_by_coords:
1849
  push eax ;Row
1853
  push eax ;Row
1850
  push ebx ;Col
1854
  push ebx ;Col
1851
 
1855
 
1852
  xor eax,eax
1856
  xor eax,eax
1853
  xor ebx,ebx
1857
  xor ebx,ebx
1854
  mov ted_gp_opt,0
1858
  mov ted_gp_opt,0
1855
  mov edx,ted_tex
1859
  mov edx,ted_tex
1856
  @@:
1860
  @@:
1857
    call ted_iterat_next
1861
    call ted_iterat_next
1858
    cmp edx,ted_tex_1
1862
    cmp edx,ted_tex_1
1859
    jle @f 
1863
    jle @f 
1860
    cmp ebx,esi
1864
    cmp ebx,esi
1861
    jne .u1_0 ;Col <> ted_cur_x
1865
    jne .u1_0 ;Col <> ted_cur_x
1862
      mov ted_gp_opt,1
1866
      mov ted_gp_opt,1
1863
      cmp eax,ecx
1867
      cmp eax,ecx
1864
      jge @f ; Row >= ted_cur_y
1868
      jge @f ; Row >= ted_cur_y
1865
    .u1_0:
1869
    .u1_0:
1866
    mov ted_gp_opt,0
1870
    mov ted_gp_opt,0
1867
    inc ebx
1871
    inc ebx
1868
    cmp byte [edx],13
1872
    cmp byte [edx],13
1869
    jne @b
1873
    jne @b
1870
    cmp eax,ecx
1874
    cmp eax,ecx
1871
    jge @f ; Row >= ted_cur_y
1875
    jge @f ; Row >= ted_cur_y
1872
    inc eax
1876
    inc eax
1873
    xor ebx,ebx
1877
    xor ebx,ebx
1874
    jmp @b
1878
    jmp @b
1875
  @@:
1879
  @@:
1876
  cmp eax,ecx
1880
  cmp eax,ecx
1877
  jne @f ; Row = ted_cur_y
1881
  jne @f ; Row = ted_cur_y
1878
    inc ted_gp_opt
1882
    inc ted_gp_opt
1879
  @@:
1883
  @@:
1880
  cmp ted_gp_opt,0
1884
  cmp ted_gp_opt,0
1881
  jne @f
1885
  jne @f
1882
    mov edx,ted_tex_1
1886
    mov edx,ted_tex_1
1883
    ;call ted_get_text_perv_pos
1887
    ;call ted_get_text_perv_pos
1884
  @@:
1888
  @@:
1885
  pop ebx eax
1889
  pop ebx eax
1886
  ret
1890
  ret
1887
 
1891
 
1888
 
1892
 
1889
;input:
1893
;input:
1890
; eax = Row
1894
; eax = Row
1891
; edi = pointer to tedit struct
1895
; edi = pointer to tedit struct
1892
;output:
1896
;output:
1893
; ebx = str len
1897
; ebx = str len
1894
align 16
1898
align 16
1895
ted_strlen:
1899
ted_strlen:
1896
  push edx ecx
1900
  push edx ecx
1897
  ;ecx = Row, from cycle
1901
  ;ecx = Row, from cycle
1898
 
1902
 
1899
  xor ebx,ebx
1903
  xor ebx,ebx
1900
  xor ecx,ecx
1904
  xor ecx,ecx
1901
  mov edx,ted_tex
1905
  mov edx,ted_tex
1902
  @@:
1906
  @@:
1903
    call ted_iterat_next
1907
    call ted_iterat_next
1904
    cmp edx,ted_tex_1
1908
    cmp edx,ted_tex_1
1905
    jle @f 
1909
    jle @f 
1906
    inc ebx
1910
    inc ebx
1907
    cmp byte [edx],13
1911
    cmp byte [edx],13
1908
    jne @b
1912
    jne @b
1909
    dec ebx ;lenght minus 1 sumbol to paragraph
1913
    dec ebx ;lenght minus 1 sumbol to paragraph
1910
    cmp eax,ecx
1914
    cmp eax,ecx
1911
    je @f
1915
    je @f
1912
    xor ebx,ebx
1916
    xor ebx,ebx
1913
    inc ecx
1917
    inc ecx
1914
    jmp @b
1918
    jmp @b
1915
  @@:
1919
  @@:
1916
 
1920
 
1917
  cmp eax,ecx
1921
  cmp eax,ecx
1918
  je @f
1922
  je @f
1919
    xor ebx,ebx
1923
    xor ebx,ebx
1920
  @@:
1924
  @@:
1921
 
1925
 
1922
  pop ecx edx
1926
  pop ecx edx
1923
  ret
1927
  ret
1924
 
1928
 
1925
 
1929
 
1926
;input:
1930
;input:
1927
; edx = symbol position
1931
; edx = symbol position
1928
; edi = pointer to tedit struct
1932
; edi = pointer to tedit struct
1929
;output:
1933
;output:
1930
; eax = number of line
1934
; eax = number of line
1931
; ebx = symbol position in line
1935
; ebx = symbol position in line
1932
align 16
1936
align 16
1933
ted_get_text_coords:
1937
ted_get_text_coords:
1934
  push edx
1938
  push edx
1935
  xor eax,eax
1939
  xor eax,eax
1936
  xor ebx,ebx
1940
  xor ebx,ebx
1937
  @@:
1941
  @@:
1938
    call ted_iterat_perv
1942
    call ted_iterat_perv
1939
 
1943
 
1940
    cmp eax,0
1944
    cmp eax,0
1941
    jne .no_col_mov
1945
    jne .no_col_mov
1942
    inc ebx
1946
    inc ebx
1943
    .no_col_mov:
1947
    .no_col_mov:
1944
 
1948
 
1945
    cmp edx,ted_tex_1
1949
    cmp edx,ted_tex_1
1946
    jle @f
1950
    jle @f
1947
    cmp byte [edx],13
1951
    cmp byte [edx],13
1948
    jne @b
1952
    jne @b
1949
    inc eax
1953
    inc eax
1950
    jmp @b
1954
    jmp @b
1951
  @@:
1955
  @@:
1952
  dec ebx
1956
  dec ebx
1953
  pop edx
1957
  pop edx
1954
  ret
1958
  ret
1955
 
1959
 
1956
;input:
1960
;input:
1957
; edi = pointer to tedit struct
1961
; edi = pointer to tedit struct
1958
;output:
1962
;output:
1959
; eax = num lines
1963
; eax = num lines
1960
align 16
1964
align 16
1961
ted_get_num_lines:
1965
ted_get_num_lines:
1962
	push edx
1966
	push edx
1963
	mov eax,1
1967
	mov eax,1
1964
	mov edx,ted_tex
1968
	mov edx,ted_tex
1965
	@@:
1969
	@@:
1966
		call ted_iterat_next
1970
		call ted_iterat_next
1967
		cmp edx,ted_tex_1
1971
		cmp edx,ted_tex_1
1968
		jle @f
1972
		jle @f
1969
		cmp byte [edx],13
1973
		cmp byte [edx],13
1970
		jne @b
1974
		jne @b
1971
		inc eax
1975
		inc eax
1972
		jmp @b
1976
		jmp @b
1973
	@@:
1977
	@@:
1974
;...
1978
;...
1975
;dec eax
1979
;dec eax
1976
	pop edx
1980
	pop edx
1977
	ret
1981
	ret
1978
 
1982
 
1979
 
1983
 
1980
;input:
1984
;input:
1981
; edi = pointer to tedit struct
1985
; edi = pointer to tedit struct
1982
;description:
1986
;description:
1983
; ®â¬¥­ï¥â ®â¬¥­¥­­ë¥ ¤¥©á⢨ï, ¯¥à¥¤ ¨§¬¥­¥­¨¥¬ ¤®ªã¬¥­â 
1987
; ®â¬¥­ï¥â ®â¬¥­¥­­ë¥ ¤¥©á⢨ï, ¯¥à¥¤ ¨§¬¥­¥­¨¥¬ ¤®ªã¬¥­â 
1984
align 16
1988
align 16
1985
proc ted_set_undo
1989
proc ted_set_undo
1986
	mov ted_drag_k,0 ;§ ª ­ç¨¢ ¥¬ ¢ë¤¥«¥­¨¥ ®â ª« ¢¨ âãàë
1990
	mov ted_drag_k,0 ;§ ª ­ç¨¢ ¥¬ ¢ë¤¥«¥­¨¥ ®â ª« ¢¨ âãàë
1987
	cmp ted_tim_undo,1
1991
	cmp ted_tim_undo,1
1988
	jl .no_work
1992
	jl .no_work
1989
 
1993
 
1990
	push eax ebx edx
1994
	push eax ebx edx
1991
	mov edx,ted_tex
1995
	mov edx,ted_tex
1992
	call ted_get_text_next_pos ;long i=tex[0].next;
1996
	call ted_get_text_next_pos ;long i=tex[0].next;
1993
	mov eax,ted_tim_undo
1997
	mov eax,ted_tim_undo
1994
	sub ted_tim_ch,eax ;ted_tim_ch-=ted_tim_undo;
1998
	sub ted_tim_ch,eax ;ted_tim_ch-=ted_tim_undo;
1995
	mov eax,ted_tim_ch
1999
	mov eax,ted_tim_ch
1996
	cmp ted_tim_ls,eax ;if(ted_tim_ls>ted_tim_ch)
2000
	cmp ted_tim_ls,eax ;if(ted_tim_ls>ted_tim_ch)
1997
	jle @f
2001
	jle @f
1998
		mov ted_tim_ls,0
2002
		mov ted_tim_ls,0
1999
	@@:
2003
	@@:
2000
		cmp edx,ted_tex_1
2004
		cmp edx,ted_tex_1
2001
		jle @f
2005
		jle @f
2002
 
2006
 
2003
		;if(tex[i].tc>ted_tim_ch){ // ¥á«¨ ᮧ¤ ­¨¥ ᨬ¢®«  ¡ë«® ®â¬¥­¥­®
2007
		;if(tex[i].tc>ted_tim_ch){ // ¥á«¨ ᮧ¤ ­¨¥ ᨬ¢®«  ¡ë«® ®â¬¥­¥­®
2004
		cmp [edx+symbol.tc],eax
2008
		cmp [edx+symbol.tc],eax
2005
		jle .no_u1
2009
		jle .no_u1
2006
			mov dword [edx+symbol.tc],0
2010
			mov dword [edx+symbol.tc],0
2007
			mov dword [edx+symbol.td],0
2011
			mov dword [edx+symbol.td],0
2008
 
2012
 
2009
			mov ebx,[edx+symbol.perv]
2013
			mov ebx,[edx+symbol.perv]
2010
			imul ebx,sizeof.symbol
2014
			imul ebx,sizeof.symbol
2011
			add ebx,ted_tex ;ebx=tex[i].perv
2015
			add ebx,ted_tex ;ebx=tex[i].perv
2012
			m2m dword [ebx+symbol.next],dword [edx+symbol.next] ;tex[tex[i].perv].next=tex[i].next;
2016
			m2m dword [ebx+symbol.next],dword [edx+symbol.next] ;tex[tex[i].perv].next=tex[i].next;
2013
 
2017
 
2014
			mov ebx,[edx+symbol.next]
2018
			mov ebx,[edx+symbol.next]
2015
			imul ebx,sizeof.symbol
2019
			imul ebx,sizeof.symbol
2016
			add ebx,ted_tex ;ebx=tex[i].next
2020
			add ebx,ted_tex ;ebx=tex[i].next
2017
			m2m dword [ebx+symbol.perv],dword [edx+symbol.perv] ;tex[tex[i].next].perv=tex[i].perv;
2021
			m2m dword [ebx+symbol.perv],dword [edx+symbol.perv] ;tex[tex[i].next].perv=tex[i].perv;
2018
 
2022
 
2019
			cmp ted_ptr_free_symb,edx
2023
			cmp ted_ptr_free_symb,edx
2020
			jle .no_cor_free
2024
			jle .no_cor_free
2021
				mov ted_ptr_free_symb,edx ;¬¥­ï¥¬ 㪠§ â¥«ì ­  ᢮¡®¤­ë© ᨬ¢®«, ¤«ï ¡®«¥¥ ¡ëáâண® ¯®¨áª  ¯ ¬ïâ¨
2025
				mov ted_ptr_free_symb,edx ;¬¥­ï¥¬ 㪠§ â¥«ì ­  ᢮¡®¤­ë© ᨬ¢®«, ¤«ï ¡®«¥¥ ¡ëáâண® ¯®¨áª  ¯ ¬ïâ¨
2022
			.no_cor_free:
2026
			.no_cor_free:
2023
			mov edx,ebx ;®¯â¨¬¨§¨à㥬 ¯® ᪮à®á⨠(edx ¯®á«¥ ¢ë§®¢  ted_get_text_next_pos ¡ã¤¥â à ¢¥­ ebx)
2027
			mov edx,ebx ;®¯â¨¬¨§¨à㥬 ¯® ᪮à®á⨠(edx ¯®á«¥ ¢ë§®¢  ted_get_text_next_pos ¡ã¤¥â à ¢¥­ ebx)
2024
			jmp @b
2028
			jmp @b
2025
		.no_u1:
2029
		.no_u1:
2026
 
2030
 
2027
		;else if(tex[i].td>ted_tim_ch) tex[i].td=0; // ¥á«¨ 㤠«¥­¨¥ ᨬ¢®«  ¡ë«® ®â¬¥­¥­®
2031
		;else if(tex[i].td>ted_tim_ch) tex[i].td=0; // ¥á«¨ 㤠«¥­¨¥ ᨬ¢®«  ¡ë«® ®â¬¥­¥­®
2028
		cmp [edx+symbol.td],eax
2032
		cmp [edx+symbol.td],eax
2029
		jle .no_u2
2033
		jle .no_u2
2030
			mov dword [edx+symbol.td],0
2034
			mov dword [edx+symbol.td],0
2031
		.no_u2:
2035
		.no_u2:
2032
 
2036
 
2033
		call ted_get_text_next_pos
2037
		call ted_get_text_next_pos
2034
		jmp @b
2038
		jmp @b
2035
	@@:
2039
	@@:
2036
	mov ted_tim_undo,0
2040
	mov ted_tim_undo,0
2037
	mov eax,ted_tim_co
2041
	mov eax,ted_tim_co
2038
	cmp ted_tim_ch,eax
2042
	cmp ted_tim_ch,eax
2039
	jge @f
2043
	jge @f
2040
		mov ted_tim_co,0
2044
		mov ted_tim_co,0
2041
	@@:
2045
	@@:
2042
	pop edx ebx eax
2046
	pop edx ebx eax
2043
	.no_work:
2047
	.no_work:
2044
	ret
2048
	ret
2045
endp
2049
endp
2046
 
2050
 
2047
;input:
2051
;input:
2048
; ecx = Col
2052
; ecx = Col
2049
; edx = Row
2053
; edx = Row
2050
; edi = pointer to tedit struct
2054
; edi = pointer to tedit struct
2051
align 16
2055
align 16
2052
ted_go_to_pos:
2056
ted_go_to_pos:
2053
	push eax
2057
	push eax
2054
	mov eax,ted_scr_w
2058
	mov eax,ted_scr_w
2055
	mov ted_cur_x,ecx
2059
	mov ted_cur_x,ecx
2056
	sub edx,dword[eax+sb_offs_position]
2060
	sub edx,[eax+sb_offs_position]
2057
 
2061
 
2058
	cmp edx,dword[eax+sb_offs_cur_area] ;ted_cur_y > [.cur_area]
2062
	cmp edx,[eax+sb_offs_cur_area] ;ted_cur_y > [.cur_area]
2059
	jl @f
2063
	jl @f
2060
		push ebx
2064
		push ebx
2061
		mov ebx,edx
2065
		mov ebx,edx
2062
		sub ebx,dword[eax+sb_offs_cur_area]
2066
		sub ebx,[eax+sb_offs_cur_area]
2063
		inc ebx
2067
		inc ebx
2064
		add dword[eax+sb_offs_position],ebx
2068
		add [eax+sb_offs_position],ebx
2065
		sub edx,ebx
2069
		sub edx,ebx
2066
		pop ebx
2070
		pop ebx
2067
		; ??? redrav
2071
		; ??? redrav
2068
	@@:
2072
	@@:
2069
	mov ted_cur_y,edx
2073
	mov ted_cur_y,edx
2070
	pop eax
2074
	pop eax
2071
	ret
2075
	ret
2072
 
2076
 
2073
;input:
2077
;input:
2074
; edi = pointer to tedit struct
2078
; edi = pointer to tedit struct
2075
align 16
2079
align 16
2076
ted_text_colored:
2080
ted_text_colored:
2077
  push eax edx
2081
  push eax edx
2078
  mov eax,ted_tim_ch
2082
  mov eax,ted_tim_ch
2079
  sub eax,ted_tim_undo
2083
  sub eax,ted_tim_undo
2080
  mov ted_tim_co,eax
2084
  mov ted_tim_co,eax
2081
  mov edx,ted_tex
2085
  mov edx,ted_tex
2082
  @@:
2086
  @@:
2083
    call ted_iterat_next
2087
    call ted_iterat_next
2084
    cmp edx,ted_tex_1
2088
    cmp edx,ted_tex_1
2085
    jle @f
2089
    jle @f
2086
    mov byte[edx+1],0
2090
    mov byte[edx+1],0
2087
    jmp @b
2091
    jmp @b
2088
  @@:
2092
  @@:
2089
 
2093
 
2090
  cmp ted_key_words_count,1
2094
  cmp ted_key_words_count,1
2091
  jl .no_colors
2095
  jl .no_colors
2092
  mov edx,ted_tex
2096
  mov edx,ted_tex
2093
  @@:
2097
  @@:
2094
    call ted_text_find_sel_color
2098
    call ted_text_find_sel_color
2095
    cmp edx,ted_tex_1
2099
    cmp edx,ted_tex_1
2096
    jle .no_colors
2100
    jle .no_colors
2097
    jmp @b
2101
    jmp @b
2098
  .no_colors:
2102
  .no_colors:
2099
  pop edx eax
2103
  pop edx eax
2100
  ret
2104
  ret
2101
 
2105
 
2102
 
2106
 
2103
;input:
2107
;input:
2104
; edx = pointer to start symbol
2108
; edx = pointer to start symbol
2105
; edi = pointer to tedit struct
2109
; edi = pointer to tedit struct
2106
;output:
2110
;output:
2107
; edx = pointer to next symbol
2111
; edx = pointer to next symbol
2108
;description:
2112
;description:
2109
; ”ã­ªæ¨ï ¤«ï ¯®¨áª  ¨ ¢ë¤¥«¥­¨ï ¯®¤á¢¥ç¥­ëå á«®¢
2113
; ”ã­ªæ¨ï ¤«ï ¯®¨áª  ¨ ¢ë¤¥«¥­¨ï ¯®¤á¢¥ç¥­ëå á«®¢
2110
align 16
2114
align 16
2111
proc ted_text_find_sel_color uses eax ebx ecx esi
2115
proc ted_text_find_sel_color uses eax ebx ecx esi
2112
locals
2116
locals
2113
	begPos dd ? ;­ ç «ì­ ï ¯®§¨æ¨ï
2117
	begPos dd ? ;­ ç «ì­ ï ¯®§¨æ¨ï
2114
	endPos dd ? ;ª®­¥ç­ ï ¯®§¨æ¨ï
2118
	endPos dd ? ;ª®­¥ç­ ï ¯®§¨æ¨ï
2115
	find db ? ;­ ©¤¥­® / ­¥ ­ ©¤¥­®
2119
	find db ? ;­ ©¤¥­® / ­¥ ­ ©¤¥­®
2116
	f_color db ? ;¨­¤¥ªá æ¢¥â  ­ ©¤¥­®£® á«®¢ 
2120
	f_color db ? ;¨­¤¥ªá æ¢¥â  ­ ©¤¥­®£® á«®¢ 
2117
endl
2121
endl
2118
;eax = word_n ⥪ã騩 ­®¬¥à (¯®§¨æ¨ï) ¯à®¢¥à塞®£® á«®¢  ¢ ᯨ᪥
2122
;eax = word_n ⥪ã騩 ­®¬¥à (¯®§¨æ¨ï) ¯à®¢¥à塞®£® á«®¢  ¢ ᯨ᪥
2119
;ebx = ¤«ï à §­ëå 楫¥©
2123
;ebx = ¤«ï à §­ëå 楫¥©
2120
;ecx = l_pos ¯®á«¥¤­¨© ­®¬¥à (¯®§¨æ¨ï) ¯®¤å®¤ï饣® á«®¢  ¢ ᯨ᪥
2124
;ecx = l_pos ¯®á«¥¤­¨© ­®¬¥à (¯®§¨æ¨ï) ¯®¤å®¤ï饣® á«®¢  ¢ ᯨ᪥
2121
;esi = ¤«ï à §­ëå 楫¥©, ­®¬¥à ¯à®¢¥à塞®£® ᨬ¢®«  ¢ á«®¢¥
2125
;esi = ¤«ï à §­ëå 楫¥©, ­®¬¥à ¯à®¢¥à塞®£® ᨬ¢®«  ¢ á«®¢¥
2122
	mov dword[begPos],1
2126
	mov dword[begPos],1
2123
	mov dword[endPos],1
2127
	mov dword[endPos],1
2124
	mov byte[find],0
2128
	mov byte[find],0
2125
	mov byte[f_color],1
2129
	mov byte[f_color],1
2126
	@@:
2130
	@@:
2127
		call ted_iterat_next
2131
		call ted_iterat_next
2128
		cmp edx,ted_tex_1
2132
		cmp edx,ted_tex_1
2129
		jle @f
2133
		jle @f
2130
 
2134
 
2131
		xor eax,eax
2135
		xor eax,eax
2132
		mov al,byte[edx]
2136
		mov al,byte[edx]
2133
		shl ax,2 ;eax*=4
2137
		shl ax,2 ;eax*=4
2134
		add eax,ted_arr_key_pos
2138
		add eax,ted_arr_key_pos
2135
		mov eax,dword[eax]
2139
		mov eax,[eax]
2136
		cmp eax,0
2140
		cmp eax,0
2137
		jl @b ;if( (word_n=ted_arr_key_pos[(unsigned char)tex[i].c])>-1 ){
2141
		jl @b ;if( (word_n=ted_arr_key_pos[(unsigned char)tex[i].c])>-1 ){
2138
 
2142
 
2139
		mov ecx,eax
2143
		mov ecx,eax
2140
		;while(l_pos
2144
		;while(l_pos
2141
		.wh_1b:
2145
		.wh_1b:
2142
			cmp ecx,ted_key_words_count
2146
			cmp ecx,ted_key_words_count
2143
			jge .wh_1e
2147
			jge .wh_1e
2144
			ColToIndexOffset ecx,esi
2148
			ColToIndexOffset ecx,esi
2145
			mov bl,byte[esi]
2149
			mov bl,byte[esi]
2146
			ColToIndexOffset eax,esi
2150
			ColToIndexOffset eax,esi
2147
			cmp bl,byte[esi]
2151
			cmp bl,byte[esi]
2148
			jne .wh_1e
2152
			jne .wh_1e
2149
				inc ecx
2153
				inc ecx
2150
			jmp .wh_1b
2154
			jmp .wh_1b
2151
		.wh_1e:
2155
		.wh_1e:
2152
 
2156
 
2153
		mov dword[begPos],edx ;bP=i;
2157
		mov [begPos],edx ;bP=i;
2154
		mov esi,1
2158
		mov esi,1
2155
align 4
2159
align 4
2156
		.wh_2b: ;while(1){
2160
		.wh_2b: ;while(1){
2157
		call ted_iterat_next
2161
		call ted_iterat_next
2158
 
2162
 
2159
		;while(l_pos>word_n && Col[l_pos-1].Text[pos]!=tex[i].c)
2163
		;while(l_pos>word_n && Col[l_pos-1].Text[pos]!=tex[i].c)
2160
		.wh_3b:
2164
		.wh_3b:
2161
			cmp ecx,eax
2165
			cmp ecx,eax
2162
			jle .wh_3e
2166
			jle .wh_3e
2163
			dec ecx
2167
			dec ecx
2164
			ColToIndexOffset ecx,ebx
2168
			ColToIndexOffset ecx,ebx
2165
			inc ecx
2169
			inc ecx
2166
			;cmp byte[ebx+esi],byte[edx]
2170
			;cmp byte[ebx+esi],byte[edx]
2167
			mov bl,byte[ebx+esi]
2171
			mov bl,byte[ebx+esi]
2168
			cmp bl,byte[edx]
2172
			cmp bl,byte[edx]
2169
			je .wh_3e
2173
			je .wh_3e
2170
				dec ecx
2174
				dec ecx
2171
			jmp .wh_3b
2175
			jmp .wh_3b
2172
		.wh_3e:
2176
		.wh_3e:
2173
 
2177
 
2174
		ColToIndexOffset eax,ebx
2178
		ColToIndexOffset eax,ebx
2175
		cmp byte[ebx+esi],0
2179
		cmp byte[ebx+esi],0
2176
		jne .if_0 ;if(Col[word_n].Text[pos]==0){
2180
		jne .if_0 ;if(Col[word_n].Text[pos]==0){
2177
		mov dword[endPos],edx ;eP=i;
2181
		mov [endPos],edx ;eP=i;
2178
		ColToIndexOffset eax,ebx
2182
		ColToIndexOffset eax,ebx
2179
		mov bl,byte[ebx+MAX_COLOR_WORD_LEN+7]
2183
		mov bl,[ebx+MAX_COLOR_WORD_LEN+7]
2180
		mov byte[f_color],bl ;f_color=Col[word_n].color;
2184
		mov [f_color],bl ;f_color=Col[word_n].color;
2181
 
2185
 
2182
		mov byte[find],1
2186
		mov byte[find],1
2183
		ColToIndexOffset eax,ebx ;... ebx = Col[word_n]
2187
		ColToIndexOffset eax,ebx ;... ebx = Col[word_n]
2184
		mov bl,byte[ebx+MAX_COLOR_WORD_LEN+4]
2188
		mov bl,[ebx+MAX_COLOR_WORD_LEN+4]
2185
		cmp bl,0 ;if(Col[word_n].wwo)
2189
		cmp bl,0 ;if(Col[word_n].wwo)
2186
		je .if_2n
2190
		je .if_2n
2187
			push edx
2191
			push edx
2188
			mov edx,dword[begPos]
2192
			mov edx,[begPos]
2189
			call ted_iterat_perv
2193
			call ted_iterat_perv
2190
 
2194
 
2191
			btr bx,0 ;1-1
2195
			btr bx,0 ;1-1
2192
			jae .if_3e ;if(Col[word_n].wwo&1)
2196
			jae .if_3e ;if(Col[word_n].wwo&1)
2193
				;u1= !(isalnum(cont_s)||cont_s=='_')
2197
				;u1= !(isalnum(cont_s)||cont_s=='_')
2194
				call isalnum
2198
				call isalnum
2195
				jae .if_3e
2199
				jae .if_3e
2196
					mov byte[find],0
2200
					mov byte[find],0
2197
					jmp .if_4e
2201
					jmp .if_4e
2198
			.if_3e:
2202
			.if_3e:
2199
 
2203
 
2200
			btr bx,3 ;4-1
2204
			btr bx,3 ;4-1
2201
			jae .if_4e ;if(Col[word_n].wwo&8)
2205
			jae .if_4e ;if(Col[word_n].wwo&8)
2202
				;u1= !isalpha(cont_s);
2206
				;u1= !isalpha(cont_s);
2203
				call isalpha
2207
				call isalpha
2204
				jae .if_4e
2208
				jae .if_4e
2205
					mov byte[find],0
2209
					mov byte[find],0
2206
			.if_4e:
2210
			.if_4e:
2207
 
2211
 
2208
			mov edx,dword[endPos]
2212
			mov edx,[endPos]
2209
			;call ted_iterat_next
2213
			;call ted_iterat_next
2210
 
2214
 
2211
			btr bx,1 ;2-1
2215
			btr bx,1 ;2-1
2212
			jae .if_5e ;if(Col[word_n].wwo&2)
2216
			jae .if_5e ;if(Col[word_n].wwo&2)
2213
				;u1= !(isalnum(cont_s)||cont_s=='_')
2217
				;u1= !(isalnum(cont_s)||cont_s=='_')
2214
				call isalnum
2218
				call isalnum
2215
				jae .if_5e
2219
				jae .if_5e
2216
					mov byte[find],0
2220
					mov byte[find],0
2217
					jmp .if_6e
2221
					jmp .if_6e
2218
			.if_5e:
2222
			.if_5e:
2219
 
2223
 
2220
			btr bx,4 ;5-1
2224
			btr bx,4 ;5-1
2221
			jae .if_6e ;if(Col[word_n].wwo&16)
2225
			jae .if_6e ;if(Col[word_n].wwo&16)
2222
				;u1= !isalpha(cont_s);
2226
				;u1= !isalpha(cont_s);
2223
				call isalpha
2227
				call isalpha
2224
				jae .if_6e
2228
				jae .if_6e
2225
					mov byte[find],0
2229
					mov byte[find],0
2226
			.if_6e:
2230
			.if_6e:
2227
 
2231
 
2228
			btr bx,2 ;3-1
2232
			btr bx,2 ;3-1
2229
			jae .if_7e ;if(Col[word_n].wwo&4)
2233
			jae .if_7e ;if(Col[word_n].wwo&4)
2230
				ColToIndexOffset eax,ebx
2234
				ColToIndexOffset eax,ebx
2231
				mov bx,word[ebx+MAX_COLOR_WORD_LEN+5]
2235
				mov bx,word[ebx+MAX_COLOR_WORD_LEN+5]
2232
				call ted_iterat_next_pos_char
2236
				call ted_iterat_next_pos_char
2233
				cmp edx,ted_tex_1
2237
				cmp edx,ted_tex_1
2234
				jle .if_7e
2238
				jle .if_7e
2235
					mov dword[endPos],edx
2239
					mov dword[endPos],edx
2236
			.if_7e:
2240
			.if_7e:
2237
 
2241
 
2238
			pop edx
2242
			pop edx
2239
		.if_2n:
2243
		.if_2n:
2240
;if(i!=1){ // ­¥ ª®­¥æ ¤®ªã¬¥­â 
2244
;if(i!=1){ // ­¥ ª®­¥æ ¤®ªã¬¥­â 
2241
;  cont_s=tex[eP].c;
2245
;  cont_s=tex[eP].c;
2242
;  if(Col[word_n].wwo&2) u2= !(isalnum(cont_s)||cont_s=='_');  // ­¥ ¡ãª¢.-ç¨á«. ᨬ¢®«
2246
;  if(Col[word_n].wwo&2) u2= !(isalnum(cont_s)||cont_s=='_');  // ­¥ ¡ãª¢.-ç¨á«. ᨬ¢®«
2243
;  if(u2 && Col[word_n].wwo&16) u2= !isalpha(cont_s); // ­¥ ç¨á«. ᨬ¢®«
2247
;  if(u2 && Col[word_n].wwo&16) u2= !isalpha(cont_s); // ­¥ ç¨á«. ᨬ¢®«
2244
;  if(Col[word_n].wwo&4) eP=ted_iterat_next_pos_char(eP,Col[word_n].endc);
2248
;  if(Col[word_n].wwo&4) eP=ted_iterat_next_pos_char(eP,Col[word_n].endc);
2245
 
2249
 
2246
			cmp eax,ecx
2250
			cmp eax,ecx
2247
			je .wh_2e ;if(word_n==l_pos) break; // do double - ¥á«¨ á«®¢® â®ç­® ¯®á«¥¤­¥¥
2251
			je .wh_2e ;if(word_n==l_pos) break; // do double - ¥á«¨ á«®¢® â®ç­® ¯®á«¥¤­¥¥
2248
		.if_0:
2252
		.if_0:
2249
 
2253
 
2250
		cmp edx,ted_tex_1
2254
		cmp edx,ted_tex_1
2251
		jle .wh_2e ;if(i==1) break;
2255
		jle .wh_2e ;if(i==1) break;
2252
 
2256
 
2253
		;while(l_pos>word_n && Col[word_n].Text[pos]!=tex[i].c)
2257
		;while(l_pos>word_n && Col[word_n].Text[pos]!=tex[i].c)
2254
		.wh_4b:
2258
		.wh_4b:
2255
		cmp ecx,eax
2259
		cmp ecx,eax
2256
		jle .wh_4e
2260
		jle .wh_4e
2257
			ColToIndexOffset eax,ebx
2261
			ColToIndexOffset eax,ebx
2258
			;cmp byte[ebx+esi],byte[edx]
2262
			;cmp byte[ebx+esi],byte[edx]
2259
			mov bl,byte[ebx+esi]
2263
			mov bl,byte[ebx+esi]
2260
			cmp bl,byte[edx]
2264
			cmp bl,byte[edx]
2261
			je .wh_4e
2265
			je .wh_4e
2262
				inc eax
2266
				inc eax
2263
			jmp .wh_4b
2267
			jmp .wh_4b
2264
		.wh_4e:
2268
		.wh_4e:
2265
 
2269
 
2266
		cmp eax,ecx
2270
		cmp eax,ecx
2267
		je .wh_2e;if(word_n==l_pos) break;
2271
		je .wh_2e;if(word_n==l_pos) break;
2268
			inc esi ;pos++;
2272
			inc esi ;pos++;
2269
			jmp .wh_2b
2273
			jmp .wh_2b
2270
		.wh_2e:
2274
		.wh_2e:
2271
 
2275
 
2272
		cmp byte[find],1 ;if(fnd)break;
2276
		cmp byte[find],1 ;if(fnd)break;
2273
		je @f
2277
		je @f
2274
			mov edx,dword[begPos];i=bP;
2278
			mov edx,[begPos];i=bP;
2275
		jmp @b
2279
		jmp @b
2276
	@@:
2280
	@@:
2277
 
2281
 
2278
	cmp byte[find],1
2282
	cmp byte[find],1
2279
	jne .if_1e ;if(fnd){ // ¢ë¤¥«¥­¨¥ ­ ©¤¥­®£® ⥪áâ 
2283
	jne .if_1e ;if(fnd){ // ¢ë¤¥«¥­¨¥ ­ ©¤¥­®£® ⥪áâ 
2280
		;if(!mode_sf1 || (mode_sf1 && strlen(Col[word_n].f1->c_str())>0)){
2284
		;if(!mode_sf1 || (mode_sf1 && strlen(Col[word_n].f1->c_str())>0)){
2281
		mov eax,dword[begPos]
2285
		mov eax,[begPos]
2282
		mov bl,byte[f_color]
2286
		mov bl,[f_color]
2283
		mov byte[eax+1],bl ;tex[bP].col=f_color;
2287
		mov [eax+1],bl ;tex[bP].col=f_color;
2284
		mov eax,dword[endPos]
2288
		mov eax,[endPos]
2285
		mov byte[eax+1],0xff ;tex[eP].col=255;
2289
		mov byte[eax+1],0xff ;tex[eP].col=255;
2286
		;return ItPoPerv(eP); // ¢®§¢à é ¥¬ ¯®§¨æ¨î ª®­æ  ¢å®¦¤¥­¨ï
2290
		;return ItPoPerv(eP); // ¢®§¢à é ¥¬ ¯®§¨æ¨î ª®­æ  ¢å®¦¤¥­¨ï
2287
		mov edx,dword[endPos]
2291
		mov edx,[endPos]
2288
		call ted_get_text_perv_pos
2292
		call ted_get_text_perv_pos
2289
		jmp @f
2293
		jmp @f
2290
	.if_1e:
2294
	.if_1e:
2291
		mov edx,ted_tex
2295
		mov edx,ted_tex
2292
	@@:
2296
	@@:
2293
 
2297
 
2294
	ret
2298
	ret
2295
endp
2299
endp
2296
 
2300
 
2297
;input:
2301
;input:
2298
; edx = pointer to char (byte)
2302
; edx = pointer to char (byte)
2299
;output:
2303
;output:
2300
; cf=1 if symbol is...
2304
; cf=1 if symbol is...
2301
align 16
2305
align 16
2302
tab_all_num db 0,0,0,0,0,0,0xff,11b,11111110b,0xff,0xff,10000111b,11111110b,0xff,0xff,111b,0,0,0,0,0,0,0,0;,0,0,0,0,0,0,0,0 - tab_alpha_0,0,0,0,0,0,0,0
2306
tab_all_num db 0,0,0,0,0,0,0xff,11b,11111110b,0xff,0xff,10000111b,11111110b,0xff,0xff,111b,0,0,0,0,0,0,0,0;,0,0,0,0,0,0,0,0 - tab_alpha_0,0,0,0,0,0,0,0
2303
tab_alpha db 0,0,0,0,0,0,0,0,11111110b,0xff,0xff,10000111b,11111110b,0xff,0xff,111b,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
2307
tab_alpha db 0,0,0,0,0,0,0,0,11111110b,0xff,0xff,10000111b,11111110b,0xff,0xff,111b,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
2304
 
2308
 
2305
;output:
2309
;output:
2306
; cf=1 ¥á«¨ ¢ [edx] ¡ãª¢ , æ¨äà  ¨«¨ '_'
2310
; cf=1 ¥á«¨ ¢ [edx] ¡ãª¢ , æ¨äà  ¨«¨ '_'
2307
align 16
2311
align 16
2308
isalnum:
2312
isalnum:
2309
	push eax ebx
2313
	push eax ebx
2310
	movzx eax,byte[edx] ;al=offset
2314
	movzx eax,byte[edx] ;al=offset
2311
	shr eax,3
2315
	shr eax,3
2312
	lea ebx,[tab_all_num]
2316
	lea ebx,[tab_all_num]
2313
	add ebx,eax
2317
	add ebx,eax
2314
	movzx ax,byte[edx] ;al=bit
2318
	movzx ax,byte[edx] ;al=bit
2315
	and ax,111b
2319
	and ax,111b
2316
	bt word[ebx],ax
2320
	bt word[ebx],ax
2317
	pop ebx eax
2321
	pop ebx eax
2318
	ret
2322
	ret
2319
 
2323
 
2320
;output:
2324
;output:
2321
; cf=1 ¥á«¨ ¢ [edx] ¡ãª¢  ¨«¨ '_'
2325
; cf=1 ¥á«¨ ¢ [edx] ¡ãª¢  ¨«¨ '_'
2322
align 16
2326
align 16
2323
isalpha:
2327
isalpha:
2324
	push eax ebx
2328
	push eax ebx
2325
	movzx eax,byte[edx] ;al=offset
2329
	movzx eax,byte[edx] ;al=offset
2326
	shr eax,3
2330
	shr eax,3
2327
	lea ebx,[tab_alpha]
2331
	lea ebx,[tab_alpha]
2328
	add ebx,eax
2332
	add ebx,eax
2329
	movzx ax,byte[edx] ;al=bit
2333
	movzx ax,byte[edx] ;al=bit
2330
	and ax,111b
2334
	and ax,111b
2331
	bt word[ebx],ax
2335
	bt word[ebx],ax
2332
	pop ebx eax
2336
	pop ebx eax
2333
	ret
2337
	ret
2334
 
2338
 
2335
align 16
2339
align 16
2336
proc ted_show_help_f1 uses eax edx edi, edit:dword
2340
proc ted_show_help_f1 uses eax edx edi, edit:dword
2337
	mov edi,[edit]
2341
	mov edi,[edit]
2338
 
2342
 
2339
	call ted_get_pos_by_cursor
2343
	call ted_get_pos_by_cursor
2340
	push edx
2344
	push edx
2341
		call ted_iterat_next_color_tag
2345
		call ted_iterat_next_color_tag
2342
		mov eax,edx
2346
		mov eax,edx
2343
	pop edx
2347
	pop edx
2344
	call ted_iterat_perv_color_tag
2348
	call ted_iterat_perv_color_tag
2345
 
2349
 
2346
	cmp eax,ted_tex
2350
	cmp eax,ted_tex
2347
	jle @f
2351
	jle @f
2348
	cmp edx,ted_tex_1
2352
	cmp edx,ted_tex_1
2349
	jle @f
2353
	jle @f
2350
		stdcall ted_find_help_id,eax
2354
		stdcall ted_find_help_id,eax
2351
	@@:
2355
	@@:
2352
	;call ted_draw_main_cursor
2356
	;call ted_draw_main_cursor
2353
	call ted_draw_help_f1
2357
	call ted_draw_help_f1
2354
	ret 
2358
	ret 
2355
endp
2359
endp
2356
 
2360
 
2357
;input:
2361
;input:
2358
; edx = position begin 'symbol' struct
2362
; edx = position begin 'symbol' struct
2359
; edi = pointer to tedit struct
2363
; edi = pointer to tedit struct
2360
; end_pos = position end 'symbol' struct
2364
; end_pos = position end 'symbol' struct
2361
align 16
2365
align 16
2362
proc ted_find_help_id, end_pos:dword
2366
proc ted_find_help_id, end_pos:dword
2363
; ecx = word_n
2367
; ecx = word_n
2364
; ebx = l_pos
2368
; ebx = l_pos
2365
  mov ted_help_id,-1
2369
  mov ted_help_id,-1
2366
 
2370
 
2367
  push ebx ecx
2371
  push ebx ecx
2368
    xor ebx,ebx
2372
    xor ebx,ebx
2369
    mov bl,byte[edx]
2373
    mov bl,[edx]
2370
    shl bx,2 ;ebx*=4
2374
    shl bx,2 ;ebx*=4
2371
    add ebx,ted_arr_key_pos
2375
    add ebx,ted_arr_key_pos
2372
    mov ecx,dword[ebx]
2376
    mov ecx,[ebx]
2373
    cmp ecx,0
2377
    cmp ecx,0
2374
    jl .if_0e ;if( (word_n=ted_arr_key_pos[(unsigned char)tf[0]])>-1 ){
2378
    jl .if_0e ;if( (word_n=ted_arr_key_pos[(unsigned char)tf[0]])>-1 ){
2375
      push esi eax
2379
      push esi eax
2376
      mov ebx,ecx ;l_pos=word_n;
2380
      mov ebx,ecx ;l_pos=word_n;
2377
      ColToIndexOffset ecx,esi
2381
      ColToIndexOffset ecx,esi
2378
      push cx
2382
      push cx
2379
      mov cl,byte[esi]
2383
      mov cl,[esi]
2380
      @@:
2384
      @@:
2381
	cmp ebx,ted_key_words_count ;while(l_pos
2385
	cmp ebx,ted_key_words_count ;while(l_pos
2382
	jge @f
2386
	jge @f
2383
	;ColToIndexOffset ecx,esi
2387
	;ColToIndexOffset ecx,esi
2384
	ColToIndexOffset ebx,eax
2388
	ColToIndexOffset ebx,eax
2385
	cmp cl,byte[eax] ;&& Col[l_pos].Text[0]==Col[word_n].Text[0])
2389
	cmp cl,[eax] ;&& Col[l_pos].Text[0]==Col[word_n].Text[0])
2386
	jne @f
2390
	jne @f
2387
	  inc ebx ;l_pos++;
2391
	  inc ebx ;l_pos++;
2388
	  jmp @b
2392
	  jmp @b
2389
      @@:
2393
      @@:
2390
      pop cx
2394
      pop cx
2391
      call ted_iterat_next ;pos=1;
2395
      call ted_iterat_next ;pos=1;
2392
      mov esi,1
2396
      mov esi,1
2393
      @@:
2397
      @@:
2394
	push dx
2398
	push dx
2395
	push word[edx]
2399
	push word[edx]
2396
	pop dx 
2400
	pop dx 
2397
	  .wh_0b:
2401
	  .wh_0b:
2398
	    cmp ebx,ecx ;while(l_pos>word_n
2402
	    cmp ebx,ecx ;while(l_pos>word_n
2399
	    jle .wh_0e
2403
	    jle .wh_0e
2400
	    dec ebx
2404
	    dec ebx
2401
	    ColToIndexOffset ebx,eax
2405
	    ColToIndexOffset ebx,eax
2402
	    inc ebx
2406
	    inc ebx
2403
	    cmp byte[eax+esi],dl ;&& Col[l_pos-1].Text[pos]!=tf[i])
2407
	    cmp byte[eax+esi],dl ;&& Col[l_pos-1].Text[pos]!=tf[i])
2404
	    je .wh_0e
2408
	    je .wh_0e
2405
	      dec ebx ;l_pos--;
2409
	      dec ebx ;l_pos--;
2406
	    jmp .wh_0b
2410
	    jmp .wh_0b
2407
	  .wh_0e:
2411
	  .wh_0e:
2408
 
2412
 
2409
	  .wh_1b:
2413
	  .wh_1b:
2410
	    cmp ebx,ecx ;while(l_pos>word_n
2414
	    cmp ebx,ecx ;while(l_pos>word_n
2411
	    jle .wh_1e
2415
	    jle .wh_1e
2412
	    ColToIndexOffset ecx,eax
2416
	    ColToIndexOffset ecx,eax
2413
	    cmp byte[eax+esi],dl
2417
	    cmp byte[eax+esi],dl
2414
	    je .wh_1e
2418
	    je .wh_1e
2415
	      inc ecx ;word_n++;
2419
	      inc ecx ;word_n++;
2416
	    jmp .wh_1b
2420
	    jmp .wh_1b
2417
	  .wh_1e:
2421
	  .wh_1e:
2418
	pop dx
2422
	pop dx
2419
 
2423
 
2420
	cmp ecx,ebx ;if(word_n==l_pos) break;
2424
	cmp ecx,ebx ;if(word_n==l_pos) break;
2421
	je @f
2425
	je @f
2422
	call ted_iterat_next ;pos++;
2426
	call ted_iterat_next ;pos++;
2423
	cmp edx,dword[end_pos] ;for(...;i
2427
	cmp edx,[end_pos] ;for(...;i
2424
	je @f ;jge
2428
	je @f ;jge
2425
	inc esi
2429
	inc esi
2426
	jmp @b
2430
	jmp @b
2427
      @@:
2431
      @@:
2428
      pop eax esi
2432
      pop eax esi
2429
 
2433
 
2430
      mov ted_help_id,ecx
2434
      mov ted_help_id,ecx
2431
      ;return word_n;
2435
      ;return word_n;
2432
 
2436
 
2433
    .if_0e:
2437
    .if_0e:
2434
  pop ecx ebx
2438
  pop ecx ebx
2435
  ret
2439
  ret
2436
endp
2440
endp
2437
 
2441
 
2438
;output:
2442
;output:
2439
; eax = ª®¤ ®è¨¡ª¨
2443
; eax = ª®¤ ®è¨¡ª¨
2440
; ebx = ª®««¨ç¥á⢮ ¯à®ç¨â ­­ëå ¡ ©â
2444
; ebx = ª®««¨ç¥á⢮ ¯à®ç¨â ­­ëå ¡ ©â
2441
align 16
2445
align 16
2442
proc ted_open_file uses ecx edx edi, edit:dword, file:dword, f_name:dword ;äã­ªæ¨ï ®âªàëâ¨ï ä ©« 
2446
proc ted_open_file uses ecx edx edi, edit:dword, file:dword, f_name:dword ;äã­ªæ¨ï ®âªàëâ¨ï ä ©« 
2443
	mov edi,[edit]
2447
	mov edi,[edit]
2444
 
2448
 
2445
	; *** ¯à®¢¥à塞 à §¬¥à ¯ ¬ï⨠¨ ¥á«¨ ­¥ 墠⠥â ⮠㢥«¨ç¨¢ ¥¬ ***
2449
	; *** ¯à®¢¥à塞 à §¬¥à ¯ ¬ï⨠¨ ¥á«¨ ­¥ 墠⠥â ⮠㢥«¨ç¨¢ ¥¬ ***
2446
	;¯à®¡ã¥¬ ¯®«ãç¨âì ¨­ä®à¬ æ¨î ® ä ©«¥
2450
	;¯à®¡ã¥¬ ¯®«ãç¨âì ¨­ä®à¬ æ¨î ® ä ©«¥
2447
	mov ebx,[file]
2451
	mov ebx,[file]
2448
	mov dword[ebx], SSF_GET_INFO
2452
	mov dword[ebx], SSF_GET_INFO
2449
	mov dword[ebx+4], 0
2453
	mov dword[ebx+4], 0
2450
	mov dword[ebx+8], 0
2454
	mov dword[ebx+8], 0
2451
	mov dword[ebx+12], 0
2455
	mov dword[ebx+12], 0
2452
	m2m dword[ebx+16], ted_tex
2456
	m2m dword[ebx+16], ted_tex
2453
	mov  byte[ebx+20], 0
2457
	mov  byte[ebx+20], 0
2454
	push dword[f_name]
2458
	push dword[f_name]
2455
	pop dword[ebx+21]
2459
	pop dword[ebx+21]
2456
	mcall SF_FILE
2460
	mcall SF_FILE
2457
	or eax,eax
2461
	or eax,eax
2458
	jz .end_0
2462
	jz .end_0
2459
		mov edx,ted_max_chars
2463
		mov edx,ted_max_chars
2460
		cmp eax,2 ;äã­ªæ¨ï ­¥ ¯®¤¤¥à¦¨¢ ¥âáï ¤«ï ¤ ­­®© ä ©«®¢®© á¨á⥬ë
2464
		cmp eax,2 ;äã­ªæ¨ï ­¥ ¯®¤¤¥à¦¨¢ ¥âáï ¤«ï ¤ ­­®© ä ©«®¢®© á¨á⥬ë
2461
		je @f
2465
		je @f
2462
		jmp .ret_f
2466
		jmp .ret_f
2463
align 4
2467
align 4
2464
	.end_0:
2468
	.end_0:
2465
	;¯à®¢¥à塞 墠â¨â «¨ ¯ ¬ï⨠¤«ï § £à㧪¨ ä ©« 
2469
	;¯à®¢¥à塞 墠â¨â «¨ ¯ ¬ï⨠¤«ï § £à㧪¨ ä ©« 
2466
	mov ecx,ted_max_chars
2470
	mov ecx,ted_max_chars
2467
	sub ecx,2 ;ecx = ¬ ªá¨¬ «ì­®¥ ç¨á«® ¡ ©â, ¤«ï ª®â®àëå ¡ë«  ¢ë¤¥«¥­  ¯ ¬ïâì
2471
	sub ecx,2 ;ecx = ¬ ªá¨¬ «ì­®¥ ç¨á«® ¡ ©â, ¤«ï ª®â®àëå ¡ë«  ¢ë¤¥«¥­  ¯ ¬ïâì
2468
	mov edx,ted_tex
2472
	mov edx,ted_tex
2469
	mov edx,[edx+32] ;+32 = +0x20: qword: à §¬¥à ä ©«  ¢ ¡ ©â å
2473
	mov edx,[edx+32] ;+32 = +0x20: qword: à §¬¥à ä ©«  ¢ ¡ ©â å
2470
	cmp edx,ecx
2474
	cmp edx,ecx
2471
	jl @f
2475
	jl @f
2472
		;㢥«¨ç¨¢ ¥¬ ¯ ¬ïâì ¥á«¨ ­¥ 墠⨫®
2476
		;㢥«¨ç¨¢ ¥¬ ¯ ¬ïâì ¥á«¨ ­¥ 墠⨫®
2473
		mov ecx,edx ;¯ ¬ïâì ­¥®¡å®¤¨¬ ï ¤«ï ®âªàëâ¨ï ä ©« 
2477
		mov ecx,edx ;¯ ¬ïâì ­¥®¡å®¤¨¬ ï ¤«ï ®âªàëâ¨ï ä ©« 
2474
		add ecx,2  ;¯ ¬ïâì ¤«ï á«ã¦¥¡­ëå ­ ç «ì­®£® ¨ ª®­¥ç­®£® ᨬ¢®«®¢
2478
		add ecx,2  ;¯ ¬ïâì ¤«ï á«ã¦¥¡­ëå ­ ç «ì­®£® ¨ ª®­¥ç­®£® ᨬ¢®«®¢
2475
		add ecx,ted_increase_size ;¯ ¬ïâì ¤«ï । ªâ¨à®¢ ­¨ï ä ©« 
2479
		add ecx,ted_increase_size ;¯ ¬ïâì ¤«ï । ªâ¨à®¢ ­¨ï ä ©« 
2476
		mov ted_max_chars,ecx
2480
		mov ted_max_chars,ecx
2477
		imul ecx,sizeof.symbol
2481
		imul ecx,sizeof.symbol
2478
		invoke mem.realloc, ted_tex,ecx
2482
		invoke mem.realloc, ted_tex,ecx
2479
		mov ted_tex,eax
2483
		mov ted_tex,eax
2480
		mov ted_tex_1,eax
2484
		mov ted_tex_1,eax
2481
		add ted_tex_1,sizeof.symbol
2485
		add ted_tex_1,sizeof.symbol
2482
		add eax,ecx
2486
		add eax,ecx
2483
		mov ted_tex_end,eax
2487
		mov ted_tex_end,eax
2484
		mov ecx,ted_tex_1
2488
		mov ecx,ted_tex_1
2485
		add ecx,sizeof.symbol
2489
		add ecx,sizeof.symbol
2486
		mov ted_ptr_free_symb,ecx
2490
		mov ted_ptr_free_symb,ecx
2487
	@@:
2491
	@@:
2488
 
2492
 
2489
	; *** ¯à®¡ã¥¬ ®âªàëâì ä ©« ***
2493
	; *** ¯à®¡ã¥¬ ®âªàëâì ä ©« ***
2490
	mov ebx,[file]
2494
	mov ebx,[file]
2491
	mov dword[ebx], SSF_READ_FILE
2495
	mov dword[ebx], SSF_READ_FILE
2492
	mov dword[ebx+4], 0
2496
	mov dword[ebx+4], 0
2493
	mov dword[ebx+8], 0
2497
	mov dword[ebx+8], 0
2494
	m2m dword[ebx+12], edx ;ç¨á«® ¡ ©â, ª®â®àë¥ ¬®£ãâ ¡ëâì áç¨â ­ë á ä ©«  (­¥ ¡®«ìè¥ ç¥¬ ted_max_chars)
2498
	m2m dword[ebx+12], edx ;ç¨á«® ¡ ©â, ª®â®àë¥ ¬®£ãâ ¡ëâì áç¨â ­ë á ä ©«  (­¥ ¡®«ìè¥ ç¥¬ ted_max_chars)
2495
	m2m dword[ebx+16], ted_tex
2499
	m2m dword[ebx+16], ted_tex
2496
	mov  byte[ebx+20], 0
2500
	mov  byte[ebx+20], 0
2497
	push dword[f_name]
2501
	push dword[f_name]
2498
	pop dword[ebx+21]
2502
	pop dword[ebx+21]
2499
	mcall SF_FILE
2503
	mcall SF_FILE
2500
 
2504
 
2501
	or eax,eax
2505
	or eax,eax
2502
	jz @f
2506
	jz @f
2503
	cmp eax,6
2507
	cmp eax,6
2504
	je @f
2508
	je @f
2505
		jmp .ret_f
2509
		jmp .ret_f
2506
	@@:
2510
	@@:
2507
	cmp ebx,-1
2511
	cmp ebx,-1
2508
	je .ret_f
2512
	je .ret_f
2509
		;if open file
2513
		;if open file
2510
		call ted_on_open_file
2514
		call ted_on_open_file
2511
	.ret_f:
2515
	.ret_f:
2512
	ret
2516
	ret
2513
endp
2517
endp
2514
 
2518
 
2515
align 16
2519
align 16
2516
proc ted_but_select_word, edit:dword
2520
proc ted_but_select_word, edit:dword
2517
	pushad
2521
	pushad
2518
	mov edi,[edit]
2522
	mov edi,[edit]
2519
 
2523
 
2520
	call ted_get_pos_by_cursor
2524
	call ted_get_pos_by_cursor
2521
	push edx
2525
	push edx
2522
		call ted_iterat_perv_color_tag
2526
		call ted_iterat_perv_color_tag
2523
		cmp edx,ted_tex_1
2527
		cmp edx,ted_tex_1
2524
		jle @f
2528
		jle @f
2525
			call ted_get_text_coords
2529
			call ted_get_text_coords
2526
			mov ted_sel_x0,ebx
2530
			mov ted_sel_x0,ebx
2527
			mov ted_sel_y0,eax
2531
			mov ted_sel_y0,eax
2528
		@@:
2532
		@@:
2529
	pop edx
2533
	pop edx
2530
	call ted_iterat_next_color_tag
2534
	call ted_iterat_next_color_tag
2531
	cmp edx,ted_tex_1
2535
	cmp edx,ted_tex_1
2532
	jle @f
2536
	jle @f
2533
		call ted_get_text_coords
2537
		call ted_get_text_coords
2534
		mov ted_sel_x1,ebx
2538
		mov ted_sel_x1,ebx
2535
		mov ted_sel_y1,eax
2539
		mov ted_sel_y1,eax
2536
	@@:
2540
	@@:
2537
 
2541
 
2538
	cmp ted_fun_draw_panel_buttons,0
2542
	cmp ted_fun_draw_panel_buttons,0
2539
	je @f
2543
	je @f
2540
		call ted_fun_draw_panel_buttons
2544
		call ted_fun_draw_panel_buttons
2541
	@@:
2545
	@@:
2542
	stdcall ted_draw,edi
2546
	stdcall ted_draw,edi
2543
	popad
2547
	popad
2544
	ret
2548
	ret
2545
endp
2549
endp
-
 
2550
 
-
 
2551
;output:
2546
 
2552
; al = 1 if delete
2547
align 16
2553
align 16
2548
proc ted_but_cut uses edi, edit:dword
2554
proc ted_but_cut uses edi, edit:dword
2549
	mov edi,[edit]
2555
	mov edi,[edit]
2550
 
2556
 
2551
	stdcall ted_but_copy,edi
2557
	stdcall ted_but_copy,edi
2552
	call ted_set_undo
2558
	call ted_set_undo
2553
	stdcall ted_sel_text_del,ted_opt_ed_change_time
2559
	stdcall ted_sel_text_del,ted_opt_ed_change_time
2554
 
2560
 
2555
	cmp al,1
2561
	cmp al,1
2556
	jne @f
2562
	jne @f
2557
		stdcall ted_draw,edi
2563
		stdcall ted_draw,edi
2558
		cmp ted_fun_draw_panel_buttons,0
2564
		cmp ted_fun_draw_panel_buttons,0
2559
		je @f
2565
		je @f
2560
			call ted_fun_draw_panel_buttons
2566
			call ted_fun_draw_panel_buttons
2561
	@@:
2567
	@@:
2562
	ret
2568
	ret
2563
endp
2569
endp
2564
 
-
 
2565
;output:
-
 
2566
; al = 1 if copy text
2570
 
2567
align 16
2571
align 16
2568
proc ted_but_copy, edit:dword
2572
proc ted_but_copy, edit:dword
2569
	pushad
2573
	pushad
2570
	mov edi,[edit]
2574
	mov edi,[edit]
2571
 
2575
 
2572
	call ted_is_select
2576
	call ted_is_select
2573
	or al,al
2577
	or al,al
2574
	jz .end_f ;if not selected text
2578
	jz .end_f ;if not selected text
2575
	call ted_sel_normalize
2579
	call ted_sel_normalize
2576
 
2580
 
2577
	mov esi,ted_seln_x1
2581
	mov esi,ted_seln_x1
2578
	mov ecx,ted_seln_y1
2582
	mov ecx,ted_seln_y1
2579
	call ted_get_pos_by_coords
2583
	call ted_get_pos_by_coords
2580
	mov ebx,edx
2584
	mov ebx,edx
2581
	mov esi,ted_seln_x0
2585
	mov esi,ted_seln_x0
2582
	mov ecx,ted_seln_y0
2586
	mov ecx,ted_seln_y0
2583
	call ted_get_pos_by_coords
2587
	call ted_get_pos_by_coords
2584
	mov esi,ebx
2588
	mov esi,ebx
2585
 
2589
 
2586
	mov ecx,12 ;system buffer header size
2590
	mov ecx,12 ;system buffer header size
2587
	mov ebx,ted_buffer
2591
	mov ebx,ted_buffer
2588
	mov dword[ebx+4],0 ;text data
2592
	mov dword[ebx+4],0 ;text data
2589
	mov dword[ebx+8],1 ;code 866
2593
	mov dword[ebx+8],1 ;code 866
2590
	add ebx,ecx
2594
	add ebx,ecx
2591
	@@:
2595
	@@:
2592
		cmp edx,ted_tex_1 ;end of file
2596
		cmp edx,ted_tex_1 ;end of file
2593
		jle @f
2597
		jle @f
2594
		cmp edx,esi ;end of select
2598
		cmp edx,esi ;end of select
2595
		je @f
2599
		je @f
2596
		inc ecx
2600
		inc ecx
2597
		cmp ecx,ted_buffer_size ;owerflow bufer
2601
		cmp ecx,ted_buffer_size ;owerflow bufer
2598
		je @f
2602
		je @f
2599
 
2603
 
2600
		mov al,byte[edx]
2604
		mov al,byte[edx]
2601
		mov byte[ebx],al
2605
		mov byte[ebx],al
2602
		inc ebx
2606
		inc ebx
2603
		cmp al,13
2607
		cmp al,13
2604
		jne .no_13
2608
		jne .no_13
2605
			mov byte[ebx],10 ;¤¥« ¥¬ ª®­¥æ áâப¨ ¢ ¡ãä¥à¥ 13,10 ¤«ï ᮢ¬¥á⨬®áâ¨ á ¤à㣨¬¨ ¯à®£à ¬¬ ¬¨
2609
			mov byte[ebx],10 ;¤¥« ¥¬ ª®­¥æ áâப¨ ¢ ¡ãä¥à¥ 13,10 ¤«ï ᮢ¬¥á⨬®áâ¨ á ¤à㣨¬¨ ¯à®£à ¬¬ ¬¨
2606
			inc ebx
2610
			inc ebx
2607
			inc ecx
2611
			inc ecx
2608
		.no_13:
2612
		.no_13:
2609
		
2613
		
2610
		call ted_iterat_next
2614
		call ted_iterat_next
2611
		jmp @b
2615
		jmp @b
2612
	@@:
2616
	@@:
2613
	mov byte[ebx],0
2617
	mov byte[ebx],0
2614
 
2618
 
2615
	cmp ecx,12
2619
	cmp ecx,12
2616
	je .end_f
2620
	je .end_f
2617
		mov ebx,ted_buffer
2621
		mov ebx,ted_buffer
2618
		mov [ebx],ecx
2622
		mov [ebx],ecx
2619
		mcall SF_CLIPBOARD,SSF_WRITE_CB,ecx,ted_buffer
2623
		mcall SF_CLIPBOARD,SSF_WRITE_CB,ecx,ted_buffer
2620
		call ted_draw_buffer
2624
		call ted_draw_buffer
2621
		cmp ted_fun_draw_panel_buttons,0
2625
		cmp ted_fun_draw_panel_buttons,0
2622
		je .end_f
2626
		je .end_f
2623
			call ted_fun_draw_panel_buttons
2627
			call ted_fun_draw_panel_buttons
2624
	.end_f:
2628
	.end_f:
2625
	popad
2629
	popad
2626
	ret
2630
	ret
2627
endp
2631
endp
2628
 
2632
 
2629
 
2633
 
2630
align 16
2634
align 16
2631
proc ted_but_paste, edit:dword
2635
proc ted_but_paste, edit:dword
2632
	pushad
2636
	pushad
2633
	mov edi,[edit]
2637
	mov edi,[edit]
2634
 
2638
 
2635
	mcall SF_CLIPBOARD,SSF_GET_SLOT_COUNT
2639
	mcall SF_CLIPBOARD,SSF_GET_SLOT_COUNT
2636
	cmp eax,1
2640
	cmp eax,1
2637
	jl .no_buf_r
2641
	jl .no_buf_r
2638
 
2642
 
2639
	mov esi,eax
2643
	mov esi,eax
2640
	.cycle: ;®¡à â­ë© 横« ¯® ᫮⠬
2644
	.cycle: ;®¡à â­ë© 横« ¯® ᫮⠬
2641
	dec esi ;­®¬¥à ⥪ã饣®, ¯à®¢¥à塞®£® á«®â 
2645
	dec esi ;­®¬¥à ⥪ã饣®, ¯à®¢¥à塞®£® á«®â 
2642
	mcall SF_CLIPBOARD,SSF_READ_CB,esi
2646
	mcall SF_CLIPBOARD,SSF_READ_CB,esi
2643
	cmp eax,1
2647
	cmp eax,1
2644
	je .no_buf_r
2648
	je .no_buf_r
2645
	cmp eax,-1
2649
	cmp eax,-1
2646
	je .no_buf_r
2650
	je .no_buf_r
2647
		mov ecx,dword[eax]
2651
		mov ecx,[eax]
2648
		cmp ecx,1 ;size
2652
		cmp ecx,1 ;size
2649
		jl .no_buf_r
2653
		jl .no_buf_r
2650
		cmp dword[eax+4],0 ;text
2654
		cmp dword[eax+4],0 ;text
2651
		je @f
2655
		je @f
2652
			cmp esi,1
2656
			cmp esi,1
2653
			jge .cycle ;¥á«¨ ¢ ¡ãä¥à¥ ­¥ ⥪áâ,   ᫮⮢ ¢ ¡ãä¥à¥ ­¥áª®«ìª®, ¯à®¡ã¥¬ ¯¥à¥©â¨ ª ¢¥àå­¥¬ã á«®âã
2657
			jge .cycle ;¥á«¨ ¢ ¡ãä¥à¥ ­¥ ⥪áâ,   ᫮⮢ ¢ ¡ãä¥à¥ ­¥áª®«ìª®, ¯à®¡ã¥¬ ¯¥à¥©â¨ ª ¢¥àå­¥¬ã á«®âã
2654
			jmp .no_buf_r
2658
			jmp .no_buf_r
2655
		@@:
2659
		@@:
2656
		cmp dword[eax+8],1 ;866
2660
		cmp dword[eax+8],1 ;866
2657
		je @f
2661
		je @f
2658
			cmp esi,1
2662
			cmp esi,1
2659
			jge .cycle ;¥á«¨ ¢ ¡ãä¥à¥ ⥪áâ ­¥ ¢ ª®¤¨à®¢ª¥ 866 ... ¯à®¡ã¥¬ ¯¥à¥©â¨ ª ¢¥àå­¥¬ã á«®âã
2663
			jge .cycle ;¥á«¨ ¢ ¡ãä¥à¥ ⥪áâ ­¥ ¢ ª®¤¨à®¢ª¥ 866 ... ¯à®¡ã¥¬ ¯¥à¥©â¨ ª ¢¥àå­¥¬ã á«®âã
2660
			jmp .no_buf_r
2664
			jmp .no_buf_r
2661
		@@:
2665
		@@:
2662
		;ª®¯¨à®¢ ­¨¥ ⥪áâ  ¨§ á¨á⥬­®£® ¡ãä¥à  ¢® ¢­ãâ७­¨©
2666
		;ª®¯¨à®¢ ­¨¥ ⥪áâ  ¨§ á¨á⥬­®£® ¡ãä¥à  ¢® ¢­ãâ७­¨©
2663
		cmp ecx,ted_buffer_size
2667
		cmp ecx,ted_buffer_size
2664
		jle @f
2668
		jle @f
2665
			mov ecx,ted_buffer_size
2669
			mov ecx,ted_buffer_size
2666
		@@:
2670
		@@:
2667
		mov edi,ted_buffer
2671
		mov edi,ted_buffer
2668
		mov esi,eax
2672
		mov esi,eax
2669
		add	esi,4 ;12
2673
		add	esi,4 ;12
2670
		mov dword[edi],ecx
2674
		mov dword[edi],ecx
2671
		add edi,4 ;12
2675
		add edi,4 ;12
2672
		sub ecx,4 ;12
2676
		sub ecx,4 ;12
2673
		rep movsb
2677
		rep movsb
2674
		mov edi,[edit]
2678
		mov edi,[edit]
2675
 
2679
 
2676
		mov esi,eax
2680
		mov esi,eax
2677
		add	esi,12
2681
		add	esi,12
2678
		jmp .buf_r
2682
		jmp .buf_r
2679
	.no_buf_r:
2683
	.no_buf_r:
2680
		
2684
		
2681
	;¥á«¨ ­¥ 㤠«®áì ¯à®ç¨â âì ¤ ­­ë¥ ¨§ á¨á⥬­®£® ¡ãä¥à , ¯®¯ ¤ ¥¬ á
2685
	;¥á«¨ ­¥ 㤠«®áì ¯à®ç¨â âì ¤ ­­ë¥ ¨§ á¨á⥬­®£® ¡ãä¥à , ¯®¯ ¤ ¥¬ á
2682
	mov esi,ted_buffer
2686
	mov esi,ted_buffer
2683
	cmp dword[esi],1 ;¯à®¢¥à塞 ¥áâì «¨ ¤ ­­ë¥ ¢® ¢­ãâ७­¥¬ ¡ãä¥à¥
2687
	cmp dword[esi],1 ;¯à®¢¥à塞 ¥áâì «¨ ¤ ­­ë¥ ¢® ¢­ãâ७­¥¬ ¡ãä¥à¥
2684
	jl .no_paste ;¥á«¨ ¢®®¡é¥ ­¨ç¥£® ­¥ 㤠«®áì ¯à®ç¨â âì ¨¤¥¬ ­  ¢ë室
2688
	jl .no_paste ;¥á«¨ ¢®®¡é¥ ­¨ç¥£® ­¥ 㤠«®áì ¯à®ç¨â âì ¨¤¥¬ ­  ¢ë室
2685
	add esi,12 ;system buffer header size
2689
	add esi,12 ;system buffer header size
2686
	.buf_r:
2690
	.buf_r:
2687
	
2691
	
2688
	mov edx,esi
2692
	mov edx,esi
2689
	call tl_strlen
2693
	call tl_strlen
2690
	cmp eax,1
2694
	cmp eax,1
2691
	jl .no_paste
2695
	jl .no_paste
2692
		mov esi,eax
2696
		mov esi,eax
2693
		call ted_set_undo
2697
		call ted_set_undo
2694
		mov ebx,ted_opt_ed_change_time+ted_opt_ed_move_cursor
2698
		mov ebx,ted_opt_ed_change_time+ted_opt_ed_move_cursor
2695
		stdcall ted_sel_text_del,ebx
2699
		stdcall ted_sel_text_del,ebx
2696
		cmp al,1
2700
		cmp al,1
2697
		jne .del
2701
		jne .del
2698
			mov ebx,ted_opt_ed_move_cursor
2702
			mov ebx,ted_opt_ed_move_cursor
2699
		.del:
2703
		.del:
2700
		stdcall ted_text_add,edi,edx,esi,ebx
2704
		stdcall ted_text_add,edi,edx,esi,ebx
2701
		stdcall ted_draw,edi
2705
		stdcall ted_draw,edi
2702
		cmp ted_fun_draw_panel_buttons,0
2706
		cmp ted_fun_draw_panel_buttons,0
2703
		je .no_paste
2707
		je .no_paste
2704
			call ted_fun_draw_panel_buttons
2708
			call ted_fun_draw_panel_buttons
2705
	.no_paste:
2709
	.no_paste:
2706
	popad
2710
	popad
2707
	ret
2711
	ret
2708
endp
2712
endp
2709
 
2713
 
2710
align 16
2714
align 16
2711
proc ted_but_sumb_upper uses edi esi, edit:dword
2715
proc ted_but_sumb_upper uses edi esi, edit:dword
2712
	mov edi,[edit]
2716
	mov edi,[edit]
2713
 
2717
 
2714
	stdcall ted_convert_sel_text,fb_char_toupper
2718
	stdcall ted_convert_sel_text,fb_char_toupper
2715
	or esi,esi
2719
	or esi,esi
2716
	jz @f
2720
	jz @f
2717
		stdcall ted_draw,edi
2721
		stdcall ted_draw,edi
2718
	@@:
2722
	@@:
2719
	ret
2723
	ret
2720
endp
2724
endp
2721
 
2725
 
2722
align 16
2726
align 16
2723
proc ted_but_sumb_lover uses edi esi, edit:dword
2727
proc ted_but_sumb_lover uses edi esi, edit:dword
2724
	mov edi,[edit]
2728
	mov edi,[edit]
2725
 
2729
 
2726
	stdcall ted_convert_sel_text,fb_char_todown
2730
	stdcall ted_convert_sel_text,fb_char_todown
2727
	or esi,esi
2731
	or esi,esi
2728
	jz @f
2732
	jz @f
2729
		stdcall ted_draw,edi
2733
		stdcall ted_draw,edi
2730
	@@:
2734
	@@:
2731
	ret
2735
	ret
2732
endp
2736
endp
2733
 
2737
 
2734
align 16
2738
align 16
2735
proc ted_but_reverse uses eax ebx edi, edit:dword
2739
proc ted_but_reverse uses eax ebx edi, edit:dword
2736
	mov edi,[edit]
2740
	mov edi,[edit]
2737
 
2741
 
2738
	call ted_is_select
2742
	call ted_is_select
2739
	or al,al
2743
	or al,al
2740
	jz @f
2744
	jz @f
2741
		call ted_sel_normalize
2745
		call ted_sel_normalize
2742
		push esi ecx edx
2746
		push esi ecx edx
2743
			mov esi,ted_seln_x0
2747
			mov esi,ted_seln_x0
2744
			mov ecx,ted_seln_y0
2748
			mov ecx,ted_seln_y0
2745
			call ted_get_pos_by_coords
2749
			call ted_get_pos_by_coords
2746
			mov eax,edx
2750
			mov eax,edx
2747
			mov esi,ted_seln_x1
2751
			mov esi,ted_seln_x1
2748
			cmp esi,0
2752
			cmp esi,0
2749
			je .beg_str
2753
			je .beg_str
2750
				dec esi
2754
				dec esi
2751
			.beg_str:
2755
			.beg_str:
2752
			mov ecx,ted_seln_y1
2756
			mov ecx,ted_seln_y1
2753
			call ted_get_pos_by_coords
2757
			call ted_get_pos_by_coords
2754
			;call ted_get_text_perv_pos
2758
			;call ted_get_text_perv_pos
2755
			mov ebx,edx
2759
			mov ebx,edx
2756
		pop edx ecx esi
2760
		pop edx ecx esi
2757
		;cmp eax,...
2761
		;cmp eax,...
2758
		;je @f
2762
		;je @f
2759
		call ted_revers
2763
		call ted_revers
2760
	@@:
2764
	@@:
2761
	stdcall ted_draw,edi
2765
	stdcall ted_draw,edi
2762
	ret
2766
	ret
2763
endp
2767
endp
2764
 
2768
 
2765
align 16
2769
align 16
2766
proc ted_but_undo uses eax edi, edit:dword
2770
proc ted_but_undo uses eax edi, edit:dword
2767
	mov edi,[edit]
2771
	mov edi,[edit]
2768
 
2772
 
2769
	mov eax,ted_tim_undo
2773
	mov eax,ted_tim_undo
2770
	cmp ted_tim_ch,eax
2774
	cmp ted_tim_ch,eax
2771
	jbe @f
2775
	jbe @f
2772
		inc ted_tim_undo
2776
		inc ted_tim_undo
2773
		;call ted_text_colored
2777
		;call ted_text_colored
2774
		stdcall ted_draw,edi
2778
		stdcall ted_draw,edi
2775
		cmp ted_fun_draw_panel_buttons,0
2779
		cmp ted_fun_draw_panel_buttons,0
2776
		je @f
2780
		je @f
2777
			call ted_fun_draw_panel_buttons
2781
			call ted_fun_draw_panel_buttons
2778
	@@:
2782
	@@:
2779
	ret
2783
	ret
2780
endp
2784
endp
2781
 
2785
 
2782
align 16
2786
align 16
2783
proc ted_but_redo uses edi, edit:dword
2787
proc ted_but_redo uses edi, edit:dword
2784
	mov edi,[edit]
2788
	mov edi,[edit]
2785
 
2789
 
2786
	cmp ted_tim_undo,1
2790
	cmp ted_tim_undo,1
2787
	jb @f
2791
	jb @f
2788
		dec ted_tim_undo
2792
		dec ted_tim_undo
2789
		;call ted_text_colored
2793
		;call ted_text_colored
2790
		stdcall ted_draw,edi
2794
		stdcall ted_draw,edi
2791
		cmp ted_fun_draw_panel_buttons,0
2795
		cmp ted_fun_draw_panel_buttons,0
2792
		je @f
2796
		je @f
2793
			call ted_fun_draw_panel_buttons
2797
			call ted_fun_draw_panel_buttons
2794
	@@:
2798
	@@:
2795
	ret
2799
	ret
2796
endp
2800
endp
2797
 
2801
 
2798
align 16
2802
align 16
2799
proc ted_but_find_next, edit:dword
2803
proc ted_but_find_next, edit:dword
2800
	pushad
2804
	pushad
2801
	mov edi,[edit]
2805
	mov edi,[edit]
2802
 
2806
 
2803
	call ted_get_pos_by_cursor
2807
	call ted_get_pos_by_cursor
2804
	mov eax,ted_buffer_find
2808
	mov eax,ted_buffer_find
2805
	mov bl,byte[eax]
2809
	mov bl,byte[eax]
2806
	@@:
2810
	@@:
2807
		call ted_get_find_rezult
2811
		call ted_get_find_rezult
2808
		cmp bh,1
2812
		cmp bh,1
2809
		je @f ; find
2813
		je @f ; find
2810
			call ted_iterat_next
2814
			call ted_iterat_next
2811
			cmp edx,ted_tex_1
2815
			cmp edx,ted_tex_1
2812
			jle @f
2816
			jle @f
2813
			jmp @b
2817
			jmp @b
2814
	@@:
2818
	@@:
2815
	cmp bh,0
2819
	cmp bh,0
2816
	je @f
2820
	je @f
2817
		call ted_get_text_coords
2821
		call ted_get_text_coords
2818
		inc ebx ;move cursor right
2822
		inc ebx ;move cursor right
2819
		mov ted_sel_x1,ebx
2823
		mov ted_sel_x1,ebx
2820
		mov ted_sel_y1,eax
2824
		mov ted_sel_y1,eax
2821
		mov edx,eax
2825
		mov edx,eax
2822
		mov ecx,ebx
2826
		mov ecx,ebx
2823
		call ted_go_to_pos
2827
		call ted_go_to_pos
2824
		mov edx,esi ;esi ¡ë«® ãáâ ­®¢«¥® ¢ ted_get_find_rezult
2828
		mov edx,esi ;esi ¡ë«® ãáâ ­®¢«¥® ¢ ted_get_find_rezult
2825
		call ted_get_text_coords
2829
		call ted_get_text_coords
2826
		mov ted_sel_x0,ebx
2830
		mov ted_sel_x0,ebx
2827
		mov ted_sel_y0,eax
2831
		mov ted_sel_y0,eax
2828
		stdcall ted_draw,edi
2832
		stdcall ted_draw,edi
2829
		jmp .end_find
2833
		jmp .end_find
2830
	@@:
2834
	@@:
2831
		;¯®¯ ¤ ¥¬ á ¥á«¨ ⥪áâ ­¥ ­ ©¤¥­
2835
		;¯®¯ ¤ ¥¬ á ¥á«¨ ⥪áâ ­¥ ­ ©¤¥­
2832
		cmp ted_fun_find_err,0
2836
		cmp ted_fun_find_err,0
2833
		je .end_find
2837
		je .end_find
2834
			call ted_fun_find_err ;¯®«ì§®¢ â¥«ì᪠ï äã­ªæ¨ï
2838
			call ted_fun_find_err ;¯®«ì§®¢ â¥«ì᪠ï äã­ªæ¨ï
2835
	.end_find:
2839
	.end_find:
2836
	popad
2840
	popad
2837
	ret
2841
	ret
2838
endp
2842
endp
2839
 
2843
 
2840
;input:
2844
;input:
2841
; edi = pointer to tedit struct
2845
; edi = pointer to tedit struct
2842
align 16
2846
align 16
2843
ted_key_ctrl_home:
2847
ted_key_ctrl_home:
2844
	mov ted_cur_x,0
2848
	mov ted_cur_x,0
2845
	mov ted_cur_y,0
2849
	mov ted_cur_y,0
2846
	push eax
2850
	push eax
2847
		mov eax,ted_scr_w
2851
		mov eax,ted_scr_w
2848
		mov dword[eax+sb_offs_position],0
2852
		mov dword[eax+sb_offs_position],0
2849
		mov eax,ted_scr_h
2853
		mov eax,ted_scr_h
2850
		mov dword[eax+sb_offs_position],0
2854
		mov dword[eax+sb_offs_position],0
2851
	pop eax
2855
	pop eax
2852
	stdcall ted_draw,edi
2856
	stdcall ted_draw,edi
2853
	cmp ted_fun_draw_panel_buttons,0
2857
	cmp ted_fun_draw_panel_buttons,0
2854
	je @f
2858
	je @f
2855
		call ted_fun_draw_panel_buttons
2859
		call ted_fun_draw_panel_buttons
2856
	@@:
2860
	@@:
2857
	ret
2861
	ret
2858
 
2862
 
2859
;input:
2863
;input:
2860
; edi = pointer to tedit struct
2864
; edi = pointer to tedit struct
2861
align 16
2865
align 16
2862
ted_key_ctrl_end:
2866
ted_key_ctrl_end:
2863
	push eax ebx
2867
	push eax ebx
2864
		call ted_get_num_lines
2868
		call ted_get_num_lines
2865
		mov ebx,ted_scr_w
2869
		mov ebx,ted_scr_w
2866
		mov dword[ebx+sb_offs_position],eax ;áâ ¢¨¬ ¯®«§ã­®ª ­  ¯®á«¥¤­îî áâப㠤®ªã¬¥­â 
2870
		mov [ebx+sb_offs_position],eax ;áâ ¢¨¬ ¯®«§ã­®ª ­  ¯®á«¥¤­îî áâப㠤®ªã¬¥­â 
2867
		cmp eax,dword[ebx+sb_offs_cur_area]
2871
		cmp eax,[ebx+sb_offs_cur_area]
2868
		jle @f
2872
		jle @f
2869
			mov eax,dword[ebx+sb_offs_cur_area] ;¯®«ãç ¥¬ ç¨á«® áâப ¢« §ïé¨å ¢ ®ª­®
2873
			mov eax,[ebx+sb_offs_cur_area] ;¯®«ãç ¥¬ ç¨á«® áâப ¢« §ïé¨å ¢ ®ª­®
2870
		@@:
2874
		@@:
2871
		sub dword[ebx+sb_offs_position],eax ;®â­¨¬ ¥¬ ®â ¯®«§ã­ª  ç¨á«® áâப ¢« §ïé¨å ¢ ®ª­® (­® ­¥ ¡®«ìè¥ â¥å, çâ® ¥áâì ¢ ¤®ªã¬¥­â¥)
2875
		sub [ebx+sb_offs_position],eax ;®â­¨¬ ¥¬ ®â ¯®«§ã­ª  ç¨á«® áâப ¢« §ïé¨å ¢ ®ª­® (­® ­¥ ¡®«ìè¥ â¥å, çâ® ¥áâì ¢ ¤®ªã¬¥­â¥)
2872
		dec eax
2876
		dec eax
2873
		mov ted_cur_y,eax ;áâ ¢¨¬ ªãàá®à ­  ¯®á«¥¤­îî áâப㠤®ªã¬¥­â 
2877
		mov ted_cur_y,eax ;áâ ¢¨¬ ªãàá®à ­  ¯®á«¥¤­îî áâப㠤®ªã¬¥­â 
2874
	pop ebx eax
2878
	pop ebx eax
2875
	call ted_cur_move_x_last_char
2879
	call ted_cur_move_x_last_char
2876
	stdcall ted_draw,edi
2880
	stdcall ted_draw,edi
2877
	cmp ted_fun_draw_panel_buttons,0
2881
	cmp ted_fun_draw_panel_buttons,0
2878
	je @f
2882
	je @f
2879
		call ted_fun_draw_panel_buttons
2883
		call ted_fun_draw_panel_buttons
2880
	@@:
2884
	@@:
2881
	ret
2885
	ret
2882
 
2886
 
2883
;input:
2887
;input:
2884
; edi = pointer to tedit struct
2888
; edi = pointer to tedit struct
2885
align 16
2889
align 16
2886
proc ted_sel_key_up
2890
proc ted_sel_key_up
2887
  cmp ted_drag_k,1
2891
  cmp ted_drag_k,1
2888
  je @f
2892
  je @f
2889
    call ted_sel_start
2893
    call ted_sel_start
2890
    mov ted_drag_k,1
2894
    mov ted_drag_k,1
2891
  @@:
2895
  @@:
2892
  push dx
2896
  push dx
2893
    call ted_cur_move_up
2897
    call ted_cur_move_up
2894
    cmp dl,8
2898
    cmp dl,8
2895
    jne @f
2899
    jne @f
2896
      call ted_scroll_set_redraw
2900
      call ted_scroll_set_redraw
2897
    @@:
2901
    @@:
2898
  pop dx
2902
  pop dx
2899
  call ted_sel_move
2903
  call ted_sel_move
2900
  stdcall ted_draw,edi
2904
  stdcall ted_draw,edi
2901
  ret
2905
  ret
2902
endp
2906
endp
2903
 
2907
 
2904
;input:
2908
;input:
2905
; edi = pointer to tedit struct
2909
; edi = pointer to tedit struct
2906
align 16
2910
align 16
2907
proc ted_sel_key_down
2911
proc ted_sel_key_down
2908
  cmp ted_drag_k,1
2912
  cmp ted_drag_k,1
2909
  je @f
2913
  je @f
2910
    call ted_sel_start
2914
    call ted_sel_start
2911
    mov ted_drag_k,1
2915
    mov ted_drag_k,1
2912
  @@:
2916
  @@:
2913
  push dx
2917
  push dx
2914
    call ted_cur_move_down
2918
    call ted_cur_move_down
2915
    cmp dl,8
2919
    cmp dl,8
2916
    jne @f
2920
    jne @f
2917
      call ted_scroll_set_redraw
2921
      call ted_scroll_set_redraw
2918
    @@:
2922
    @@:
2919
  pop dx
2923
  pop dx
2920
  call ted_sel_move
2924
  call ted_sel_move
2921
  stdcall ted_draw,edi
2925
  stdcall ted_draw,edi
2922
  ret
2926
  ret
2923
endp
2927
endp
2924
 
2928
 
2925
;input:
2929
;input:
2926
; edi = pointer to tedit struct
2930
; edi = pointer to tedit struct
2927
align 16
2931
align 16
2928
proc ted_sel_key_left
2932
proc ted_sel_key_left
2929
  cmp ted_drag_k,1
2933
  cmp ted_drag_k,1
2930
  je @f
2934
  je @f
2931
    call ted_sel_start
2935
    call ted_sel_start
2932
  @@:
2936
  @@:
2933
  push dx
2937
  push dx
2934
    call ted_cur_move_left
2938
    call ted_cur_move_left
2935
    call ted_sel_move
2939
    call ted_sel_move
2936
    cmp ted_drag_k,1
2940
    cmp ted_drag_k,1
2937
    je @f
2941
    je @f
2938
      mov ted_drag_k,1
2942
      mov ted_drag_k,1
2939
      mov dl,8
2943
      mov dl,8
2940
    @@:
2944
    @@:
2941
    cmp dl,8
2945
    cmp dl,8
2942
    jne @f
2946
    jne @f
2943
      call ted_scroll_set_redraw
2947
      call ted_scroll_set_redraw
2944
      stdcall ted_draw,edi
2948
      stdcall ted_draw,edi
2945
      jmp .end_f
2949
      jmp .end_f
2946
    @@:
2950
    @@:
2947
      stdcall ted_draw_cur_line,edi
2951
      stdcall ted_draw_cur_line,edi
2948
    .end_f:
2952
    .end_f:
2949
  pop dx
2953
  pop dx
2950
  ret
2954
  ret
2951
endp
2955
endp
2952
 
2956
 
2953
;input:
2957
;input:
2954
; edi = pointer to tedit struct
2958
; edi = pointer to tedit struct
2955
align 16
2959
align 16
2956
proc ted_sel_key_right
2960
proc ted_sel_key_right
2957
  cmp ted_drag_k,1
2961
  cmp ted_drag_k,1
2958
  je @f
2962
  je @f
2959
    call ted_sel_start
2963
    call ted_sel_start
2960
  @@:
2964
  @@:
2961
  push dx
2965
  push dx
2962
    call ted_cur_move_right
2966
    call ted_cur_move_right
2963
    call ted_sel_move
2967
    call ted_sel_move
2964
    cmp ted_drag_k,1
2968
    cmp ted_drag_k,1
2965
    je @f
2969
    je @f
2966
      mov ted_drag_k,1
2970
      mov ted_drag_k,1
2967
      mov dl,8
2971
      mov dl,8
2968
    @@:
2972
    @@:
2969
    cmp dl,8
2973
    cmp dl,8
2970
    jne @f
2974
    jne @f
2971
      call ted_scroll_set_redraw
2975
      call ted_scroll_set_redraw
2972
      stdcall ted_draw,edi
2976
      stdcall ted_draw,edi
2973
      jmp .end_f
2977
      jmp .end_f
2974
    @@:
2978
    @@:
2975
      stdcall ted_draw_cur_line,edi
2979
      stdcall ted_draw_cur_line,edi
2976
    .end_f:
2980
    .end_f:
2977
  pop dx
2981
  pop dx
2978
  ret
2982
  ret
2979
endp
2983
endp
2980
 
2984
 
2981
;input:
2985
;input:
2982
; edi = pointer to tedit struct
2986
; edi = pointer to tedit struct
2983
;description:
2987
;description:
2984
; this function need to optimize output
2988
; this function need to optimize output
2985
align 16
2989
align 16
2986
proc ted_draw_cursor_sumb
2990
proc ted_draw_cursor_sumb
2987
pushad
2991
pushad
2988
	mov ebx,ted_wnd_l
2992
	mov ebx,ted_wnd_l
2989
	add ebx,ted_rec_l
2993
	add ebx,ted_rec_l
2990
	mov edx,ted_cur_x
2994
	mov edx,ted_cur_x
2991
	imul edx,ted_rec_w
2995
	imul edx,ted_rec_w
2992
	add ebx,edx
2996
	add ebx,edx
2993
	shl ebx,16
2997
	shl ebx,16
2994
	add ebx,ted_rec_w
2998
	add ebx,ted_rec_w
2995
 
2999
 
2996
	mov ecx,ted_wnd_t ;calc rect -> y0,y1
3000
	mov ecx,ted_wnd_t ;calc rect -> y0,y1
2997
	add ecx,ted_rec_t
3001
	add ecx,ted_rec_t
2998
	mov edx,ted_cur_y
3002
	mov edx,ted_cur_y
2999
	imul edx,ted_rec_h
3003
	imul edx,ted_rec_h
3000
	add ecx,edx
3004
	add ecx,edx
3001
	shl ecx,16
3005
	shl ecx,16
3002
	add ecx,ted_rec_h
3006
	add ecx,ted_rec_h
3003
 
3007
 
3004
	mov edx,ted_color_wnd_work
3008
	mov edx,ted_color_wnd_work
3005
	call ted_sel_normalize
3009
	call ted_sel_normalize
3006
 
3010
 
3007
	mov esi,ted_scr_w
3011
	mov esi,ted_scr_w
3008
	mov eax,[esi+sb_offs_position]
3012
	mov eax,[esi+sb_offs_position]
3009
	sub ted_seln_y0,eax
3013
	sub ted_seln_y0,eax
3010
	sub ted_seln_y1,eax
3014
	sub ted_seln_y1,eax
3011
 
3015
 
3012
	mov eax,ted_cur_y
3016
	mov eax,ted_cur_y
3013
	cmp eax,ted_seln_y0
3017
	cmp eax,ted_seln_y0
3014
	jl .no_cur_sel
3018
	jl .no_cur_sel
3015
	cmp eax,ted_seln_y1
3019
	cmp eax,ted_seln_y1
3016
	jg .no_cur_sel
3020
	jg .no_cur_sel
3017
		mov edx,ted_color_select ;¬¥­ï¥¬ 梥â ä®­  ­  梥⠢뤥«¥­¨ï
3021
		mov edx,ted_color_select ;¬¥­ï¥¬ 梥â ä®­  ­  梥⠢뤥«¥­¨ï
3018
		mov esi,ted_scr_h
3022
		mov esi,ted_scr_h
3019
		cmp eax,ted_seln_y0
3023
		cmp eax,ted_seln_y0
3020
		jne @f
3024
		jne @f
3021
			mov eax,ted_cur_x
3025
			mov eax,ted_cur_x
3022
			add eax,[esi+sb_offs_position]
3026
			add eax,[esi+sb_offs_position]
3023
			cmp eax,ted_seln_x0
3027
			cmp eax,ted_seln_x0
3024
			jge @f
3028
			jge @f
3025
			mov edx,ted_color_wnd_work
3029
			mov edx,ted_color_wnd_work
3026
		@@:
3030
		@@:
3027
		mov eax,ted_cur_y
3031
		mov eax,ted_cur_y
3028
		cmp eax,ted_seln_y1
3032
		cmp eax,ted_seln_y1
3029
		jne .no_cur_sel
3033
		jne .no_cur_sel
3030
			mov eax,ted_cur_x
3034
			mov eax,ted_cur_x
3031
			add eax,[esi+sb_offs_position]
3035
			add eax,[esi+sb_offs_position]
3032
			cmp eax,ted_seln_x1
3036
			cmp eax,ted_seln_x1
3033
			jl .no_cur_sel
3037
			jl .no_cur_sel
3034
			mov edx,ted_color_wnd_work
3038
			mov edx,ted_color_wnd_work
3035
	.no_cur_sel:
3039
	.no_cur_sel:
3036
	mcall SF_DRAW_RECT
3040
	mcall SF_DRAW_RECT
3037
 
3041
 
3038
	call ted_get_pos_by_cursor ;¡¥à¥¬ ¯®§¨æ¨î ᨬ¢®« 
3042
	call ted_get_pos_by_cursor ;¡¥à¥¬ ¯®§¨æ¨î ᨬ¢®« 
3039
	cmp ted_gp_opt,2
3043
	cmp ted_gp_opt,2
3040
	jne @f
3044
	jne @f
3041
		mov esi,1
3045
		mov esi,1
3042
		ror ecx,16
3046
		ror ecx,16
3043
		mov bx,cx
3047
		mov bx,cx
3044
		add ebx,0x10001
3048
		add ebx,0x10001
3045
		call ted_get_symb_color
3049
		call ted_get_symb_color
3046
		call ted_convert_invis_symb
3050
		call ted_convert_invis_symb
3047
		mcall SF_DRAW_TEXT ;à¨á®¢ ­¨¥ ᨬ¢®« 
3051
		mcall SF_DRAW_TEXT ;à¨á®¢ ­¨¥ ᨬ¢®« 
3048
	@@:
3052
	@@:
3049
popad
3053
popad
3050
	ret
3054
	ret
3051
endp
3055
endp
3052
 
3056
 
3053
;input:
3057
;input:
3054
; edx -> pointer to text
3058
; edx -> pointer to text
3055
; edi -> 㪠§ â¥«ì ­  áâàãªâãàã tedit
3059
; edi -> 㪠§ â¥«ì ­  áâàãªâãàã tedit
3056
;output:
3060
;output:
3057
; ecx = color
3061
; ecx = color
3058
; if ted_mode_color=0 then ecx=ted_color_wnd_text
3062
; if ted_mode_color=0 then ecx=ted_color_wnd_text
3059
align 16
3063
align 16
3060
ted_get_symb_color:
3064
ted_get_symb_color:
3061
	mov ecx,ted_color_wnd_text ;§ ¤ ¥¬ 梥â ⥪áâ  ¯® 㬮«ç ­¨î
3065
	mov ecx,ted_color_wnd_text ;§ ¤ ¥¬ 梥â ⥪áâ  ¯® 㬮«ç ­¨î
3062
 
3066
 
3063
	push eax edx
3067
	push eax edx
3064
	cmp ted_mode_color,0
3068
	cmp ted_mode_color,0
3065
	je .exit
3069
	je .exit
3066
		jmp .on_first
3070
		jmp .on_first
3067
		@@:
3071
		@@:
3068
			call ted_iterat_perv
3072
			call ted_iterat_perv
3069
			cmp edx,ted_tex_1
3073
			cmp edx,ted_tex_1
3070
			jle .exit
3074
			jle .exit
3071
		.on_first:
3075
		.on_first:
3072
			xor eax,eax
3076
			xor eax,eax
3073
			mov al,byte[edx+1]
3077
			mov al,byte[edx+1]
3074
			or al,al ;¥á«¨ al=0 ⮠梥⠭¥ ¬¥­ï¥âáï
3078
			or al,al ;¥á«¨ al=0 ⮠梥⠭¥ ¬¥­ï¥âáï
3075
			jz @b
3079
			jz @b
3076
 
3080
 
3077
		cmp eax,ted_colors_text_count
3081
		cmp eax,ted_colors_text_count
3078
		jge .exit
3082
		jge .exit
3079
 
3083
 
3080
		shl ax,2 ;㬭®¦ ¥¬ ¨­¤¥ªá æ¢¥â  ­  4 ¡ ©â 
3084
		shl ax,2 ;㬭®¦ ¥¬ ¨­¤¥ªá æ¢¥â  ­  4 ¡ ©â 
3081
		mov ecx,ted_text_colors ;¯à¨¡ ¢«ï¥¬ ᬥ饭¨¥ 1-£® 梥â 
3085
		mov ecx,ted_text_colors ;¯à¨¡ ¢«ï¥¬ ᬥ饭¨¥ 1-£® 梥â 
3082
		add ecx,eax
3086
		add ecx,eax
3083
		mov ecx,dword[ecx] ;ãáâ ­ ¢«¨¢ ¥¬ ⥪ã騩 梥â ⥪áâ  ¯® ᬥ饭¨î
3087
		mov ecx,[ecx] ;ãáâ ­ ¢«¨¢ ¥¬ ⥪ã騩 梥â ⥪áâ  ¯® ᬥ饭¨î
3084
	.exit:
3088
	.exit:
3085
	or ecx,ted_font_size
3089
	or ecx,ted_font_size
3086
	pop edx eax
3090
	pop edx eax
3087
	ret
3091
	ret
3088
 
3092
 
3089
;input:
3093
;input:
3090
; edx = pointer to text
3094
; edx = pointer to text
3091
; edi = pointer to tedit struct
3095
; edi = pointer to tedit struct
3092
;description:
3096
;description:
3093
; ”ã­ªæ¨ï ¯à¥®¡à §ã¥â ­¥¢¨¤¨¬ë¥ ᨬ¢®«ë ¢ ¯¥ç â ¥¬ë¥ ­  íªà ­¥
3097
; ”ã­ªæ¨ï ¯à¥®¡à §ã¥â ­¥¢¨¤¨¬ë¥ ᨬ¢®«ë ¢ ¯¥ç â ¥¬ë¥ ­  íªà ­¥
3094
align 16
3098
align 16
3095
ted_convert_invis_symb:
3099
ted_convert_invis_symb:
3096
	cmp ted_mode_invis,1
3100
	cmp ted_mode_invis,1
3097
	jne .else
3101
	jne .else
3098
		cmp byte[edx],9
3102
		cmp byte[edx],9
3099
		jne @f
3103
		jne @f
3100
			lea edx,[ted_symbol_tab]
3104
			lea edx,[ted_symbol_tab]
3101
			jmp .end_f
3105
			jmp .end_f
3102
align 4
3106
align 4
3103
		@@:
3107
		@@:
3104
		cmp byte[edx],13
3108
		cmp byte[edx],13
3105
		jne @f
3109
		jne @f
3106
			mov edx,edi
3110
			mov edx,edi
3107
			add edx,ted_offs_symbol_new_line
3111
			add edx,ted_offs_symbol_new_line
3108
		@@:
3112
		@@:
3109
		jmp .end_f
3113
		jmp .end_f
3110
align 4
3114
align 4
3111
	.else:
3115
	.else:
3112
		cmp byte[edx],9
3116
		cmp byte[edx],9
3113
		je @f
3117
		je @f
3114
		cmp byte[edx],13
3118
		cmp byte[edx],13
3115
		je @f
3119
		je @f
3116
			jmp .end_f
3120
			jmp .end_f
3117
		@@:
3121
		@@:
3118
			lea edx,[ted_symbol_space]
3122
			lea edx,[ted_symbol_space]
3119
	.end_f:
3123
	.end_f:
3120
	ret
3124
	ret
3121
 
3125
 
3122
;input:
3126
;input:
3123
; edi = pointer to tedit struct
3127
; edi = pointer to tedit struct
3124
align 16
3128
align 16
3125
ted_scroll_set_redraw:
3129
ted_scroll_set_redraw:
3126
	push eax
3130
	push eax
3127
	mov eax,ted_scr_w
3131
	mov eax,ted_scr_w
3128
	mov dword[eax+sb_offs_redraw],1
3132
	mov dword[eax+sb_offs_redraw],1
3129
	mov eax,ted_scr_h
3133
	mov eax,ted_scr_h
3130
	mov dword[eax+sb_offs_redraw],1
3134
	mov dword[eax+sb_offs_redraw],1
3131
	pop eax
3135
	pop eax
3132
	ret
3136
	ret
3133
 
3137
 
3134
align 16
3138
align 16
3135
proc ted_draw, edit:dword
3139
proc ted_draw, edit:dword
3136
	locals
3140
	locals
3137
		line_num dd ?
3141
		line_num dd ?
3138
	endl
3142
	endl
3139
	pushad
3143
	pushad
3140
	mov edi,[edit]
3144
	mov edi,[edit]
3141
 
3145
 
3142
	mov eax,SF_DRAW_TEXT
3146
	mov eax,SF_DRAW_TEXT
3143
	mov ecx,ted_text_colors
3147
	mov ecx,ted_text_colors
3144
	mov ecx,dword[ecx]
3148
	mov ecx,[ecx]
3145
 
3149
 
3146
	mov ebx,ted_wnd_l
3150
	mov ebx,ted_wnd_l
3147
	add ebx,ted_rec_l
3151
	add ebx,ted_rec_l
3148
	shl ebx,16
3152
	shl ebx,16
3149
	add ebx,ted_wnd_t
3153
	add ebx,ted_wnd_t
3150
	add ebx,ted_rec_t
3154
	add ebx,ted_rec_t
3151
	add ebx,0x10001 ;¤®¡ ¢«ï¥¬ ®âáâã¯ë ¤«ï ¢ëà ¢­¨¢ ­¨ï ¡ãª¢ë ¯® 業âàã
3155
	add ebx,0x10001 ;¤®¡ ¢«ï¥¬ ®âáâã¯ë ¤«ï ¢ëà ¢­¨¢ ­¨ï ¡ãª¢ë ¯® 業âàã
3152
 
3156
 
3153
	call ted_sel_normalize ;need before draw select
3157
	call ted_sel_normalize ;need before draw select
3154
	mov esi,ted_scr_w
3158
	mov esi,ted_scr_w
3155
	mov esi,[esi+sb_offs_position]
3159
	mov esi,[esi+sb_offs_position]
3156
	mov [line_num],esi
3160
	mov [line_num],esi
3157
 
3161
 
3158
	stdcall ted_clear_line_before_draw, edi,ebx,1,esi
3162
	stdcall ted_clear_line_before_draw, edi,ebx,1,esi
3159
	call ted_get_first_visible_pos
3163
	call ted_get_first_visible_pos
3160
	cmp edx,0
3164
	cmp edx,0
3161
	je .no_draw_text
3165
	je .no_draw_text
3162
	mov esi,1 ;¤«¨­­  ¢ë¢®¤¨¬®£® ⥪áâ  ¯® 1-¬ã ᨬ¢®«ã
3166
	mov esi,1 ;¤«¨­­  ¢ë¢®¤¨¬®£® ⥪áâ  ¯® 1-¬ã ᨬ¢®«ã
3163
	@@:
3167
	@@:
3164
		call ted_iterat_next
3168
		call ted_iterat_next
3165
		cmp edx,ted_tex_1
3169
		cmp edx,ted_tex_1
3166
		jle .no_draw_text
3170
		jle .no_draw_text
3167
 
3171
 
3168
		; *** 梥⮢ ï à §¬¥âª 
3172
		; *** 梥⮢ ï à §¬¥âª 
3169
		cmp ted_mode_color,0
3173
		cmp ted_mode_color,0
3170
		je .no_col_change
3174
		je .no_col_change
3171
		cmp byte[edx+1],0
3175
		cmp byte[edx+1],0
3172
		je .no_col_change
3176
		je .no_col_change
3173
			call ted_get_symb_color
3177
			call ted_get_symb_color
3174
		.no_col_change:
3178
		.no_col_change:
3175
 
3179
 
3176
		cmp byte[edx],13
3180
		cmp byte[edx],13
3177
		jne .no_13
3181
		jne .no_13
3178
			cmp ted_mode_invis,1
3182
			cmp ted_mode_invis,1
3179
			jne .no_invis
3183
			jne .no_invis
3180
				push edx
3184
				push edx
3181
				mov edx,edi
3185
				mov edx,edi
3182
				add edx,ted_offs_symbol_new_line
3186
				add edx,ted_offs_symbol_new_line
3183
				int 0x40
3187
				int 0x40
3184
				pop edx
3188
				pop edx
3185
			.no_invis:
3189
			.no_invis:
3186
			add ebx,ted_rec_h
3190
			add ebx,ted_rec_h
3187
			;optimized output \/
3191
			;optimized output \/
3188
			mov eax,ted_wnd_h
3192
			mov eax,ted_wnd_h
3189
			add eax,ted_wnd_t
3193
			add eax,ted_wnd_t
3190
			cmp bx,ax
3194
			cmp bx,ax
3191
			jg .no_draw_text
3195
			jg .no_draw_text
3192
			mov eax,SF_DRAW_TEXT
3196
			mov eax,SF_DRAW_TEXT
3193
			;optimized output /\        
3197
			;optimized output /\        
3194
			and ebx,0xffff
3198
			and ebx,0xffff
3195
			ror ebx,16
3199
			ror ebx,16
3196
			add ebx,ted_wnd_l
3200
			add ebx,ted_wnd_l
3197
			add ebx,ted_rec_l
3201
			add ebx,ted_rec_l
3198
			inc ebx
3202
			inc ebx
3199
			ror ebx,16
3203
			ror ebx,16
3200
			inc dword[line_num] ;increment line number
3204
			inc dword[line_num] ;increment line number
3201
			stdcall ted_clear_line_before_draw,edi,ebx,1,dword[line_num]
3205
			stdcall ted_clear_line_before_draw,edi,ebx,1,dword[line_num]
3202
			call ted_opt_draw_line_left
3206
			call ted_opt_draw_line_left
3203
			jmp @b
3207
			jmp @b
3204
align 4
3208
align 4
3205
		.no_13:
3209
		.no_13:
3206
 
3210
 
3207
		int 0x40
3211
		int 0x40
3208
		ror ebx,16
3212
		ror ebx,16
3209
		add ebx,ted_rec_w
3213
		add ebx,ted_rec_w
3210
		mov esi,ted_wnd_l
3214
		mov esi,ted_wnd_l
3211
		add esi,ted_wnd_w
3215
		add esi,ted_wnd_w
3212
		cmp bx,si
3216
		cmp bx,si
3213
		jl .no_opt
3217
		jl .no_opt
3214
			call ted_opt_draw_line_right
3218
			call ted_opt_draw_line_right
3215
		.no_opt:
3219
		.no_opt:
3216
		mov si,1
3220
		mov si,1
3217
		ror ebx,16
3221
		ror ebx,16
3218
		jmp @b
3222
		jmp @b
3219
	.no_draw_text:
3223
	.no_draw_text:
3220
 
3224
 
3221
	inc dword[line_num]
3225
	inc dword[line_num]
3222
	stdcall ted_clear_line_before_draw,edi,ebx,0,dword[line_num]
3226
	stdcall ted_clear_line_before_draw,edi,ebx,0,dword[line_num]
3223
	call ted_draw_line_numbers
3227
	call ted_draw_line_numbers
3224
	call ted_draw_main_cursor
3228
	call ted_draw_main_cursor
3225
 
3229
 
3226
;---------------------------------------------
3230
;---------------------------------------------
3227
; set all_redraw flag for draw all ScrollBar
3231
; set all_redraw flag for draw all ScrollBar
3228
; In some cases it is necessity to draw only the area
3232
; In some cases it is necessity to draw only the area
3229
; of moving of a "runner", for acceleration of output - 
3233
; of moving of a "runner", for acceleration of output - 
3230
; in this case the flag needs to be reset to 0 (zero).
3234
; in this case the flag needs to be reset to 0 (zero).
3231
	mov eax,ted_scr_h
3235
	mov eax,ted_scr_h
3232
	mov esi,ted_scr_w
3236
	mov esi,ted_scr_w
3233
	mov dword[eax+sb_offs_all_redraw],1
3237
	mov dword[eax+sb_offs_all_redraw],1
3234
	mov dword[esi+sb_offs_all_redraw],1
3238
	mov dword[esi+sb_offs_all_redraw],1
3235
 
3239
 
3236
; à¨á®¢ ­¨¥ ¯®«®á ¯à®ªàã⪨
3240
; à¨á®¢ ­¨¥ ¯®«®á ¯à®ªàã⪨
3237
	stdcall scroll_bar_horizontal.draw,eax ;[scrollbar_hor_draw]
3241
	stdcall scroll_bar_horizontal.draw,eax ;[scrollbar_hor_draw]
3238
	stdcall scroll_bar_vertical.draw,esi ;[scrollbar_ver_draw]
3242
	stdcall scroll_bar_vertical.draw,esi ;[scrollbar_ver_draw]
3239
; reset all_redraw flag 
3243
; reset all_redraw flag 
3240
	mov dword[eax+sb_offs_all_redraw],0
3244
	mov dword[eax+sb_offs_all_redraw],0
3241
	mov dword[esi+sb_offs_all_redraw],0
3245
	mov dword[esi+sb_offs_all_redraw],0
3242
;---------------------------------------------
3246
;---------------------------------------------
3243
 
3247
 
3244
	;left-bottom square
3248
	;left-bottom square
3245
	mov ebx,ted_wnd_l
3249
	mov ebx,ted_wnd_l
3246
	shl ebx,16
3250
	shl ebx,16
3247
	add ebx,ted_rec_l
3251
	add ebx,ted_rec_l
3248
	mov ecx,ted_wnd_t
3252
	mov ecx,ted_wnd_t
3249
	add ecx,ted_wnd_h
3253
	add ecx,ted_wnd_h
3250
	shl ecx,16
3254
	shl ecx,16
3251
	mov cx,word[eax+sb_offs_size_y]
3255
	mov cx,word[eax+sb_offs_size_y]
3252
	inc cx
3256
	inc cx
3253
	mcall SF_DRAW_RECT,,,ted_color_wnd_capt ;[sc.work]
3257
	mcall SF_DRAW_RECT,,,ted_color_wnd_capt ;[sc.work]
3254
 
3258
 
3255
	;right-bottom square
3259
	;right-bottom square
3256
	mov ebx,ted_wnd_l
3260
	mov ebx,ted_wnd_l
3257
	add ebx,ted_wnd_w
3261
	add ebx,ted_wnd_w
3258
	shl ebx,16
3262
	shl ebx,16
3259
	mov bx,word[esi+sb_offs_size_x]
3263
	mov bx,word[esi+sb_offs_size_x]
3260
	inc bx
3264
	inc bx
3261
	int 0x40
3265
	int 0x40
3262
 
3266
 
3263
	cmp ted_fun_draw_panel_find,0
3267
	cmp ted_fun_draw_panel_find,0
3264
	je @f
3268
	je @f
3265
		call ted_fun_draw_panel_find
3269
		call ted_fun_draw_panel_find
3266
	@@:
3270
	@@:
3267
	cmp ted_fun_draw_panel_syntax,0
3271
	cmp ted_fun_draw_panel_syntax,0
3268
	je @f
3272
	je @f
3269
		call ted_fun_draw_panel_syntax
3273
		call ted_fun_draw_panel_syntax
3270
	@@:
3274
	@@:
3271
	popad
3275
	popad
3272
	ret
3276
	ret
3273
endp
3277
endp
3274
 
3278
 
3275
;input:
3279
;input:
3276
; edi = pointer to tedit struct
3280
; edi = pointer to tedit struct
3277
align 16
3281
align 16
3278
proc ted_draw_main_cursor
3282
proc ted_draw_main_cursor
3279
pushad
3283
pushad
3280
 
3284
 
3281
	mov eax,SF_DRAW_RECT ;draw cursor
3285
	mov eax,SF_DRAW_RECT ;draw cursor
3282
	mov ecx,ted_wnd_t ;calc rect -> y0,y1
3286
	mov ecx,ted_wnd_t ;calc rect -> y0,y1
3283
	add ecx,ted_rec_t
3287
	add ecx,ted_rec_t
3284
	mov edx,ted_cur_y
3288
	mov edx,ted_cur_y
3285
	imul edx,ted_rec_h
3289
	imul edx,ted_rec_h
3286
	add ecx,edx
3290
	add ecx,edx
3287
 
3291
 
3288
	cmp ted_cur_ins,1 ;¯à®¢¥àª  ०¨¬  à ¡®âë ªãàá®à  (®¡ëç­ë© ¨«¨ ¢áâ ¢ª )
3292
	cmp ted_cur_ins,1 ;¯à®¢¥àª  ०¨¬  à ¡®âë ªãàá®à  (®¡ëç­ë© ¨«¨ ¢áâ ¢ª )
3289
	jne @f
3293
	jne @f
3290
		mov edx,ted_rec_h
3294
		mov edx,ted_rec_h
3291
		inc edx   ;1->1, 3->2, 5->3, ...
3295
		inc edx   ;1->1, 3->2, 5->3, ...
3292
		shr edx,1 ;edx = ¢ëá®â  áâப¨ ¤¥«¥­­ ï ­  2 (ª®£¤  ªãàá®à ­¥ ¯®«­ë©)
3296
		shr edx,1 ;edx = ¢ëá®â  áâப¨ ¤¥«¥­­ ï ­  2 (ª®£¤  ªãàá®à ­¥ ¯®«­ë©)
3293
		add ecx,edx
3297
		add ecx,edx
3294
	@@:
3298
	@@:
3295
	shl ecx,16
3299
	shl ecx,16
3296
	add ecx,ted_rec_h
3300
	add ecx,ted_rec_h
3297
	cmp ted_cur_ins,1
3301
	cmp ted_cur_ins,1
3298
	jne @f
3302
	jne @f
3299
		shr cx,1 ;¤¥«¨¬ ¢ëá®âã ªãàá®à  ­  2
3303
		shr cx,1 ;¤¥«¨¬ ¢ëá®âã ªãàá®à  ­  2
3300
	@@:
3304
	@@:
3301
 
3305
 
3302
	mov ebx,ted_wnd_l ;calc rect -> x0,x1
3306
	mov ebx,ted_wnd_l ;calc rect -> x0,x1
3303
	add ebx,ted_rec_l
3307
	add ebx,ted_rec_l
3304
	mov edx,ted_cur_x
3308
	mov edx,ted_cur_x
3305
	imul edx,ted_rec_w
3309
	imul edx,ted_rec_w
3306
	add ebx,edx
3310
	add ebx,edx
3307
	shl ebx,16
3311
	shl ebx,16
3308
	add ebx,ted_rec_w
3312
	add ebx,ted_rec_w
3309
 
3313
 
3310
	mov edx,ted_color_cursor
3314
	mov edx,ted_color_cursor
3311
	int 0x40 ;¢ë¢®¤ ªãàá®à 
3315
	int 0x40 ;¢ë¢®¤ ªãàá®à 
3312
 
3316
 
3313
	call ted_get_pos_by_cursor
3317
	call ted_get_pos_by_cursor
3314
	cmp ted_gp_opt,2
3318
	cmp ted_gp_opt,2
3315
	jne @f
3319
	jne @f
3316
		mov esi,1
3320
		mov esi,1
3317
		ror ecx,16
3321
		ror ecx,16
3318
		mov bx,cx
3322
		mov bx,cx
3319
		add ebx,0x10001
3323
		add ebx,0x10001
3320
		cmp ted_cur_ins,1
3324
		cmp ted_cur_ins,1
3321
		jne .no_up_tetx
3325
		jne .no_up_tetx
3322
			mov ecx,ted_rec_h
3326
			mov ecx,ted_rec_h
3323
			inc cx ; 1->1, 3->2, 5->3, ...
3327
			inc cx ; 1->1, 3->2, 5->3, ...
3324
			shr cx,1
3328
			shr cx,1
3325
			sub bx,cx
3329
			sub bx,cx
3326
		.no_up_tetx:
3330
		.no_up_tetx:
3327
		mov ecx,ted_color_cur_text
3331
		mov ecx,ted_color_cur_text
3328
		or ecx,ted_font_size
3332
		or ecx,ted_font_size
3329
		call ted_convert_invis_symb
3333
		call ted_convert_invis_symb
3330
		mcall SF_DRAW_TEXT
3334
		mcall SF_DRAW_TEXT
3331
	@@:
3335
	@@:
3332
 
3336
 
3333
	mov ebx,ted_wnd_l
3337
	mov ebx,ted_wnd_l
3334
	add ebx,ted_rec_l
3338
	add ebx,ted_rec_l
3335
	shl ebx,16
3339
	shl ebx,16
3336
	add ebx,ted_wnd_t
3340
	add ebx,ted_wnd_t
3337
	add ebx,3
3341
	add ebx,3
3338
	mov ecx,ted_color_wnd_bord
3342
	mov ecx,ted_color_wnd_bord
3339
	or  ecx,0x80000000
3343
	or  ecx,0x80000000
3340
	lea edx,[txtRow]
3344
	lea edx,[txtRow]
3341
	mcall SF_DRAW_TEXT ;¢ë¢®¤ ¯®¤¯¨á¨ '‘âப '
3345
	mcall SF_DRAW_TEXT ;¢ë¢®¤ ¯®¤¯¨á¨ '‘âப '
3342
 
3346
 
3343
	add ebx,0x500000
3347
	add ebx,0x500000
3344
	lea edx,[txtCol]
3348
	lea edx,[txtCol]
3345
	int 0x40 ;¢ë¢®¤ ¯®¤¯¨á¨ '‡­ ª'
3349
	int 0x40 ;¢ë¢®¤ ¯®¤¯¨á¨ '‡­ ª'
3346
 
3350
 
3347
	cmp ted_tim_undo,0
3351
	cmp ted_tim_undo,0
3348
	je @f
3352
	je @f
3349
		add ebx,0x500000
3353
		add ebx,0x500000
3350
		lea edx,[txtOtm]
3354
		lea edx,[txtOtm]
3351
		int 0x40
3355
		int 0x40
3352
		sub ebx,0x500000
3356
		sub ebx,0x500000
3353
	@@:
3357
	@@:
3354
 
3358
 
3355
	call ted_draw_buffer
3359
	call ted_draw_buffer
3356
	call ted_draw_help_f1
3360
	call ted_draw_help_f1
3357
 
3361
 
3358
	mov eax,47 ;draw cursor coords
3362
	mov eax,47 ;draw cursor coords
3359
	mov esi,ted_color_wnd_bord
3363
	mov esi,ted_color_wnd_bord
3360
	or  esi,0x40000000
3364
	or  esi,0x40000000
3361
 
3365
 
3362
	mov edx,ebx
3366
	mov edx,ebx
3363
	ror edx,16
3367
	ror edx,16
3364
	sub edx,35
3368
	sub edx,35
3365
	ror edx,16
3369
	ror edx,16
3366
	;add edx,3
3370
	;add edx,3
3367
	mov ebx,0x40000 ;Row=...
3371
	mov ebx,0x40000 ;Row=...
3368
	mov ecx,ted_scr_w
3372
	mov ecx,ted_scr_w
3369
	mov ecx,[ecx+sb_offs_position]
3373
	mov ecx,[ecx+sb_offs_position]
3370
	add ecx,ted_cur_y
3374
	add ecx,ted_cur_y
3371
	inc ecx
3375
	inc ecx
3372
 
3376
 
3373
push edi
3377
push edi
3374
	mov edi,ted_color_wnd_work
3378
	mov edi,ted_color_wnd_work
3375
	int 0x40 ;¢ë¢®¤ ç¨á«  ⥪ã饩 áâப¨
3379
	int 0x40 ;¢ë¢®¤ ç¨á«  ⥪ã饩 áâப¨
3376
pop edi
3380
pop edi
3377
 
3381
 
3378
	;mov ebx,0x40000 ;Col=...
3382
	;mov ebx,0x40000 ;Col=...
3379
	mov ecx,ted_scr_h
3383
	mov ecx,ted_scr_h
3380
	mov ecx,[ecx+sb_offs_position]
3384
	mov ecx,[ecx+sb_offs_position]
3381
	add ecx,ted_cur_x
3385
	add ecx,ted_cur_x
3382
	inc ecx
3386
	inc ecx
3383
	add edx,0x500000
3387
	add edx,0x500000
3384
push edi
3388
push edi
3385
	mov edi,ted_color_wnd_work
3389
	mov edi,ted_color_wnd_work
3386
	int 0x40 ;¢ë¢®¤ ç¨á«  §­ ª®¢
3390
	int 0x40 ;¢ë¢®¤ ç¨á«  §­ ª®¢
3387
pop edi
3391
pop edi
3388
 
3392
 
3389
	cmp ted_tim_undo,0
3393
	cmp ted_tim_undo,0
3390
	je @f
3394
	je @f
3391
		mov ecx,ted_tim_undo
3395
		mov ecx,ted_tim_undo
3392
		add edx,0x500000
3396
		add edx,0x500000
3393
		mov edi,ted_color_wnd_work ;¯®à⨬ ॣ¨áâà edi, ­® ¢ ª®­æ¥ ä㭪樨 í⮠㦥 ­¥ ¢ ¦­®
3397
		mov edi,ted_color_wnd_work ;¯®à⨬ ॣ¨áâà edi, ­® ¢ ª®­æ¥ ä㭪樨 í⮠㦥 ­¥ ¢ ¦­®
3394
		int 0x40 ;¢ë¢®¤ ç¨á«  ®â¬¥­¥­­ëå ¤¥©á⢨©
3398
		int 0x40 ;¢ë¢®¤ ç¨á«  ®â¬¥­¥­­ëå ¤¥©á⢨©
3395
	@@:
3399
	@@:
3396
 
3400
 
3397
popad
3401
popad
3398
	ret
3402
	ret
3399
endp
3403
endp
3400
 
3404
 
3401
;input:
3405
;input:
3402
; edi = pointer to tedit struct
3406
; edi = pointer to tedit struct
3403
align 16
3407
align 16
3404
proc ted_draw_buffer
3408
proc ted_draw_buffer
3405
	pushad
3409
	pushad
3406
 
3410
 
3407
	mov eax,ted_buffer
3411
	mov eax,ted_buffer
3408
	cmp dword[eax],1 ;ᬮâਬ à §¬¥à ¡ãä¥à 
3412
	cmp dword[eax],1 ;ᬮâਬ à §¬¥à ¡ãä¥à 
3409
	jl @f
3413
	jl @f
3410
		mov ebx,ted_rec_l
3414
		mov ebx,ted_rec_l
3411
		add bx,300
3415
		add bx,300
3412
		cmp ebx,ted_wnd_w ;áà ¢­¨¢ ¥¬ ª®®à¤¨­ âã ¤«ï ¢ë¢®¤ ⥪áâ 
3416
		cmp ebx,ted_wnd_w ;áà ¢­¨¢ ¥¬ ª®®à¤¨­ âã ¤«ï ¢ë¢®¤ ⥪áâ 
3413
		jge @f ;¯®¤¯¨áì ­¥ ¢« §¨â ¢ ®ª­®
3417
		jge @f ;¯®¤¯¨áì ­¥ ¢« §¨â ¢ ®ª­®
3414
 
3418
 
3415
		add ebx,ted_wnd_l
3419
		add ebx,ted_wnd_l
3416
		shl ebx,16
3420
		shl ebx,16
3417
		add ebx,ted_wnd_t
3421
		add ebx,ted_wnd_t
3418
		add ebx,3
3422
		add ebx,3
3419
		mov ecx,ted_color_wnd_bord
3423
		mov ecx,ted_color_wnd_bord
3420
		or ecx,0x40000000
3424
		or ecx,0x40000000
3421
 
3425
 
3422
		mov edx,ted_buffer
3426
		mov edx,ted_buffer
3423
		add edx,12
3427
		add edx,12
3424
		mov esi,edx
3428
		mov esi,edx
3425
		mov edi,ted_color_wnd_work ;edi - destroy not pointer to tedit
3429
		mov edi,ted_color_wnd_work ;edi - destroy not pointer to tedit
3426
		call tl_strlen
3430
		call tl_strlen
3427
		;cmp eax,0 ;¡ãä¥à ¯ãáâ
3431
		;cmp eax,0 ;¡ãä¥à ¯ãáâ
3428
		;je @f
3432
		;je @f
3429
		cmp eax,20
3433
		cmp eax,20
3430
		jle .crop_buf
3434
		jle .crop_buf
3431
			mov eax,20 ;®¡à¥§ª  ¯®¤¯¨á¨ ¤® 20 ᨬ¢®«®¢
3435
			mov eax,20 ;®¡à¥§ª  ¯®¤¯¨á¨ ¤® 20 ᨬ¢®«®¢
3432
		.crop_buf:
3436
		.crop_buf:
3433
		mov esi,eax
3437
		mov esi,eax
3434
		mcall SF_DRAW_TEXT ;¢ë¢®¤ ᮤ¥à¦¨¬®£® ¡ãä¥à 
3438
		mcall SF_DRAW_TEXT ;¢ë¢®¤ ᮤ¥à¦¨¬®£® ¡ãä¥à 
3435
 
3439
 
3436
		sub ebx,50 shl 16
3440
		sub ebx,50 shl 16
3437
		lea edx,[txtBuf]
3441
		lea edx,[txtBuf]
3438
		mov esi,edx
3442
		mov esi,edx
3439
		call tl_strlen
3443
		call tl_strlen
3440
		mov esi,eax
3444
		mov esi,eax
3441
		xor ecx,0x40000000 ;㡨ࠥ¬ 梥â ä®­ 
3445
		xor ecx,0x40000000 ;㡨ࠥ¬ 梥â ä®­ 
3442
		mcall SF_DRAW_TEXT ;¢ë¢®¤ ¯®¤¯¨á¨ ¤«ï ¡ãä¥à 
3446
		mcall SF_DRAW_TEXT ;¢ë¢®¤ ¯®¤¯¨á¨ ¤«ï ¡ãä¥à 
3443
	@@:
3447
	@@:
3444
	popad
3448
	popad
3445
	ret
3449
	ret
3446
endp
3450
endp
3447
 
3451
 
3448
;input:
3452
;input:
3449
; edi = pointer to tedit struct
3453
; edi = pointer to tedit struct
3450
align 16
3454
align 16
3451
proc ted_draw_help_f1
3455
proc ted_draw_help_f1
3452
	pushad
3456
	pushad
3453
	cmp ted_rec_t,13 ;¬¨­¨¬ «ì­ ï ¢ëá®â  ¤«ï à¨á®¢ ­¨ï á¯à ¢ª¨
3457
	cmp ted_rec_t,13 ;¬¨­¨¬ «ì­ ï ¢ëá®â  ¤«ï à¨á®¢ ­¨ï á¯à ¢ª¨
3454
	jle @f
3458
	jle @f
3455
		;clear place before draw help
3459
		;clear place before draw help
3456
		mov ebx,ted_wnd_l
3460
		mov ebx,ted_wnd_l
3457
		add ebx,ted_rec_l
3461
		add ebx,ted_rec_l
3458
		shl ebx,16
3462
		shl ebx,16
3459
		add ebx,ted_wnd_w
3463
		add ebx,ted_wnd_w
3460
		sub ebx,ted_rec_l
3464
		sub ebx,ted_rec_l
3461
		mov ecx,ted_wnd_t
3465
		mov ecx,ted_wnd_t
3462
		add ecx,13
3466
		add ecx,13
3463
		shl ecx,16
3467
		shl ecx,16
3464
		add ecx,9 ;9 - ¢ëá®â  0-£® èà¨äâ , áâ ¢¨âì ted_rec_h ¯®ª  ¥é¥ à ­®
3468
		add ecx,9 ;9 - ¢ëá®â  0-£® èà¨äâ , áâ ¢¨âì ted_rec_h ¯®ª  ¥é¥ à ­®
3465
		mcall SF_DRAW_RECT,,,ted_color_wnd_capt
3469
		mcall SF_DRAW_RECT,,,ted_color_wnd_capt
3466
 
3470
 
3467
	cmp ted_help_id,-1
3471
	cmp ted_help_id,-1
3468
	je @f
3472
	je @f
3469
		mov eax,ted_help_id
3473
		mov eax,ted_help_id
3470
		ColToIndexOffset eax,edx
3474
		ColToIndexOffset eax,edx
3471
 
3475
 
3472
		;SetCoordinates
3476
		;SetCoordinates
3473
		mov ebx,ted_wnd_l
3477
		mov ebx,ted_wnd_l
3474
		add ebx,ted_rec_l
3478
		add ebx,ted_rec_l
3475
		shl ebx,16
3479
		shl ebx,16
3476
		add ebx,ted_wnd_t
3480
		add ebx,ted_wnd_t
3477
		add ebx,13 ;=3+10
3481
		add ebx,13 ;=3+10
3478
 
3482
 
3479
		;SetTextColor
3483
		;SetTextColor
3480
		xor eax,eax
3484
		xor eax,eax
3481
		mov al,byte[edx+MAX_COLOR_WORD_LEN+7]
3485
		mov al,byte[edx+MAX_COLOR_WORD_LEN+7]
3482
		shl ax,2
3486
		shl ax,2
3483
		mov ecx,ted_text_colors
3487
		mov ecx,ted_text_colors
3484
		add ecx,eax
3488
		add ecx,eax
3485
		mov ecx,[ecx]
3489
		mov ecx,[ecx]
3486
		or	ecx,0xc0000000 ;SetTextStyles
3490
		or	ecx,0xc0000000 ;SetTextStyles
3487
		mov esi,edi
3491
		mov esi,edi
3488
		mcall SF_DRAW_TEXT,,,,,ted_color_wnd_work
3492
		mcall SF_DRAW_TEXT,,,,,ted_color_wnd_work
3489
		mov edi,esi
3493
		mov edi,esi
3490
 
3494
 
3491
		mov esi,edx
3495
		mov esi,edx
3492
		call tl_strlen
3496
		call tl_strlen
3493
 
3497
 
3494
		;*** draw help string ***
3498
		;*** draw help string ***
3495
		mov ecx,ted_color_wnd_bord
3499
		mov ecx,ted_color_wnd_bord
3496
		or ecx,0x80000000
3500
		or ecx,0x80000000
3497
		mov edx,[edx+MAX_COLOR_WORD_LEN]
3501
		mov edx,[edx+MAX_COLOR_WORD_LEN]
3498
		or edx,edx
3502
		or edx,edx
3499
		jz @f
3503
		jz @f
3500
			add edx,ted_help_text_f1
3504
			add edx,ted_help_text_f1
3501
			inc eax
3505
			inc eax
3502
			imul eax,6 ;è¨à¨­  ᨬ¢®«  ¢ á¨áâ. èà¨äâ¥
3506
			imul eax,6 ;è¨à¨­  ᨬ¢®«  ¢ á¨áâ. èà¨äâ¥
3503
			shl eax,16			
3507
			shl eax,16			
3504
			add ebx,eax
3508
			add ebx,eax
3505
			mcall SF_DRAW_TEXT
3509
			mcall SF_DRAW_TEXT
3506
	@@:
3510
	@@:
3507
	popad
3511
	popad
3508
	ret
3512
	ret
3509
endp
3513
endp
3510
 
3514
 
3511
;input:
3515
;input:
3512
; edi = pointer to tedit struct
3516
; edi = pointer to tedit struct
3513
align 16
3517
align 16
3514
proc ted_draw_line_numbers
3518
proc ted_draw_line_numbers
3515
pushad
3519
pushad
3516
	;top panel with caption
3520
	;top panel with caption
3517
	mov ebx,ted_wnd_l
3521
	mov ebx,ted_wnd_l
3518
	;add ebx,ted_rec_l
3522
	;add ebx,ted_rec_l
3519
	shl ebx,16
3523
	shl ebx,16
3520
	add ebx,ted_wnd_w
3524
	add ebx,ted_wnd_w
3521
	;sub ebx,ted_rec_l
3525
	;sub ebx,ted_rec_l
3522
	mov edx,ted_color_wnd_work
3526
	mov edx,ted_color_wnd_work
3523
	mov ecx,ted_wnd_t
3527
	mov ecx,ted_wnd_t
3524
	shl ecx,16
3528
	shl ecx,16
3525
	add ecx,ted_rec_t
3529
	add ecx,ted_rec_t
3526
	mov edx,ted_color_wnd_capt
3530
	mov edx,ted_color_wnd_capt
3527
	mcall SF_DRAW_RECT
3531
	mcall SF_DRAW_RECT
3528
 
3532
 
3529
	;line numbers
3533
	;line numbers
3530
	mov ebx,0x40000 ;format
3534
	mov ebx,0x40000 ;format
3531
	mov ecx,ted_scr_w
3535
	mov ecx,ted_scr_w
3532
	mov ecx,[ecx+sb_offs_position]
3536
	mov ecx,[ecx+sb_offs_position]
3533
	inc ecx
3537
	inc ecx
3534
	mov edx,3
3538
	mov edx,3
3535
	add edx,ted_wnd_l
3539
	add edx,ted_wnd_l
3536
	rol edx,16
3540
	rol edx,16
3537
	add edx,ted_wnd_t
3541
	add edx,ted_wnd_t
3538
	add edx,ted_rec_t
3542
	add edx,ted_rec_t
3539
	@@:
3543
	@@:
3540
 
3544
 
3541
push ebx ecx edx
3545
push ebx ecx edx
3542
	;left panel with numbers
3546
	;left panel with numbers
3543
	mov ebx,ted_wnd_l
3547
	mov ebx,ted_wnd_l
3544
	shl ebx,16
3548
	shl ebx,16
3545
	add ebx,ted_rec_l
3549
	add ebx,ted_rec_l
3546
	mov ecx,ted_rec_h
3550
	mov ecx,ted_rec_h
3547
	rol ecx,16
3551
	rol ecx,16
3548
	mov cx,dx
3552
	mov cx,dx
3549
	rol ecx,16
3553
	rol ecx,16
3550
	mov edx,ted_color_wnd_capt
3554
	mov edx,ted_color_wnd_capt
3551
	mcall SF_DRAW_RECT ;à¨á㥬 ¯àאַ㣮«ì­¨ª ¯®¤ ­®¬¥à®¬ áâப¨
3555
	mcall SF_DRAW_RECT ;à¨á㥬 ¯àאַ㣮«ì­¨ª ¯®¤ ­®¬¥à®¬ áâப¨
3552
pop edx ecx ebx
3556
pop edx ecx ebx
3553
 
3557
 
3554
		mov esi,ted_color_wnd_bord
3558
		mov esi,ted_color_wnd_bord
3555
		mcall SF_DRAW_NUMBER ;à¨á㥬 ­®¬¥à áâப¨
3559
		mcall SF_DRAW_NUMBER ;à¨á㥬 ­®¬¥à áâப¨
3556
		inc ecx
3560
		inc ecx
3557
		add edx,ted_rec_h
3561
		add edx,ted_rec_h
3558
		sub edx,ted_wnd_t
3562
		sub edx,ted_wnd_t
3559
		mov esi,edx
3563
		mov esi,edx
3560
		and esi,0xffff
3564
		and esi,0xffff
3561
		cmp esi,ted_wnd_h
3565
		cmp esi,ted_wnd_h
3562
		jge @f
3566
		jge @f
3563
		add edx,ted_wnd_t
3567
		add edx,ted_wnd_t
3564
		jmp @b
3568
		jmp @b
3565
align 4
3569
align 4
3566
	@@:
3570
	@@:
3567
popad
3571
popad
3568
	ret
3572
	ret
3569
endp
3573
endp
3570
 
3574
 
3571
;output:
3575
;output:
3572
; ah = symbol
3576
; ah = symbol
3573
align 16
3577
align 16
3574
proc KeyConvertToASCII uses ebx, table:dword
3578
proc KeyConvertToASCII uses ebx, table:dword
3575
	mov ebx,[table] ;convert scan to ascii
3579
	mov ebx,[table] ;convert scan to ascii
3576
	ror ax,8
3580
	ror ax,8
3577
	xor ah,ah
3581
	xor ah,ah
3578
	add bx,ax ;? ebx,eax
3582
	add bx,ax ;? ebx,eax
3579
	mov ah,byte[ebx]
3583
	mov ah,byte[ebx]
3580
	ret
3584
	ret
3581
endp
3585
endp
3582
 
3586
 
3583
align 16
3587
align 16
3584
proc ted_draw_cur_line, edit:dword
3588
proc ted_draw_cur_line, edit:dword
3585
pushad
3589
pushad
3586
	mov edi,[edit]
3590
	mov edi,[edit]
3587
 
3591
 
3588
	mov ebx,ted_wnd_l
3592
	mov ebx,ted_wnd_l
3589
	add ebx,ted_rec_l
3593
	add ebx,ted_rec_l
3590
	shl ebx,16
3594
	shl ebx,16
3591
	mov eax,ted_cur_y
3595
	mov eax,ted_cur_y
3592
	imul eax,ted_rec_h
3596
	imul eax,ted_rec_h
3593
	mov bx,ax
3597
	mov bx,ax
3594
	add ebx,ted_wnd_t
3598
	add ebx,ted_wnd_t
3595
	add ebx,ted_rec_t ;ebx - ª®®à¤¨­ âë ¤«ï ¯àאַ㣮«ì­¨ª  ®ç¨á⪨ «¨­¨¨
3599
	add ebx,ted_rec_t ;ebx - ª®®à¤¨­ âë ¤«ï ¯àאַ㣮«ì­¨ª  ®ç¨á⪨ «¨­¨¨
3596
	add ebx,0x10001   ;¤®¡ ¢«ï¥¬ ®âáâã¯ë ¤«ï ¢ëà ¢­¨¢ ­¨ï ¡ãª¢ë ¯® 業âàã
3600
	add ebx,0x10001   ;¤®¡ ¢«ï¥¬ ®âáâã¯ë ¤«ï ¢ëà ¢­¨¢ ­¨ï ¡ãª¢ë ¯® 業âàã
3597
 
3601
 
3598
	call ted_sel_normalize ;need before draw select
3602
	call ted_sel_normalize ;need before draw select
3599
	mov ecx,ted_cur_y
3603
	mov ecx,ted_cur_y
3600
	mov eax,ted_scr_w
3604
	mov eax,ted_scr_w
3601
	add ecx,[eax+sb_offs_position]
3605
	add ecx,[eax+sb_offs_position]
3602
	stdcall ted_clear_line_before_draw,edi,ebx,1,ecx
3606
	stdcall ted_clear_line_before_draw,edi,ebx,1,ecx
3603
 
3607
 
3604
	mov eax,ted_scr_h
3608
	mov eax,ted_scr_h
3605
	mov esi,[eax+sb_offs_position]
3609
	mov esi,[eax+sb_offs_position]
3606
	call ted_get_pos_by_coords
3610
	call ted_get_pos_by_coords
3607
 
3611
 
3608
	cmp ted_gp_opt,2
3612
	cmp ted_gp_opt,2
3609
	jne .no_draw_text
3613
	jne .no_draw_text
3610
	call ted_get_symb_color
3614
	call ted_get_symb_color
3611
	mov esi,1 ;draw 1 symbol
3615
	mov esi,1 ;draw 1 symbol
3612
	@@:
3616
	@@:
3613
		;call ted_iterat_next
3617
		;call ted_iterat_next
3614
		cmp edx,ted_tex_1
3618
		cmp edx,ted_tex_1
3615
		jle .no_draw_text
3619
		jle .no_draw_text
3616
 
3620
 
3617
		; *** 梥⮢ ï à §¬¥âª 
3621
		; *** 梥⮢ ï à §¬¥âª 
3618
		cmp ted_mode_color,0
3622
		cmp ted_mode_color,0
3619
		je .no_col_change
3623
		je .no_col_change
3620
		cmp byte[edx+1],0
3624
		cmp byte[edx+1],0
3621
		je .no_col_change
3625
		je .no_col_change
3622
			call ted_get_symb_color
3626
			call ted_get_symb_color
3623
		.no_col_change:
3627
		.no_col_change:
3624
 
3628
 
3625
		mov eax,SF_DRAW_TEXT
3629
		mov eax,SF_DRAW_TEXT
3626
		cmp byte [edx],13
3630
		cmp byte [edx],13
3627
		jne .no_13
3631
		jne .no_13
3628
			cmp ted_mode_invis,1
3632
			cmp ted_mode_invis,1
3629
			jne .no_draw_text
3633
			jne .no_draw_text
3630
			push edx
3634
			push edx
3631
			mov edx,edi
3635
			mov edx,edi
3632
			add edx,ted_offs_symbol_new_line
3636
			add edx,ted_offs_symbol_new_line
3633
			int 0x40
3637
			int 0x40
3634
			pop edx
3638
			pop edx
3635
			jmp .no_draw_text
3639
			jmp .no_draw_text
3636
align 4
3640
align 4
3637
		.no_13:
3641
		.no_13:
3638
 
3642
 
3639
		int 0x40
3643
		int 0x40
3640
		ror ebx,16
3644
		ror ebx,16
3641
		add ebx,ted_rec_w
3645
		add ebx,ted_rec_w
3642
		mov eax,ted_wnd_w
3646
		mov eax,ted_wnd_w
3643
		add eax,ted_wnd_l ;ax = ®âáâ㯠¯® ®á¨ x
3647
		add eax,ted_wnd_l ;ax = ®âáâ㯠¯® ®á¨ x
3644
		cmp bx,ax
3648
		cmp bx,ax
3645
		jge .no_draw_text ;Opt
3649
		jge .no_draw_text ;Opt
3646
		ror ebx,16
3650
		ror ebx,16
3647
		call ted_iterat_next
3651
		call ted_iterat_next
3648
		jmp @b
3652
		jmp @b
3649
align 4
3653
align 4
3650
	.no_draw_text:
3654
	.no_draw_text:
3651
 
3655
 
3652
	call ted_draw_main_cursor
3656
	call ted_draw_main_cursor
3653
popad
3657
popad
3654
	ret
3658
	ret
3655
endp
3659
endp
3656
 
3660
 
3657
;input:
3661
;input:
3658
; eax - text need find
3662
; eax - text need find
3659
; bl - first symbol to find
3663
; bl - first symbol to find
3660
; edx - first symbol pointer
3664
; edx - first symbol pointer
3661
; edi - pointer to tedit struct
3665
; edi - pointer to tedit struct
3662
;output:
3666
;output:
3663
; bh - rezult
3667
; bh - rezult
3664
; edx - last text position (if find sucess)
3668
; edx - last text position (if find sucess)
3665
; esi - first symbol pointer
3669
; esi - first symbol pointer
3666
;description:
3670
;description:
3667
; ”ã­ªæ¨ï ¯à®¢¥àï¥â ᮢ¯ ¤ ¥â «¨ ⥪áâ ¢ ¡ãä¥à¥ eax
3671
; ”ã­ªæ¨ï ¯à®¢¥àï¥â ᮢ¯ ¤ ¥â «¨ ⥪áâ ¢ ¡ãä¥à¥ eax
3668
; á ⥪á⮬ । ªâ®à  ¯® 㪠§ â¥«î edx.
3672
; á ⥪á⮬ । ªâ®à  ¯® 㪠§ â¥«î edx.
3669
; ‘â ­¤ àâ­ë¥ ä㭪樨 (­ ¯à. strcmp) âãâ ­¥ ¯®¤®©¤ãâ, ¯®â®¬ã çâ®
3673
; ‘â ­¤ àâ­ë¥ ä㭪樨 (­ ¯à. strcmp) âãâ ­¥ ¯®¤®©¤ãâ, ¯®â®¬ã çâ®
3670
; ¢ ¯ ¬ï⨠। ªâ®à  ⥪áâ ᮤ¥à¦¨âáï ­¥ ¢ ¢¨¤¥ ascii áâப.
3674
; ¢ ¯ ¬ï⨠। ªâ®à  ⥪áâ ᮤ¥à¦¨âáï ­¥ ¢ ¢¨¤¥ ascii áâப.
3671
align 16
3675
align 16
3672
ted_get_find_rezult:
3676
ted_get_find_rezult:
3673
push eax
3677
push eax
3674
	mov bh,1
3678
	mov bh,1
3675
	mov esi,edx ;copy edx
3679
	mov esi,edx ;copy edx
3676
	@@:
3680
	@@:
3677
		cmp byte[edx],bl
3681
		cmp byte[edx],bl
3678
		jne .no_text
3682
		jne .no_text
3679
 
3683
 
3680
		inc eax ;*** get next symbol (in find text) ***
3684
		inc eax ;*** get next symbol (in find text) ***
3681
		mov bl,byte[eax]
3685
		mov bl,byte[eax]
3682
		or bl,bl
3686
		or bl,bl
3683
		jz @f ;end of find text
3687
		jz @f ;end of find text
3684
 
3688
 
3685
		call ted_iterat_next ;*** get next symbol (in editor text) ***
3689
		call ted_iterat_next ;*** get next symbol (in editor text) ***
3686
		cmp edx,ted_tex_1
3690
		cmp edx,ted_tex_1
3687
		jle @f ;end of editor text
3691
		jle @f ;end of editor text
3688
 
3692
 
3689
		jmp @b
3693
		jmp @b
3690
align 4
3694
align 4
3691
		.no_text:
3695
		.no_text:
3692
	xor bh,bh
3696
	xor bh,bh
3693
	mov edx,esi ;restore edx
3697
	mov edx,esi ;restore edx
3694
	@@:
3698
	@@:
3695
pop eax
3699
pop eax
3696
	mov bl,byte[eax] ;restore bl
3700
	mov bl,byte[eax] ;restore bl
3697
	ret
3701
	ret
3698
 
3702
 
3699
;input:
3703
;input:
3700
;  clear_o - ¥á«¨ =1 ®ç¨áâ¨âì ®¤­ã áâபã, =0 ®ç¨áâ¨âì ¢á¥ áâப¨ ®ª­  ¤® ­¨§ã
3704
;  clear_o - ¥á«¨ =1 ®ç¨áâ¨âì ®¤­ã áâபã, =0 ®ç¨áâ¨âì ¢á¥ áâப¨ ®ª­  ¤® ­¨§ã
3701
align 16
3705
align 16
3702
proc ted_clear_line_before_draw, edit:dword, coords:dword, clear_o:dword, numb_lin:dword
3706
proc ted_clear_line_before_draw, edit:dword, coords:dword, clear_o:dword, numb_lin:dword
3703
	pushad
3707
	pushad
3704
	mov edi,[edit]
3708
	mov edi,[edit]
3705
	mov ebx,[coords] ;ebx = x*2^16+y coords to left up point clear line
3709
	mov ebx,[coords] ;ebx = x*2^16+y coords to left up point clear line
3706
	mov esi,[numb_lin] ;esi - number text line
3710
	mov esi,[numb_lin] ;esi - number text line
3707
 
3711
 
3708
	sub ebx,0x10001 ;®â­¨¬ ¥¬ ®âáâã¯ë ¤«ï ¢ëà ¢­¨¢ ­¨ï ¡ãª¢ë ¯® 業âàã
3712
	sub ebx,0x10001 ;®â­¨¬ ¥¬ ®âáâã¯ë ¤«ï ¢ëà ¢­¨¢ ­¨ï ¡ãª¢ë ¯® 業âàã
3709
	cmp dword[clear_o],0
3713
	cmp dword[clear_o],0
3710
	jne @f
3714
	jne @f
3711
		add ebx,ted_rec_h
3715
		add ebx,ted_rec_h
3712
		ror ebx,16
3716
		ror ebx,16
3713
		xor bx,bx
3717
		xor bx,bx
3714
		add ebx,ted_wnd_l
3718
		add ebx,ted_wnd_l
3715
		add ebx,ted_rec_l ;bx = ted_wnd_l+ted_rec_l
3719
		add ebx,ted_rec_l ;bx = ted_wnd_l+ted_rec_l
3716
		ror ebx,16
3720
		ror ebx,16
3717
	@@:
3721
	@@:
3718
 
3722
 
3719
	mov eax,ted_wnd_h
3723
	mov eax,ted_wnd_h
3720
	add eax,ted_wnd_t
3724
	add eax,ted_wnd_t
3721
	cmp ax,bx
3725
	cmp ax,bx
3722
	jl .no_clear
3726
	jl .no_clear
3723
	sub ax,bx
3727
	sub ax,bx
3724
 
3728
 
3725
	mov cx,bx
3729
	mov cx,bx
3726
	shl ecx,16
3730
	shl ecx,16
3727
 
3731
 
3728
	xor bx,bx
3732
	xor bx,bx
3729
	add ebx,ted_wnd_w
3733
	add ebx,ted_wnd_w
3730
	sub ebx,ted_rec_l
3734
	sub ebx,ted_rec_l
3731
	xor cx,cx
3735
	xor cx,cx
3732
	add ecx,ted_rec_h
3736
	add ecx,ted_rec_h
3733
	mov edx,ted_color_wnd_work
3737
	mov edx,ted_color_wnd_work
3734
 
3738
 
3735
	cmp dword[clear_o],0
3739
	cmp dword[clear_o],0
3736
	je .pusto
3740
	je .pusto
3737
	cmp ax,cx
3741
	cmp ax,cx
3738
	jge @f
3742
	jge @f
3739
	.pusto:
3743
	.pusto:
3740
		mov cx,ax
3744
		mov cx,ax
3741
		jmp .no_select ;¥á«¨ ®ç¨á⪠ ®ª­  ¤® ­¨§ã, â® ¢á¥£¤  ä®­®¢ë¬ 梥⮬
3745
		jmp .no_select ;¥á«¨ ®ç¨á⪠ ®ª­  ¤® ­¨§ã, â® ¢á¥£¤  ä®­®¢ë¬ 梥⮬
3742
	@@:
3746
	@@:
3743
 
3747
 
3744
	call ted_is_select
3748
	call ted_is_select
3745
	cmp al,0
3749
	cmp al,0
3746
	je .no_select
3750
	je .no_select
3747
	cmp ted_seln_y0,esi
3751
	cmp ted_seln_y0,esi
3748
	jg .no_select
3752
	jg .no_select
3749
	cmp ted_seln_y1,esi
3753
	cmp ted_seln_y1,esi
3750
	jl .no_select
3754
	jl .no_select
3751
		mov edx,ted_color_select ;draw selected line
3755
		mov edx,ted_color_select ;draw selected line
3752
	.no_select:
3756
	.no_select:
3753
 
3757
 
3754
	mcall SF_DRAW_RECT ;§ ªà áª  ¯®«­®© áâப¨ 梥⮬ ä®­  ¨«¨ 梥⮬ ¢ë¤¥«¥­¨ï
3758
	mcall SF_DRAW_RECT ;§ ªà áª  ¯®«­®© áâப¨ 梥⮬ ä®­  ¨«¨ 梥⮬ ¢ë¤¥«¥­¨ï
3755
 
3759
 
3756
	call ted_is_select
3760
	call ted_is_select
3757
	or al,al
3761
	or al,al
3758
	jz .no_clear
3762
	jz .no_clear
3759
 
3763
 
3760
	mov al,SF_DRAW_RECT
3764
	mov al,SF_DRAW_RECT
3761
	xor cx,cx
3765
	xor cx,cx
3762
	add ecx,ted_rec_h
3766
	add ecx,ted_rec_h
3763
	cmp ted_seln_y0,esi
3767
	cmp ted_seln_y0,esi
3764
	jne @f
3768
	jne @f
3765
		push bx esi
3769
		push bx esi
3766
		mov edx,ted_seln_x0 ; ¢¥àå­ïï ¯®«®á  (§ â¨à ¥â á«¥¢ )
3770
		mov edx,ted_seln_x0 ; ¢¥àå­ïï ¯®«®á  (§ â¨à ¥â á«¥¢ )
3767
		mov esi,ted_scr_h
3771
		mov esi,ted_scr_h
3768
		cmp edx,[esi+sb_offs_position]
3772
		cmp edx,[esi+sb_offs_position]
3769
		jle .in_wnd
3773
		jle .in_wnd
3770
			sub edx,[esi+sb_offs_position]
3774
			sub edx,[esi+sb_offs_position]
3771
			imul edx,ted_rec_w
3775
			imul edx,ted_rec_w
3772
			mov bx,dx
3776
			mov bx,dx
3773
			jmp .no_wnd
3777
			jmp .no_wnd
3774
		.in_wnd:
3778
		.in_wnd:
3775
		mov bx,0
3779
		xor bx,bx
3776
		.no_wnd:
3780
		.no_wnd:
3777
		mov edx,ted_color_wnd_work
3781
		mov edx,ted_color_wnd_work
3778
		int 0x40
3782
		int 0x40
3779
		pop esi bx
3783
		pop esi bx
3780
	@@:
3784
	@@:
3781
	cmp ted_seln_y1,esi
3785
	cmp ted_seln_y1,esi
3782
	jne @f
3786
	jne @f
3783
		;push esi
3787
		;push esi
3784
		;¥á«¨ ¢ë¤¥«¥­ ¢¥áì ä ©« âãâ ¬®¦­® ᤥ« âì ¢ë室, ­® ⮣¤  ­ã¦­® ¢ëè¥ ã¡à âì jmp .no_select
3788
		;¥á«¨ ¢ë¤¥«¥­ ¢¥áì ä ©« âãâ ¬®¦­® ᤥ« âì ¢ë室, ­® ⮣¤  ­ã¦­® ¢ëè¥ ã¡à âì jmp .no_select
3785
		mov edx,ted_seln_x1 ; ­¨¦­ïï ¯®«®á  (§ â¨à ¥â á¯à ¢ )
3789
		mov edx,ted_seln_x1 ; ­¨¦­ïï ¯®«®á  (§ â¨à ¥â á¯à ¢ )
3786
		mov esi,ted_scr_h
3790
		mov esi,ted_scr_h
3787
		cmp edx,[esi+sb_offs_position]
3791
		cmp edx,[esi+sb_offs_position]
3788
		jle .in_wnd2
3792
		jle .in_wnd2
3789
			sub edx,[esi+sb_offs_position]
3793
			sub edx,[esi+sb_offs_position]
3790
			imul edx,ted_rec_w
3794
			imul edx,ted_rec_w
3791
			sub bx,dx
3795
			sub bx,dx
3792
			shl edx,16
3796
			shl edx,16
3793
			add ebx,edx
3797
			add ebx,edx
3794
		.in_wnd2:
3798
		.in_wnd2:
3795
		mov edx,ted_color_wnd_work
3799
		mov edx,ted_color_wnd_work
3796
		int 0x40
3800
		int 0x40
3797
		;pop esi
3801
		;pop esi
3798
	@@:
3802
	@@:
3799
 
3803
 
3800
	.no_clear:
3804
	.no_clear:
3801
	popad
3805
	popad
3802
	ret
3806
	ret
3803
endp
3807
endp
3804
 
3808
 
3805
;input:
3809
;input:
3806
; edi = pointer to tedit struct
3810
; edi = pointer to tedit struct
3807
;output:
3811
;output:
3808
; ecx = ­®¢ë© 梥â ᨬ¢®« 
3812
; ecx = ­®¢ë© 梥â ᨬ¢®« 
3809
; edx = pointer to symbol
3813
; edx = pointer to symbol
3810
; edx = 0 if text not in screen
3814
; edx = 0 if text not in screen
3811
align 16
3815
align 16
3812
ted_get_first_visible_pos:
3816
ted_get_first_visible_pos:
3813
	push eax ecx
3817
	push eax ecx
3814
	mov eax,ted_scr_w
3818
	mov eax,ted_scr_w
3815
	mov edx,ted_tex
3819
	mov edx,ted_tex
3816
	xor ecx,ecx
3820
	xor ecx,ecx
3817
	@@:
3821
	@@:
3818
		cmp ecx,[eax+sb_offs_position]
3822
		cmp ecx,[eax+sb_offs_position]
3819
		je @f
3823
		je @f
3820
		call ted_iterat_next
3824
		call ted_iterat_next
3821
		cmp edx,ted_tex_1
3825
		cmp edx,ted_tex_1
3822
		jle @f
3826
		jle @f
3823
		cmp byte[edx],13
3827
		cmp byte[edx],13
3824
		jne @b
3828
		jne @b
3825
		inc ecx
3829
		inc ecx
3826
		jmp @b
3830
		jmp @b
3827
align 4
3831
align 4
3828
	@@:
3832
	@@:
3829
 
3833
 
3830
	cmp ecx,[eax+sb_offs_position]
3834
	cmp ecx,[eax+sb_offs_position]
3831
	je @f
3835
	je @f
3832
		xor edx,edx
3836
		xor edx,edx
3833
	@@:
3837
	@@:
3834
	cmp ecx,[eax+sb_offs_max_area]
3838
	cmp ecx,[eax+sb_offs_max_area]
3835
	jle @f
3839
	jle @f
3836
		mov [eax+sb_offs_max_area],ecx
3840
		mov [eax+sb_offs_max_area],ecx
3837
	@@:
3841
	@@:
3838
	pop ecx eax
3842
	pop ecx eax
3839
	call ted_opt_draw_line_left
3843
	call ted_opt_draw_line_left
3840
	ret
3844
	ret
3841
 
3845
 
3842
;input:
3846
;input:
3843
; edx = pointer to symbol
3847
; edx = pointer to symbol
3844
; edi = pointer to tedit struct
3848
; edi = pointer to tedit struct
3845
;output:
3849
;output:
3846
; ecx = 梥â ᨬ¢®« 
3850
; ecx = 梥â ᨬ¢®« 
3847
; edx = 㪠§ â¥«ì ­  ¯¥à¢ë© «¥¢ë© ᨬ¢®«
3851
; edx = 㪠§ â¥«ì ­  ¯¥à¢ë© «¥¢ë© ᨬ¢®«
3848
;description:
3852
;description:
3849
; äã­ªæ¨ï ­ã¦­  ¤«ï ®¯â¨¬¨§ æ¨¨ ¢ë¢®¤  ⥪áâ 
3853
; äã­ªæ¨ï ­ã¦­  ¤«ï ®¯â¨¬¨§ æ¨¨ ¢ë¢®¤  ⥪áâ 
3850
align 16
3854
align 16
3851
proc ted_opt_draw_line_left uses ebx
3855
proc ted_opt_draw_line_left uses ebx
3852
	mov ebx,ted_scr_h
3856
	mov ebx,ted_scr_h
3853
	mov ebx,[ebx+sb_offs_position]
3857
	mov ebx,[ebx+sb_offs_position]
3854
	or ebx,ebx
3858
	or ebx,ebx
3855
	jz .ret_f
3859
	jz .ret_f
3856
	push eax
3860
	push eax
3857
	mov eax,edx
3861
	mov eax,edx
3858
 
3862
 
3859
	cmp edx,ted_tex
3863
	cmp edx,ted_tex
3860
	jne @f
3864
	jne @f
3861
		call ted_iterat_next
3865
		call ted_iterat_next
3862
		jmp .beg_cycle
3866
		jmp .beg_cycle
3863
	@@:
3867
	@@:
3864
 
3868
 
3865
	or ebx,ebx
3869
	or ebx,ebx
3866
	jz @f
3870
	jz @f
3867
 
3871
 
3868
	cmp byte[edx],13
3872
	cmp byte[edx],13
3869
	jne @f
3873
	jne @f
3870
		call ted_iterat_next
3874
		call ted_iterat_next
3871
		.beg_cycle:
3875
		.beg_cycle:
3872
	@@:
3876
	@@:
3873
		cmp edx,ted_tex_1
3877
		cmp edx,ted_tex_1
3874
		jle @f
3878
		jle @f
3875
		cmp byte[edx],13
3879
		cmp byte[edx],13
3876
		je @f
3880
		je @f
3877
		or ebx,ebx
3881
		or ebx,ebx
3878
		jz @f
3882
		jz @f
3879
;--------------------------------------
3883
;--------------------------------------
3880
xor eax,eax ;eax ¡ã¤¥â ¬¥­ïâìáï
3884
xor eax,eax ;eax ¡ã¤¥â ¬¥­ïâìáï
3881
mov al,byte[edx+1]
3885
mov al,byte[edx+1]
3882
or al,al
3886
or al,al
3883
jz .no_color
3887
jz .no_color
3884
cmp eax,ted_colors_text_count
3888
cmp eax,ted_colors_text_count
3885
jge .no_color
3889
jge .no_color
3886
	xor ecx,ecx
3890
	xor ecx,ecx
3887
	mov cl,byte[edx+1]
3891
	mov cl,byte[edx+1]
3888
	shl cx,2
3892
	shl cx,2
3889
	add ecx,ted_text_colors
3893
	add ecx,ted_text_colors
3890
	mov ecx,[ecx]
3894
	mov ecx,[ecx]
3891
.no_color:
3895
.no_color:
3892
;--------------------------------------
3896
;--------------------------------------
3893
		mov eax,edx
3897
		mov eax,edx
3894
		call ted_iterat_next
3898
		call ted_iterat_next
3895
		dec ebx
3899
		dec ebx
3896
		jmp @b
3900
		jmp @b
3897
align 4
3901
align 4
3898
	@@:
3902
	@@:
3899
		mov edx,eax
3903
		mov edx,eax
3900
	pop eax
3904
	pop eax
3901
	.ret_f:
3905
	.ret_f:
3902
	call ted_get_symb_color
3906
	call ted_get_symb_color
3903
	ret
3907
	ret
3904
endp
3908
endp
3905
 
3909
 
3906
;input:
3910
;input:
3907
; edx = pointer to symbol
3911
; edx = pointer to symbol
3908
; edi = pointer to tedit struct
3912
; edi = pointer to tedit struct
3909
;output:
3913
;output:
3910
; ecx = symbol color
3914
; ecx = symbol color
3911
; edx = pointer to 13 symbol
3915
; edx = pointer to 13 symbol
3912
;description:
3916
;description:
3913
; äã­ªæ¨ï ­ã¦­  ¤«ï ®¯â¨¬¨§ æ¨¨ ¢ë¢®¤  ⥪áâ 
3917
; äã­ªæ¨ï ­ã¦­  ¤«ï ®¯â¨¬¨§ æ¨¨ ¢ë¢®¤  ⥪áâ 
3914
align 16
3918
align 16
3915
proc ted_opt_draw_line_right
3919
proc ted_opt_draw_line_right
3916
	push eax
3920
	push eax
3917
	mov eax,edx
3921
	mov eax,edx
3918
	@@:
3922
	@@:
3919
		cmp edx,ted_tex_1
3923
		cmp edx,ted_tex_1
3920
		jle @f
3924
		jle @f
3921
		cmp byte[edx],13
3925
		cmp byte[edx],13
3922
		je @f
3926
		je @f
3923
		mov eax,edx
3927
		mov eax,edx
3924
		call ted_iterat_next
3928
		call ted_iterat_next
3925
		jmp @b
3929
		jmp @b
3926
	@@:
3930
	@@:
3927
	mov edx,eax ;perv sumbol
3931
	mov edx,eax ;perv sumbol
3928
	call ted_get_symb_color
3932
	call ted_get_symb_color
3929
 
3933
 
3930
	pop eax
3934
	pop eax
3931
	ret
3935
	ret
3932
endp
3936
endp
3933
 
3937
 
3934
align 16
3938
align 16
3935
proc ted_mouse, edit:dword
3939
proc ted_mouse, edit:dword
3936
	pushad
3940
	pushad
3937
	mov edi,[edit]
3941
	mov edi,[edit]
3938
 
3942
 
3939
	;®¡à ¡ â뢠¥¬ áªà®««¨­£¨
3943
	;®¡à ¡ â뢠¥¬ áªà®««¨­£¨
3940
	mov edx,ted_scr_h
3944
	mov edx,ted_scr_h
3941
	mov ecx,ted_scr_w
3945
	mov ecx,ted_scr_w
3942
 
3946
 
3943
	cmp word[edx+sb_offs_delta2],0
3947
	cmp word[edx+sb_offs_delta2],0
3944
	jne .horizontal
3948
	jne .horizontal
3945
 
3949
 
3946
	mov eax,[ecx+sb_offs_max_area]
3950
	mov eax,[ecx+sb_offs_max_area]
3947
	cmp eax,[ecx+sb_offs_cur_area]
3951
	cmp eax,[ecx+sb_offs_cur_area]
3948
	jbe .horizontal
3952
	jbe .horizontal
3949
	; mouse event for Vertical ScrollBar
3953
	; mouse event for Vertical ScrollBar
3950
	stdcall scroll_bar_vertical.mouse,ecx ;[scrollbar_ver_mouse]
3954
	stdcall scroll_bar_vertical.mouse,ecx ;[scrollbar_ver_mouse]
3951
	cmp dword[ecx+sb_offs_redraw],0
3955
	cmp dword[ecx+sb_offs_redraw],0
3952
	je @f
3956
	je @f
3953
		mov dword[ecx+sb_offs_redraw],0
3957
		mov dword[ecx+sb_offs_redraw],0
3954
		stdcall ted_draw,edi
3958
		stdcall ted_draw,edi
3955
		jmp .no_in_wnd
3959
		jmp .no_in_wnd
3956
	@@:
3960
	@@:
3957
	cmp word[ecx+sb_offs_delta2],0
3961
	cmp word[ecx+sb_offs_delta2],0
3958
	jne .no_in_wnd
3962
	jne .no_in_wnd
3959
	.horizontal:
3963
	.horizontal:
3960
	mov eax,[edx+sb_offs_max_area]
3964
	mov eax,[edx+sb_offs_max_area]
3961
	cmp eax,[edx+sb_offs_cur_area]
3965
	cmp eax,[edx+sb_offs_cur_area]
3962
	jbe .other
3966
	jbe .other
3963
	; mouse event for Horizontal ScrollBar
3967
	; mouse event for Horizontal ScrollBar
3964
	stdcall scroll_bar_horizontal.mouse,edx ;[scrollbar_hor_mouse]
3968
	stdcall scroll_bar_horizontal.mouse,edx ;[scrollbar_hor_mouse]
3965
	cmp dword[edx+sb_offs_redraw],0
3969
	cmp dword[edx+sb_offs_redraw],0
3966
	je .other
3970
	je .other
3967
		mov dword[edx+sb_offs_redraw],0
3971
		mov dword[edx+sb_offs_redraw],0
3968
		stdcall ted_draw,edi
3972
		stdcall ted_draw,edi
3969
		jmp .no_in_wnd
3973
		jmp .no_in_wnd
3970
	.other:
3974
	.other:
3971
	cmp word[ecx+sb_offs_delta2],0
3975
	cmp word[ecx+sb_offs_delta2],0
3972
	jne .no_in_wnd
3976
	jne .no_in_wnd
3973
	cmp word[edx+sb_offs_delta2],0
3977
	cmp word[edx+sb_offs_delta2],0
3974
	jne .no_in_wnd
3978
	jne .no_in_wnd
3975
 
3979
 
3976
	;®¡à ¡ â뢠¥¬ ®ª­® । ªâ®à 
3980
	;®¡à ¡ â뢠¥¬ ®ª­® । ªâ®à 
3977
	mcall SF_MOUSE_GET,SSF_BUTTON
3981
	mcall SF_MOUSE_GET,SSF_BUTTON
3978
	cmp al,1
3982
	cmp al,1
3979
	jne @f
3983
	jne @f
3980
		mcall SF_MOUSE_GET,SSF_WINDOW_POSITION
3984
		mcall SF_MOUSE_GET,SSF_WINDOW_POSITION
3981
		mov ebx,ted_wnd_t
3985
		mov ebx,ted_wnd_t
3982
		add ebx,ted_rec_t
3986
		add ebx,ted_rec_t
3983
		cmp ax,bx
3987
		cmp ax,bx
3984
		jl @f ;y_mouse
3988
		jl @f ;y_mouse
3985
 
3989
 
3986
		sub ebx,ted_rec_t
3990
		sub ebx,ted_rec_t
3987
		add ebx,ted_wnd_h
3991
		add ebx,ted_wnd_h
3988
		cmp bx,ax
3992
		cmp bx,ax
3989
		jl @f ;y_mouse>y_wnd
3993
		jl @f ;y_mouse>y_wnd
3990
 
3994
 
3991
		mov ebx,ted_wnd_l
3995
		mov ebx,ted_wnd_l
3992
		add ebx,ted_rec_l
3996
		add ebx,ted_rec_l
3993
		mov ecx,eax
3997
		mov ecx,eax
3994
		shr ecx,16
3998
		shr ecx,16
3995
		cmp cx,bx
3999
		cmp cx,bx
3996
		jl @f ;x_mouse
4000
		jl @f ;x_mouse
3997
 
4001
 
3998
		sub ebx,ted_rec_l
4002
		sub ebx,ted_rec_l
3999
		add ebx,ted_wnd_w
4003
		add ebx,ted_wnd_w
4000
		cmp bx,cx
4004
		cmp bx,cx
4001
		jl @f ;x_mouse>x_wnd
4005
		jl @f ;x_mouse>x_wnd
4002
 
4006
 
4003
		call ted_draw_cursor_sumb
4007
		call ted_draw_cursor_sumb
4004
		call ted_wnd_main_click
4008
		call ted_wnd_main_click
4005
		jmp .no_in_wnd
4009
		jmp .no_in_wnd
4006
	@@:
4010
	@@:
4007
	mov edx,ted_el_focus
4011
	mov edx,ted_el_focus
4008
	cmp [edx],edi
4012
	cmp [edx],edi
4009
	jne @f
4013
	jne @f
4010
		call ted_wnd_main_mouse_scroll ;ᬮâਬ ­  ¯à®ªàãâªã ª®«¥á  ¬ëè¨
4014
		call ted_wnd_main_mouse_scroll ;ᬮâਬ ­  ¯à®ªàãâªã ª®«¥á  ¬ëè¨
4011
	@@:
4015
	@@:
4012
	cmp ted_drag_m,0
4016
	cmp ted_drag_m,0
4013
	je .no_in_wnd
4017
	je .no_in_wnd
4014
		mov ted_drag_m,0
4018
		mov ted_drag_m,0
4015
		stdcall ted_draw,edi
4019
		stdcall ted_draw,edi
4016
		cmp ted_fun_draw_panel_buttons,0
4020
		cmp ted_fun_draw_panel_buttons,0
4017
		je .no_in_wnd
4021
		je .no_in_wnd
4018
			call ted_fun_draw_panel_buttons
4022
			call ted_fun_draw_panel_buttons
4019
	.no_in_wnd:
4023
	.no_in_wnd:
4020
	popad
4024
	popad
4021
	ret
4025
	ret
4022
endp
4026
endp
4023
 
4027
 
4024
;input:
4028
;input:
4025
; eax -> (x,y)
4029
; eax -> (x,y)
4026
; edi -> 㪠§ â¥«ì ­  áâàãªâãàã tedit
4030
; edi -> 㪠§ â¥«ì ­  áâàãªâãàã tedit
4027
;description:
4031
;description:
4028
; äã­ªæ¨ï ¢ë§ë¢¥âáï ¯à¨ ­ ¦ â¨¨ ª­®¯ª®© ¬ëè¨ ¨ ¯®¯ ¤¥­¨¨ ªãàá®à®¬ ¢ ®ª­® । ªâ®à 
4032
; äã­ªæ¨ï ¢ë§ë¢¥âáï ¯à¨ ­ ¦ â¨¨ ª­®¯ª®© ¬ëè¨ ¨ ¯®¯ ¤¥­¨¨ ªãàá®à®¬ ¢ ®ª­® । ªâ®à 
4029
align 16
4033
align 16
4030
ted_wnd_main_click:
4034
ted_wnd_main_click:
4031
	push ebx ecx edx
4035
	push ebx ecx edx
4032
	mov ebx,ted_el_focus
4036
	mov ebx,ted_el_focus
4033
	mov [ebx],edi ;áâ ¢¨¬ 䮪ãá
4037
	mov [ebx],edi ;áâ ¢¨¬ 䮪ãá
4034
 
4038
 
4035
	push eax
4039
	push eax
4036
		shr eax,16
4040
		shr eax,16
4037
		sub eax,ted_wnd_l
4041
		sub eax,ted_wnd_l
4038
		sub eax,ted_rec_l
4042
		sub eax,ted_rec_l
4039
 
4043
 
4040
		xor edx,edx
4044
		xor edx,edx
4041
		mov ecx,ted_rec_w
4045
		mov ecx,ted_rec_w
4042
		div cx
4046
		div cx
4043
		;inc eax
4047
		;inc eax
4044
		mov ebx,ted_scr_h
4048
		mov ebx,ted_scr_h
4045
		cmp eax,[ebx+sb_offs_cur_area]
4049
		cmp eax,[ebx+sb_offs_cur_area]
4046
		jle @f
4050
		jle @f
4047
			mov eax,[ebx+sb_offs_cur_area]
4051
			mov eax,[ebx+sb_offs_cur_area]
4048
		@@:
4052
		@@:
4049
		;dec eax
4053
		;dec eax
4050
		mov ted_cur_x,eax
4054
		mov ted_cur_x,eax
4051
	pop eax
4055
	pop eax
4052
 
4056
 
4053
	push eax
4057
	push eax
4054
		and eax,0xffff
4058
		and eax,0xffff
4055
		sub eax,ted_wnd_t
4059
		sub eax,ted_wnd_t
4056
		sub eax,ted_rec_t
4060
		sub eax,ted_rec_t
4057
 
4061
 
4058
		xor edx,edx
4062
		xor edx,edx
4059
		mov ecx,ted_rec_h
4063
		mov ecx,ted_rec_h
4060
		div cx
4064
		div cx
4061
		inc eax
4065
		inc eax
4062
		mov ebx,ted_scr_w
4066
		mov ebx,ted_scr_w
4063
		cmp eax,[ebx+sb_offs_cur_area]
4067
		cmp eax,[ebx+sb_offs_cur_area]
4064
		jle @f
4068
		jle @f
4065
			mov eax,[ebx+sb_offs_cur_area]
4069
			mov eax,[ebx+sb_offs_cur_area]
4066
		@@:
4070
		@@:
4067
		dec eax
4071
		dec eax
4068
		mov ted_cur_y,eax
4072
		mov ted_cur_y,eax
4069
	pop eax
4073
	pop eax
4070
 
4074
 
4071
	cmp ted_drag_m,0
4075
	cmp ted_drag_m,0
4072
	je @f
4076
	je @f
4073
		call ted_sel_move
4077
		call ted_sel_move
4074
		jmp .sel_move
4078
		jmp .sel_move
4075
	@@:
4079
	@@:
4076
		mov ted_drag_m,1
4080
		mov ted_drag_m,1
4077
		call ted_sel_start
4081
		call ted_sel_start
4078
	.sel_move:
4082
	.sel_move:
4079
	pop edx ecx ebx
4083
	pop edx ecx ebx
4080
	ret
4084
	ret
4081
 
4085
 
4082
;input:
4086
;input:
4083
; edi = pointer to tedit struct
4087
; edi = pointer to tedit struct
4084
align 16
4088
align 16
4085
ted_wnd_main_mouse_scroll:
4089
ted_wnd_main_mouse_scroll:
4086
	push eax ebx ecx
4090
	push eax ebx ecx
4087
	mcall SF_MOUSE_GET,SSF_SCROLL_DATA
4091
	mcall SF_MOUSE_GET,SSF_SCROLL_DATA
4088
	or ax,ax
4092
	or ax,ax
4089
	jz .no_scroll
4093
	jz .no_scroll
4090
		mov ecx,ted_scr_w
4094
		mov ecx,ted_scr_w
4091
		mov ebx,[ecx+sb_offs_position] ;copy old scroll position
4095
		mov ebx,[ecx+sb_offs_position] ;copy old scroll position
4092
		and eax,0xffff
4096
		and eax,0xffff
4093
		btr ax,15
4097
		btr ax,15
4094
		jae @f
4098
		jae @f
4095
			or eax,0xffff8000
4099
			or eax,0xffff8000
4096
		@@:
4100
		@@:
4097
		add [ecx+sb_offs_position],eax
4101
		add [ecx+sb_offs_position],eax
4098
 
4102
 
4099
		mov eax,[ecx+sb_offs_position]
4103
		mov eax,[ecx+sb_offs_position]
4100
		cmp eax,[ecx+sb_offs_max_area]
4104
		cmp eax,[ecx+sb_offs_max_area]
4101
		jb @f
4105
		jb @f
4102
			mov [ecx+sb_offs_position],ebx ;if scroll position out of range
4106
			mov [ecx+sb_offs_position],ebx ;if scroll position out of range
4103
			jmp .no_scroll
4107
			jmp .no_scroll
4104
		@@:
4108
		@@:
4105
		stdcall ted_draw,edi
4109
		stdcall ted_draw,edi
4106
	.no_scroll:
4110
	.no_scroll:
4107
	pop ecx ebx eax
4111
	pop ecx ebx eax
4108
	ret
4112
	ret
4109
 
4113
 
4110
align 16
4114
align 16
4111
proc ted_save_file, edit:dword, file:dword, f_name:dword
4115
proc ted_save_file, edit:dword, file:dword, f_name:dword
4112
pushad
4116
pushad
4113
	mov edi,[edit]
4117
	mov edi,[edit]
4114
 
4118
 
4115
	stdcall ted_can_save,edi
4119
	stdcall ted_can_save,edi
4116
	;or al,al
4120
	;or al,al
4117
	;jz .no_save
4121
	;jz .no_save
4118
 
4122
 
4119
	mov ecx,ted_max_chars
4123
	mov ecx,ted_max_chars
4120
	invoke mem.alloc,ecx
4124
	invoke mem.alloc,ecx
4121
	push eax ;§ ¯®¬¨­ ¥¬ 㪠§ â¥«ì ­  ¢ë¤¥«¥­­ãî ¯ ¬ïâì
4125
	push eax ;§ ¯®¬¨­ ¥¬ 㪠§ â¥«ì ­  ¢ë¤¥«¥­­ãî ¯ ¬ïâì
4122
 
4126
 
4123
	mov edx,ted_tex
4127
	mov edx,ted_tex
4124
	xor ecx,ecx
4128
	xor ecx,ecx
4125
	@@:
4129
	@@:
4126
		call ted_iterat_next
4130
		call ted_iterat_next
4127
		cmp edx,ted_tex_1
4131
		cmp edx,ted_tex_1
4128
		jle @f ;edx = ted_tex or edx = ted_tex+sizeof.symbol
4132
		jle @f ;edx = ted_tex or edx = ted_tex+sizeof.symbol
4129
		mov bl,[edx]
4133
		mov bl,[edx]
4130
		mov byte[eax],bl
4134
		mov byte[eax],bl
4131
		inc eax
4135
		inc eax
4132
		inc ecx
4136
		inc ecx
4133
		jmp @b
4137
		jmp @b
4134
align 4
4138
align 4
4135
	@@:
4139
	@@:
4136
 
4140
 
4137
	or ecx,ecx
4141
	or ecx,ecx
4138
	jz @f
4142
	jz @f
4139
		mov ebx,[file]
4143
		mov ebx,[file]
4140
		pop eax ;§ ¯¨á뢠¥¬ 㪠§ â¥«ì ­  ¢ë¤¥«¥­­ãî ¯ ¬ïâì
4144
		pop eax ;§ ¯¨á뢠¥¬ 㪠§ â¥«ì ­  ¢ë¤¥«¥­­ãî ¯ ¬ïâì
4141
		mov [ebx+16],eax
4145
		mov [ebx+16],eax
4142
		push eax ;®¡à â­® § ¯®¬¨­ ¥¬ 㪠§ â¥«ì ­  ¢ë¤¥«¥­­ãî ¯ ¬ïâì
4146
		push eax ;®¡à â­® § ¯®¬¨­ ¥¬ 㪠§ â¥«ì ­  ¢ë¤¥«¥­­ãî ¯ ¬ïâì
4143
		mov dword[ebx], SSF_CREATE_FILE
4147
		mov dword[ebx], SSF_CREATE_FILE
4144
		mov dword[ebx+4], 0
4148
		mov dword[ebx+4], 0
4145
		mov dword[ebx+8], 0
4149
		mov dword[ebx+8], 0
4146
		mov [ebx+12], ecx
4150
		mov [ebx+12], ecx
4147
		mov  byte[ebx+20], 0
4151
		mov  byte[ebx+20], 0
4148
		push dword[f_name]
4152
		push dword[f_name]
4149
		pop dword[ebx+21]
4153
		pop dword[ebx+21]
4150
		mcall SF_FILE
4154
		mcall SF_FILE
4151
 
4155
 
4152
		mov ted_err_save,al
4156
		mov ted_err_save,al
4153
 
4157
 
4154
		or eax,eax
4158
		or eax,eax
4155
		jz .no_msg
4159
		jz .no_msg
4156
		;cmp eax,6
4160
		;cmp eax,6
4157
		;je @f
4161
		;je @f
4158
		cmp ax,10
4162
		cmp ax,10
4159
		jl .zifra_0_9
4163
		jl .zifra_0_9
4160
			mov al,'?'
4164
			mov al,'?'
4161
			sub ax,48
4165
			sub ax,48
4162
		.zifra_0_9:
4166
		.zifra_0_9:
4163
		add ax,48
4167
		add ax,48
4164
		cmp ted_fun_save_err,0
4168
		cmp ted_fun_save_err,0
4165
		je @f
4169
		je @f
4166
		call ted_fun_save_err
4170
		call ted_fun_save_err
4167
		jmp @f
4171
		jmp @f
4168
		.no_msg:
4172
		.no_msg:
4169
		m2m ted_tim_ls,ted_tim_ch
4173
		m2m ted_tim_ls,ted_tim_ch
4170
	@@:
4174
	@@:
4171
 
4175
 
4172
	pop ecx ;§ ¯¨á뢠¥¬ 㪠§ â¥«ì ­  ¢ë¤¥«¥­­ãî ¯ ¬ïâì
4176
	pop ecx ;§ ¯¨á뢠¥¬ 㪠§ â¥«ì ­  ¢ë¤¥«¥­­ãî ¯ ¬ïâì
4173
	invoke mem.free,ecx
4177
	invoke mem.free,ecx
4174
	.no_save:
4178
	.no_save:
4175
popad
4179
popad
4176
	ret
4180
	ret
4177
endp
4181
endp
4178
 
4182
 
4179
>
4183
>
4180
 
4184
 
4181
>
4185
>
4182
>
4186
>
4183
>
4187
>
4184
>
4188
>
4185
>
4189
>