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