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