Rev 1343 | Rev 1456 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1449 | IgorA | 1 | proc mouse_wnd_main, edit:dword |
2 | push eax ebx ecx edi |
||
1338 | IgorA | 3 | mcall 37,2 ;get mouse buttons |
4 | |||
1449 | IgorA | 5 | mov edi,dword[edit] |
6 | |||
1338 | IgorA | 7 | cmp al,1 |
8 | jne @f |
||
9 | mcall 37,1 ;get mouse coords |
||
1449 | IgorA | 10 | mov ebx,ted_wnd_t |
11 | add ebx,ted_rec_t |
||
1338 | IgorA | 12 | cmp ax,bx |
13 | jl @f ;y_mouse |
||
14 | |||
1449 | IgorA | 15 | sub ebx,ted_rec_t |
16 | add ebx,ted_wnd_h |
||
1338 | IgorA | 17 | cmp bx,ax |
18 | jl @f ;y_mouse>y_wnd |
||
19 | |||
1449 | IgorA | 20 | mov ebx,ted_wnd_l |
21 | add ebx,ted_rec_l |
||
1338 | IgorA | 22 | mov ecx,eax |
23 | shr ecx,16 |
||
24 | cmp cx,bx |
||
25 | jl @f ;x_mouse |
||
26 | |||
1449 | IgorA | 27 | sub ebx,ted_rec_l |
28 | add ebx,ted_wnd_w |
||
1338 | IgorA | 29 | cmp bx,cx |
30 | jl @f ;x_mouse>x_wnd |
||
31 | |||
1449 | IgorA | 32 | stdcall draw_cursor_sumb, tedit0 |
1338 | IgorA | 33 | call wnd_main_click |
34 | jmp .no_in_wnd |
||
35 | @@: |
||
36 | call wnd_main_mouse_scroll |
||
1449 | IgorA | 37 | cmp ted_drag_m,0 |
1338 | IgorA | 38 | je .no_in_wnd |
1449 | IgorA | 39 | mov ted_drag_m,0 |
1338 | IgorA | 40 | call draw_but_toolbar |
1449 | IgorA | 41 | stdcall draw_main_win, tedit0 |
1338 | IgorA | 42 | .no_in_wnd: |
1449 | IgorA | 43 | pop edi ecx ebx eax |
1338 | IgorA | 44 | ret |
1449 | IgorA | 45 | endp |
1338 | IgorA | 46 | |
1449 | IgorA | 47 | ;input: |
48 | ; eax -> (x,y) |
||
49 | ; edi -> указатель на структуру tedit |
||
50 | ;description: |
||
51 | ; функция вызывется при нажатии кнопкой мыши и попадении курсором в окно редактора |
||
1338 | IgorA | 52 | wnd_main_click: |
53 | push ecx edx |
||
54 | |||
55 | push eax |
||
56 | shr eax,16 |
||
57 | and eax,0xffff |
||
1449 | IgorA | 58 | sub eax,ted_wnd_l |
59 | sub eax,ted_rec_l |
||
1338 | IgorA | 60 | |
61 | xor edx,edx |
||
1449 | IgorA | 62 | mov ecx,ted_rec_w |
1338 | IgorA | 63 | div cx |
64 | ;inc eax |
||
65 | cmp eax,[hScr.cur_area] |
||
66 | jle @f |
||
67 | mov eax,[hScr.cur_area] |
||
68 | @@: |
||
69 | ;dec eax |
||
70 | mov [cur_x],eax |
||
71 | pop eax |
||
72 | |||
73 | push eax |
||
74 | and eax,0xffff |
||
1449 | IgorA | 75 | sub eax,ted_wnd_t |
76 | sub eax,ted_rec_t |
||
1338 | IgorA | 77 | |
78 | xor edx,edx |
||
1449 | IgorA | 79 | mov ecx,ted_rec_h |
1338 | IgorA | 80 | div cx |
81 | inc eax |
||
82 | cmp eax,[wScr.cur_area] |
||
83 | jle @f |
||
84 | mov eax,[wScr.cur_area] |
||
85 | @@: |
||
86 | dec eax |
||
87 | mov [cur_y],eax |
||
88 | pop eax |
||
89 | |||
1449 | IgorA | 90 | cmp ted_drag_m,0 |
1338 | IgorA | 91 | je @f |
92 | call SelMove |
||
93 | jmp .sel_move |
||
94 | @@: |
||
1449 | IgorA | 95 | mov ted_drag_m,1 |
1338 | IgorA | 96 | call SelStart |
97 | .sel_move: |
||
98 | pop edx ecx |
||
99 | ret |
||
100 | |||
101 | wnd_main_mouse_scroll: |
||
102 | push eax ebx |
||
103 | mcall 37,7 |
||
104 | cmp ax,0 |
||
105 | je .no_scroll |
||
106 | mov ebx,dword[wScr.position] ;copy old scroll position |
||
107 | and eax,0xffff |
||
108 | btr ax,15 |
||
109 | jae @f |
||
110 | or eax,0xffff8000 |
||
111 | @@: |
||
112 | add dword[wScr.position],eax |
||
113 | |||
114 | mov eax,[wScr.position] |
||
115 | cmp eax,[wScr.max_area] |
||
116 | jb @f |
||
117 | mov dword[wScr.position],ebx ;if scroll position out of range |
||
118 | jmp .no_scroll |
||
119 | @@: |
||
1449 | IgorA | 120 | stdcall draw_main_win, tedit0 |
1338 | IgorA | 121 | .no_scroll: |
122 | pop ebx eax |
||
123 | ret |
||
124 | |||
125 | draw_but_toolbar: |
||
126 | |||
127 | push ebx ecx edx |
||
128 | mov ecx,0x40000000 |
||
129 | ; mov edx,5*65536+25 |
||
130 | mov edx,85*65536+2 |
||
131 | call draw_but_icon |
||
132 | |||
133 | inc cx |
||
134 | ; mov edx,30*65536+25 |
||
135 | mov edx,110*65536+2 |
||
136 | call draw_but_icon |
||
137 | |||
138 | call CanSave |
||
139 | cmp al,1 |
||
140 | je @f |
||
141 | and ecx,0xffff |
||
142 | @@: |
||
143 | inc cx |
||
144 | ; mov edx,55*65536+25 |
||
145 | mov edx,135*65536+2 |
||
146 | call draw_but_icon |
||
147 | or ecx,0x40000000 |
||
148 | |||
149 | inc cx |
||
150 | mov edx,85*65536+25 |
||
151 | call draw_but_icon |
||
152 | |||
1449 | IgorA | 153 | stdcall IsSel, tedit0 |
1338 | IgorA | 154 | cmp al,0 |
155 | jne @f |
||
156 | and ecx,0xffff |
||
157 | @@: |
||
158 | inc cx ; Cut |
||
159 | mov edx,110*65536+25 |
||
160 | call draw_but_icon |
||
161 | |||
162 | inc cx ; Copy |
||
163 | mov edx,135*65536+25 |
||
164 | call draw_but_icon |
||
165 | |||
166 | mov cx,10 ; Upper |
||
167 | mov edx,265*65536+25 |
||
168 | call draw_but_icon |
||
169 | |||
170 | inc cx ; Lower |
||
171 | mov edx,290*65536+25 |
||
172 | call draw_but_icon |
||
173 | |||
174 | inc cx ; Reverse |
||
175 | mov edx,315*65536+25 |
||
176 | call draw_but_icon |
||
177 | or ecx,0x40000000 |
||
178 | |||
179 | cmp byte[buf],0 |
||
180 | jne @f |
||
181 | and ecx,0xffff |
||
182 | @@: |
||
183 | mov cx,6 ; Paste |
||
184 | mov edx,160*65536+25 |
||
185 | call draw_but_icon |
||
186 | or ecx,0x40000000 |
||
187 | |||
188 | inc cx |
||
189 | mov edx,185*65536+25 |
||
190 | call draw_but_icon |
||
191 | |||
192 | inc cx |
||
193 | mov edx,210*65536+25 |
||
194 | call draw_but_icon |
||
195 | |||
196 | inc cx |
||
197 | mov edx,235*65536+25 |
||
198 | call draw_but_icon |
||
199 | |||
200 | mov ebx,[tim_Undo] |
||
201 | cmp [ch_tim],ebx |
||
202 | jg @f |
||
203 | and ecx,0xffff |
||
204 | @@: |
||
205 | mov cx,13 |
||
206 | mov edx,345*65536+25 |
||
207 | call draw_but_icon |
||
208 | or ecx,0x40000000 |
||
209 | |||
210 | cmp [tim_Undo],1 |
||
211 | jge @f |
||
212 | and ecx,0xffff |
||
213 | @@: |
||
214 | inc cx |
||
215 | mov edx,370*65536+25 |
||
216 | call draw_but_icon |
||
217 | or ecx,0x40000000 |
||
218 | |||
219 | inc cx |
||
220 | mov edx,400*65536+25 |
||
221 | call draw_but_icon |
||
222 | |||
223 | inc cx |
||
224 | mov edx,425*65536+25 |
||
225 | call draw_but_icon |
||
226 | |||
227 | mov cx,17 |
||
228 | mov edx,450*65536+25 |
||
229 | call draw_but_icon |
||
230 | |||
231 | pop edx ecx ebx |
||
232 | ret |
||
233 | |||
1449 | IgorA | 234 | ;input: |
235 | ; clear_o - если =1 очистить одну строку, =0 очистить все строки окна до низу |
||
236 | proc clear_line_before_draw, edit:dword, coords:dword, clear_o:dword, numb_lin:dword |
||
237 | pushad |
||
238 | mov edi,dword[edit] |
||
239 | mov ebx,dword[coords] ;ebx = x*2^16+y coords to left up point clear line |
||
240 | mov esi,dword[numb_lin] ;esi - number text line |
||
1338 | IgorA | 241 | |
242 | sub ebx,0x10001 ;отнимаем отступы для выравнивания буквы по центру |
||
1449 | IgorA | 243 | cmp dword[clear_o],0 |
1338 | IgorA | 244 | jne @f |
1449 | IgorA | 245 | add ebx,ted_rec_h |
246 | inc esi |
||
1338 | IgorA | 247 | ror ebx,16 |
1449 | IgorA | 248 | xor bx,bx |
249 | add ebx,ted_wnd_l |
||
250 | add ebx,ted_rec_l ;bx = ted_wnd_l+ted_rec_l |
||
1338 | IgorA | 251 | ror ebx,16 |
252 | @@: |
||
253 | |||
1449 | IgorA | 254 | mov eax,ted_wnd_h |
255 | add eax,ted_wnd_t |
||
1338 | IgorA | 256 | cmp ax,bx |
257 | jl .no_clear |
||
258 | sub ax,bx |
||
259 | |||
260 | mov cx,bx |
||
261 | shl ecx,16 |
||
262 | |||
1449 | IgorA | 263 | xor bx,bx |
264 | add ebx,ted_wnd_w |
||
265 | sub ebx,ted_rec_l |
||
266 | xor cx,cx |
||
267 | add ecx,ted_rec_h |
||
1338 | IgorA | 268 | mov edx,[WND_WORK_COLOR] |
269 | |||
1449 | IgorA | 270 | cmp dword[clear_o],0 |
1338 | IgorA | 271 | je .pusto |
272 | cmp ax,cx |
||
273 | jge @f |
||
274 | .pusto: |
||
275 | mov cx,ax |
||
276 | @@: |
||
277 | |||
1449 | IgorA | 278 | stdcall IsSel,edi |
1338 | IgorA | 279 | cmp al,0 |
280 | je @f |
||
1449 | IgorA | 281 | cmp [seln.y0],esi |
1338 | IgorA | 282 | jg @f |
1449 | IgorA | 283 | cmp [seln.y1],esi |
1338 | IgorA | 284 | jl @f |
285 | mov edx,[SELECT_COLOR] ;draw selected line |
||
286 | @@: |
||
287 | |||
288 | mov eax,13 ;rect |
||
289 | int 0x40 |
||
290 | |||
1449 | IgorA | 291 | stdcall IsSel,edi |
1338 | IgorA | 292 | cmp al,0 |
293 | je .no_clear |
||
294 | |||
295 | mov al,13 ;rect |
||
1449 | IgorA | 296 | xor cx,cx |
297 | add ecx,ted_rec_h |
||
298 | cmp [seln.y0],esi |
||
1338 | IgorA | 299 | jne @f |
300 | push bx |
||
301 | mov edx,[seln.x0] ; верхняя полоса (затирает слева) |
||
302 | cmp edx,[hScr.position] |
||
303 | jle .in_wnd |
||
304 | sub edx,[hScr.position] |
||
1449 | IgorA | 305 | imul edx,ted_rec_w |
1338 | IgorA | 306 | mov bx,dx |
307 | jmp .no_wnd |
||
308 | .in_wnd: |
||
309 | mov bx,0 |
||
310 | .no_wnd: |
||
311 | mov edx,[WND_WORK_COLOR] |
||
312 | int 0x40 |
||
313 | pop bx |
||
314 | @@: |
||
1449 | IgorA | 315 | cmp [seln.y1],esi |
1338 | IgorA | 316 | jne @f |
317 | mov edx,[seln.x1] ; нижняя полоса (затирает справа) |
||
318 | cmp edx,[hScr.position] |
||
319 | jle .in_wnd2 |
||
320 | sub edx,[hScr.position] |
||
1449 | IgorA | 321 | imul edx,ted_rec_w |
1338 | IgorA | 322 | sub bx,dx |
323 | shl edx,16 |
||
324 | add ebx,edx |
||
325 | .in_wnd2: |
||
326 | |||
327 | mov edx,[WND_WORK_COLOR] |
||
328 | int 0x40 |
||
329 | @@: |
||
330 | |||
331 | .no_clear: |
||
1449 | IgorA | 332 | popad |
1338 | IgorA | 333 | ret |
1449 | IgorA | 334 | endp |
1338 | IgorA | 335 | |
336 | |||
1449 | IgorA | 337 | proc draw_main_win, edit:dword |
338 | locals |
||
339 | line_num dd ? |
||
340 | endl |
||
341 | pushad |
||
342 | mov edi,dword[edit] |
||
343 | |||
1338 | IgorA | 344 | mov eax,4 ;draw text |
345 | mov ecx,[tex_colors] |
||
346 | push dword[ecx] |
||
347 | pop ecx |
||
348 | |||
1449 | IgorA | 349 | mov ebx,ted_wnd_l |
350 | add ebx,ted_rec_l |
||
1338 | IgorA | 351 | shl ebx,16 |
1449 | IgorA | 352 | add ebx,ted_wnd_t |
353 | add ebx,ted_rec_t |
||
354 | add ebx,0x10001 ;добавляем отступы для выравнивания буквы по центру |
||
1338 | IgorA | 355 | |
356 | call SelNormalize ;need before draw select |
||
1449 | IgorA | 357 | mov esi,[wScr.position] |
358 | mov dword[line_num],esi |
||
1338 | IgorA | 359 | |
1449 | IgorA | 360 | stdcall clear_line_before_draw, tedit0,ebx,1,esi |
1338 | IgorA | 361 | call GetFirstVisiblePos |
362 | cmp edx,0 |
||
363 | je .no_draw_text |
||
1449 | IgorA | 364 | mov esi,1 ;длинна выводимого текста по 1-му символу |
1338 | IgorA | 365 | @@: |
366 | call IteratNext |
||
367 | cmp edx,[tex_1] |
||
368 | jle .no_draw_text |
||
369 | |||
370 | ; *** цветовая разметка |
||
371 | cmp byte[mode_colored],0 |
||
372 | je .no_col_change |
||
373 | cmp byte[edx+1],0 |
||
374 | je .no_col_change |
||
375 | call GetSymbColor |
||
376 | .no_col_change: |
||
377 | |||
378 | cmp byte [edx],13 |
||
379 | jne .no_13 |
||
380 | cmp [invis],1 |
||
381 | jne .no_invis |
||
382 | push edx |
||
383 | mov edx,symbol_new_line |
||
384 | int 0x40 |
||
385 | pop edx |
||
386 | .no_invis: |
||
1449 | IgorA | 387 | add ebx,ted_rec_h |
1338 | IgorA | 388 | ;optimized output \/ |
1449 | IgorA | 389 | mov eax,ted_wnd_h |
390 | add eax,ted_wnd_t |
||
1338 | IgorA | 391 | cmp bx,ax |
392 | jg .no_draw_text |
||
1449 | IgorA | 393 | mov eax,4 |
394 | ;optimized output /\ |
||
395 | and ebx,0xffff |
||
1338 | IgorA | 396 | ror ebx,16 |
1449 | IgorA | 397 | add ebx,ted_wnd_l |
398 | add ebx,ted_rec_l |
||
1338 | IgorA | 399 | inc ebx |
400 | ror ebx,16 |
||
1449 | IgorA | 401 | inc dword[line_num] ;increment line number |
402 | stdcall clear_line_before_draw, tedit0,ebx,1,dword[line_num] |
||
1338 | IgorA | 403 | call OptDrawLineLeft |
404 | jmp @b |
||
405 | .no_13: |
||
406 | |||
407 | int 0x40 |
||
408 | ror ebx,16 |
||
1449 | IgorA | 409 | add ebx,ted_rec_w |
410 | mov esi,ted_wnd_l |
||
411 | add esi,ted_wnd_w |
||
1338 | IgorA | 412 | cmp bx,si |
413 | jl .no_opt |
||
414 | call OptDrawLineRight |
||
415 | .no_opt: |
||
1449 | IgorA | 416 | mov si,1 |
1338 | IgorA | 417 | ror ebx,16 |
418 | jmp @b |
||
419 | .no_draw_text: |
||
420 | |||
1449 | IgorA | 421 | stdcall clear_line_before_draw, tedit0,ebx,0,dword[line_num] |
422 | stdcall draw_line_numbers, tedit0 |
||
423 | stdcall draw_main_cursor, tedit0 |
||
1338 | IgorA | 424 | |
425 | ;--------------------------------------------- |
||
426 | ; set all_redraw flag for draw all ScrollBar |
||
427 | ; In some cases it is necessity to draw only the area |
||
428 | ; of moving of a "runner", for acceleration of output - |
||
429 | ; in this case the flag needs to be reset to 0 (zero). |
||
430 | xor eax,eax |
||
431 | inc eax |
||
432 | mov [wScr.all_redraw],eax |
||
433 | mov [hScr.all_redraw],eax |
||
434 | |||
435 | ; draw for Vertical ScrollBar |
||
1449 | IgorA | 436 | stdcall [scrollbar_ver_draw], dword wScr |
437 | stdcall [scrollbar_hor_draw], dword hScr |
||
1338 | IgorA | 438 | ; reset all_redraw flag |
439 | xor eax,eax |
||
440 | mov [wScr.all_redraw],eax |
||
441 | mov [hScr.all_redraw],eax |
||
442 | ;--------------------------------------------- |
||
443 | |||
444 | mov eax,13 |
||
445 | ;left-bottom square |
||
1449 | IgorA | 446 | mov ebx,ted_wnd_l |
1338 | IgorA | 447 | shl ebx,16 |
1449 | IgorA | 448 | add ebx,ted_rec_l |
449 | mov ecx,ted_wnd_t |
||
450 | add ecx,ted_wnd_h |
||
1338 | IgorA | 451 | shl ecx,16 |
452 | mov cx,word[hScr.size_y] |
||
453 | inc cx |
||
454 | mov edx,[sc.work] |
||
455 | int 0x40 |
||
456 | |||
457 | ;right-bottom square |
||
1449 | IgorA | 458 | mov ebx,ted_wnd_l |
459 | add ebx,ted_wnd_w |
||
1338 | IgorA | 460 | shl ebx,16 |
461 | mov bx,word[wScr.size_x] |
||
462 | inc bx |
||
463 | int 0x40 |
||
464 | |||
1449 | IgorA | 465 | stdcall draw_panel_find, edi |
466 | stdcall draw_panel_syntax, edi |
||
467 | popad |
||
1338 | IgorA | 468 | ret |
1449 | IgorA | 469 | endp |
1338 | IgorA | 470 | |
471 | ;txtBUp db 24 |
||
472 | ;txtBDn db 25 |
||
473 | ;txtBRi db 26 |
||
474 | ;txtBLe db 27 |
||
1449 | IgorA | 475 | proc draw_panel_find, edit:dword |
476 | push edi |
||
477 | mov edi,dword[edit] |
||
478 | |||
1338 | IgorA | 479 | cmp byte[panel_id],TE_PANEL_FIND ;if not panel |
480 | jne @f |
||
481 | push eax ebx ecx edx |
||
482 | |||
483 | mov eax,13 ;рисование прямоугольника |
||
484 | mov ebx,TE_PANEL_WIDTH |
||
1449 | IgorA | 485 | mov ecx,ted_wnd_t |
1338 | IgorA | 486 | shl ecx,16 |
487 | mov cx,20 |
||
488 | mov edx,[sc.work] |
||
489 | int 0x40 |
||
490 | |||
491 | mov eax,4 ;рисование текста |
||
492 | mov ebx,30*65536+5 |
||
1449 | IgorA | 493 | add ebx,ted_wnd_t |
1338 | IgorA | 494 | mov ecx,[sc.work_text] |
495 | or ecx,0x80000000 |
||
496 | mov edx,txtFindCapt |
||
497 | int 0x40 |
||
498 | |||
499 | push dword edit2 |
||
500 | call [edit_box_draw] |
||
501 | |||
502 | mov eax,13 ;рисование прямоугольника |
||
503 | mov ebx,TE_PANEL_WIDTH |
||
1449 | IgorA | 504 | mov ecx,ted_wnd_t |
1338 | IgorA | 505 | add cx,20+15 ; 15 - height text box |
506 | shl ecx,16 |
||
1449 | IgorA | 507 | add ecx,ted_wnd_h |
1338 | IgorA | 508 | add cx,word[hScr.size_y] |
509 | sub cx,20+15-1 ; 15 - height text box |
||
510 | mov edx,[sc.work] |
||
511 | int 0x40 |
||
512 | |||
513 | mov eax,8 ;кнопка |
||
514 | mov ebx,5*65536+85 |
||
1449 | IgorA | 515 | mov ecx,ted_wnd_t |
1338 | IgorA | 516 | add cx,20+15+5 |
517 | shl ecx,16 |
||
518 | mov cx,20 |
||
519 | mov edx,201 ;button id |
||
520 | mov esi,[sc.work_button] |
||
521 | int 0x40 |
||
522 | |||
523 | mov eax,4 ;рисование текста |
||
524 | mov ebx,15*65536+(20+15+10) |
||
1449 | IgorA | 525 | add ebx,ted_wnd_t |
1338 | IgorA | 526 | mov ecx,[sc.work_text] |
527 | or ecx,0x80000000 |
||
528 | mov edx,txtFindNext |
||
529 | int 0x40 |
||
530 | |||
531 | pop edx ecx ebx eax |
||
1449 | IgorA | 532 | jmp .end_f |
1338 | IgorA | 533 | @@: |
534 | push eax edx |
||
535 | mov eax,8 |
||
536 | mov edx,201 |
||
537 | or edx,0x80000000 |
||
538 | int 0x40 |
||
539 | pop edx eax |
||
1449 | IgorA | 540 | .end_f: |
541 | pop edi |
||
1338 | IgorA | 542 | ret |
1449 | IgorA | 543 | endp |
1338 | IgorA | 544 | |
1449 | IgorA | 545 | proc draw_panel_syntax, edit:dword |
546 | push edi |
||
547 | mov edi,dword[edit] |
||
548 | |||
1338 | IgorA | 549 | cmp byte[panel_id],TE_PANEL_SYNTAX ;if not panel |
550 | jne @f |
||
551 | push eax ebx ecx edx |
||
552 | |||
553 | mov eax,13 ;рисование прямоугольника |
||
554 | mov ebx,TE_PANEL_WIDTH |
||
1449 | IgorA | 555 | mov ecx,ted_wnd_t |
1338 | IgorA | 556 | shl ecx,16 |
557 | mov cx,20 |
||
558 | mov edx,[sc.work] |
||
1449 | IgorA | 559 | int 0x40 ;рисование верхнего фонового прямоугольника |
1338 | IgorA | 560 | |
1449 | IgorA | 561 | stdcall dword[tl_draw], dword tree1 |
562 | mov [ws_dir_lbox.all_redraw],1 ;для полной перерисовки дочернего скроллинга |
||
563 | stdcall dword[scrollbar_ver_draw], dword ws_dir_lbox |
||
1338 | IgorA | 564 | |
565 | ror ecx,16 |
||
566 | add ecx,dword[tree1.box_height] |
||
567 | add ecx,20 |
||
1449 | IgorA | 568 | and ecx,0xffff |
1338 | IgorA | 569 | ror ecx,16 |
1449 | IgorA | 570 | add ecx,ted_wnd_h |
1338 | IgorA | 571 | add cx,word[hScr.size_y] |
572 | sub cx,20 |
||
573 | sub ecx,dword[tree1.box_height] |
||
574 | inc cx |
||
1449 | IgorA | 575 | int 0x40 ;рисование нижнего фонового прямоугольника |
1338 | IgorA | 576 | |
577 | mov eax,8 ;кнопка |
||
578 | mov ebx,5*65536+65 |
||
1449 | IgorA | 579 | mov ecx,ted_wnd_t |
580 | add ecx,25 |
||
1338 | IgorA | 581 | add ecx,dword[tree1.box_height] |
582 | shl ecx,16 |
||
583 | mov cx,20 |
||
584 | mov edx,200 ;button id |
||
585 | mov esi,[sc.work_button] |
||
586 | int 0x40 |
||
587 | |||
588 | mov eax,4 ;рисование текста |
||
589 | mov ebx,30*65536+5 |
||
1449 | IgorA | 590 | add ebx,ted_wnd_t |
1338 | IgorA | 591 | mov ecx,[sc.work_text] |
592 | or ecx,0x80000000 |
||
593 | mov edx,txtFormatCapt |
||
594 | int 0x40 |
||
595 | |||
596 | mov ebx,10*65536+30 |
||
597 | add ebx,dword[tree1.box_height] |
||
1449 | IgorA | 598 | add ebx,ted_wnd_t |
1338 | IgorA | 599 | mov edx,txtFormatApply |
600 | int 0x40 |
||
601 | |||
602 | pop edx ecx ebx eax |
||
1449 | IgorA | 603 | jmp .end_f |
1338 | IgorA | 604 | @@: |
1449 | IgorA | 605 | push eax edx |
606 | mov eax,8 |
||
607 | mov edx,200 |
||
608 | or edx,0x80000000 |
||
609 | int 0x40 ;если нет панели то удаляем кнопку |
||
610 | pop edx eax |
||
611 | .end_f: |
||
612 | pop edi |
||
1338 | IgorA | 613 | ret |
1449 | IgorA | 614 | endp |
1338 | IgorA | 615 | |
1449 | IgorA | 616 | proc draw_cur_line, edit:dword |
617 | pushad |
||
618 | mov edi,dword[edit] |
||
1338 | IgorA | 619 | |
1449 | IgorA | 620 | mov ebx,ted_wnd_l |
621 | add ebx,ted_rec_l |
||
1338 | IgorA | 622 | shl ebx,16 |
1449 | IgorA | 623 | mov eax,[cur_y] |
624 | imul eax,ted_rec_h |
||
625 | mov bx,ax |
||
626 | add ebx,ted_wnd_t |
||
627 | add ebx,ted_rec_t ;ebx - координаты для прямоугольника очистки линии |
||
628 | add ebx,0x10001 ;добавляем отступы для выравнивания буквы по центру |
||
1338 | IgorA | 629 | |
630 | call SelNormalize ;need before draw select |
||
1449 | IgorA | 631 | mov ecx,[cur_y] |
632 | add ecx,[wScr.position] |
||
633 | stdcall clear_line_before_draw, tedit0, ebx,1,ecx |
||
1338 | IgorA | 634 | |
635 | mov esi,[hScr.position] |
||
636 | call GetPosByParam |
||
637 | |||
638 | cmp [gpOpt],2 |
||
639 | jne .no_draw_text |
||
640 | ; mov eax,4 ;draw text |
||
641 | call GetSymbColor |
||
642 | mov esi,1 ;draw 1 symbol |
||
643 | @@: |
||
644 | ;call IteratNext |
||
645 | cmp edx,[tex_1] |
||
646 | jle .no_draw_text |
||
647 | |||
648 | ; *** цветовая разметка |
||
649 | cmp byte[mode_colored],0 |
||
650 | je .no_col_change |
||
651 | cmp byte[edx+1],0 |
||
652 | je .no_col_change |
||
653 | call GetSymbColor |
||
654 | .no_col_change: |
||
655 | |||
656 | mov eax,4 ;draw text |
||
657 | cmp byte [edx],13 |
||
658 | jne .no_13 |
||
659 | cmp [invis],1 |
||
660 | jne .no_draw_text |
||
661 | push edx |
||
662 | mov edx,symbol_new_line |
||
663 | int 0x40 |
||
664 | pop edx |
||
665 | jmp .no_draw_text |
||
666 | .no_13: |
||
667 | |||
668 | int 0x40 |
||
669 | ror ebx,16 |
||
1449 | IgorA | 670 | add ebx,ted_rec_w |
671 | mov eax,ted_wnd_w |
||
672 | add eax,ted_wnd_l ;ax = отступ по оси x |
||
1338 | IgorA | 673 | cmp bx,ax |
674 | jge .no_draw_text ;Opt |
||
675 | ror ebx,16 |
||
676 | call IteratNext |
||
677 | jmp @b |
||
678 | .no_draw_text: |
||
679 | |||
1449 | IgorA | 680 | stdcall draw_main_cursor, tedit0 |
681 | popad |
||
1338 | IgorA | 682 | ret |
1449 | IgorA | 683 | endp |
1338 | IgorA | 684 | |
685 | MIN_M_WND_H equ 100 |
||
686 | MIN_W_SCRL_ARE equ 3 |
||
687 | MIN_H_SCRL_ARE equ 3 |
||
1449 | IgorA | 688 | proc EvSize, edit:dword |
1338 | IgorA | 689 | push eax ecx edx edi |
1449 | IgorA | 690 | mov edi,dword[edit] |
1338 | IgorA | 691 | |
1449 | IgorA | 692 | m2m ted_wnd_w,[procinfo.client_box.width] ;ставим ширину окна редактора равной ширине всего окна |
693 | mov eax,ted_wnd_l |
||
694 | sub ted_wnd_w,eax ;отнимаем отступ слева |
||
695 | mov eax,[wScr] ;+0 size_x |
||
696 | and eax,0xffff |
||
697 | sub ted_wnd_w,eax ;отнимаем ширину верт. скроллинга |
||
698 | |||
699 | m2m ted_wnd_h,[procinfo.client_box.height] ;ставим высоту окна редактора равной высоте всего окна |
||
700 | cmp ted_wnd_h,MIN_M_WND_H |
||
1338 | IgorA | 701 | jg @f |
1449 | IgorA | 702 | mov ted_wnd_h,MIN_M_WND_H |
1338 | IgorA | 703 | @@: |
704 | |||
705 | mov ax,word[hScr.size_y] |
||
1449 | IgorA | 706 | and eax,0xffff |
707 | sub ted_wnd_h,eax ;отнимаем высоту гориз. скроллинга |
||
708 | mov eax,ted_wnd_h ;eax = высота окна - высота гориз. скроллинга |
||
709 | mov word[hScr.start_y],ax ;передвигаем гориз. скроллинг |
||
710 | mov eax,ted_wnd_t |
||
711 | sub ted_wnd_h,eax ;отнимаем отступ сверху |
||
1338 | IgorA | 712 | |
1449 | IgorA | 713 | mov eax,ted_wnd_w |
714 | mov ecx,ted_wnd_l |
||
715 | add eax,ecx |
||
716 | mov word[wScr.start_x],ax ;передвигаем верт. скроллинг |
||
717 | mov eax,ted_wnd_h |
||
718 | mov word[wScr.size_y],ax ;задаем высоту верт. скроллинга |
||
1338 | IgorA | 719 | |
1449 | IgorA | 720 | add ecx,ted_rec_l ;ecx=ted_wnd_l+ted_rec_l |
721 | mov [hScr.start_x],cx ;сдвигаем гориз. скроллинг по размеру левого отступа для цифр |
||
722 | mov eax,ted_wnd_w |
||
723 | sub eax,ted_rec_l |
||
724 | mov word[hScr.size_x],ax ;задаем ширину гориз. скроллинга |
||
1338 | IgorA | 725 | |
1449 | IgorA | 726 | mov eax,ted_wnd_h ;calculate lines in page |
727 | sub eax,ted_rec_t |
||
1338 | IgorA | 728 | xor edx,edx |
1449 | IgorA | 729 | mov ecx,ted_rec_h |
1338 | IgorA | 730 | div ecx |
731 | cmp eax,MIN_W_SCRL_ARE |
||
732 | jg @f |
||
733 | mov eax,MIN_W_SCRL_ARE |
||
734 | @@: |
||
735 | mov [wScr.cur_area],eax |
||
736 | |||
1449 | IgorA | 737 | mov eax,ted_wnd_w ;calculate cols in page |
738 | sub eax,ted_rec_l |
||
1338 | IgorA | 739 | xor edx,edx |
1449 | IgorA | 740 | mov ecx,ted_rec_w |
1338 | IgorA | 741 | div ecx |
742 | cmp eax,MIN_H_SCRL_ARE |
||
743 | jg @f |
||
744 | mov eax,MIN_H_SCRL_ARE |
||
745 | @@: |
||
746 | dec eax ; ??? |
||
747 | mov [hScr.cur_area],eax |
||
748 | |||
1449 | IgorA | 749 | mov eax,ted_wnd_t |
1338 | IgorA | 750 | mov edi,dword tree1 |
1449 | IgorA | 751 | mov tl_box_top,eax ;=ted_wnd_t |
1338 | IgorA | 752 | add tl_box_top,20 |
753 | |||
1449 | IgorA | 754 | mov dword[edit2.top],eax ;=ted_wnd_t |
1338 | IgorA | 755 | add dword[edit2.top],20 |
756 | |||
757 | pop edi edx ecx eax |
||
758 | call OnInitialUpdate |
||
759 | ret |
||
1449 | IgorA | 760 | endp |
1338 | IgorA | 761 | |
762 | OnInitialUpdate: |
||
763 | mov [wScr.redraw],1 |
||
764 | mov [hScr.redraw],1 |
||
765 | ret |
||
766 | |||
767 | ;output: |
||
768 | ; edx = pointer to symbol |
||
769 | ; edx = 0 if text not in screen |
||
770 | GetFirstVisiblePos: |
||
771 | push ecx |
||
772 | mov edx,[tex] |
||
773 | xor ecx,ecx |
||
774 | @@: |
||
775 | cmp ecx,[wScr.position] |
||
776 | je @f |
||
777 | call IteratNext |
||
778 | cmp edx,[tex_1] |
||
779 | jle @f |
||
780 | cmp byte [edx],13 |
||
781 | jne @b |
||
782 | inc ecx |
||
783 | jmp @b |
||
784 | @@: |
||
785 | |||
786 | cmp ecx,[wScr.position] |
||
787 | je @f |
||
788 | xor edx,edx |
||
789 | @@: |
||
790 | cmp ecx,[wScr.max_area] |
||
791 | jle @f |
||
792 | mov [wScr.max_area],ecx |
||
793 | @@: |
||
794 | pop ecx |
||
795 | call OptDrawLineLeft |
||
796 | ret |
||
797 | |||
798 | |||
799 | |||
800 | ;input: |
||
801 | ; edx = pointer to symbol |
||
802 | ;output: |
||
803 | ; edx = pointer to first left symbol |
||
804 | OptDrawLineLeft: |
||
805 | push ecx |
||
806 | mov ecx,[hScr.position] |
||
807 | cmp ecx,0 |
||
808 | je .ret_f |
||
809 | push eax |
||
810 | mov eax,edx |
||
811 | |||
812 | cmp edx,[tex] |
||
813 | jne @f |
||
814 | call IteratNext |
||
815 | jmp .beg_cycle |
||
816 | @@: |
||
817 | |||
818 | cmp ecx,0 |
||
819 | je @f |
||
820 | |||
821 | cmp byte[edx],13 |
||
822 | jne @f |
||
823 | call IteratNext |
||
824 | .beg_cycle: |
||
825 | @@: |
||
826 | cmp edx,[tex_1] |
||
827 | jle @f |
||
828 | cmp byte[edx],13 |
||
829 | je @f |
||
830 | cmp ecx,0 |
||
831 | je @f |
||
832 | mov eax,edx |
||
833 | call IteratNext |
||
834 | dec ecx |
||
835 | jmp @b |
||
836 | @@: |
||
837 | mov edx,eax |
||
838 | pop eax |
||
839 | .ret_f: |
||
840 | pop ecx |
||
841 | call GetSymbColor |
||
842 | ret |
||
843 | |||
844 | ;input: |
||
845 | ; edx = pointer to symbol |
||
846 | ;output: |
||
847 | ; edx = pointer to 13 symbol |
||
848 | OptDrawLineRight: |
||
849 | push eax |
||
850 | mov eax,edx |
||
851 | @@: |
||
852 | cmp edx,[tex_1] |
||
853 | jle @f |
||
854 | cmp byte[edx],13 |
||
855 | je @f |
||
856 | mov eax,edx |
||
857 | call IteratNext |
||
858 | jmp @b |
||
859 | @@: |
||
860 | mov edx,eax ;perv sumbol |
||
861 | pop eax |
||
862 | call GetSymbColor |
||
863 | ret |
||
864 | |||
1449 | IgorA | 865 | proc draw_main_cursor, edit:dword |
866 | pushad |
||
867 | mov edi,dword[edit] |
||
1338 | IgorA | 868 | |
869 | mov eax,13 ;draw cursor |
||
1449 | IgorA | 870 | mov ecx,ted_wnd_t ;calc rect -> y0,y1 |
871 | add ecx,ted_rec_t |
||
1338 | IgorA | 872 | mov edx,[cur_y] |
1449 | IgorA | 873 | imul edx,ted_rec_h |
1338 | IgorA | 874 | add ecx,edx |
875 | |||
1449 | IgorA | 876 | cmp [curMod],1 ;проверка режима работы курсора (обычный или вставка) |
1338 | IgorA | 877 | jne @f |
1449 | IgorA | 878 | mov edx,ted_rec_h |
879 | inc edx ;1->1, 3->2, 5->3, ... |
||
880 | shr edx,1 ;edx = высота строки деленная на 2 (когда курсор не полный) |
||
1338 | IgorA | 881 | add ecx,edx |
882 | @@: |
||
883 | shl ecx,16 |
||
1449 | IgorA | 884 | add ecx,ted_rec_h |
1338 | IgorA | 885 | cmp [curMod],1 |
886 | jne @f |
||
1449 | IgorA | 887 | shr cx,1 ;делим высоту курсора на 2 |
1338 | IgorA | 888 | @@: |
889 | |||
1449 | IgorA | 890 | mov ebx,ted_wnd_l ;calc rect -> x0,x1 |
891 | add ebx,ted_rec_l |
||
1338 | IgorA | 892 | mov edx,[cur_x] |
1449 | IgorA | 893 | imul edx,ted_rec_w |
1338 | IgorA | 894 | add ebx,edx |
895 | shl ebx,16 |
||
1449 | IgorA | 896 | add ebx,ted_rec_w |
1338 | IgorA | 897 | |
898 | mov edx,[CURSOR_COLOR] |
||
1449 | IgorA | 899 | int 0x40 ;вывод курсора |
1338 | IgorA | 900 | |
901 | call GetPos |
||
902 | cmp [gpOpt],2 |
||
903 | jne @f |
||
904 | mov eax,4 ;draw text |
||
905 | mov esi,1 |
||
906 | ror ecx,16 |
||
907 | mov bx,cx |
||
908 | add ebx,0x10001 |
||
909 | cmp [curMod],1 |
||
910 | jne .no_up_tetx |
||
1449 | IgorA | 911 | mov ecx,ted_rec_h |
1338 | IgorA | 912 | inc cx ; 1->1, 3->2, 5->3, ... |
913 | shr cx,1 |
||
914 | sub bx,cx |
||
915 | .no_up_tetx: |
||
916 | mov ecx,[CUR_TEXT_COLOR] |
||
917 | call ConvertInvisSymb |
||
918 | int 0x40 |
||
919 | @@: |
||
920 | |||
921 | mov eax,4 |
||
1449 | IgorA | 922 | mov ebx,ted_wnd_l |
923 | add ebx,ted_rec_l |
||
1338 | IgorA | 924 | shl ebx,16 |
1449 | IgorA | 925 | add ebx,ted_wnd_t |
1338 | IgorA | 926 | add ebx,3 |
927 | mov ecx,[WND_BORD_COLOR] |
||
928 | or ecx,0x80000000 |
||
929 | mov edx,txtRow |
||
1449 | IgorA | 930 | int 0x40 ;вывод подписи 'Строка' |
1338 | IgorA | 931 | |
932 | add ebx,0x500000 |
||
933 | mov edx,txtCol |
||
1449 | IgorA | 934 | int 0x40 ;вывод подписи 'Знак' |
1338 | IgorA | 935 | |
936 | cmp [tim_Undo],0 |
||
937 | je @f |
||
938 | add ebx,0x500000 |
||
939 | mov edx,txtOtm |
||
940 | int 0x40 |
||
941 | sub ebx,0x500000 |
||
942 | @@: |
||
943 | |||
1449 | IgorA | 944 | stdcall draw_bufer, edi |
945 | stdcall draw_help_f1, edi |
||
1338 | IgorA | 946 | |
947 | mov eax,47 ;draw cursor coords |
||
948 | mov esi,[WND_BORD_COLOR] |
||
949 | or esi,0x40000000 |
||
950 | |||
951 | mov edx,ebx |
||
952 | ror edx,16 |
||
953 | sub edx,35 |
||
954 | ror edx,16 |
||
955 | ;add edx,3 |
||
956 | mov ebx,0x40000 ;Row=... |
||
957 | mov ecx,[cur_y] |
||
958 | inc ecx |
||
959 | add ecx,[wScr.position] |
||
1449 | IgorA | 960 | ; edi <> tedit ---------------------------------------------------------------- |
961 | mov edi,[WND_WORK_COLOR] |
||
1338 | IgorA | 962 | int 0x40 |
963 | |||
964 | ;mov ebx,0x40000 ;Col=... |
||
965 | mov ecx,[cur_x] |
||
966 | inc ecx |
||
967 | add ecx,[hScr.position] |
||
968 | add edx,0x500000 |
||
969 | int 0x40 |
||
970 | |||
971 | cmp [tim_Undo],0 |
||
972 | je @f |
||
973 | mov ecx,[tim_Undo] |
||
974 | add edx,0x500000 |
||
975 | int 0x40 |
||
976 | @@: |
||
977 | |||
1449 | IgorA | 978 | popad |
1338 | IgorA | 979 | ret |
1449 | IgorA | 980 | endp |
1338 | IgorA | 981 | |
1449 | IgorA | 982 | proc draw_bufer, edit:dword |
983 | pushad |
||
984 | mov edi,dword[edit] |
||
1338 | IgorA | 985 | |
986 | cmp byte[buf],0 |
||
987 | je @f |
||
1449 | IgorA | 988 | mov ebx,ted_wnd_l |
989 | add ebx,ted_rec_l |
||
1338 | IgorA | 990 | add bx,250 |
991 | shl ebx,16 |
||
1449 | IgorA | 992 | add ebx,ted_wnd_t |
1338 | IgorA | 993 | add ebx,3 |
994 | mov ecx,[WND_BORD_COLOR] |
||
995 | or ecx,0x40000000 |
||
996 | mov edi,[WND_WORK_COLOR] |
||
997 | |||
998 | mov edx,txtBuf |
||
999 | mov esi,buf |
||
1000 | call strlen |
||
1343 | IgorA | 1001 | if lang eq ru |
1338 | IgorA | 1002 | cmp eax,15 |
1003 | jle .crop_buf |
||
1004 | mov eax,15 |
||
1005 | .crop_buf: |
||
1343 | IgorA | 1006 | mov esi,7 ;7=len(txtBuf) |
1007 | else |
||
1008 | cmp eax,14 |
||
1009 | jle .crop_buf |
||
1010 | mov eax,14 |
||
1011 | .crop_buf: |
||
1012 | mov esi,8 ;8=len(txtBuf) |
||
1013 | end if |
||
1338 | IgorA | 1014 | add esi,eax |
1015 | |||
1016 | mov eax,4 |
||
1017 | int 0x40 |
||
1018 | @@: |
||
1449 | IgorA | 1019 | popad |
1338 | IgorA | 1020 | ret |
1449 | IgorA | 1021 | endp |
1338 | IgorA | 1022 | |
1449 | IgorA | 1023 | proc draw_help_f1, edit:dword |
1024 | pushad |
||
1025 | mov edi,dword[edit] |
||
1026 | |||
1338 | IgorA | 1027 | mov eax,13 ;clear place before draw help |
1449 | IgorA | 1028 | mov ebx,ted_wnd_l |
1029 | add ebx,ted_rec_l |
||
1338 | IgorA | 1030 | shl ebx,16 |
1449 | IgorA | 1031 | add ebx,ted_wnd_w |
1032 | sub ebx,ted_rec_l |
||
1033 | mov ecx,ted_wnd_t |
||
1338 | IgorA | 1034 | add ecx,13 |
1035 | shl ecx,16 |
||
1449 | IgorA | 1036 | add ecx,ted_rec_h |
1338 | IgorA | 1037 | mov edx,[WND_CAPT_COLOR] |
1038 | int 0x40 |
||
1039 | |||
1040 | cmp [help_id],-1 |
||
1449 | IgorA | 1041 | je @f |
1338 | IgorA | 1042 | mov eax,[help_id] |
1043 | ColToIndexOffset eax,edx |
||
1044 | |||
1045 | ;SetCoordinates |
||
1449 | IgorA | 1046 | mov ebx,ted_wnd_l |
1047 | add ebx,ted_rec_l |
||
1338 | IgorA | 1048 | shl ebx,16 |
1449 | IgorA | 1049 | add ebx,ted_wnd_t |
1338 | IgorA | 1050 | add ebx,13 ;=3+10 |
1051 | |||
1052 | ;SetTextColor |
||
1053 | xor eax,eax |
||
1054 | mov al,byte[edx+MAX_COLOR_WORD_LEN+6] |
||
1055 | shl ax,2 |
||
1056 | mov ecx,[tex_colors] |
||
1057 | add ecx,eax |
||
1058 | push dword[ecx] |
||
1059 | pop ecx |
||
1060 | or ecx,0xc0000000 ;SetTextStyles |
||
1061 | mov edi,[WND_WORK_COLOR] |
||
1449 | IgorA | 1062 | ; edi <> edit ----------------------------------------------------------------- |
1338 | IgorA | 1063 | mov eax,4 |
1064 | int 0x40 |
||
1065 | |||
1066 | ;*** draw help string *** |
||
1067 | mov ecx,[WND_BORD_COLOR] |
||
1068 | or ecx,0x80000000 |
||
1069 | mov edi,dword[edx+MAX_COLOR_WORD_LEN] |
||
1070 | cmp edi,0 |
||
1071 | je @f |
||
1072 | add edi,dword[tex_help_f1] |
||
1073 | mov edx,edi |
||
1074 | add ebx,0x500000 |
||
1075 | int 0x40 |
||
1449 | IgorA | 1076 | @@: |
1077 | popad |
||
1338 | IgorA | 1078 | ret |
1449 | IgorA | 1079 | endp |
1338 | IgorA | 1080 | |
1449 | IgorA | 1081 | proc draw_line_numbers, edit:dword |
1082 | pushad |
||
1083 | mov edi,dword[edit] |
||
1084 | |||
1085 | ;top panel with caption |
||
1086 | mov ebx,ted_wnd_l |
||
1087 | ; add ebx,ted_rec_l |
||
1088 | shl ebx,16 |
||
1089 | add ebx,ted_wnd_w |
||
1090 | ; sub ebx,ted_rec_l |
||
1091 | mov edx,[WND_WORK_COLOR] |
||
1092 | mov ecx,ted_wnd_t |
||
1093 | shl ecx,16 |
||
1094 | add ecx,ted_rec_t |
||
1095 | mov eax,13 |
||
1096 | mov edx,[WND_CAPT_COLOR] |
||
1097 | int 0x40 |
||
1098 | |||
1338 | IgorA | 1099 | ;line numbers |
1100 | mov ebx,0x40000 ;format |
||
1101 | mov ecx,[wScr.position] |
||
1102 | inc ecx |
||
1449 | IgorA | 1103 | mov edx,3 |
1104 | add edx,ted_wnd_l |
||
1105 | rol edx,16 |
||
1106 | add edx,ted_wnd_t |
||
1107 | add edx,ted_rec_t |
||
1338 | IgorA | 1108 | @@: |
1109 | |||
1449 | IgorA | 1110 | push ebx ecx edx |
1338 | IgorA | 1111 | ;left panel with numbers |
1449 | IgorA | 1112 | mov ebx,ted_wnd_l |
1338 | IgorA | 1113 | shl ebx,16 |
1449 | IgorA | 1114 | add ebx,ted_rec_l |
1115 | mov ecx,ted_rec_h |
||
1116 | rol ecx,16 |
||
1338 | IgorA | 1117 | mov cx,dx |
1449 | IgorA | 1118 | rol ecx,16 |
1119 | mov eax,13 |
||
1338 | IgorA | 1120 | mov edx,[WND_CAPT_COLOR] |
1449 | IgorA | 1121 | int 0x40 ;рисуем прямоугольник под номером строки |
1122 | pop edx ecx ebx |
||
1338 | IgorA | 1123 | |
1449 | IgorA | 1124 | mov eax,47 |
1125 | mov esi,[WND_BORD_COLOR] |
||
1126 | int 0x40 ;рисуем номер строки |
||
1338 | IgorA | 1127 | inc ecx |
1449 | IgorA | 1128 | add edx,ted_rec_h |
1129 | sub edx,ted_wnd_t |
||
1130 | mov esi,edx |
||
1131 | and esi,0xffff |
||
1132 | cmp esi,ted_wnd_h |
||
1338 | IgorA | 1133 | jge @f |
1449 | IgorA | 1134 | add edx,ted_wnd_t |
1338 | IgorA | 1135 | jmp @b |
1136 | @@: |
||
1137 | |||
1449 | IgorA | 1138 | popad |
1338 | IgorA | 1139 | ret |
1449 | IgorA | 1140 | endp |
1141 | |||
1142 | ;this function need to optimize output |
||
1143 | proc draw_cursor_sumb, edit:dword |
||
1144 | push eax ecx edx edi |
||
1145 | mov edi,dword[edit] |
||
1338 | IgorA | 1146 | |
1147 | mov eax,13 ;rect |
||
1449 | IgorA | 1148 | mov ebx,ted_wnd_l |
1149 | add ebx,ted_rec_l |
||
1338 | IgorA | 1150 | mov edx,[cur_x] |
1449 | IgorA | 1151 | imul edx,ted_rec_w |
1338 | IgorA | 1152 | add ebx,edx |
1153 | shl ebx,16 |
||
1449 | IgorA | 1154 | add ebx,ted_rec_w |
1338 | IgorA | 1155 | |
1449 | IgorA | 1156 | mov ecx,ted_wnd_t ;calc rect -> y0,y1 |
1157 | add ecx,ted_rec_t |
||
1338 | IgorA | 1158 | mov edx,[cur_y] |
1449 | IgorA | 1159 | imul edx,ted_rec_h |
1338 | IgorA | 1160 | add ecx,edx |
1161 | shl ecx,16 |
||
1449 | IgorA | 1162 | add ecx,ted_rec_h |
1338 | IgorA | 1163 | |
1164 | mov edx,[WND_WORK_COLOR] |
||
1165 | push ecx |
||
1166 | call SelNormalize |
||
1167 | |||
1168 | mov ecx,[wScr.position] |
||
1169 | sub [seln.y0],ecx |
||
1170 | sub [seln.y1],ecx |
||
1171 | |||
1172 | mov ecx,[cur_y] |
||
1173 | cmp ecx,[seln.y0] |
||
1174 | jl .no_cur_sel |
||
1175 | cmp ecx,[seln.y1] |
||
1176 | jg .no_cur_sel |
||
1177 | mov edx,[SELECT_COLOR] |
||
1178 | |||
1179 | cmp ecx,[seln.y0] |
||
1180 | jne @f |
||
1181 | mov ecx,[cur_x] |
||
1182 | add ecx,[hScr.position] |
||
1183 | cmp ecx,[seln.x0] |
||
1184 | jge @f |
||
1185 | mov edx,[WND_WORK_COLOR] |
||
1186 | @@: |
||
1187 | |||
1188 | mov ecx,[cur_y] |
||
1189 | cmp ecx,[seln.y1] |
||
1190 | jne .no_cur_sel |
||
1191 | mov ecx,[cur_x] |
||
1192 | add ecx,[hScr.position] |
||
1193 | cmp ecx,[seln.x1] |
||
1194 | jl .no_cur_sel |
||
1195 | mov edx,[WND_WORK_COLOR] |
||
1196 | |||
1197 | .no_cur_sel: |
||
1198 | pop ecx |
||
1199 | int 0x40 |
||
1200 | |||
1201 | call GetPos |
||
1202 | cmp [gpOpt],2 |
||
1203 | jne @f |
||
1204 | push esi |
||
1205 | mov eax,4 ;draw text |
||
1206 | mov esi,1 |
||
1207 | ror ecx,16 |
||
1208 | mov bx,cx |
||
1209 | add ebx,0x10001 |
||
1210 | ;mov ecx,[WND_TEXT_COLOR] |
||
1211 | call GetSymbColor |
||
1212 | call ConvertInvisSymb |
||
1213 | int 0x40 |
||
1214 | pop esi |
||
1215 | @@: |
||
1216 | |||
1449 | IgorA | 1217 | pop edi edx ecx eax |
1338 | IgorA | 1218 | ret |
1449 | IgorA | 1219 | endp |
1338 | IgorA | 1220 | |
1221 | |||
1222 | ;input: |
||
1223 | ; edx = pointer to text |
||
1224 | ;output: |
||
1225 | ; ecx = color |
||
1226 | ; if mode_colored=0 then ecx=WND_TEXT_COLOR |
||
1227 | GetSymbColor: |
||
1228 | mov ecx,[WND_TEXT_COLOR] |
||
1229 | |||
1230 | push eax edx |
||
1231 | cmp byte[mode_colored],0 |
||
1232 | je .exit |
||
1233 | jmp .on_first |
||
1234 | @@: |
||
1235 | call IteratPerv |
||
1236 | cmp edx,[tex_1] |
||
1237 | jle .exit |
||
1238 | .on_first: |
||
1239 | xor eax,eax |
||
1240 | mov al,byte[edx+1] |
||
1241 | cmp al,0 |
||
1242 | je @b |
||
1243 | |||
1244 | ;cmp al,0xff |
||
1245 | ;je .exit |
||
1246 | cmp eax,[ColColor] |
||
1247 | jge .exit |
||
1248 | |||
1249 | shl ax,2 ;*4 |
||
1250 | mov ecx,[tex_colors] |
||
1251 | add ecx,eax |
||
1252 | push dword[ecx] |
||
1253 | pop ecx |
||
1254 | .exit: |
||
1255 | pop edx eax |
||
1256 | ret |
||
1257 | |||
1258 | ;input: |
||
1259 | ; edx = pointer to text |
||
1260 | ConvertInvisSymb: |
||
1261 | cmp [invis],1 |
||
1262 | jne @f |
||
1263 | cmp byte [edx],13 |
||
1264 | jne @f |
||
1265 | mov edx,symbol_new_line |
||
1266 | @@: |
||
1267 | ret |
||
1268 | |||
1269 | ;input: |
||
1270 | ; ecx = 0x4000____ |
||
1271 | ; cx = icon index |
||
1272 | ; edx = x*2^16+y |
||
1273 | draw_but_icon: |
||
1274 | push eax ebx |
||
1275 | |||
1276 | mov eax,8 ;кнопка |
||
1277 | push ecx edx esi |
||
1278 | mov ebx,edx |
||
1279 | mov edx,ecx |
||
1280 | add edx,3 |
||
1281 | mov cx,bx |
||
1282 | shl ecx,16 |
||
1283 | mov cx,19 ;=20-1 |
||
1284 | mov bx,19 ;=20-1 |
||
1285 | mov esi,[sc.work_button] |
||
1286 | int 0x40 |
||
1287 | pop esi edx ecx |
||
1288 | |||
1289 | mov ebx,ecx |
||
1290 | ror ebx,16 |
||
1291 | cmp bx,0x4000 |
||
1292 | jne @f |
||
1293 | |||
1294 | mov eax,7 ;bmp |
||
1295 | mov ebx,[bmp_icon] |
||
1296 | push ecx |
||
1297 | and ecx,0xffff |
||
1298 | imul ecx,1200 |
||
1299 | add ebx,ecx |
||
1300 | mov ecx,20 |
||
1301 | shl ecx,16 |
||
1302 | add ecx,20 |
||
1303 | int 0x40 |
||
1304 | pop ecx |
||
1305 | |||
1306 | @@: |
||
1307 | pop ebx eax |
||
1308 | ret>> |
||
1309 |