Subversion Repositories Kolibri OS

Rev

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

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