Rev 312 | Rev 824 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 312 | Rev 617 | ||
---|---|---|---|
1 | ;----------------------------------------------------------------------------- |
1 | ;----------------------------------------------------------------------------- |
2 | func draw_editor ;///// DRAW EDITOR ////////////////////////////////////////// |
2 | proc draw_editor ;///// DRAW EDITOR ////////////////////////////////////////// |
3 | ;----------------------------------------------------------------------------- |
3 | ;----------------------------------------------------------------------------- |
4 | 4 | ||
5 | mov ebx,[cur_editor.Bounds.Left-2] |
5 | mov ebx,[cur_editor.Bounds.Left-2] |
6 | mov bx,word[cur_editor.Bounds.Right] |
6 | mov bx,word[cur_editor.Bounds.Right] |
7 | sub bx,word[cur_editor.Bounds.Left] |
7 | sub bx,word[cur_editor.Bounds.Left] |
8 | inc ebx |
8 | inc ebx |
9 | mov ecx,[cur_editor.Bounds.Top-2] |
9 | mov ecx,[cur_editor.Bounds.Top-2] |
10 | mov cx,word[cur_editor.Bounds.Bottom] |
10 | mov cx,word[cur_editor.Bounds.Bottom] |
11 | sub cx,word[cur_editor.Bounds.Top] |
11 | sub cx,word[cur_editor.Bounds.Top] |
12 | inc ecx |
12 | inc ecx |
13 | mov edx,[cl_3d_inset] |
13 | mov edx,[cl_3d_inset] |
14 | call draw_framerect |
14 | call draw_framerect |
15 | 15 | ||
16 | mov [cur_editor.Gutter.Visible],0 |
16 | mov [cur_editor.Gutter.Visible],0 |
17 | test [options],OPTS_LINENUMS |
17 | test [options],OPTS_LINENUMS |
18 | jnz @f |
18 | jnz @f |
19 | xor eax,eax |
19 | xor eax,eax |
20 | jmp .lp1 |
20 | jmp .lp1 |
21 | @@: inc [cur_editor.Gutter.Visible] |
21 | @@: inc [cur_editor.Gutter.Visible] |
22 | mov edi,p_info+100 |
22 | mov edi,p_info+100 |
23 | mov eax,[cur_editor.Lines.Count] |
23 | mov eax,[cur_editor.Lines.Count] |
24 | mov ecx,10 |
24 | mov ecx,10 |
25 | call uint2str |
25 | call uint2str |
26 | lea eax,[edi-p_info-100] |
26 | lea eax,[edi-p_info-100] |
27 | cmp eax,3 |
27 | cmp eax,3 |
28 | jae @f |
28 | jae @f |
29 | mov eax,3 |
29 | mov eax,3 |
30 | @@: imul eax,6 |
30 | @@: imul eax,6 |
31 | add eax,8 |
31 | add eax,8 |
32 | .lp1: mov [cur_editor.Gutter.Width],eax |
32 | .lp1: mov [cur_editor.Gutter.Width],eax |
33 | mov [left_ofs],eax |
33 | mov [left_ofs],eax |
34 | 34 | ||
35 | mov eax,[cur_editor.Bounds.Right] |
35 | mov eax,[cur_editor.Bounds.Right] |
36 | sub eax,[cur_editor.Bounds.Left] |
36 | sub eax,[cur_editor.Bounds.Left] |
37 | sub eax,[cur_editor.Gutter.Width] |
37 | sub eax,[cur_editor.Gutter.Width] |
38 | sub eax,SCRLW+LCHGW+4 |
38 | sub eax,SCRLW+LCHGW+4 |
39 | js .exit |
39 | js .exit |
40 | cdq |
40 | cdq |
41 | mov ebx,6 |
41 | mov ebx,6 |
42 | div ebx |
42 | div ebx |
43 | mov [columns.scr],eax |
43 | mov [columns.scr],eax |
44 | 44 | ||
45 | mov eax,[cur_editor.Bounds.Bottom] |
45 | mov eax,[cur_editor.Bounds.Bottom] |
46 | sub eax,[cur_editor.Bounds.Top] |
46 | sub eax,[cur_editor.Bounds.Top] |
47 | 47 | ||
48 | sub eax,SCRLW+3 |
48 | sub eax,SCRLW+3 |
49 | js .exit |
49 | js .exit |
50 | cdq |
50 | cdq |
51 | mov ebx,LINEH |
51 | mov ebx,LINEH |
52 | div ebx |
52 | div ebx |
53 | mov [lines.scr],eax |
53 | mov [lines.scr],eax |
54 | 54 | ||
55 | call draw_editor_gutter |
55 | call draw_editor_gutter |
56 | call draw_editor_vscroll |
56 | call draw_editor_vscroll |
57 | call draw_editor_hscroll |
57 | call draw_editor_hscroll |
58 | call draw_editor_text |
58 | call draw_editor_text |
59 | call draw_editor_caret |
59 | call draw_editor_caret |
60 | 60 | ||
61 | .exit: |
61 | .exit: |
62 | ret |
62 | ret |
63 | endf |
63 | endp |
64 | 64 | ||
65 | ;----------------------------------------------------------------------------- |
65 | ;----------------------------------------------------------------------------- |
66 | func draw_editor_gutter ;///// DRAW EDITOR GUTTER (LEFT PANEL) /////////////// |
66 | proc draw_editor_gutter ;///// DRAW EDITOR GUTTER (LEFT PANEL) /////////////// |
67 | ;----------------------------------------------------------------------------- |
67 | ;----------------------------------------------------------------------------- |
68 | cmp [cur_editor.Gutter.Visible],0 |
68 | cmp [cur_editor.Gutter.Visible],0 |
69 | je .exit |
69 | je .exit |
70 | 70 | ||
71 | add esp,-4*8*2 |
71 | add esp,-4*8*2 |
72 | 72 | ||
73 | mov ebx,[cur_editor.Bounds.Left-2] |
73 | mov ebx,[cur_editor.Bounds.Left-2] |
74 | mov bx,word[cur_editor.Gutter.Width] |
74 | mov bx,word[cur_editor.Gutter.Width] |
75 | add ebx,0x00010000 |
75 | add ebx,0x00010000 |
76 | mov ecx,[cur_editor.Bounds.Top-2] |
76 | mov ecx,[cur_editor.Bounds.Top-2] |
77 | mov cx,word[cur_editor.Bounds.Bottom] |
77 | mov cx,word[cur_editor.Bounds.Bottom] |
78 | sub cx,word[cur_editor.Bounds.Top] |
78 | sub cx,word[cur_editor.Bounds.Top] |
79 | add cx,-SCRLW |
79 | add cx,-SCRLW |
80 | add ecx,0x00010000 |
80 | add ecx,0x00010000 |
81 | dec cx |
81 | dec cx |
82 | mcall 13,,,[cl_3d_normal] |
82 | mcall 13,,,[cl_3d_normal] |
83 | 83 | ||
84 | add bx,word[cur_editor.Bounds.Left] |
84 | add bx,word[cur_editor.Bounds.Left] |
85 | push bx |
85 | push bx |
86 | shl ebx,16 |
86 | shl ebx,16 |
87 | pop bx |
87 | pop bx |
88 | add ecx,[cur_editor.Bounds.Top] |
88 | add ecx,[cur_editor.Bounds.Top] |
89 | mcall 38,,,[cl_3d_inset] |
89 | mcall 38,,,[cl_3d_inset] |
90 | 90 | ||
91 | add ebx,-2*65536 |
91 | add ebx,-2*65536 |
92 | mov bx,word[cur_editor.Bounds.Top] |
92 | mov bx,word[cur_editor.Bounds.Top] |
93 | add bx,3 |
93 | add bx,3 |
94 | mov edi,[sc.work_text] |
94 | mov edi,[sc.work_text] |
95 | mov ecx,[cur_editor.TopLeft.Y] |
95 | mov ecx,[cur_editor.TopLeft.Y] |
96 | inc ecx |
96 | inc ecx |
97 | mov edx,p_info+100 |
97 | mov edx,p_info+100 |
98 | @@: pushad |
98 | @@: pushad |
99 | push eax edx edi |
99 | push eax edx edi |
100 | mov eax,ecx |
100 | mov eax,ecx |
101 | mov ecx,10 |
101 | mov ecx,10 |
102 | mov edi,edx |
102 | mov edi,edx |
103 | call uint2str |
103 | call uint2str |
104 | mov esi,edi |
104 | mov esi,edi |
105 | pop edi edx eax |
105 | pop edi edx eax |
106 | sub esi,edx |
106 | sub esi,edx |
107 | imul eax,esi,6*65536 |
107 | imul eax,esi,6*65536 |
108 | sub ebx,eax |
108 | sub ebx,eax |
109 | mcall 4,,edi |
109 | mcall 4,,edi |
110 | popad |
110 | popad |
111 | add ebx,LINEH |
111 | add ebx,LINEH |
112 | inc ecx |
112 | inc ecx |
113 | cmp ecx,[cur_editor.Lines.Count] |
113 | cmp ecx,[cur_editor.Lines.Count] |
114 | jg @f |
114 | jg @f |
115 | mov esi,ecx |
115 | mov esi,ecx |
116 | sub esi,[cur_editor.TopLeft.Y] |
116 | sub esi,[cur_editor.TopLeft.Y] |
117 | cmp esi,[lines.scr] |
117 | cmp esi,[lines.scr] |
118 | jbe @b |
118 | jbe @b |
119 | @@: add esp,4*8*2 |
119 | @@: add esp,4*8*2 |
120 | 120 | ||
121 | .exit: |
121 | .exit: |
122 | ret |
122 | ret |
123 | endf |
123 | endp |
124 | 124 | ||
125 | ;----------------------------------------------------------------------------- |
125 | ;----------------------------------------------------------------------------- |
126 | func draw_editor_vscroll ;///// DRAW EDITOR VERTICAL SCROLL BAR ////////////// |
126 | proc draw_editor_vscroll ;///// DRAW EDITOR VERTICAL SCROLL BAR ////////////// |
127 | ;----------------------------------------------------------------------------- |
127 | ;----------------------------------------------------------------------------- |
128 | mov ebx,[cur_editor.Bounds.Right] |
128 | mov ebx,[cur_editor.Bounds.Right] |
129 | shl ebx,16 |
129 | shl ebx,16 |
130 | add ebx,(-SCRLW)*65536+SCRLW |
130 | add ebx,(-SCRLW)*65536+SCRLW |
131 | mov ecx,[cur_editor.Bounds.Top-2] |
131 | mov ecx,[cur_editor.Bounds.Top-2] |
132 | mov cx,SCRLW |
132 | mov cx,SCRLW |
133 | cmp [bot_mode],0 |
133 | cmp [bot_mode],0 |
134 | jne @f |
134 | jne @f |
135 | mcall 8,,,'VSL' or 0x40000000 |
135 | mcall 8,,,'VSL' or 0x40000000 |
136 | @@: pushad |
136 | @@: pushad |
137 | sar ebx,16 |
137 | sar ebx,16 |
138 | sar ecx,16 |
138 | sar ecx,16 |
139 | push ebx ecx SCRLW SCRLW |
139 | push ebx ecx SCRLW SCRLW |
140 | call draw_3d_panel |
140 | call draw_3d_panel |
141 | popad |
141 | popad |
142 | mov eax,8 |
142 | mov eax,8 |
143 | 143 | ||
144 | pushad |
144 | pushad |
145 | push 0x18 |
145 | push 0x18 |
146 | shr ecx,16 |
146 | shr ecx,16 |
147 | mov bx,cx |
147 | mov bx,cx |
148 | add ebx,(SCRLW/2-2)*65536+SCRLW/2-3 |
148 | add ebx,(SCRLW/2-2)*65536+SCRLW/2-3 |
149 | mcall 4,,[sc.work_text],esp,1 |
149 | mcall 4,,[sc.work_text],esp,1 |
150 | add esp,4 |
150 | add esp,4 |
151 | popad |
151 | popad |
152 | 152 | ||
153 | mov ecx,[cur_editor.Bounds.Bottom] |
153 | mov ecx,[cur_editor.Bounds.Bottom] |
154 | shl ecx,16 |
154 | shl ecx,16 |
155 | add ecx,(-SCRLW*2)*65536+SCRLW |
155 | add ecx,(-SCRLW*2)*65536+SCRLW |
156 | cmp [bot_mode],0 |
156 | cmp [bot_mode],0 |
157 | jne @f |
157 | jne @f |
158 | mcall ,,,'VSG' or 0x40000000 |
158 | mcall ,,,'VSG' or 0x40000000 |
159 | @@: pushad |
159 | @@: pushad |
160 | sar ebx,16 |
160 | sar ebx,16 |
161 | sar ecx,16 |
161 | sar ecx,16 |
162 | push ebx ecx SCRLW SCRLW |
162 | push ebx ecx SCRLW SCRLW |
163 | call draw_3d_panel |
163 | call draw_3d_panel |
164 | popad |
164 | popad |
165 | mov eax,8 |
165 | mov eax,8 |
166 | 166 | ||
167 | pushad |
167 | pushad |
168 | push 0x19 |
168 | push 0x19 |
169 | shr ecx,16 |
169 | shr ecx,16 |
170 | mov bx,cx |
170 | mov bx,cx |
171 | add ebx,(SCRLW/2-2)*65536+SCRLW/2-3 |
171 | add ebx,(SCRLW/2-2)*65536+SCRLW/2-3 |
172 | mcall 4,,[sc.work_text],esp,1 |
172 | mcall 4,,[sc.work_text],esp,1 |
173 | add esp,4 |
173 | add esp,4 |
174 | popad |
174 | popad |
175 | 175 | ||
176 | push ebx |
176 | push ebx |
177 | mov eax,[cur_editor.Lines.Count] |
177 | mov eax,[cur_editor.Lines.Count] |
178 | mov ebx,[lines.scr] |
178 | mov ebx,[lines.scr] |
179 | mov ecx,[cur_editor.TopLeft.Y] |
179 | mov ecx,[cur_editor.TopLeft.Y] |
180 | mov edx,[cur_editor.Bounds.Bottom] |
180 | mov edx,[cur_editor.Bounds.Bottom] |
181 | sub edx,[cur_editor.Bounds.Top] |
181 | sub edx,[cur_editor.Bounds.Top] |
182 | add edx,-SCRLW*3;+1 |
182 | add edx,-SCRLW*3;+1 |
183 | call get_scroll_vars |
183 | call get_scroll_vars |
184 | mov [cur_editor.VScroll.Top],eax |
184 | mov [cur_editor.VScroll.Top],eax |
185 | mov [cur_editor.VScroll.Size],ebx |
185 | mov [cur_editor.VScroll.Size],ebx |
186 | pop ebx |
186 | pop ebx |
187 | 187 | ||
188 | mov ecx,eax |
188 | mov ecx,eax |
189 | add ecx,[cur_editor.Bounds.Top] |
189 | add ecx,[cur_editor.Bounds.Top] |
190 | add ecx,SCRLW+1 |
190 | add ecx,SCRLW+1 |
191 | 191 | ||
192 | pushad |
192 | pushad |
193 | sar ebx,16 |
193 | sar ebx,16 |
194 | push ebx ecx SCRLW [cur_editor.VScroll.Size] |
194 | push ebx ecx SCRLW [cur_editor.VScroll.Size] |
195 | dec dword[esp] |
195 | dec dword[esp] |
196 | call draw_3d_panel |
196 | call draw_3d_panel |
197 | popad |
197 | popad |
198 | mov eax,13 |
198 | mov eax,13 |
199 | add ebx,1*65536-1 |
199 | add ebx,1*65536-1 |
200 | 200 | ||
201 | mov ecx,[cur_editor.Bounds.Top-2] |
201 | mov ecx,[cur_editor.Bounds.Top-2] |
202 | mov cx,word[cur_editor.VScroll.Top] |
202 | mov cx,word[cur_editor.VScroll.Top] |
203 | add ecx,(SCRLW+1)*65536 |
203 | add ecx,(SCRLW+1)*65536 |
204 | mov edx,[sc.work] |
204 | mov edx,[sc.work] |
205 | or cx,cx |
205 | or cx,cx |
206 | jle @f |
206 | jle @f |
207 | mcall 13 |
207 | mcall 13 |
208 | @@: |
208 | @@: |
209 | mov ecx,[cur_editor.Bounds.Top] |
209 | mov ecx,[cur_editor.Bounds.Top] |
210 | add ecx,[cur_editor.VScroll.Top] |
210 | add ecx,[cur_editor.VScroll.Top] |
211 | add ecx,[cur_editor.VScroll.Size] |
211 | add ecx,[cur_editor.VScroll.Size] |
212 | add ecx,SCRLW+1 |
212 | add ecx,SCRLW+1 |
213 | mov di,cx |
213 | mov di,cx |
214 | shl ecx,16 |
214 | shl ecx,16 |
215 | mov cx,word[cur_editor.Bounds.Bottom] |
215 | mov cx,word[cur_editor.Bounds.Bottom] |
216 | sub cx,di |
216 | sub cx,di |
217 | sub cx,SCRLW*2;+1 |
217 | sub cx,SCRLW*2;+1 |
218 | jle @f |
218 | jle @f |
219 | mcall |
219 | mcall |
220 | @@: |
220 | @@: |
221 | rol ebx,16 |
221 | rol ebx,16 |
222 | dec bx |
222 | dec bx |
223 | push bx |
223 | push bx |
224 | rol ebx,16 |
224 | rol ebx,16 |
225 | pop bx |
225 | pop bx |
226 | mov ecx,[cur_editor.Bounds.Top-2] |
226 | mov ecx,[cur_editor.Bounds.Top-2] |
227 | mov cx,word[cur_editor.Bounds.Bottom] |
227 | mov cx,word[cur_editor.Bounds.Bottom] |
228 | add ecx,(SCRLW)*65536-SCRLW*2-1 |
228 | add ecx,(SCRLW)*65536-SCRLW*2-1 |
229 | mcall 38,,,[cl_3d_inset] |
229 | mcall 38,,,[cl_3d_inset] |
230 | 230 | ||
231 | ret |
231 | ret |
232 | endf |
232 | endp |
233 | 233 | ||
234 | ;----------------------------------------------------------------------------- |
234 | ;----------------------------------------------------------------------------- |
235 | func draw_editor_hscroll ;///// DRAW EDITOR HORIZONTAL SCROLL BAR //////////// |
235 | proc draw_editor_hscroll ;///// DRAW EDITOR HORIZONTAL SCROLL BAR //////////// |
236 | ;----------------------------------------------------------------------------- |
236 | ;----------------------------------------------------------------------------- |
237 | mov ebx,[cur_editor.Bounds.Left-2] |
237 | mov ebx,[cur_editor.Bounds.Left-2] |
238 | mov bx,SCRLW |
238 | mov bx,SCRLW |
239 | mov ecx,[cur_editor.Bounds.Bottom] |
239 | mov ecx,[cur_editor.Bounds.Bottom] |
240 | shl ecx,16 |
240 | shl ecx,16 |
241 | add ecx,(-SCRLW)*65536+SCRLW |
241 | add ecx,(-SCRLW)*65536+SCRLW |
242 | cmp [bot_mode],0 |
242 | cmp [bot_mode],0 |
243 | jne @f |
243 | jne @f |
244 | mcall 8,,,'HSL' or 0x40000000 |
244 | mcall 8,,,'HSL' or 0x40000000 |
245 | @@: pushad |
245 | @@: pushad |
246 | sar ebx,16 |
246 | sar ebx,16 |
247 | sar ecx,16 |
247 | sar ecx,16 |
248 | push ebx ecx SCRLW SCRLW |
248 | push ebx ecx SCRLW SCRLW |
249 | call draw_3d_panel |
249 | call draw_3d_panel |
250 | popad |
250 | popad |
251 | 251 | ||
252 | pushad |
252 | pushad |
253 | push 0x1B |
253 | push 0x1B |
254 | shr ecx,16 |
254 | shr ecx,16 |
255 | mov bx,cx |
255 | mov bx,cx |
256 | add ebx,(SCRLW/2-2)*65536+SCRLW/2-3 |
256 | add ebx,(SCRLW/2-2)*65536+SCRLW/2-3 |
257 | mcall 4,,[sc.work_text],esp,1 |
257 | mcall 4,,[sc.work_text],esp,1 |
258 | add esp,4 |
258 | add esp,4 |
259 | popad |
259 | popad |
260 | 260 | ||
261 | mov ebx,[cur_editor.Bounds.Right] |
261 | mov ebx,[cur_editor.Bounds.Right] |
262 | shl ebx,16 |
262 | shl ebx,16 |
263 | add ebx,(-SCRLW*2)*65536+SCRLW |
263 | add ebx,(-SCRLW*2)*65536+SCRLW |
264 | cmp [bot_mode],0 |
264 | cmp [bot_mode],0 |
265 | jne @f |
265 | jne @f |
266 | mcall 8,,,'HSG' or 0x40000000 |
266 | mcall 8,,,'HSG' or 0x40000000 |
267 | @@: pushad |
267 | @@: pushad |
268 | sar ebx,16 |
268 | sar ebx,16 |
269 | sar ecx,16 |
269 | sar ecx,16 |
270 | push ebx ecx SCRLW SCRLW |
270 | push ebx ecx SCRLW SCRLW |
271 | call draw_3d_panel |
271 | call draw_3d_panel |
272 | popad |
272 | popad |
273 | 273 | ||
274 | pushad |
274 | pushad |
275 | push 0x1A |
275 | push 0x1A |
276 | shr ecx,16 |
276 | shr ecx,16 |
277 | mov bx,cx |
277 | mov bx,cx |
278 | add ebx,(SCRLW/2-2)*65536+SCRLW/2-3 |
278 | add ebx,(SCRLW/2-2)*65536+SCRLW/2-3 |
279 | mcall 4,,[sc.work_text],esp,1 |
279 | mcall 4,,[sc.work_text],esp,1 |
280 | add esp,4 |
280 | add esp,4 |
281 | popad |
281 | popad |
282 | 282 | ||
283 | push ecx |
283 | push ecx |
284 | mov eax,[cur_editor.Columns.Count] |
284 | mov eax,[cur_editor.Columns.Count] |
285 | mov ebx,[columns.scr] |
285 | mov ebx,[columns.scr] |
286 | mov ecx,[cur_editor.TopLeft.X] |
286 | mov ecx,[cur_editor.TopLeft.X] |
287 | mov edx,[cur_editor.Bounds.Right] |
287 | mov edx,[cur_editor.Bounds.Right] |
288 | sub edx,[cur_editor.Bounds.Left] |
288 | sub edx,[cur_editor.Bounds.Left] |
289 | add edx,-(SCRLW*3) |
289 | add edx,-(SCRLW*3) |
290 | call get_scroll_vars |
290 | call get_scroll_vars |
291 | mov [cur_editor.HScroll.Top],eax |
291 | mov [cur_editor.HScroll.Top],eax |
292 | mov [cur_editor.HScroll.Size],ebx |
292 | mov [cur_editor.HScroll.Size],ebx |
293 | pop ecx |
293 | pop ecx |
294 | 294 | ||
295 | mov ebx,eax |
295 | mov ebx,eax |
296 | add ebx,[cur_editor.Bounds.Left] |
296 | add ebx,[cur_editor.Bounds.Left] |
297 | add ebx,SCRLW+1 |
297 | add ebx,SCRLW+1 |
298 | shl ebx,16 |
298 | shl ebx,16 |
299 | mov bx,word[cur_editor.HScroll.Size] |
299 | mov bx,word[cur_editor.HScroll.Size] |
300 | 300 | ||
301 | pushad |
301 | pushad |
302 | sar ecx,16 |
302 | sar ecx,16 |
303 | rol ebx,16 |
303 | rol ebx,16 |
304 | movsx eax,bx |
304 | movsx eax,bx |
305 | sar ebx,16 |
305 | sar ebx,16 |
306 | dec ebx |
306 | dec ebx |
307 | push eax ecx ebx SCRLW |
307 | push eax ecx ebx SCRLW |
308 | call draw_3d_panel |
308 | call draw_3d_panel |
309 | popad |
309 | popad |
310 | add ecx,1*65536-1 |
310 | add ecx,1*65536-1 |
311 | 311 | ||
312 | mov ebx,[cur_editor.Bounds.Left-2] |
312 | mov ebx,[cur_editor.Bounds.Left-2] |
313 | mov bx,word[cur_editor.Bounds.Left] |
313 | mov bx,word[cur_editor.Bounds.Left] |
314 | mov bx,word[cur_editor.HScroll.Top] |
314 | mov bx,word[cur_editor.HScroll.Top] |
315 | add ebx,(1+SCRLW)*65536 |
315 | add ebx,(1+SCRLW)*65536 |
316 | mcall 13,,,[sc.work] |
316 | mcall 13,,,[sc.work] |
317 | mov ebx,[cur_editor.Bounds.Left] |
317 | mov ebx,[cur_editor.Bounds.Left] |
318 | add ebx,1+SCRLW |
318 | add ebx,1+SCRLW |
319 | add ebx,[cur_editor.HScroll.Top] |
319 | add ebx,[cur_editor.HScroll.Top] |
320 | add ebx,[cur_editor.HScroll.Size] |
320 | add ebx,[cur_editor.HScroll.Size] |
321 | mov di,bx |
321 | mov di,bx |
322 | shl ebx,16 |
322 | shl ebx,16 |
323 | mov bx,word[cur_editor.Bounds.Right] |
323 | mov bx,word[cur_editor.Bounds.Right] |
324 | sub bx,di |
324 | sub bx,di |
325 | sub bx,SCRLW*2 |
325 | sub bx,SCRLW*2 |
326 | jle @f |
326 | jle @f |
327 | mcall |
327 | mcall |
328 | @@: |
328 | @@: |
329 | mov ebx,[cur_editor.Bounds.Left-2] |
329 | mov ebx,[cur_editor.Bounds.Left-2] |
330 | mov bx,word[cur_editor.Bounds.Right] |
330 | mov bx,word[cur_editor.Bounds.Right] |
331 | add ebx,(SCRLW)*65536-SCRLW*2-1 |
331 | add ebx,(SCRLW)*65536-SCRLW*2-1 |
332 | rol ecx,16 |
332 | rol ecx,16 |
333 | dec cx |
333 | dec cx |
334 | push cx |
334 | push cx |
335 | rol ecx,16 |
335 | rol ecx,16 |
336 | pop cx |
336 | pop cx |
337 | mcall 38,,,[cl_3d_inset] |
337 | mcall 38,,,[cl_3d_inset] |
338 | 338 | ||
339 | ret |
339 | ret |
340 | endf |
340 | endp |
341 | 341 | ||
342 | ;----------------------------------------------------------------------------- |
342 | ;----------------------------------------------------------------------------- |
343 | func draw_editor_text.part ;///// DRAW EDITOR TEXT (PARTLY) ////////////////// |
343 | proc draw_editor_text.part ;///// DRAW EDITOR TEXT (PARTLY) ////////////////// |
344 | ;----------------------------------------------------------------------------- |
344 | ;----------------------------------------------------------------------------- |
345 | ; EAX = start line |
345 | ; EAX = start line |
346 | ; EBX = end line |
346 | ; EBX = end line |
347 | ;----------------------------------------------------------------------------- |
347 | ;----------------------------------------------------------------------------- |
348 | cmp [cur_editor.Lines],0 |
348 | cmp [cur_editor.Lines],0 |
349 | jne @f |
349 | jne @f |
350 | ret |
350 | ret |
351 | @@: push eax |
351 | @@: push eax |
352 | mov eax,[cur_editor.Bounds.Bottom] |
352 | mov eax,[cur_editor.Bounds.Bottom] |
353 | sub eax,[cur_editor.Bounds.Top] |
353 | sub eax,[cur_editor.Bounds.Top] |
354 | cmp eax,LINEH |
354 | cmp eax,LINEH |
355 | pop eax |
355 | pop eax |
356 | jge @f |
356 | jge @f |
357 | ret |
357 | ret |
358 | @@: |
358 | @@: |
359 | mov ebp,cur_editor |
359 | mov ebp,cur_editor |
360 | call init_sel_vars |
360 | call init_sel_vars |
361 | call check_bottom_right |
361 | call check_bottom_right |
362 | 362 | ||
363 | pushad |
363 | pushad |
364 | 364 | ||
365 | push eax |
365 | push eax |
366 | mov eax,[cur_editor.Bounds.Left] |
366 | mov eax,[cur_editor.Bounds.Left] |
367 | add eax,[cur_editor.Gutter.Width] |
367 | add eax,[cur_editor.Gutter.Width] |
368 | add eax,LCHGW+3 |
368 | add eax,LCHGW+3 |
369 | mov [left_ofs],eax |
369 | mov [left_ofs],eax |
370 | mov eax,[cur_editor.Bounds.Top] |
370 | mov eax,[cur_editor.Bounds.Top] |
371 | add eax,3 |
371 | add eax,3 |
372 | mov [top_ofs],eax |
372 | mov [top_ofs],eax |
373 | pop eax |
373 | pop eax |
374 | 374 | ||
375 | cmp [lines.scr],0 |
375 | cmp [lines.scr],0 |
376 | jle .exit |
376 | jle .exit |
377 | 377 | ||
378 | cmp eax,ebx |
378 | cmp eax,ebx |
379 | jle @f |
379 | jle @f |
380 | xchg eax,ebx |
380 | xchg eax,ebx |
381 | @@: cmp eax,[cur_editor.TopLeft.Y] |
381 | @@: cmp eax,[cur_editor.TopLeft.Y] |
382 | jge @f |
382 | jge @f |
383 | mov eax,[cur_editor.TopLeft.Y] |
383 | mov eax,[cur_editor.TopLeft.Y] |
384 | @@: mov ecx,[cur_editor.TopLeft.Y] |
384 | @@: mov ecx,[cur_editor.TopLeft.Y] |
385 | add ecx,[lines.scr] |
385 | add ecx,[lines.scr] |
386 | cmp ebx,ecx |
386 | cmp ebx,ecx |
387 | jl @f |
387 | jl @f |
388 | dec ecx |
388 | dec ecx |
389 | mov ebx,ecx |
389 | mov ebx,ecx |
390 | @@: cmp eax,ebx |
390 | @@: cmp eax,ebx |
391 | jg .exit |
391 | jg .exit |
392 | 392 | ||
393 | mov ecx,eax |
393 | mov ecx,eax |
394 | push eax |
394 | push eax |
395 | call get_line_offset |
395 | call get_line_offset |
396 | 396 | ||
397 | .start: |
397 | .start: |
398 | mov ecx,ebx |
398 | mov ecx,ebx |
399 | sub ecx,eax |
399 | sub ecx,eax |
400 | inc ecx |
400 | inc ecx |
401 | 401 | ||
402 | mov ebx,[top_ofs] |
402 | mov ebx,[top_ofs] |
403 | add ebx,[left_ofs-2] |
403 | add ebx,[left_ofs-2] |
404 | sub eax,[cur_editor.TopLeft.Y] |
404 | sub eax,[cur_editor.TopLeft.Y] |
405 | imul eax,LINEH |
405 | imul eax,LINEH |
406 | add ebx,eax |
406 | add ebx,eax |
407 | 407 | ||
408 | imul ebp,[cur_editor.TopLeft.X],6*65536 |
408 | imul ebp,[cur_editor.TopLeft.X],6*65536 |
409 | mov [draw_blines],0 |
409 | mov [draw_blines],0 |
410 | 410 | ||
411 | jmp draw_editor_text.next_line |
411 | jmp draw_editor_text.next_line |
412 | 412 | ||
413 | .exit: |
413 | .exit: |
414 | popad |
414 | popad |
415 | ret |
415 | ret |
416 | endf |
416 | endp |
417 | 417 | ||
418 | ;----------------------------------------------------------------------------- |
418 | ;----------------------------------------------------------------------------- |
419 | func draw_editor_text ;///// DRAW EDITOR TEXT //////////////////////////////// |
419 | proc draw_editor_text ;///// DRAW EDITOR TEXT //////////////////////////////// |
420 | ;----------------------------------------------------------------------------- |
420 | ;----------------------------------------------------------------------------- |
421 | cmp [cur_editor.Lines],0 |
421 | cmp [cur_editor.Lines],0 |
422 | jne @f |
422 | jne @f |
423 | ret |
423 | ret |
424 | @@: mov eax,[cur_editor.Bounds.Bottom] |
424 | @@: mov eax,[cur_editor.Bounds.Bottom] |
425 | sub eax,[cur_editor.Bounds.Top] |
425 | sub eax,[cur_editor.Bounds.Top] |
426 | cmp eax,LINEH |
426 | cmp eax,LINEH |
427 | jge @f |
427 | jge @f |
428 | ret |
428 | ret |
429 | @@: |
429 | @@: |
430 | mov ebp,cur_editor |
430 | mov ebp,cur_editor |
431 | call init_sel_vars |
431 | call init_sel_vars |
432 | call check_bottom_right |
432 | call check_bottom_right |
433 | 433 | ||
434 | pushad |
434 | pushad |
435 | 435 | ||
436 | mov eax,[cur_editor.Bounds.Left] |
436 | mov eax,[cur_editor.Bounds.Left] |
437 | add eax,[cur_editor.Gutter.Width] |
437 | add eax,[cur_editor.Gutter.Width] |
438 | add eax,LCHGW+3 |
438 | add eax,LCHGW+3 |
439 | mov [left_ofs],eax |
439 | mov [left_ofs],eax |
440 | mov eax,[cur_editor.Bounds.Top] |
440 | mov eax,[cur_editor.Bounds.Top] |
441 | add eax,3 |
441 | add eax,3 |
442 | mov [top_ofs],eax |
442 | mov [top_ofs],eax |
443 | 443 | ||
444 | mov ebx,[top_ofs] |
444 | mov ebx,[top_ofs] |
445 | add ebx,[left_ofs-2] |
445 | add ebx,[left_ofs-2] |
446 | 446 | ||
447 | mov ecx,[cur_editor.TopLeft.Y] |
447 | mov ecx,[cur_editor.TopLeft.Y] |
448 | push ecx |
448 | push ecx |
449 | call get_line_offset |
449 | call get_line_offset |
450 | 450 | ||
451 | .start: |
451 | .start: |
452 | add esp,4 |
452 | add esp,4 |
453 | mov ecx,[lines.scr] |
453 | mov ecx,[lines.scr] |
454 | or ecx,ecx |
454 | or ecx,ecx |
455 | jle .exit |
455 | jle .exit |
456 | add esp,-4 |
456 | add esp,-4 |
457 | 457 | ||
458 | imul ebp,[cur_editor.TopLeft.X],6*65536 |
458 | imul ebp,[cur_editor.TopLeft.X],6*65536 |
459 | mov [draw_blines],1 |
459 | mov [draw_blines],1 |
460 | 460 | ||
461 | .next_line: |
461 | .next_line: |
462 | 462 | ||
463 | push ecx ebx |
463 | push ecx ebx |
464 | 464 | ||
465 | mov ecx,ebx |
465 | mov ecx,ebx |
466 | shl ecx,16 |
466 | shl ecx,16 |
467 | mov cl,LINEH |
467 | mov cl,LINEH |
468 | mov ebx,[cur_editor.Bounds.Right] |
468 | mov ebx,[cur_editor.Bounds.Right] |
469 | add ebx,-SCRLW |
469 | add ebx,-SCRLW |
470 | add ebx,[left_ofs-2] |
470 | add ebx,[left_ofs-2] |
471 | sub ebx,[left_ofs] |
471 | sub ebx,[left_ofs] |
472 | add ebx,-2*65536+2 |
472 | add ebx,-2*65536+2 |
473 | 473 | ||
474 | ; selection (text background) |
474 | ; selection (text background) |
475 | mov [in_sel],0 |
475 | mov [in_sel],0 |
476 | mov edx,[color_tbl.back] |
476 | mov edx,[color_tbl.back] |
477 | mov eax,[esp+4*2] |
477 | mov eax,[esp+4*2] |
478 | cmp eax,[sel.begin.y] |
478 | cmp eax,[sel.begin.y] |
479 | jl .lp6 |
479 | jl .lp6 |
480 | je .lp1 |
480 | je .lp1 |
481 | cmp eax,[sel.end.y] |
481 | cmp eax,[sel.end.y] |
482 | jg .lp6 |
482 | jg .lp6 |
483 | je .lp3 |
483 | je .lp3 |
484 | jmp .lp6.2 |
484 | jmp .lp6.2 |
485 | .lp1: mov eax,[sel.begin.y] |
485 | .lp1: mov eax,[sel.begin.y] |
486 | cmp eax,[sel.end.y] |
486 | cmp eax,[sel.end.y] |
487 | je .lp5 |
487 | je .lp5 |
488 | .lp2: mov eax,[sel.begin.x] |
488 | .lp2: mov eax,[sel.begin.x] |
489 | sub eax,[cur_editor.TopLeft.X] |
489 | sub eax,[cur_editor.TopLeft.X] |
490 | jle .lp6.2 |
490 | jle .lp6.2 |
491 | cmp eax,[columns.scr] |
491 | cmp eax,[columns.scr] |
492 | jge .lp6 |
492 | jge .lp6 |
493 | imul eax,6 |
493 | imul eax,6 |
494 | pushad |
494 | pushad |
495 | sub bx,ax |
495 | sub bx,ax |
496 | rol ebx,16 |
496 | rol ebx,16 |
497 | mov bx,ax |
497 | mov bx,ax |
498 | add ebx,[left_ofs] |
498 | add ebx,[left_ofs] |
499 | add ebx,-2 |
499 | add ebx,-2 |
500 | rol ebx,16 |
500 | rol ebx,16 |
501 | mov edx,[color_tbl.back.sel] |
501 | mov edx,[color_tbl.back.sel] |
502 | mcall 13 |
502 | mcall 13 |
503 | popad |
503 | popad |
504 | mov bx,ax |
504 | mov bx,ax |
505 | mov [in_sel],2 |
505 | mov [in_sel],2 |
506 | jmp .lp6 |
506 | jmp .lp6 |
507 | .lp3: mov eax,[sel.begin.y] |
507 | .lp3: mov eax,[sel.begin.y] |
508 | cmp eax,[sel.end.y] |
508 | cmp eax,[sel.end.y] |
509 | je .lp5 |
509 | je .lp5 |
510 | .lp4: mov eax,[sel.end.x] |
510 | .lp4: mov eax,[sel.end.x] |
511 | sub eax,[cur_editor.TopLeft.X] |
511 | sub eax,[cur_editor.TopLeft.X] |
512 | jle .lp6 |
512 | jle .lp6 |
513 | cmp eax,[columns.scr] |
513 | cmp eax,[columns.scr] |
514 | jg .lp6.2 |
514 | jg .lp6.2 |
515 | imul eax,6 |
515 | imul eax,6 |
516 | pushad |
516 | pushad |
517 | sub bx,ax |
517 | sub bx,ax |
518 | rol ebx,16 |
518 | rol ebx,16 |
519 | add eax,[left_ofs] |
519 | add eax,[left_ofs] |
520 | add eax,-2 |
520 | add eax,-2 |
521 | mov bx,ax |
521 | mov bx,ax |
522 | rol ebx,16 |
522 | rol ebx,16 |
523 | mcall 13 |
523 | mcall 13 |
524 | popad |
524 | popad |
525 | inc eax |
525 | inc eax |
526 | mov edx,[color_tbl.back.sel] |
526 | mov edx,[color_tbl.back.sel] |
527 | mov bx,ax |
527 | mov bx,ax |
528 | mov [in_sel],3 |
528 | mov [in_sel],3 |
529 | jmp .lp6 |
529 | jmp .lp6 |
530 | .lp5: mov eax,[cur_editor.TopLeft.X] |
530 | .lp5: mov eax,[cur_editor.TopLeft.X] |
531 | cmp eax,[sel.begin.x] |
531 | cmp eax,[sel.begin.x] |
532 | jge .lp4 |
532 | jge .lp4 |
533 | add eax,[columns.scr] |
533 | add eax,[columns.scr] |
534 | cmp eax,[sel.end.x] |
534 | cmp eax,[sel.end.x] |
535 | jl .lp2 |
535 | jl .lp2 |
536 | mov eax,[sel.begin.x] |
536 | mov eax,[sel.begin.x] |
537 | cmp eax,[sel.end.x] |
537 | cmp eax,[sel.end.x] |
538 | je .lp6 |
538 | je .lp6 |
539 | sub eax,[cur_editor.TopLeft.X] |
539 | sub eax,[cur_editor.TopLeft.X] |
540 | imul eax,6 |
540 | imul eax,6 |
541 | pushad |
541 | pushad |
542 | mov ebx,[sel.end.x] |
542 | mov ebx,[sel.end.x] |
543 | sub ebx,[sel.begin.x] |
543 | sub ebx,[sel.begin.x] |
544 | imul ebx,6 |
544 | imul ebx,6 |
545 | sal ebx,16 |
545 | sal ebx,16 |
546 | dec eax |
546 | dec eax |
547 | add eax,[left_ofs] |
547 | add eax,[left_ofs] |
548 | mov bx,ax |
548 | mov bx,ax |
549 | rol ebx,16 |
549 | rol ebx,16 |
550 | mov edx,[color_tbl.back.sel] |
550 | mov edx,[color_tbl.back.sel] |
551 | mcall 13 |
551 | mcall 13 |
552 | movzx eax,bx |
552 | movzx eax,bx |
553 | sar ebx,16 |
553 | sar ebx,16 |
554 | add eax,ebx |
554 | add eax,ebx |
555 | mov ebx,eax |
555 | mov ebx,eax |
556 | sal ebx,16 |
556 | sal ebx,16 |
557 | sub ax,[esp+4*4] |
557 | sub ax,[esp+4*4] |
558 | neg ax |
558 | neg ax |
559 | add ax,word[left_ofs] |
559 | add ax,word[left_ofs] |
560 | add ax,-2 |
560 | add ax,-2 |
561 | mov bx,ax |
561 | mov bx,ax |
562 | mov edx,[color_tbl.back] |
562 | mov edx,[color_tbl.back] |
563 | mcall 13 |
563 | mcall 13 |
564 | popad |
564 | popad |
565 | mov bx,ax |
565 | mov bx,ax |
566 | mov [in_sel],4 |
566 | mov [in_sel],4 |
567 | jmp .lp6 |
567 | jmp .lp6 |
568 | 568 | ||
569 | .lp6.2: |
569 | .lp6.2: |
570 | mov edx,[color_tbl.back.sel] |
570 | mov edx,[color_tbl.back.sel] |
571 | inc [in_sel] |
571 | inc [in_sel] |
572 | .lp6: |
572 | .lp6: |
573 | mcall 13 |
573 | mcall 13 |
574 | 574 | ||
575 | lodsd |
575 | lodsd |
576 | 576 | ||
577 | pushad |
577 | pushad |
578 | mov edx,[color_tbl.back] |
578 | mov edx,[color_tbl.back] |
579 | test eax,0x00010000 |
579 | test eax,0x00010000 |
580 | jz @f |
580 | jz @f |
581 | mov edx,[color_tbl.line.moded] |
581 | mov edx,[color_tbl.line.moded] |
582 | test eax,0x00020000 |
582 | test eax,0x00020000 |
583 | jz @f |
583 | jz @f |
584 | mov edx,[color_tbl.line.saved] |
584 | mov edx,[color_tbl.line.saved] |
585 | @@: mov ebx,[left_ofs] |
585 | @@: mov ebx,[left_ofs] |
586 | 586 | ||
587 | add ebx,-LCHGW-2;-4 |
587 | add ebx,-LCHGW-2;-4 |
588 | shl ebx,16 |
588 | shl ebx,16 |
589 | mov bx,LCHGW |
589 | mov bx,LCHGW |
590 | mcall 13 |
590 | mcall 13 |
591 | popad |
591 | popad |
592 | 592 | ||
593 | xor ecx,ecx |
593 | xor ecx,ecx |
594 | and eax,0x0000FFFF |
594 | and eax,0x0000FFFF |
595 | mov [cur_line_len],eax |
595 | mov [cur_line_len],eax |
596 | 596 | ||
597 | or eax,eax |
597 | or eax,eax |
598 | ja .next_block |
598 | ja .next_block |
599 | add esp,4*2 |
599 | add esp,4*2 |
600 | jmp .exit |
600 | jmp .exit |
601 | 601 | ||
602 | .next_block: |
602 | .next_block: |
603 | 603 | ||
604 | push esi ecx |
604 | push esi ecx |
605 | call .get_next_part |
605 | call .get_next_part |
606 | pop ebx |
606 | pop ebx |
607 | 607 | ||
608 | push ecx |
608 | push ecx |
609 | mov ecx,eax |
609 | mov ecx,eax |
610 | 610 | ||
611 | push esi ebx |
611 | push esi ebx |
612 | mov eax,ebx |
612 | mov eax,ebx |
613 | sub ebx,[cur_editor.TopLeft.X] |
613 | sub ebx,[cur_editor.TopLeft.X] |
614 | cmp ebx,[columns.scr] |
614 | cmp ebx,[columns.scr] |
615 | jge .skip_t |
615 | jge .skip_t |
616 | add ebx,esi |
616 | add ebx,esi |
617 | jle .skip_t |
617 | jle .skip_t |
618 | mov ebx,[esp+8+4*2] ;// 4*2=esi+ebx |
618 | mov ebx,[esp+8+4*2] ;// 4*2=esi+ebx |
619 | sub eax,[cur_editor.TopLeft.X] |
619 | sub eax,[cur_editor.TopLeft.X] |
620 | jge .qqq |
620 | jge .qqq |
621 | sub edx,eax |
621 | sub edx,eax |
622 | add esi,eax |
622 | add esi,eax |
623 | xor eax,eax |
623 | xor eax,eax |
624 | jmp .qqq2 |
624 | jmp .qqq2 |
625 | .qqq: |
625 | .qqq: |
626 | imul eax,6*65536 |
626 | imul eax,6*65536 |
627 | .qqq2: |
627 | .qqq2: |
628 | and ebx,0x0000FFFF |
628 | and ebx,0x0000FFFF |
629 | add eax,[left_ofs-2] |
629 | add eax,[left_ofs-2] |
630 | add ebx,eax |
630 | add ebx,eax |
631 | 631 | ||
632 | mov eax,[esp] ; ebx |
632 | mov eax,[esp] ; ebx |
633 | add eax,[esp+4] ; esi |
633 | add eax,[esp+4] ; esi |
634 | sub eax,[cur_editor.TopLeft.X] |
634 | sub eax,[cur_editor.TopLeft.X] |
635 | sub eax,[columns.scr] |
635 | sub eax,[columns.scr] |
636 | jle .qweqwe |
636 | jle .qweqwe |
637 | sub esi,eax |
637 | sub esi,eax |
638 | .qweqwe: |
638 | .qweqwe: |
639 | 639 | ||
640 | mov al,[in_sel] |
640 | mov al,[in_sel] |
641 | cmp al,0 |
641 | cmp al,0 |
642 | je .draw_t |
642 | je .draw_t |
643 | dec al |
643 | dec al |
644 | jz .ya4 |
644 | jz .ya4 |
645 | .nt1: dec al |
645 | .nt1: dec al |
646 | jnz .nt2 |
646 | jnz .nt2 |
647 | mov eax,[esp] |
647 | mov eax,[esp] |
648 | cmp eax,[sel.begin.x] |
648 | cmp eax,[sel.begin.x] |
649 | jge .ya4 |
649 | jge .ya4 |
650 | add eax,[esp+4] |
650 | add eax,[esp+4] |
651 | cmp eax,[sel.begin.x] |
651 | cmp eax,[sel.begin.x] |
652 | jl .draw_t |
652 | jl .draw_t |
653 | ;---[ selection crosses block from the right ]-(- |
653 | ;---[ selection crosses block from the right ]-(- |
654 | .ya1: mov eax,esi |
654 | .ya1: mov eax,esi |
655 | mov esi,[sel.begin.x] |
655 | mov esi,[sel.begin.x] |
656 | sub esi,[esp] |
656 | sub esi,[esp] |
657 | pushad |
657 | pushad |
658 | mov ecx,[cur_editor.TopLeft.X] |
658 | mov ecx,[cur_editor.TopLeft.X] |
659 | sub ecx,[esp+4*8] |
659 | sub ecx,[esp+4*8] |
660 | jle @f |
660 | jle @f |
661 | sub esi,ecx |
661 | sub esi,ecx |
662 | sub [esp+4],ecx |
662 | sub [esp+4],ecx |
663 | @@: sub eax,esi |
663 | @@: sub eax,esi |
664 | add edx,esi |
664 | add edx,esi |
665 | imul esi,6 |
665 | imul esi,6 |
666 | rol ebx,16 |
666 | rol ebx,16 |
667 | add bx,si |
667 | add bx,si |
668 | rol ebx,16 |
668 | rol ebx,16 |
669 | mov esi,eax |
669 | mov esi,eax |
670 | mov ecx,[color_tbl.text.sel] |
670 | mov ecx,[color_tbl.text.sel] |
671 | mcall 4 |
671 | mcall 4 |
672 | popad |
672 | popad |
673 | jmp .draw_t |
673 | jmp .draw_t |
674 | ;----------------------------------------------)- |
674 | ;----------------------------------------------)- |
675 | .nt2: dec al |
675 | .nt2: dec al |
676 | jnz .nt3 |
676 | jnz .nt3 |
677 | mov eax,[esp] |
677 | mov eax,[esp] |
678 | cmp eax,[sel.end.x] |
678 | cmp eax,[sel.end.x] |
679 | jge .draw_t |
679 | jge .draw_t |
680 | add eax,[esp+4] |
680 | add eax,[esp+4] |
681 | cmp eax,[sel.end.x] |
681 | cmp eax,[sel.end.x] |
682 | jl .ya4 |
682 | jl .ya4 |
683 | ;---[ selection crosses block from the left ]--(- |
683 | ;---[ selection crosses block from the left ]--(- |
684 | .ya2: mov eax,[sel.end.x] |
684 | .ya2: mov eax,[sel.end.x] |
685 | sub eax,[esp] |
685 | sub eax,[esp] |
686 | push ebx |
686 | push ebx |
687 | mov ebx,[esp+4] |
687 | mov ebx,[esp+4] |
688 | sub ebx,[cur_editor.TopLeft.X] |
688 | sub ebx,[cur_editor.TopLeft.X] |
689 | jge .ya2.1 |
689 | jge .ya2.1 |
690 | add eax,ebx |
690 | add eax,ebx |
691 | .ya2.1: |
691 | .ya2.1: |
692 | pop ebx |
692 | pop ebx |
693 | pushad |
693 | pushad |
694 | mov esi,eax |
694 | mov esi,eax |
695 | mov ecx,[color_tbl.text.sel] |
695 | mov ecx,[color_tbl.text.sel] |
696 | mcall 4 |
696 | mcall 4 |
697 | popad |
697 | popad |
698 | sub esi,eax |
698 | sub esi,eax |
699 | add edx,eax |
699 | add edx,eax |
700 | imul eax,6*65536 |
700 | imul eax,6*65536 |
701 | add ebx,eax |
701 | add ebx,eax |
702 | jmp .draw_t |
702 | jmp .draw_t |
703 | ;----------------------------------------------)- |
703 | ;----------------------------------------------)- |
704 | .nt3: mov eax,[esp] |
704 | .nt3: mov eax,[esp] |
705 | cmp eax,[sel.end.x] |
705 | cmp eax,[sel.end.x] |
706 | jge .draw_t |
706 | jge .draw_t |
707 | cmp eax,[sel.begin.x] |
707 | cmp eax,[sel.begin.x] |
708 | jge @f |
708 | jge @f |
709 | add eax,[esp+4] |
709 | add eax,[esp+4] |
710 | cmp eax,[sel.begin.x] |
710 | cmp eax,[sel.begin.x] |
711 | jl .draw_t |
711 | jl .draw_t |
712 | cmp eax,[sel.end.x] |
712 | cmp eax,[sel.end.x] |
713 | jl .ya1 |
713 | jl .ya1 |
714 | ;---[ selection inside block ]-----------------(- |
714 | ;---[ selection inside block ]-----------------(- |
715 | mov eax,esi |
715 | mov eax,esi |
716 | mov esi,[sel.begin.x] |
716 | mov esi,[sel.begin.x] |
717 | sub esi,[esp] |
717 | sub esi,[esp] |
718 | push eax |
718 | push eax |
719 | mov eax,[esp+4] |
719 | mov eax,[esp+4] |
720 | sub eax,[cur_editor.TopLeft.X] |
720 | sub eax,[cur_editor.TopLeft.X] |
721 | jge .nt3.1 |
721 | jge .nt3.1 |
722 | add esi,eax |
722 | add esi,eax |
723 | .nt3.1: |
723 | .nt3.1: |
724 | pop eax |
724 | pop eax |
725 | sub eax,esi |
725 | sub eax,esi |
726 | pushad |
726 | pushad |
727 | add edx,esi |
727 | add edx,esi |
728 | imul esi,6*65536 |
728 | imul esi,6*65536 |
729 | add ebx,esi |
729 | add ebx,esi |
730 | mov esi,[sel.end.x] |
730 | mov esi,[sel.end.x] |
731 | sub esi,[sel.begin.x] |
731 | sub esi,[sel.begin.x] |
732 | mov ecx,[color_tbl.text.sel] |
732 | mov ecx,[color_tbl.text.sel] |
733 | sub eax,esi |
733 | sub eax,esi |
734 | push eax |
734 | push eax |
735 | mcall 4 |
735 | mcall 4 |
736 | add edx,esi |
736 | add edx,esi |
737 | imul esi,6*65536 |
737 | imul esi,6*65536 |
738 | add ebx,esi |
738 | add ebx,esi |
739 | pop esi |
739 | pop esi |
740 | mov ecx,[esp+4*6] |
740 | mov ecx,[esp+4*6] |
741 | mcall 4 |
741 | mcall 4 |
742 | popad |
742 | popad |
743 | jmp .draw_t |
743 | jmp .draw_t |
744 | ;----------------------------------------------)- |
744 | ;----------------------------------------------)- |
745 | @@: add eax,esi |
745 | @@: add eax,esi |
746 | dec eax |
746 | dec eax |
747 | cmp eax,[sel.end.x] |
747 | cmp eax,[sel.end.x] |
748 | jge .ya2 |
748 | jge .ya2 |
749 | ;---[ block inside selection ]-----------------(- |
749 | ;---[ block inside selection ]-----------------(- |
750 | .ya4: mov ecx,[color_tbl.text.sel] |
750 | .ya4: mov ecx,[color_tbl.text.sel] |
751 | ;----------------------------------------------)- |
751 | ;----------------------------------------------)- |
752 | 752 | ||
753 | .draw_t: |
753 | .draw_t: |
754 | mcall 4 |
754 | mcall 4 |
755 | .skip_t: |
755 | .skip_t: |
756 | pop eax eax ; ebx esi |
756 | pop eax eax ; ebx esi |
757 | imul eax,6 |
757 | imul eax,6 |
758 | add [esp+4*2+2],ax |
758 | add [esp+4*2+2],ax |
759 | pop ecx esi |
759 | pop ecx esi |
760 | cmp ecx,[cur_line_len] |
760 | cmp ecx,[cur_line_len] |
761 | jl .next_block |
761 | jl .next_block |
762 | 762 | ||
763 | pop ebx ecx |
763 | pop ebx ecx |
764 | and ebx,0x0000FFFF |
764 | and ebx,0x0000FFFF |
765 | add ebx,[left_ofs-2] |
765 | add ebx,[left_ofs-2] |
766 | add ebx,LINEH |
766 | add ebx,LINEH |
767 | add esi,[cur_line_len] |
767 | add esi,[cur_line_len] |
768 | inc dword[esp] |
768 | inc dword[esp] |
769 | dec ecx |
769 | dec ecx |
770 | jg .next_line |
770 | jg .next_line |
771 | 771 | ||
772 | .exit: |
772 | .exit: |
773 | 773 | ||
774 | cmp [draw_blines],0 |
774 | cmp [draw_blines],0 |
775 | je .exit.2 |
775 | je .exit.2 |
776 | mov eax,[cur_editor.Bounds.Left] |
776 | mov eax,[cur_editor.Bounds.Left] |
777 | add eax,[cur_editor.Gutter.Width] |
777 | add eax,[cur_editor.Gutter.Width] |
778 | inc eax |
778 | inc eax |
779 | mov ebx,eax |
779 | mov ebx,eax |
780 | shl ebx,16 |
780 | shl ebx,16 |
781 | mov bx,word[cur_editor.Bounds.Right] |
781 | mov bx,word[cur_editor.Bounds.Right] |
782 | sub bx,ax |
782 | sub bx,ax |
783 | add ebx,-SCRLW |
783 | add ebx,-SCRLW |
784 | mov edx,[color_tbl.back] |
784 | mov edx,[color_tbl.back] |
785 | mov eax,13 |
785 | mov eax,13 |
786 | mov ecx,[esp-8] |
786 | mov ecx,[esp-8] |
787 | add ecx,LINEH |
787 | add ecx,LINEH |
788 | shl ecx,16 |
788 | shl ecx,16 |
789 | mov cx,word[cur_editor.Bounds.Bottom] |
789 | mov cx,word[cur_editor.Bounds.Bottom] |
790 | sub cx,[esp-8] |
790 | sub cx,[esp-8] |
791 | add cx,-SCRLW-LINEH |
791 | add cx,-SCRLW-LINEH |
792 | jle @f |
792 | jle @f |
793 | mcall |
793 | mcall |
794 | @@: mov ecx,[cur_editor.Bounds.Top-2] |
794 | @@: mov ecx,[cur_editor.Bounds.Top-2] |
795 | mov cx,2 |
795 | mov cx,2 |
796 | add ecx,0x00010000 |
796 | add ecx,0x00010000 |
797 | mcall |
797 | mcall |
798 | mov ebx,[cur_editor.Bounds.Right] |
798 | mov ebx,[cur_editor.Bounds.Right] |
799 | mov ecx,[cur_editor.Bounds.Bottom] |
799 | mov ecx,[cur_editor.Bounds.Bottom] |
800 | shl ebx,16 |
800 | shl ebx,16 |
801 | shl ecx,16 |
801 | shl ecx,16 |
802 | add ebx,-(SCRLW-1)*65536+SCRLW-1 |
802 | add ebx,-(SCRLW-1)*65536+SCRLW-1 |
803 | add ecx,-(SCRLW-1)*65536+SCRLW-1 |
803 | add ecx,-(SCRLW-1)*65536+SCRLW-1 |
804 | mcall |
804 | mcall |
805 | 805 | ||
806 | .exit.2: |
806 | .exit.2: |
807 | popad |
807 | popad |
808 | add esp,4 |
808 | add esp,4 |
809 | ret |
809 | ret |
810 | endf |
810 | endp |
811 | 811 | ||
812 | ;----------------------------------------------------------------------------- |
812 | ;----------------------------------------------------------------------------- |
813 | func draw_editor_text.get_next_part ;///////////////////////////////////////// |
813 | proc draw_editor_text.get_next_part ;///////////////////////////////////////// |
814 | ;----------------------------------------------------------------------------- |
814 | ;----------------------------------------------------------------------------- |
815 | ; Input: |
815 | ; Input: |
816 | ; ECX = current letter |
816 | ; ECX = current letter |
817 | ; ESI = string |
817 | ; ESI = string |
818 | ; Output: |
818 | ; Output: |
819 | ; ECX = color |
819 | ; ECX = color |
820 | ; EDX = string |
820 | ; EDX = string |
821 | ; ESI = length |
821 | ; ESI = length |
822 | ;----------------------------------------------------------------------------- |
822 | ;----------------------------------------------------------------------------- |
823 | cmp [cur_editor.AsmMode],0 |
823 | cmp [cur_editor.AsmMode],0 |
824 | je .plain.text |
824 | je .plain.text |
825 | xor ebx,ebx |
825 | xor ebx,ebx |
826 | mov edx,ecx |
826 | mov edx,ecx |
827 | add esi,ecx |
827 | add esi,ecx |
828 | mov edi,symbols |
828 | mov edi,symbols |
829 | mov al,[esi] |
829 | mov al,[esi] |
830 | cmp al,';' |
830 | cmp al,';' |
831 | je .comment |
831 | je .comment |
832 | mov ecx,symbols.size |
832 | mov ecx,symbols.size |
833 | repne scasb |
833 | repne scasb |
834 | je .symbol |
834 | je .symbol |
835 | cmp al,'$' |
835 | cmp al,'$' |
836 | jne @f |
836 | jne @f |
837 | mov edi,symbols |
837 | mov edi,symbols |
838 | mov al,[esi+1] |
838 | mov al,[esi+1] |
839 | mov ecx,symbols.size |
839 | mov ecx,symbols.size |
840 | repne scasb |
840 | repne scasb |
841 | je .not_symbol |
841 | je .not_symbol |
842 | jmp .number |
842 | jmp .number |
843 | @@: cmp al,'0' |
843 | @@: cmp al,'0' |
844 | jb @f |
844 | jb @f |
845 | cmp al,'9' |
845 | cmp al,'9' |
846 | jbe .number |
846 | jbe .number |
847 | @@: cmp al,"'" |
847 | @@: cmp al,"'" |
848 | je .string |
848 | je .string |
849 | cmp al,'"' |
849 | cmp al,'"' |
850 | je .string |
850 | je .string |
851 | .not_symbol: |
851 | .not_symbol: |
852 | inc ebx |
852 | inc ebx |
853 | inc edx |
853 | inc edx |
854 | cmp edx,[cur_line_len] |
854 | cmp edx,[cur_line_len] |
855 | jge @f |
855 | jge @f |
856 | mov edi,symbols |
856 | mov edi,symbols |
857 | mov al,[esi+ebx] |
857 | mov al,[esi+ebx] |
858 | cmp al,';' |
858 | cmp al,';' |
859 | je @f |
859 | je @f |
860 | mov ecx,symbols.size |
860 | mov ecx,symbols.size |
861 | repne scasb |
861 | repne scasb |
862 | jne .not_symbol |
862 | jne .not_symbol |
863 | @@: mov ecx,edx |
863 | @@: mov ecx,edx |
864 | mov edx,esi |
864 | mov edx,esi |
865 | mov esi,ebx |
865 | mov esi,ebx |
866 | mov eax,[color_tbl.text] |
866 | mov eax,[color_tbl.text] |
867 | ret |
867 | ret |
868 | .symbol: |
868 | .symbol: |
869 | inc ebx |
869 | inc ebx |
870 | inc edx |
870 | inc edx |
871 | cmp edx,[cur_line_len] |
871 | cmp edx,[cur_line_len] |
872 | jge @f |
872 | jge @f |
873 | mov edi,symbols |
873 | mov edi,symbols |
874 | mov al,[esi+ebx] |
874 | mov al,[esi+ebx] |
875 | mov ecx,symbols.size |
875 | mov ecx,symbols.size |
876 | repne scasb |
876 | repne scasb |
877 | je .symbol |
877 | je .symbol |
878 | @@: mov ecx,edx |
878 | @@: mov ecx,edx |
879 | mov edx,esi |
879 | mov edx,esi |
880 | mov esi,ebx |
880 | mov esi,ebx |
881 | mov eax,[color_tbl.symbol] |
881 | mov eax,[color_tbl.symbol] |
882 | ret |
882 | ret |
883 | .comment: |
883 | .comment: |
884 | neg edx |
884 | neg edx |
885 | add edx,[cur_line_len] |
885 | add edx,[cur_line_len] |
886 | xchg edx,esi |
886 | xchg edx,esi |
887 | mov ecx,[cur_line_len] |
887 | mov ecx,[cur_line_len] |
888 | mov eax,[color_tbl.comment] |
888 | mov eax,[color_tbl.comment] |
889 | ret |
889 | ret |
890 | .number: |
890 | .number: |
891 | inc ebx |
891 | inc ebx |
892 | inc edx |
892 | inc edx |
893 | cmp edx,[cur_line_len] |
893 | cmp edx,[cur_line_len] |
894 | jge @f |
894 | jge @f |
895 | mov edi,symbols |
895 | mov edi,symbols |
896 | mov al,[esi+ebx] |
896 | mov al,[esi+ebx] |
897 | cmp al,';' |
897 | cmp al,';' |
898 | je @f |
898 | je @f |
899 | mov ecx,symbols.size |
899 | mov ecx,symbols.size |
900 | repne scasb |
900 | repne scasb |
901 | jne .number |
901 | jne .number |
902 | @@: mov ecx,edx |
902 | @@: mov ecx,edx |
903 | mov edx,esi |
903 | mov edx,esi |
904 | mov esi,ebx |
904 | mov esi,ebx |
905 | mov eax,[color_tbl.number] |
905 | mov eax,[color_tbl.number] |
906 | ret |
906 | ret |
907 | .string: |
907 | .string: |
908 | inc ebx |
908 | inc ebx |
909 | inc edx |
909 | inc edx |
910 | cmp edx,[cur_line_len] |
910 | cmp edx,[cur_line_len] |
911 | jge @f |
911 | jge @f |
912 | cmp [esi+ebx],al |
912 | cmp [esi+ebx],al |
913 | jne .string |
913 | jne .string |
914 | inc ebx |
914 | inc ebx |
915 | inc edx |
915 | inc edx |
916 | @@: |
916 | @@: |
917 | mov ecx,edx |
917 | mov ecx,edx |
918 | mov edx,esi |
918 | mov edx,esi |
919 | mov esi,ebx |
919 | mov esi,ebx |
920 | mov eax,[color_tbl.string] |
920 | mov eax,[color_tbl.string] |
921 | ret |
921 | ret |
922 | .plain.text: |
922 | .plain.text: |
923 | mov edx,[cur_line_len] |
923 | mov edx,[cur_line_len] |
924 | xchg edx,esi |
924 | xchg edx,esi |
925 | mov ecx,[cur_line_len] |
925 | mov ecx,[cur_line_len] |
926 | mov eax,[color_tbl.text] |
926 | mov eax,[color_tbl.text] |
927 | ret |
927 | ret |
928 | endf |
928 | endp |
929 | 929 | ||
930 | ;----------------------------------------------------------------------------- |
930 | ;----------------------------------------------------------------------------- |
931 | func draw_editor_caret ;///// DRAW EDITOR TEXT CARET ///////////////////////// |
931 | proc draw_editor_caret ;///// DRAW EDITOR TEXT CARET ///////////////////////// |
932 | ;----------------------------------------------------------------------------- |
932 | ;----------------------------------------------------------------------------- |
933 | cmp [bot_mode],0 |
933 | cmp [bot_mode],0 |
934 | jne @f |
934 | jne @f |
935 | mov ebx,[cur_editor.Caret.X] |
935 | mov ebx,[cur_editor.Caret.X] |
936 | sub ebx,[cur_editor.TopLeft.X] |
936 | sub ebx,[cur_editor.TopLeft.X] |
937 | js @f |
937 | js @f |
938 | cmp ebx,[columns.scr] |
938 | cmp ebx,[columns.scr] |
939 | ja @f |
939 | ja @f |
940 | imul ebx,6 |
940 | imul ebx,6 |
941 | add ebx,[left_ofs] |
941 | add ebx,[left_ofs] |
942 | dec ebx |
942 | dec ebx |
943 | push bx |
943 | push bx |
944 | shl ebx,16 |
944 | shl ebx,16 |
945 | pop bx |
945 | pop bx |
946 | mov eax,[cur_editor.Caret.Y] |
946 | mov eax,[cur_editor.Caret.Y] |
947 | sub eax,[cur_editor.TopLeft.Y] |
947 | sub eax,[cur_editor.TopLeft.Y] |
948 | js @f |
948 | js @f |
949 | cmp eax,[lines.scr] |
949 | cmp eax,[lines.scr] |
950 | jge @f |
950 | jge @f |
951 | imul eax,LINEH |
951 | imul eax,LINEH |
952 | add eax,[top_ofs] |
952 | add eax,[top_ofs] |
953 | mov esi,eax |
953 | mov esi,eax |
954 | shl esi,16 |
954 | shl esi,16 |
955 | add eax,LINEH-2 |
955 | add eax,LINEH-2 |
956 | mov si,ax |
956 | mov si,ax |
957 | mov ecx,2 |
957 | mov ecx,2 |
958 | cmp [ins_mode],0 |
958 | cmp [ins_mode],0 |
959 | jne .lp8 |
959 | jne .lp8 |
960 | add cl,4 |
960 | add cl,4 |
961 | .lp8: push ecx |
961 | .lp8: push ecx |
962 | mcall 38,,esi,0x01000000 |
962 | mcall 38,,esi,0x01000000 |
963 | add ebx,0x00010001 |
963 | add ebx,0x00010001 |
964 | pop ecx |
964 | pop ecx |
965 | loop .lp8 |
965 | loop .lp8 |
966 | @@: |
966 | @@: |
967 | ret |
967 | ret |
968 | endf |
968 | endp |
969 | 969 | ||
970 | ;----------------------------------------------------------------------------- |
970 | ;----------------------------------------------------------------------------- |
971 | func editor_realloc_lines ;///// ADD $DELTA$ TO LINES SIZE /////////////////// |
971 | proc editor_realloc_lines ;///// ADD $DELTA$ TO LINES SIZE /////////////////// |
972 | ;----------------------------------------------------------------------------- |
972 | ;----------------------------------------------------------------------------- |
973 | ; EAX = delta |
973 | ; EAX = delta |
974 | ;----------------------------------------------------------------------------- |
974 | ;----------------------------------------------------------------------------- |
975 | push ebx ecx |
975 | push ebx ecx |
976 | mov ebx,[cur_editor.Lines.Size] |
976 | mov ebx,[cur_editor.Lines.Size] |
977 | add ebx,eax |
977 | add ebx,eax |
978 | mov eax,[cur_editor.Lines] |
978 | mov eax,[cur_editor.Lines] |
979 | mov [cur_editor.Lines.Size],ebx |
979 | mov [cur_editor.Lines.Size],ebx |
980 | mov ecx,eax |
980 | mov ecx,eax |
981 | call mem.ReAlloc |
981 | stdcall mem.ReAlloc,eax,ebx |
982 | mov [cur_editor.Lines],eax |
982 | mov [cur_editor.Lines],eax |
983 | sub eax,ecx |
983 | sub eax,ecx |
984 | pop ecx ebx |
984 | pop ecx ebx |
985 | ret |
985 | ret |
986 | endf |
986 | endp |
987 | 987 | ||
988 | REDRAW_TEXT = 00000001b |
988 | REDRAW_TEXT = 00000001b |
989 | REDRAW_HSCROLL = 00000010b |
989 | REDRAW_HSCROLL = 00000010b |
990 | REDRAW_VSCROLL = 00000100b |
990 | REDRAW_VSCROLL = 00000100b |
991 | REDRAW_ONELINE = 00001000b |
991 | REDRAW_ONELINE = 00001000b |
992 | REDRAW_TWOLINES = 00010000b |
992 | REDRAW_TWOLINES = 00010000b |
993 | 993 | ||
994 | ;----------------------------------------------------------------------------- |
994 | ;----------------------------------------------------------------------------- |
995 | func editor_check_for_changes ;///// EDITOR CHANGES CHECKER ////////////////// |
995 | proc editor_check_for_changes ;///// EDITOR CHANGES CHECKER ////////////////// |
996 | ;----------------------------------------------------------------------------- |
996 | ;----------------------------------------------------------------------------- |
997 | call .check_cursor_visibility |
997 | call .check_cursor_visibility |
998 | .direct: |
998 | .direct: |
999 | xor edx,edx |
999 | xor edx,edx |
1000 | 1000 | ||
1001 | mov eax,[cur_editor.Lines.Count] |
1001 | mov eax,[cur_editor.Lines.Count] |
1002 | cmp eax,[checker_ed.Lines.Count] |
1002 | cmp eax,[checker_ed.Lines.Count] |
1003 | je @f |
1003 | je @f |
1004 | or dl,REDRAW_TEXT+REDRAW_VSCROLL+REDRAW_HSCROLL |
1004 | or dl,REDRAW_TEXT+REDRAW_VSCROLL+REDRAW_HSCROLL |
1005 | @@: mov eax,[cur_editor.TopLeft.Y] |
1005 | @@: mov eax,[cur_editor.TopLeft.Y] |
1006 | cmp eax,[checker_ed.TopLeft.Y] |
1006 | cmp eax,[checker_ed.TopLeft.Y] |
1007 | je @f |
1007 | je @f |
1008 | or dl,REDRAW_TEXT+REDRAW_VSCROLL |
1008 | or dl,REDRAW_TEXT+REDRAW_VSCROLL |
1009 | @@: mov eax,[cur_editor.TopLeft.X] |
1009 | @@: mov eax,[cur_editor.TopLeft.X] |
1010 | cmp eax,[checker_ed.TopLeft.X] |
1010 | cmp eax,[checker_ed.TopLeft.X] |
1011 | je @f |
1011 | je @f |
1012 | or dl,REDRAW_TEXT+REDRAW_HSCROLL |
1012 | or dl,REDRAW_TEXT+REDRAW_HSCROLL |
1013 | @@: or dl,dl |
1013 | @@: or dl,dl |
1014 | jnz .redraw |
1014 | jnz .redraw |
1015 | 1015 | ||
1016 | mov ecx,[cur_editor.Caret.Y] |
1016 | mov ecx,[cur_editor.Caret.Y] |
1017 | call get_line_offset |
1017 | call get_line_offset |
1018 | call get_real_length |
1018 | call get_real_length |
1019 | cmp eax,[checker_ed_ll] |
1019 | cmp eax,[checker_ed_ll] |
1020 | je @f |
1020 | je @f |
1021 | mov [checker_ed_ll],eax |
1021 | mov [checker_ed_ll],eax |
1022 | or dl,REDRAW_ONELINE |
1022 | or dl,REDRAW_ONELINE |
1023 | @@: |
1023 | @@: |
1024 | mov eax,[cur_editor.Caret.Y] |
1024 | mov eax,[cur_editor.Caret.Y] |
1025 | cmp eax,[checker_ed.Caret.Y] |
1025 | cmp eax,[checker_ed.Caret.Y] |
1026 | je @f |
1026 | je @f |
1027 | or dl,REDRAW_TWOLINES |
1027 | or dl,REDRAW_TWOLINES |
1028 | @@: mov eax,[cur_editor.Caret.X] |
1028 | @@: mov eax,[cur_editor.Caret.X] |
1029 | cmp eax,[checker_ed.Caret.X] |
1029 | cmp eax,[checker_ed.Caret.X] |
1030 | je @f |
1030 | je @f |
1031 | or dl,REDRAW_ONELINE |
1031 | or dl,REDRAW_ONELINE |
1032 | @@: mov ebp,cur_editor |
1032 | @@: mov ebp,cur_editor |
1033 | call init_sel_vars |
1033 | call init_sel_vars |
1034 | mov al,[sel.selected] |
1034 | mov al,[sel.selected] |
1035 | mov ebp,checker_ed |
1035 | mov ebp,checker_ed |
1036 | call init_sel_vars |
1036 | call init_sel_vars |
1037 | cmp al,[sel.selected] |
1037 | cmp al,[sel.selected] |
1038 | je @f |
1038 | je @f |
1039 | cmp al,0 |
1039 | cmp al,0 |
1040 | je .clear_sel |
1040 | je .clear_sel |
1041 | jmp .draw_sel |
1041 | jmp .draw_sel |
1042 | @@: cmp al,0 |
1042 | @@: cmp al,0 |
1043 | jne .redraw_sel |
1043 | jne .redraw_sel |
1044 | 1044 | ||
1045 | or dl,dl |
1045 | or dl,dl |
1046 | jz .exit |
1046 | jz .exit |
1047 | test dl,REDRAW_TWOLINES |
1047 | test dl,REDRAW_TWOLINES |
1048 | jz .one_line |
1048 | jz .one_line |
1049 | push edx |
1049 | push edx |
1050 | mov eax,[checker_ed.Caret.Y] |
1050 | mov eax,[checker_ed.Caret.Y] |
1051 | mov ebx,eax |
1051 | mov ebx,eax |
1052 | call draw_editor_text.part |
1052 | call draw_editor_text.part |
1053 | pop edx |
1053 | pop edx |
1054 | .one_line: |
1054 | .one_line: |
1055 | mov eax,[cur_editor.Caret.Y] |
1055 | mov eax,[cur_editor.Caret.Y] |
1056 | mov ebx,eax |
1056 | mov ebx,eax |
1057 | call draw_editor_text.part |
1057 | call draw_editor_text.part |
1058 | call draw_editor_caret |
1058 | call draw_editor_caret |
1059 | jmp .exit |
1059 | jmp .exit |
1060 | 1060 | ||
1061 | .clear_sel: |
1061 | .clear_sel: |
1062 | ;// use checker_ed |
1062 | ;// use checker_ed |
1063 | mov eax,[sel.begin.y] |
1063 | mov eax,[sel.begin.y] |
1064 | mov ebx,[sel.end.y] |
1064 | mov ebx,[sel.end.y] |
1065 | push eax ebx |
1065 | push eax ebx |
1066 | call draw_editor_text.part |
1066 | call draw_editor_text.part |
1067 | pop edx ecx |
1067 | pop edx ecx |
1068 | mov eax,[cur_editor.Caret.Y] |
1068 | mov eax,[cur_editor.Caret.Y] |
1069 | cmp eax,ecx |
1069 | cmp eax,ecx |
1070 | jb @f |
1070 | jb @f |
1071 | cmp eax,edx |
1071 | cmp eax,edx |
1072 | jbe .lp1 |
1072 | jbe .lp1 |
1073 | @@: mov ebx,eax |
1073 | @@: mov ebx,eax |
1074 | call draw_editor_text.part |
1074 | call draw_editor_text.part |
1075 | .lp1: call draw_editor_caret |
1075 | .lp1: call draw_editor_caret |
1076 | jmp .exit |
1076 | jmp .exit |
1077 | 1077 | ||
1078 | .draw_sel: |
1078 | .draw_sel: |
1079 | ;// use cur_editor |
1079 | ;// use cur_editor |
1080 | mov ebp,cur_editor |
1080 | mov ebp,cur_editor |
1081 | call init_sel_vars |
1081 | call init_sel_vars |
1082 | mov eax,[sel.begin.y] |
1082 | mov eax,[sel.begin.y] |
1083 | mov ebx,[sel.end.y] |
1083 | mov ebx,[sel.end.y] |
1084 | push eax ebx |
1084 | push eax ebx |
1085 | call draw_editor_text.part |
1085 | call draw_editor_text.part |
1086 | pop edx ecx |
1086 | pop edx ecx |
1087 | mov eax,[checker_ed.Caret.Y] |
1087 | mov eax,[checker_ed.Caret.Y] |
1088 | cmp eax,ecx |
1088 | cmp eax,ecx |
1089 | jb @f |
1089 | jb @f |
1090 | cmp eax,edx |
1090 | cmp eax,edx |
1091 | jbe .lp2 |
1091 | jbe .lp2 |
1092 | @@: mov ebx,eax |
1092 | @@: mov ebx,eax |
1093 | call draw_editor_text.part |
1093 | call draw_editor_text.part |
1094 | .lp2: call draw_editor_caret |
1094 | .lp2: call draw_editor_caret |
1095 | jmp .exit |
1095 | jmp .exit |
1096 | 1096 | ||
1097 | .redraw_sel: |
1097 | .redraw_sel: |
1098 | ;// use checker_ed and cur_editor |
1098 | ;// use checker_ed and cur_editor |
1099 | mov eax,[checker_ed.Caret.Y] |
1099 | mov eax,[checker_ed.Caret.Y] |
1100 | mov ebx,[cur_editor.Caret.Y] |
1100 | mov ebx,[cur_editor.Caret.Y] |
1101 | cmp eax,ebx |
1101 | cmp eax,ebx |
1102 | jb @f |
1102 | jb @f |
1103 | xchg eax,ebx |
1103 | xchg eax,ebx |
1104 | @@: call draw_editor_text.part |
1104 | @@: call draw_editor_text.part |
1105 | call draw_editor_caret |
1105 | call draw_editor_caret |
1106 | jmp .exit |
1106 | jmp .exit |
1107 | 1107 | ||
1108 | .redraw: |
1108 | .redraw: |
1109 | push edx |
1109 | push edx |
1110 | call draw_editor_gutter |
1110 | call draw_editor_gutter |
1111 | call draw_editor_text |
1111 | call draw_editor_text |
1112 | call draw_editor_caret |
1112 | call draw_editor_caret |
1113 | test byte[esp],REDRAW_VSCROLL |
1113 | test byte[esp],REDRAW_VSCROLL |
1114 | jz @f |
1114 | jz @f |
1115 | call draw_editor_vscroll |
1115 | call draw_editor_vscroll |
1116 | @@: pop edx |
1116 | @@: pop edx |
1117 | test dl,REDRAW_HSCROLL |
1117 | test dl,REDRAW_HSCROLL |
1118 | jz @f |
1118 | jz @f |
1119 | call draw_editor_hscroll |
1119 | call draw_editor_hscroll |
1120 | @@: jmp .exit |
1120 | @@: jmp .exit |
1121 | 1121 | ||
1122 | .exit: |
1122 | .exit: |
1123 | mov esi,cur_editor |
1123 | mov esi,cur_editor |
1124 | mov edi,checker_ed |
1124 | mov edi,checker_ed |
1125 | mov ecx,sizeof.EDITOR/4 |
1125 | mov ecx,sizeof.EDITOR/4 |
1126 | cld |
1126 | cld |
1127 | rep movsd |
1127 | rep movsd |
1128 | ret |
1128 | ret |
1129 | 1129 | ||
1130 | .check_cursor_visibility: |
1130 | .check_cursor_visibility: |
1131 | push eax ebx |
1131 | push eax ebx |
1132 | .chk_y: |
1132 | .chk_y: |
1133 | mov eax,[cur_editor.Caret.Y] |
1133 | mov eax,[cur_editor.Caret.Y] |
1134 | or eax,eax |
1134 | or eax,eax |
1135 | jge @f |
1135 | jge @f |
1136 | mov [cur_editor.Caret.Y],0 |
1136 | mov [cur_editor.Caret.Y],0 |
1137 | jmp .chk_dy |
1137 | jmp .chk_dy |
1138 | @@: cmp eax,[cur_editor.Lines.Count] |
1138 | @@: cmp eax,[cur_editor.Lines.Count] |
1139 | jl .chk_dy |
1139 | jl .chk_dy |
1140 | mov eax,[cur_editor.Lines.Count] |
1140 | mov eax,[cur_editor.Lines.Count] |
1141 | dec eax |
1141 | dec eax |
1142 | mov [cur_editor.Caret.Y],eax |
1142 | mov [cur_editor.Caret.Y],eax |
1143 | .chk_dy: |
1143 | .chk_dy: |
1144 | mov eax,[cur_editor.TopLeft.Y] |
1144 | mov eax,[cur_editor.TopLeft.Y] |
1145 | cmp eax,[cur_editor.Caret.Y] |
1145 | cmp eax,[cur_editor.Caret.Y] |
1146 | jle @f |
1146 | jle @f |
1147 | m2m [cur_editor.TopLeft.Y],[cur_editor.Caret.Y] |
1147 | m2m [cur_editor.TopLeft.Y],[cur_editor.Caret.Y] |
1148 | @@: add eax,[lines.scr] |
1148 | @@: add eax,[lines.scr] |
1149 | cmp eax,[cur_editor.Caret.Y] |
1149 | cmp eax,[cur_editor.Caret.Y] |
1150 | jg .chk_x |
1150 | jg .chk_x |
1151 | mov eax,[cur_editor.Caret.Y] |
1151 | mov eax,[cur_editor.Caret.Y] |
1152 | sub eax,[lines.scr] |
1152 | sub eax,[lines.scr] |
1153 | inc eax |
1153 | inc eax |
1154 | mov [cur_editor.TopLeft.Y],eax |
1154 | mov [cur_editor.TopLeft.Y],eax |
1155 | .chk_x: |
1155 | .chk_x: |
1156 | mov eax,[cur_editor.Caret.X] |
1156 | mov eax,[cur_editor.Caret.X] |
1157 | or eax,eax |
1157 | or eax,eax |
1158 | jge @f |
1158 | jge @f |
1159 | mov [cur_editor.Caret.X],0 |
1159 | mov [cur_editor.Caret.X],0 |
1160 | jmp .chk_dx |
1160 | jmp .chk_dx |
1161 | @@: cmp eax,[cur_editor.Columns.Count] |
1161 | @@: cmp eax,[cur_editor.Columns.Count] |
1162 | jl .chk_dx |
1162 | jl .chk_dx |
1163 | mov eax,[cur_editor.Columns.Count] |
1163 | mov eax,[cur_editor.Columns.Count] |
1164 | mov [cur_editor.Caret.X],eax |
1164 | mov [cur_editor.Caret.X],eax |
1165 | .chk_dx: |
1165 | .chk_dx: |
1166 | mov eax,[cur_editor.TopLeft.X] |
1166 | mov eax,[cur_editor.TopLeft.X] |
1167 | cmp eax,[cur_editor.Caret.X] |
1167 | cmp eax,[cur_editor.Caret.X] |
1168 | jle @f |
1168 | jle @f |
1169 | m2m [cur_editor.TopLeft.X],[cur_editor.Caret.X] |
1169 | m2m [cur_editor.TopLeft.X],[cur_editor.Caret.X] |
1170 | @@: add eax,[columns.scr] |
1170 | @@: add eax,[columns.scr] |
1171 | cmp eax,[cur_editor.Caret.X] |
1171 | cmp eax,[cur_editor.Caret.X] |
1172 | jg @f |
1172 | jg @f |
1173 | mov eax,[cur_editor.Caret.X] |
1173 | mov eax,[cur_editor.Caret.X] |
1174 | sub eax,[columns.scr] |
1174 | sub eax,[columns.scr] |
1175 | inc eax |
1175 | inc eax |
1176 | mov [cur_editor.TopLeft.X],eax |
1176 | mov [cur_editor.TopLeft.X],eax |
1177 | @@: cmp [mev],MEV_LDOWN |
1177 | @@: cmp [mev],MEV_LDOWN |
1178 | jne @f |
1178 | jne @f |
1179 | push [cur_editor.Caret.X] [cur_editor.Caret.Y] |
1179 | push [cur_editor.Caret.X] [cur_editor.Caret.Y] |
1180 | pop [cur_editor.SelStart.Y] [cur_editor.SelStart.X] |
1180 | pop [cur_editor.SelStart.Y] [cur_editor.SelStart.X] |
1181 | @@: pop ebx eax |
1181 | @@: pop ebx eax |
1182 | ret |
1182 | ret |
1183 | endf |
1183 | endp |
1184 | 1184 |