Subversion Repositories Kolibri OS

Rev

Rev 1449 | Rev 1457 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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