Subversion Repositories Kolibri OS

Rev

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

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