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