kolibrios-gitea/programs/develop/tinypad/trunk/tp-draw.asm
Mihail Semenyako (mike.dld) c6080c59e9 Tinypad 4.0.4 in progress (further fixing)
git-svn-id: svn://kolibrios.org@280 a494cfbc-eb01-0410-851d-a64ba20cac60
2007-01-18 21:14:15 +00:00

1344 lines
26 KiB
NASM

;-----------------------------------------------------------------------------
func drawwindow ;///// DRAW WINDOW ///////////////////////////////////////////
;-----------------------------------------------------------------------------
cmp [just_from_popup],1
jne @f
ret
@@:
mcall 48,3,sc,sizeof.system_colors
call calc_3d_colors
mcall 12,1
push [color_tbl+4*5]
pop [sc.work]
mov edx,[sc.work]
add edx,0x33000000
mov ebx,[mainwnd_pos.x-2]
mov bx,word[mainwnd_pos.w]
mov ecx,[mainwnd_pos.y-2]
mov cx,word[mainwnd_pos.h]
mcall 0,,,,,s_title
mcall 9,p_info,-1
mov esi,p_info.box.left
mov edi,mainwnd_pos
mov ecx,4
cld
rep movsd
; mcall 9,p_info,-1
cmp [p_info.client_box.height],LINEH
jl .exit.2
;++ calculate editor bounds ++
mov [tab_bar.Bounds.Left],0
mov [tab_bar.Bounds.Top],ATOPH
mov eax,[p_info.client_box.width]
mov [tab_bar.Bounds.Right],eax
mov eax,[p_info.client_box.height]
sub eax,[bot_dlg_height]
add eax,-STATH-1
mov [tab_bar.Bounds.Bottom],eax
call align_editor_in_tab
mov [top_ofs],ATOPH;+1
;// --- columns.scr and lines.scr calculation ---
mov eax,[p_info.client_box.height]
add eax,-STATH+1;*3-2-2
sub eax,[bot_dlg_height]
mov [bot_ofs],eax
call draw_bottom_dialog
; mov [do_not_draw],1 ; do_not_draw = true
; mov ebx,eax
; sub ebx,[top_ofs]
; sub ebx,SCRLW*3+AMINS+5
; js .no_draw
; dec [do_not_draw] ; do_not_draw = false
; sub eax,SCRLW+3
; sub eax,[top_ofs]
; cdq
; mov ebx,LINEH
; div ebx
; mov [lines.scr],eax
;-- horizontal lines for menubar and statusbar --
;mov ebx,[p_info.client_box.width]
;mov ecx,[top_ofs-2]
;mov cx,word[top_ofs]
;sub ecx,1*65536+1
;mcall 38,,,[cl_3d_inset];[sc.work_text]
;mov ecx,[p_info.client_box.height]
;sub ecx,STATH+1
;push cx
;shl ecx,16
;pop cx
;mcall
inc [top_ofs]
call draw_main_menu
jmp .exit
.no_draw:
mov [top_ofs],2
mov eax,[p_info.client_box.height]
inc eax
mov [bot_ofs],eax
sub eax,2
push eax
add eax,-2-SCRLW
cdq
mov ebx,LINEH
idiv ebx
mov [lines.scr],eax
pop eax
mov ebx,[p_info.client_box.height]
sub ebx,SCRLW*3+AMINS+2
jns @f
inc [do_not_draw]
dec eax
cdq
mov ebx,LINEH
idiv ebx
mov [lines.scr],eax
mov eax,[p_info.client_box.width]
cdq
mov ebx,6
idiv ebx
mov [columns.scr],eax
@@:
.exit:
;-- draw file --
;call draw_file
;++ draw editor control ++
call draw_editor
call draw_tabctl
.exit.2:
mcall 12,2
ret
endf
;-----------------------------------------------------------------------------
func draw_bottom_dialog ;/////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
cmp [bot_dlg_height],0
je .exit
pushad
mov ebx,[p_info.client_box.width]
mov ecx,[bot_ofs]
dec ecx
push cx
shl ecx,16
pop cx
mcall 38,,,[cl_3d_inset]
mov ecx,[bot_ofs-2]
mov cx,word[bot_dlg_height]
dec ecx
mov ebx,[p_info.client_box.width]
inc ebx
mcall 13,,,[cl_3d_normal]
mov al,1
call [bot_dlg_handler]
popad
.exit:
ret
endf
mi_sel dd ?
mi_cur dd -1
;-----------------------------------------------------------------------------
func draw_main_menu ;/////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
mov ebx,[p_info.client_box.width]
inc ebx
mcall 13,,ATOPH-1,[cl_3d_normal]
mcall 38,[p_info.client_box.width],<ATOPH-1,ATOPH-1>,[cl_3d_inset]
mov edx,main_menu
mov ebx,9*65536+ATOPH/2-3;4
;mov ecx,[sc.work_text]
mov [mi_sel],0
mov edi,[mi_cur]
@@: inc [mi_sel]
cmp [mi_sel],main_menu.cnt_item
ja .exit
mov ecx,[sc.work_text]
cmp edi,[mi_sel]
jne .lp1
pushad
push edx
;mov ebx,[edx+0]
mov ecx,[edx+4]
add ecx,2*65536-2
mcall 13,[edx+0],,[sc.work];[cl_3d_pushed]
mov edx,[esp]
mov cx,[edx+6]
add ecx,-1*65536+1
add bx,[edx+2]
mcall 38,,,[cl_3d_inset]
mov edx,[esp]
add cx,[edx+4]
add cx,-2
mov bx,[edx+2]
mcall 38,,,[cl_3d_inset]
pop edx
movzx eax,word[edx]
add ebx,eax
shl eax,16
add ebx,eax
mcall 38,,,[cl_3d_inset]
popad
mov ecx,[color_tbl+4*0]
.lp1: add edx,8+1
movzx esi,byte[edx-1]
mcall 4
add edx,esi
add esi,2
imul esi,6*65536
add ebx,esi
jmp @b
.exit:
ret
endf
;-----------------------------------------------------------------------------
func draw_file.ex ;///////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
; Input:
; EAX = start line
; EBX = end line
;-----------------------------------------------------------------------------
call draw_editor;_text
ret
macro unused {
cmp [p_info.client_box.height],LINEH
jge @f
ret
@@:
call init_sel_vars
call check_bottom_right
pushad
cmp [lines.scr],0
jle draw_file.exit
cmp eax,ebx
jle @f
xchg eax,ebx
@@: cmp eax,[cur_editor.TopLeft.Y] ;! eax,[top_line]
jge @f
mov eax,[cur_editor.TopLeft.Y] ;! eax,[top_line]
@@: mov ecx,[cur_editor.TopLeft.Y] ;! ecx,[top_line]
add ecx,[lines.scr]
cmp ebx,ecx
jl @f
dec ecx
mov ebx,ecx
@@: cmp eax,ebx
jg draw_file.exit
mov ecx,eax
push eax
call get_line_offset
.start:
mov ecx,ebx
sub ecx,eax
inc ecx
mov ebx,[top_ofs]
add ebx,[left_ofs-2]
sub eax,[cur_editor.TopLeft.Y] ;! eax,[top_line]
imul eax,LINEH
add ebx,eax
imul ebp,[cur_editor.TopLeft.X],6*65536 ;! ebp,[left_col],6*65536
or [draw_blines],-1
jmp draw_file.next_line
}
endf
;-----------------------------------------------------------------------------
func draw_file ;//////////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
call draw_editor;_text
ret
macro unused {
cmp [p_info.client_box.height],LINEH
jge @f
ret
@@:
call init_sel_vars
call check_bottom_right
pushad
mov ebx,[top_ofs]
add ebx,[left_ofs-2]
mov ecx,[cur_editor.TopLeft.Y] ;! ecx,[top_line]
push ecx
call get_line_offset
.start:
add esp,4
mov ecx,[lines.scr]
or ecx,ecx
jle .exit
add esp,-4
imul ebp,[cur_editor.TopLeft.X],6*65536 ;! ebp,[left_col],6*65536
mov eax,[lines.scr]
sub eax,[cur_editor.Lines] ;! eax,[lines]
mov [draw_blines],eax
.next_line:
push ecx ebx
mov ecx,ebx
shl ecx,16
mov cl,LINEH
mov ebx,[p_info.client_box.width]
add ebx,-SCRLW
add ebx,[left_ofs-2]
sub ebx,[left_ofs]
add ebx,-1*65536+1
; selection (text background)
mov [in_sel],0
mov edx,[color_tbl+4*5]
mov eax,[esp+4*2]
cmp eax,[sel.begin.y]
jl .lp6
je .lp1
cmp eax,[sel.end.y]
jg .lp6
je .lp3
jmp .lp6.2
.lp1: mov eax,[sel.begin.y]
cmp eax,[sel.end.y]
je .lp5
.lp2: mov eax,[sel.begin.x]
sub eax,[cur_editor.TopLeft.X] ;! eax,[left_col]
jle .lp6.2
cmp eax,[columns.scr]
jge .lp6
imul eax,6
pushad
sub bx,ax
rol ebx,16
mov bx,ax
add ebx,[left_ofs];OLEFT-1
dec ebx
rol ebx,16
mov edx,[color_tbl+4*7]
mcall 13
popad
; inc eax
mov bx,ax
mov [in_sel],2
jmp .lp6
.lp3: mov eax,[sel.begin.y]
cmp eax,[sel.end.y]
je .lp5
.lp4: mov eax,[sel.end.x]
sub eax,[cur_editor.TopLeft.X] ;! eax,[left_col]
jle .lp6
cmp eax,[columns.scr]
jg .lp6.2
imul eax,6
pushad
sub bx,ax
rol ebx,16
add eax,[left_ofs];OLEFT-1
dec eax
mov bx,ax
rol ebx,16
; inc ebx
mcall 13
popad
mov edx,[color_tbl+4*7]
mov bx,ax
mov [in_sel],3
jmp .lp6
.lp5: mov eax,[cur_editor.TopLeft.X] ;! eax,[left_col]
cmp eax,[sel.begin.x]
jge .lp4
add eax,[columns.scr]
cmp eax,[sel.end.x]
jl .lp2
mov eax,[sel.begin.x]
cmp eax,[sel.end.x]
je .lp6
sub eax,[cur_editor.TopLeft.X] ;! eax,[left_col]
imul eax,6
pushad
mov ebx,[sel.end.x]
sub ebx,[sel.begin.x]
; inc ebx
imul ebx,6
sal ebx,16
dec eax
add eax,[left_ofs]
mov bx,ax
rol ebx,16
mov edx,[color_tbl+4*7]
mcall 13
movzx eax,bx
sar ebx,16
add eax,ebx
mov ebx,eax
sal ebx,16
sub ax,[esp+4*4]
neg ax
add ax,word[left_ofs]
mov bx,ax
mov edx,[color_tbl+4*5]
mcall 13
popad
mov bx,ax
mov [in_sel],4
jmp .lp6
.lp6.2:
mov edx,[color_tbl+4*7]
inc [in_sel]
.lp6:
mcall 13
lodsd
pushad
mov edx,[color_tbl+4*5]
test eax,0x00010000
jz @f
mov edx,[color_tbl+4*8]
test eax,0x00020000
jz @f
mov edx,[color_tbl+4*9]
@@: mov ebx,[left_ofs]
add ebx,-4
shl ebx,16
mov bx,LCHGW
mcall 13
popad
xor ecx,ecx
and eax,0x0000FFFF
mov [cur_line_len],eax
or eax,eax
ja .next_block
add esp,4*2
jmp .draw_cursor
.next_block:
push esi ecx
call get_next_part
pop ebx
push ecx
mov ecx,eax
push esi ebx
mov eax,ebx
sub ebx,[cur_editor.TopLeft.X] ;! ebx,[left_col]
cmp ebx,[columns.scr]
jge .skip_t
add ebx,esi
jle .skip_t
mov ebx,[esp+8+4*2] ;// 4*2=esi+ebx
sub eax,[cur_editor.TopLeft.X] ;! eax,[left_col]
jge .qqq
sub edx,eax
add esi,eax
; mov eax,OLEFT*65536
xor eax,eax
jmp .qqq2
.qqq:
; inc eax
imul eax,6*65536
.qqq2:
and ebx,0x0000FFFF
add eax,[left_ofs-2];OLEFT*65536
add ebx,eax
mov eax,[esp] ; ebx
add eax,[esp+4] ; esi
sub eax,[cur_editor.TopLeft.X] ;! eax,[left_col]
sub eax,[columns.scr]
jle .qweqwe
sub esi,eax
.qweqwe:
mov al,[in_sel]
cmp al,0
je .draw_t
dec al
jz .ya4
.nt1: dec al
jnz .nt2
mov eax,[esp]
cmp eax,[sel.begin.x]
jge .ya4
add eax,[esp+4]
cmp eax,[sel.begin.x]
jl .draw_t
;---[ selection crosses block from the right ]-(-
.ya1: mov eax,esi
mov esi,[sel.begin.x]
sub esi,[esp]
pushad
mov ecx,[cur_editor.TopLeft.X] ;! ecx,[left_col]
sub ecx,[esp+4*8]
jle @f
sub esi,ecx
sub [esp+4],ecx
@@: sub eax,esi
add edx,esi
imul esi,6
rol ebx,16
add bx,si
rol ebx,16
mov esi,eax
mov ecx,[color_tbl+4*6]
mcall 4
popad
jmp .draw_t
;----------------------------------------------)-
.nt2: dec al
jnz .nt3
mov eax,[esp]
cmp eax,[sel.end.x]
jge .draw_t
add eax,[esp+4]
cmp eax,[sel.end.x]
jl .ya4
;---[ selection crosses block from the left ]--(-
.ya2: mov eax,[sel.end.x]
sub eax,[esp]
push ebx
mov ebx,[esp+4]
sub ebx,[cur_editor.TopLeft.X] ;! ebx,[left_col]
jge .ya2.1
add eax,ebx
.ya2.1:
pop ebx
pushad
mov esi,eax
mov ecx,[color_tbl+4*6]
mcall 4
popad
sub esi,eax
add edx,eax
imul eax,6*65536
add ebx,eax
jmp .draw_t
;----------------------------------------------)-
.nt3: mov eax,[esp]
cmp eax,[sel.end.x]
jge .draw_t
cmp eax,[sel.begin.x]
jge @f
add eax,[esp+4]
cmp eax,[sel.begin.x]
jl .draw_t
cmp eax,[sel.end.x]
jl .ya1
;---[ selection inside block ]-----------------(-
mov eax,esi
mov esi,[sel.begin.x]
sub esi,[esp]
push eax
mov eax,[esp+4]
sub eax,[cur_editor.TopLeft.X] ;! eax,[left_col]
jge .nt3.1
add esi,eax
.nt3.1:
pop eax
sub eax,esi
pushad
add edx,esi
imul esi,6*65536
add ebx,esi
mov esi,[sel.end.x]
sub esi,[sel.begin.x]
mov ecx,[color_tbl+4*6]
sub eax,esi
push eax
mcall 4
add edx,esi
imul esi,6*65536
add ebx,esi
pop esi
mov ecx,[esp+4*6]
mcall 4
popad
jmp .draw_t
;----------------------------------------------)-
@@: add eax,esi
dec eax
cmp eax,[sel.end.x]
jge .ya2
;---[ block inside selection ]-----------------(-
.ya4: mov ecx,[color_tbl+4*6]
;----------------------------------------------)-
.draw_t:
mcall 4;[esp+8]
.skip_t:
pop eax eax ; ebx esi
imul eax,6
add [esp+4*2+2],ax
pop ecx esi
cmp ecx,[cur_line_len];LINE_WIDTH
jl .next_block
pop ebx ecx
and ebx,0x0000FFFF
add ebx,[left_ofs-2]
add ebx,LINEH
add esi,[cur_line_len];LINE_WIDTH
inc dword[esp]
dec ecx
jg .next_line
;------------------------------------------------
.draw_cursor:
;------------------------------------------------
mov ebx,[left_ofs]
cmp ebx,2+LCHGW
je .no_gutter
add esp,-4*8*2
sub ebx,3+LCHGW
mov ecx,[top_ofs]
dec ecx
shl ecx,16
add ecx,[bot_ofs]
sub ecx,[top_ofs]
sub ecx,SCRLW
mcall 13,,,[cl_3d_normal]
push bx
shl ebx,16
pop bx
add ecx,[top_ofs]
dec ecx
mcall 38,,,[cl_3d_inset]
mov ebx,[left_ofs]
add ebx,-3-LCHGW
shl ebx,16
add ebx,[top_ofs]
mov edi,[sc.work_text]
mov ecx,[cur_editor.TopLeft.Y] ;! ecx,[top_line]
inc ecx
mov edx,p_info+100
@@: pushad
push eax edx edi
mov eax,ecx
mov ecx,10
mov edi,edx
call uint2str
mov esi,edi
pop edi edx eax
sub esi,edx
imul eax,esi,6*65536
sub ebx,eax
mcall 4,,edi
popad
add ebx,LINEH
inc ecx
cmp ecx,[cur_editor.Lines] ;! ecx,[lines]
jg @f
mov esi,ecx
sub esi,[cur_editor.TopLeft.Y] ;! esi,[top_line]
cmp esi,[lines.scr]
jbe @b
@@: add esp,4*8*2
.no_gutter:
;------------------------------------------------
mov ebx,[draw_blines]
or ebx,ebx
js @f
imul ebx,LINEH
mov ecx,[esp-8]
shl ecx,16
mov cx,bx
mov ebx,[p_info.client_box.width]
add ebx,[left_ofs-2]
sub ebx,[left_ofs]
add ebx,-1*65536-SCRLW+1 ; <OLEFT-1,LINE_WIDTH*6+2>
mcall 13,,,[color_tbl+4*5]
@@:
add esp,4
cmp [bot_mode],0
jne @f
mov ebx,[cur_editor.Caret.X] ;! ebx,[pos.x]
sub ebx,[cur_editor.TopLeft.X] ;! ebx,[left_col]
js @f
cmp ebx,[columns.scr]
ja @f
imul ebx,6
add ebx,[left_ofs]
dec ebx
push bx
shl ebx,16
pop bx
mov eax,[cur_editor.Caret.Y] ;! eax,[pos.y]
sub eax,[cur_editor.TopLeft.Y] ;! eax,[top_line]
js @f
cmp eax,[lines.scr]
jge @f
imul eax,LINEH
add eax,[top_ofs]
; inc eax
mov esi,eax
shl esi,16
add eax,LINEH-2
mov si,ax
mov ecx,2
cmp [ins_mode],0
jne .lp8
add cl,4
.lp8: push ecx
mcall 38,,esi,0x01000000
add ebx,0x00010001
pop ecx
loop .lp8
@@:
;------------------------------------------------
cmp [do_not_draw],2
je .exit
; mov ebx,[p_info.x_size]
; shl ebx,16
; add ebx,(-SCRLW-5+2)*65536+SCRLW-2
; mov ecx,[top_ofs-2]
; mov cx,SCRLW-1
; mcall 8,,,'UP',[sc.work_button]
;!!!!!!!!!!!!!!!!!!
mov ebx,[p_info.client_box.width]
shl ebx,16
add ebx,(-SCRLW)*65536+SCRLW
mov ecx,[top_ofs-2]
mov cx,SCRLW
sub ecx,0x00020000
mcall 8,,,'UP' or 0x40000000
pushad
sar ebx,16
sar ecx,16
push ebx ecx SCRLW SCRLW
call draw_3d_panel
popad
mov eax,8
;!!!!!!!!!!!!!!!!!!
pushad
push 0x18
shr ecx,16
mov bx,cx
add ebx,(SCRLW/2-2)*65536+SCRLW/2-3
mcall 4,,[sc.work_text],esp,1
add esp,4
popad
; mov ecx,[bot_ofs]
; shl ecx,16
; add ecx,(-SCRLW*2-1)*65536+SCRLW-1
; mcall ,,,'DN'
;!!!!!!!!!!!!!!!!!!
mov ecx,[bot_ofs]
shl ecx,16
add ecx,(-SCRLW*2-1)*65536+SCRLW
mcall ,,,'DN' or 0x40000000
pushad
sar ebx,16
sar ecx,16
push ebx ecx SCRLW SCRLW
call draw_3d_panel
popad
mov eax,8
;!!!!!!!!!!!!!!!!!!
pushad
push 0x19
shr ecx,16
mov bx,cx
add ebx,(SCRLW/2-2)*65536+SCRLW/2-3
mcall 4,,[sc.work_text],esp,1
add esp,4
popad
; sub ebx,1*65536-2
push ebx
mov eax,[cur_editor.Lines] ;! eax,[lines]
mov ebx,[lines.scr]
mov ecx,[cur_editor.TopLeft.Y] ;! ecx,[top_line]
mov edx,[bot_ofs]
sub edx,[top_ofs]
add edx,-SCRLW*3+1
call get_scroll_vars
mov [cur_editor.VScroll.Top],eax ;! [vscrl_top],eax
mov [cur_editor.VScroll.Size],ebx ;! [vscrl_size],ebx
pop ebx
mov ecx,eax
add ecx,[top_ofs]
add ecx,SCRLW-1
; shl ecx,16
; mov cx,word[vscrl_size]
; mcall 13,,,[sc.work_button]
;!!!!!!!!!!!!!!!!!!
pushad
sar ebx,16
; rol ecx,16
; movsx eax,cx
; sar ecx,16
push ebx ecx SCRLW [cur_editor.VScroll.Size] ;! ebx ecx SCRLW [vscrl_size]
dec dword[esp]
call draw_3d_panel
popad
mov eax,13
;!!!!!!!!!!!!!!!!!!
inc ebx
mov ecx,[top_ofs-2]
mov cx,word[cur_editor.VScroll.Top] ;! cx,word[vscrl_top]
add ecx,(SCRLW-1)*65536
mov edx,[sc.work];[color_tbl+4*5]
or cx,cx
jle @f
mcall 13
@@:
mov ecx,[top_ofs]
add ecx,[cur_editor.VScroll.Top] ;! ecx,[vscrl_top]
add ecx,[cur_editor.VScroll.Size] ;! ecx,[vscrl_size]
add ecx,SCRLW-1
mov di,cx
shl ecx,16
mov cx,word[bot_ofs]
sub cx,di
sub cx,SCRLW*2+1
jle @f
mcall
@@:
;-----------------------
; mov eax,ebx
; shr eax,16
; add bx,ax
; mov ecx,[top_ofs-2]
; mov cx,word[top_ofs]
; add ecx,SCRLW*65536+SCRLW
; mcall 38,,,[sc.work_graph];[sc.work_text]
; mov ecx,[bot_ofs-2]
; mov cx,word[bot_ofs]
; sub ecx,(SCRLW*2+2)*65536+(SCRLW*2+2)
; mcall
rol ebx,16
push bx
rol ebx,16
pop bx
mov ecx,[top_ofs-2]
mov cx,word[bot_ofs]
add ecx,(SCRLW-1)*65536-SCRLW*2-2
mcall 38,,,[cl_3d_inset]
;------------------------------------------------
; mov ebx,5*65536+SCRLW-1
; mov ecx,[bot_ofs]
; shl ecx,16
; add ecx,(-SCRLW)*65536+SCRLW-2
; mcall 8,,,'LT',[sc.work_button]
;!!!!!!!!!!!!!!!!!!
mov ebx,SCRLW
mov ecx,[bot_ofs]
shl ecx,16
add ecx,(-SCRLW-1)*65536+SCRLW
mcall 8,,,'LT' or 0x40000000
pushad
sar ebx,16
sar ecx,16
push ebx ecx SCRLW SCRLW
call draw_3d_panel
popad
;!!!!!!!!!!!!!!!!!!
pushad
push 0x1B
shr ecx,16
mov bx,cx
add ebx,(SCRLW/2-2)*65536+SCRLW/2-3
mcall 4,,[sc.work_text],esp,1
add esp,4
popad
; mov ebx,[p_info.x_size]
; shl ebx,16
; add ebx,(-SCRLW*2-5)*65536+SCRLW
; mcall ,,,'RT'
;!!!!!!!!!!!!!!!!!!
mov ebx,[p_info.client_box.width]
shl ebx,16
add ebx,(-SCRLW*2)*65536+SCRLW
mcall 8,,,'RT' or 0x40000000
pushad
sar ebx,16
sar ecx,16
push ebx ecx SCRLW SCRLW
call draw_3d_panel
popad
;!!!!!!!!!!!!!!!!!!
pushad
push 0x1A
shr ecx,16
mov bx,cx
add ebx,(SCRLW/2-2)*65536+SCRLW/2-3
mcall 4,,[sc.work_text],esp,1
add esp,4
popad
; inc ecx
push ecx
mov eax,[cur_editor.Columns] ;! eax,[columns]
mov ebx,[columns.scr]
mov ecx,[cur_editor.TopLeft.X] ;! ecx,[left_col]
mov edx,[p_info.client_box.width]
add edx,-(SCRLW*3)
call get_scroll_vars
mov [cur_editor.HScroll.Top],eax ;! [hscrl_top],eax
mov [cur_editor.HScroll.Size],ebx ;! [hscrl_size],ebx
pop ecx
mov ebx,eax
add ebx,1+SCRLW
shl ebx,16
mov bx,word[cur_editor.HScroll.Size] ;! bx,word[hscrl_size]
; mcall 13,,,[sc.work_button]
;!!!!!!!!!!!!!!!!!!
pushad
sar ecx,16
rol ebx,16
movsx eax,bx
sar ebx,16
dec ebx
push eax ecx ebx SCRLW
call draw_3d_panel
popad
;!!!!!!!!!!!!!!!!!!
mov ebx,(1+SCRLW)*65536
mov bx,word[cur_editor.HScroll.Top] ;! bx,word[hscrl_top]
mcall 13,,,[sc.work];[color_tbl+4*5]
mov ebx,1+SCRLW
add ebx,[cur_editor.HScroll.Top] ;! ebx,[hscrl_top]
add ebx,[cur_editor.HScroll.Size] ;! ebx,[hscrl_size]
mov di,bx
shl ebx,16
mov bx,word[p_info.client_box.width]
sub bx,di
sub bx,SCRLW*2
jle @f
mcall
@@:
; mov eax,ebx
; shr eax,16
; add bx,ax
; mov ecx,[bot_ofs-2]
; mov cx,word[bot_ofs]
; sub ecx,SCRLW*65536+2
; mcall 38,<OLEFT+SCRLW-1,OLEFT+SCRLW-1>,,[sc.work_graph];[sc.work_text]
; mov ebx,[p_info.x_size-2]
; mov bx,word[p_info.x_size]
; sub ebx,(SCRLW*2+6)*65536+(SCRLW*2+6)
; mcall
mov ebx,[p_info.client_box.width]
; add ebx,5*65536-5
mov ecx,[bot_ofs-2]
mov cx,word[bot_ofs]
sub ecx,(SCRLW+1)*65536+(SCRLW+1)
mcall 38,,,[cl_3d_inset]
;------------------------------------------------
.exit:
popad
ret
}
endf
;-----------------------------------------------------------------------------
func get_next_part ;//////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
; Input:
; ECX = current letter
; ESI = string
; Output:
; ECX = color
; EDX = string
; ESI = length
;-----------------------------------------------------------------------------
cmp [cur_editor.AsmMode],0 ;! [asm_mode],0
je .plain.text
xor ebx,ebx
mov edx,ecx
add esi,ecx
mov edi,symbols
mov al,[esi]
cmp al,';'
je .comment
mov ecx,symbols.size
repne scasb
je .symbol
cmp al,'$'
jne @f
mov edi,symbols
mov al,[esi+1]
mov ecx,symbols.size
repne scasb
je .not_symbol
jmp .number
@@: cmp al,'0'
jb @f
cmp al,'9'
jbe .number
@@: cmp al,"'"
je .string
cmp al,'"'
je .string
.not_symbol:
inc ebx
inc edx
cmp edx,[cur_line_len];LINE_WIDTH
jge @f
mov edi,symbols
mov al,[esi+ebx]
cmp al,';'
je @f
mov ecx,symbols.size
repne scasb
jne .not_symbol
@@: mov ecx,edx
mov edx,esi
mov esi,ebx
mov eax,[color_tbl+4*0]
ret
.symbol:
inc ebx
inc edx
cmp edx,[cur_line_len];LINE_WIDTH
jge @f
mov edi,symbols
mov al,[esi+ebx]
mov ecx,symbols.size
repne scasb
je .symbol
@@: mov ecx,edx
mov edx,esi
mov esi,ebx
mov eax,[color_tbl+4*4]
ret
.comment:
neg edx
add edx,[cur_line_len];LINE_WIDTH
xchg edx,esi
mov ecx,[cur_line_len];LINE_WIDTH
mov eax,[color_tbl+4*3]
ret
.number:
inc ebx
inc edx
cmp edx,[cur_line_len];LINE_WIDTH
jge @f
mov edi,symbols
mov al,[esi+ebx]
cmp al,';'
je @f
mov ecx,symbols.size
repne scasb
jne .number
@@: mov ecx,edx
mov edx,esi
mov esi,ebx
mov eax,[color_tbl+4*1]
ret
.string:
inc ebx
inc edx
cmp edx,[cur_line_len];LINE_WIDTH
jge @f
cmp [esi+ebx],al
jne .string
inc ebx
inc edx
@@:
mov ecx,edx
mov edx,esi
mov esi,ebx
mov eax,[color_tbl+4*2]
ret
.plain.text:
mov edx,[cur_line_len];LINE_WIDTH
xchg edx,esi
mov ecx,[cur_line_len];LINE_WIDTH
mov eax,[color_tbl+4*0]
ret
endf
;-----------------------------------------------------------------------------
func draw_statusbar ;///// WRITE POSITION ////////////////////////////////////
;-----------------------------------------------------------------------------
cmp [do_not_draw],1 ; return if drawing is not permitted
jae .exit
pusha
mov ecx,[p_info.client_box.height-2]
mov cx,word[p_info.client_box.height]
sub ecx,STATH*65536+STATH
mcall 38,[p_info.client_box.width],,[cl_3d_inset]
; mcall 9,p_info,-1
mov ecx,[p_info.client_box.height-2]
mov cx,word[p_info.client_box.height]
sub ecx,STATH*65536
; mpack ebx,6*13,6*13
; add ebx,[left_ofs-2]
; add ebx,[left_ofs]
mcall 38,<6*13,6*13>,,[cl_3d_inset]
pushad
add ecx,1*65536
; sub ebx,(6*13+1)*65536-1
; sub ebx,[left_ofs]
mov cx,STATH
mcall 13,<0,6*13>,,[cl_3d_normal]
mcall ,<6*13+1,6*(s_modified.size+2)-1>
mov ebx,(6*(s_modified.size+15)+1)*65536
mov bx,word[p_info.client_box.width]
sub bx,6*(s_modified.size+15)
mcall
popad
add ebx,6*(s_modified.size+2)*65536+6*(s_modified.size+2)
mcall
and ecx,0x0000FFFF
push ecx
mov eax,[cur_editor.Caret.Y] ;! eax,[pos.y]
inc eax
mov ecx,10
mov edi,p_info+0x100;htext2.pos1
cld
call uint2str
mov al,','
stosb
mov eax,[cur_editor.Caret.X] ;! eax,[pos.x]
inc eax
call uint2str
pop ebx
lea esi,[edi-p_info-0x100]
lea edi,[esi*3]
shl edi,16
; add ebx,[left_ofs-2]
add ebx,(1+6*6+3)*65536-STATH/2-3
sub ebx,edi
mcall 4,,[sc.work_text],p_info+0x100
cmp [cur_editor.Modified],0 ;! [modified],0
je @f
and ebx,0x0000FFFF
; add ebx,[left_ofs-2]
add ebx,(1+12*6+12+1)*65536
mcall ,,,s_modified,s_modified.size
@@: cmp [s_status],0
je @f
and ebx,0x0000FFFF
add ebx,6*(s_modified.size+16)*65536
or ecx, 80000000h
mcall ,,,[s_status]
@@: popa
.exit:
ret
endf
func draw_framerect ; ebx,ecx,edx
push ebx ecx
; x1 = esp+6
; x2 = esp+4 (width)
; y1 = esp+2
; y2 = esp+0 (height)
add bx,[esp+6]
mov cx,[esp+2]
dec ebx
mcall 38
add cx,[esp]
rol ecx,16
add cx,[esp]
sub ecx,0x00010001
mcall
mov ebx,[esp+4]
mov ecx,[esp]
mov bx,[esp+6]
add cx,[esp+2]
dec ecx
mcall
add bx,[esp+4]
rol ebx,16
add bx,[esp+4]
sub ebx,0x00010001
mcall
pop ecx ebx
ret
endf
func draw_check
push bx
shl ebx,16
pop bx
add ebx,0x00010000
push cx
shl ecx,16
pop cx
add ecx,0x00020001
; add ecx,0x00040003
; sub ebx,0x000A000B
mcall 38
add ecx,0x00010001
mcall
add ebx,4
sub ecx,2
mcall
sub ecx,0x00010001
mcall
ret
endf
func calc_middle
shr eax,1
shr ebx,1
and eax,0x007F7F7F
and ebx,0x007F7F7F
add eax,ebx
ret
endf
func calc_3d_colors
pushad
m2m [cl_3d_normal],[sc.work]
m2m [cl_3d_inset],[sc.work_graph]
push [cl_3d_normal]
add byte[esp],48
jnc @f
mov byte[esp],255
@@: add byte[esp+1],48
jnc @f
mov byte[esp+1],255
@@: add byte[esp+2],48
jnc @f
mov byte[esp+2],255
@@: pop [cl_3d_outset]
mov eax,[cl_3d_inset]
mov ebx,[cl_3d_outset]
call calc_middle
mov ebx,[cl_3d_normal]
call calc_middle
mov [cl_3d_pushed],eax
mov eax,[cl_3d_normal]
mov ebx,[sc.work_text]
call calc_middle
mov [cl_3d_grayed],eax
popad
ret
endf
func draw_3d_panel ; x,y,w,h
push eax ebx ecx edx
cmp dword[esp+16+8],4
jl .exit
cmp dword[esp+16+4],4
jl .exit
mov ebx,[esp+16+16-2]
mov bx,[esp+16+8]
inc ebx
mov ecx,[esp+16+12-2]
mov cx,[esp+16+4]
inc ecx
mcall 13,,,[cl_3d_normal]
dec ebx
add bx,[esp+16+16]
mov cx,[esp+16+12]
mcall 38,,,[cl_3d_inset]
add ecx,[esp+16+4-2]
add cx,[esp+16+4]
mcall
mov bx,[esp+16+16]
mov ecx,[esp+16+12-2]
mov cx,[esp+16+4]
add cx,[esp+16+12]
mcall
add ebx,[esp+16+8-2]
add bx,[esp+16+8]
mcall
mov ebx,[esp+16+16-2]
mov bx,[esp+16+8]
add bx,[esp+16+16]
add ebx,1*65536-1
mov ecx,[esp+16+12-2]
mov cx,[esp+16+12]
add ecx,0x00010001
mcall ,,,[cl_3d_outset]
mov bx,[esp+16+16]
inc ebx
mov ecx,[esp+16+12-2]
mov cx,[esp+16+4]
add cx,[esp+16+12]
add ecx,2*65536-1
mcall
.exit:
pop edx ecx ebx eax
ret 4*4
endf