2006-10-11 22:40:53 +02:00
|
|
|
virtual at ebp
|
|
|
|
tbox TBOX
|
|
|
|
end virtual
|
|
|
|
|
|
|
|
tb.pos.x db ?
|
|
|
|
tb.sel.x db ?
|
|
|
|
tb.sel.selected db ?
|
|
|
|
|
2007-09-01 23:38:00 +02:00
|
|
|
proc textbox.get_width
|
2006-10-11 22:40:53 +02:00
|
|
|
push ebx edx
|
2007-01-28 00:36:07 +01:00
|
|
|
movzx eax,[tbox.width]
|
2006-10-11 22:40:53 +02:00
|
|
|
add eax,-6
|
|
|
|
xor edx,edx
|
|
|
|
mov ebx,6
|
|
|
|
div ebx
|
|
|
|
movzx ebx,[tbox.length]
|
|
|
|
cmp eax,ebx
|
|
|
|
jle @f
|
|
|
|
mov eax,ebx
|
|
|
|
@@: pop edx ebx
|
|
|
|
ret
|
2007-09-01 23:38:00 +02:00
|
|
|
endp
|
2006-10-11 22:40:53 +02:00
|
|
|
|
2007-09-01 23:38:00 +02:00
|
|
|
proc textbox.delete_selection
|
2006-10-11 22:40:53 +02:00
|
|
|
cmp [tb.sel.selected],0
|
|
|
|
je .exit.2
|
|
|
|
pushad
|
|
|
|
movzx ecx,[tbox.length]
|
|
|
|
sub cl,[tb.sel.x]
|
|
|
|
lea eax,[tbox.text]
|
|
|
|
movzx esi,[tb.pos.x]
|
|
|
|
movzx edi,[tb.sel.x]
|
|
|
|
add esi,eax
|
|
|
|
add edi,eax
|
|
|
|
mov eax,esi
|
|
|
|
sub eax,edi
|
|
|
|
sub [tbox.length],al
|
|
|
|
cld
|
|
|
|
rep movsb
|
|
|
|
|
|
|
|
.exit:
|
|
|
|
mov al,[tb.sel.x]
|
|
|
|
mov [tbox.pos.x],al
|
|
|
|
mov [tbox.sel.x],al
|
|
|
|
popad
|
|
|
|
clc
|
|
|
|
ret
|
|
|
|
|
|
|
|
.exit.2:
|
|
|
|
stc
|
|
|
|
ret
|
2007-09-01 23:38:00 +02:00
|
|
|
endp
|
2006-10-11 22:40:53 +02:00
|
|
|
|
2007-09-01 23:38:00 +02:00
|
|
|
proc textbox.draw ; TBOX* ebp
|
2006-10-11 22:40:53 +02:00
|
|
|
call textbox.get_width
|
|
|
|
movzx ebx,[tbox.pos.x]
|
|
|
|
sub bl,[tbox.ofs.x]
|
|
|
|
sub ebx,eax
|
|
|
|
jle @f
|
|
|
|
mov bl,[tbox.pos.x]
|
|
|
|
sub bl,al
|
|
|
|
mov [tbox.ofs.x],bl
|
|
|
|
@@:
|
|
|
|
mov [tb.sel.selected],0
|
|
|
|
mov al,[tbox.pos.x]
|
|
|
|
mov ah,[tbox.sel.x]
|
|
|
|
cmp al,ah
|
|
|
|
je @f
|
|
|
|
inc [tb.sel.selected]
|
|
|
|
ja @f
|
|
|
|
xchg al,ah
|
|
|
|
@@: mov [tb.pos.x],al
|
|
|
|
mov [tb.sel.x],ah
|
|
|
|
|
2007-01-28 00:36:07 +01:00
|
|
|
mcall 13,dword[tbox.width],dword[tbox.height],[color_tbl.back]
|
2007-01-03 19:22:05 +01:00
|
|
|
mov edx,[cl_3d_inset]
|
2006-10-11 22:40:53 +02:00
|
|
|
call draw_framerect
|
|
|
|
|
|
|
|
call textbox.get_width
|
|
|
|
mov esi,eax
|
|
|
|
mov edi,eax
|
|
|
|
|
|
|
|
cmp ebp,[focused_tb]
|
|
|
|
je @f
|
2007-01-28 00:36:07 +01:00
|
|
|
mov ebx,dword[tbox.x-2]
|
|
|
|
mov bx,[tbox.y]
|
|
|
|
movzx eax,[tbox.height]
|
2006-10-11 22:40:53 +02:00
|
|
|
shr eax,1
|
|
|
|
add eax,4*65536-4
|
|
|
|
add ebx,eax
|
|
|
|
lea edx,[tbox.text]
|
2007-01-28 00:36:07 +01:00
|
|
|
mcall 4,,[color_tbl.text]
|
2006-10-11 22:40:53 +02:00
|
|
|
ret
|
|
|
|
|
|
|
|
@@: movzx eax,[tb.pos.x]
|
|
|
|
cmp al,[tb.sel.x]
|
|
|
|
je @f
|
|
|
|
sub al,[tbox.ofs.x]
|
|
|
|
jz @f
|
|
|
|
movzx ebx,[tb.sel.x]
|
|
|
|
sub bl,[tbox.ofs.x]
|
|
|
|
jge .lp1
|
|
|
|
xor ebx,ebx
|
|
|
|
.lp1: push eax ebx
|
|
|
|
sub eax,ebx
|
|
|
|
mov ecx,edi
|
|
|
|
sub ecx,ebx
|
|
|
|
cmp eax,ecx
|
|
|
|
jbe .lp2
|
|
|
|
mov eax,ecx
|
|
|
|
.lp2: imul eax,6
|
|
|
|
imul ebx,6
|
2007-01-28 00:36:07 +01:00
|
|
|
movzx ecx,[tbox.x]
|
2006-10-11 22:40:53 +02:00
|
|
|
add ecx,3
|
|
|
|
add ebx,ecx
|
|
|
|
shl ebx,16
|
|
|
|
add ebx,eax
|
2007-01-28 00:36:07 +01:00
|
|
|
movzx ecx,[tbox.height]
|
2006-10-11 22:40:53 +02:00
|
|
|
shr ecx,1
|
2007-01-28 00:36:07 +01:00
|
|
|
add cx,[tbox.y]
|
2006-10-11 22:40:53 +02:00
|
|
|
shl ecx,16
|
|
|
|
add ecx,-5*65536+10
|
2007-01-28 00:36:07 +01:00
|
|
|
mcall 13,,,[color_tbl.back.sel]
|
2006-10-11 22:40:53 +02:00
|
|
|
|
|
|
|
mov esi,[esp]
|
|
|
|
lea edx,[tbox.text]
|
|
|
|
movzx eax,[tbox.ofs.x]
|
|
|
|
add edx,eax
|
2007-01-28 00:36:07 +01:00
|
|
|
mov ebx,dword[tbox.x-2]
|
|
|
|
mov bx,[tbox.y]
|
|
|
|
movzx eax,[tbox.height]
|
2006-10-11 22:40:53 +02:00
|
|
|
shr eax,1
|
|
|
|
add eax,4*65536-4
|
|
|
|
add ebx,eax
|
|
|
|
mov eax,4
|
|
|
|
or esi,esi
|
|
|
|
jz .lp3
|
2007-01-28 00:36:07 +01:00
|
|
|
mcall ,,[color_tbl.text]
|
2006-10-11 22:40:53 +02:00
|
|
|
.lp3: sub edi,esi
|
|
|
|
jnz .lp4
|
|
|
|
add esp,8
|
|
|
|
jmp .exit
|
|
|
|
.lp4:
|
|
|
|
add edx,esi
|
|
|
|
imul esi,6*65536
|
|
|
|
add ebx,esi
|
|
|
|
pop ecx esi
|
|
|
|
sub esi,ecx
|
|
|
|
cmp esi,edi
|
|
|
|
jbe .lp5
|
|
|
|
mov esi,edi
|
|
|
|
.lp5:
|
2007-01-28 00:36:07 +01:00
|
|
|
mcall ,,[color_tbl.text.sel]
|
2006-10-11 22:40:53 +02:00
|
|
|
sub edi,esi
|
|
|
|
jz .exit
|
|
|
|
add edx,esi
|
|
|
|
imul esi,6*65536
|
|
|
|
add ebx,esi
|
|
|
|
lea ecx,[tbox.text]
|
2007-01-28 00:36:07 +01:00
|
|
|
mcall ,,[color_tbl.text],,edi
|
2006-10-11 22:40:53 +02:00
|
|
|
jmp .exit
|
|
|
|
|
|
|
|
@@: lea edx,[tbox.text]
|
|
|
|
movzx eax,[tbox.ofs.x]
|
|
|
|
add edx,eax
|
2007-01-28 00:36:07 +01:00
|
|
|
mov ebx,dword[tbox.x-2]
|
|
|
|
mov bx,[tbox.y]
|
|
|
|
movzx eax,[tbox.height]
|
2006-10-11 22:40:53 +02:00
|
|
|
shr eax,1
|
|
|
|
add eax,4*65536-4
|
|
|
|
add ebx,eax
|
|
|
|
movzx eax,[tbox.ofs.x]
|
|
|
|
call textbox.get_width
|
|
|
|
mov esi,eax
|
2007-01-28 00:36:07 +01:00
|
|
|
mcall 4,,[color_tbl.text]
|
2006-10-11 22:40:53 +02:00
|
|
|
|
|
|
|
.exit:
|
|
|
|
movzx ebx,[tbox.pos.x]
|
|
|
|
movzx eax,[tbox.ofs.x]
|
|
|
|
sub ebx,eax
|
|
|
|
imul ebx,6
|
2007-01-28 00:36:07 +01:00
|
|
|
movzx eax,[tbox.x]
|
2006-10-11 22:40:53 +02:00
|
|
|
add eax,3
|
|
|
|
add ebx,eax
|
|
|
|
push bx
|
|
|
|
shl ebx,16
|
|
|
|
pop bx
|
2007-01-28 00:36:07 +01:00
|
|
|
movzx ecx,[tbox.height]
|
2006-10-11 22:40:53 +02:00
|
|
|
shr ecx,1
|
2007-01-28 00:36:07 +01:00
|
|
|
add cx,[tbox.y]
|
2006-10-11 22:40:53 +02:00
|
|
|
push cx
|
|
|
|
shl ecx,16
|
|
|
|
pop cx
|
|
|
|
add ecx,-5*65536+4
|
|
|
|
mcall 38,,,0x01000000
|
|
|
|
add ebx,0x00010001
|
|
|
|
mcall
|
|
|
|
ret
|
2007-09-01 23:38:00 +02:00
|
|
|
endp
|
2006-10-11 22:40:53 +02:00
|
|
|
|
2007-09-01 23:38:00 +02:00
|
|
|
proc textbox.key
|
2006-10-11 22:40:53 +02:00
|
|
|
mov ebp,[focused_tb]
|
|
|
|
mov esi,accel_table_textbox
|
|
|
|
.acc: cmp ebx,[esi]
|
|
|
|
jne @f
|
|
|
|
call dword[esi+4]
|
|
|
|
jmp .exit.2
|
|
|
|
@@: add esi,8
|
|
|
|
cmp byte[esi],0
|
|
|
|
jne .acc
|
|
|
|
|
|
|
|
test byte[shi+2],0x06
|
|
|
|
jnz .exit
|
|
|
|
cmp [tbox.length],255
|
|
|
|
je .exit
|
|
|
|
|
|
|
|
movzx eax,[chr]
|
|
|
|
movzx eax,[eax+key0]
|
|
|
|
or al,al
|
|
|
|
jz .exit
|
|
|
|
mov al,[eax+key1]
|
|
|
|
cmp [tb_casesen],0
|
|
|
|
je @f
|
|
|
|
cmp al,$60
|
|
|
|
jle @f
|
|
|
|
add al,[add_table-$60+eax]
|
|
|
|
@@:
|
|
|
|
call textbox.delete_selection
|
|
|
|
|
|
|
|
mov ecx,255
|
|
|
|
sub cl,[tbox.pos.x]
|
|
|
|
lea edi,[tbox.text]
|
|
|
|
add edi,255
|
|
|
|
lea esi,[edi-1]
|
|
|
|
std
|
|
|
|
rep movsb
|
|
|
|
stosb
|
|
|
|
cld
|
|
|
|
inc [tbox.length]
|
|
|
|
call key.tb.right
|
|
|
|
|
|
|
|
.exit.2:
|
|
|
|
call textbox.draw
|
|
|
|
.exit:
|
|
|
|
ret
|
2007-09-01 23:38:00 +02:00
|
|
|
endp
|
2006-10-11 22:40:53 +02:00
|
|
|
|
|
|
|
textbox.mouse:
|
|
|
|
ret
|
|
|
|
|
2007-09-01 23:38:00 +02:00
|
|
|
proc key.tb.bkspace
|
2006-10-11 22:40:53 +02:00
|
|
|
call textbox.delete_selection
|
|
|
|
jnc @f
|
|
|
|
|
|
|
|
cmp [tbox.pos.x],0
|
|
|
|
je @f
|
|
|
|
call key.tb.left
|
|
|
|
jmp key.tb.del.direct
|
|
|
|
|
|
|
|
@@: ret
|
2007-09-01 23:38:00 +02:00
|
|
|
endp
|
2006-10-11 22:40:53 +02:00
|
|
|
|
2007-09-01 23:38:00 +02:00
|
|
|
proc key.tb.home
|
2006-10-11 22:40:53 +02:00
|
|
|
xor al,al
|
|
|
|
mov [tbox.pos.x],al
|
|
|
|
mov [tbox.sel.x],al
|
|
|
|
mov [tbox.ofs.x],al
|
|
|
|
ret
|
2007-09-01 23:38:00 +02:00
|
|
|
endp
|
2006-10-11 22:40:53 +02:00
|
|
|
|
2007-09-01 23:38:00 +02:00
|
|
|
proc key.tb.left
|
2006-10-11 22:40:53 +02:00
|
|
|
mov al,[tbox.pos.x]
|
|
|
|
mov [tbox.sel.x],al
|
|
|
|
dec al
|
|
|
|
js @f
|
|
|
|
mov [tbox.pos.x],al
|
|
|
|
mov [tbox.sel.x],al
|
|
|
|
cmp [tbox.ofs.x],al
|
|
|
|
jl @f
|
|
|
|
sub [tbox.ofs.x],8
|
|
|
|
jge @f
|
|
|
|
mov [tbox.ofs.x],0
|
|
|
|
@@: ret
|
2007-09-01 23:38:00 +02:00
|
|
|
endp
|
2006-10-11 22:40:53 +02:00
|
|
|
|
2007-09-01 23:38:00 +02:00
|
|
|
proc key.tb.right
|
2006-10-11 22:40:53 +02:00
|
|
|
call textbox.get_width
|
|
|
|
mov bl,[tbox.pos.x]
|
|
|
|
mov [tbox.sel.x],bl
|
|
|
|
inc bl
|
|
|
|
cmp bl,[tbox.length]
|
|
|
|
ja @f
|
|
|
|
mov [tbox.pos.x],bl
|
|
|
|
mov [tbox.sel.x],bl
|
|
|
|
sub bl,[tbox.ofs.x]
|
|
|
|
cmp bl,al
|
|
|
|
jbe @f
|
|
|
|
inc [tbox.ofs.x]
|
|
|
|
@@: ret
|
2007-09-01 23:38:00 +02:00
|
|
|
endp
|
2006-10-11 22:40:53 +02:00
|
|
|
|
2007-09-01 23:38:00 +02:00
|
|
|
proc key.tb.end
|
2006-10-11 22:40:53 +02:00
|
|
|
call textbox.get_width
|
|
|
|
movzx ebx,[tbox.length]
|
|
|
|
mov [tbox.pos.x],bl
|
|
|
|
mov [tbox.sel.x],bl
|
|
|
|
sub ebx,eax
|
|
|
|
jge @f
|
|
|
|
xor bl,bl
|
|
|
|
@@: mov [tbox.ofs.x],bl
|
|
|
|
ret
|
2007-09-01 23:38:00 +02:00
|
|
|
endp
|
2006-10-11 22:40:53 +02:00
|
|
|
|
2007-09-01 23:38:00 +02:00
|
|
|
proc key.tb.del
|
2006-10-11 22:40:53 +02:00
|
|
|
call textbox.delete_selection
|
|
|
|
jnc @f
|
|
|
|
.direct:
|
|
|
|
movzx ecx,[tbox.length]
|
|
|
|
sub cl,[tbox.pos.x]
|
|
|
|
jz @f
|
|
|
|
lea eax,[tbox.text]
|
|
|
|
movzx edi,[tbox.pos.x]
|
|
|
|
add edi,eax
|
|
|
|
lea esi,[edi+1]
|
|
|
|
dec [tbox.length]
|
|
|
|
cld
|
|
|
|
rep movsb
|
|
|
|
|
|
|
|
@@: ret
|
2007-09-01 23:38:00 +02:00
|
|
|
endp
|
2006-10-11 22:40:53 +02:00
|
|
|
|
2007-09-01 23:38:00 +02:00
|
|
|
proc key.tb.shift_home
|
2006-10-11 22:40:53 +02:00
|
|
|
xor al,al
|
|
|
|
mov [tbox.pos.x],al
|
|
|
|
mov [tbox.ofs.x],al
|
|
|
|
ret
|
2007-09-01 23:38:00 +02:00
|
|
|
endp
|
2006-10-11 22:40:53 +02:00
|
|
|
|
2007-09-01 23:38:00 +02:00
|
|
|
proc key.tb.shift_left
|
2006-10-11 22:40:53 +02:00
|
|
|
mov al,[tbox.pos.x]
|
|
|
|
dec al
|
|
|
|
js @f
|
|
|
|
mov [tbox.pos.x],al
|
|
|
|
cmp [tbox.ofs.x],al
|
|
|
|
jl @f
|
|
|
|
sub [tbox.ofs.x],8
|
|
|
|
jge @f
|
|
|
|
mov [tbox.ofs.x],0
|
|
|
|
@@: ret
|
2007-09-01 23:38:00 +02:00
|
|
|
endp
|
2006-10-11 22:40:53 +02:00
|
|
|
|
2007-09-01 23:38:00 +02:00
|
|
|
proc key.tb.shift_right
|
2006-10-11 22:40:53 +02:00
|
|
|
call textbox.get_width
|
|
|
|
mov bl,[tbox.pos.x]
|
|
|
|
inc bl
|
|
|
|
cmp bl,[tbox.length]
|
|
|
|
ja @f
|
|
|
|
mov [tbox.pos.x],bl
|
|
|
|
sub bl,[tbox.ofs.x]
|
|
|
|
cmp bl,al
|
|
|
|
jbe @f
|
|
|
|
inc [tbox.ofs.x]
|
|
|
|
@@: ret
|
2007-09-01 23:38:00 +02:00
|
|
|
endp
|
2006-10-11 22:40:53 +02:00
|
|
|
|
2007-09-01 23:38:00 +02:00
|
|
|
proc key.tb.shift_end
|
2006-10-11 22:40:53 +02:00
|
|
|
call textbox.get_width
|
|
|
|
movzx ebx,[tbox.length]
|
|
|
|
mov [tbox.pos.x],bl
|
|
|
|
sub ebx,eax
|
|
|
|
jge @f
|
|
|
|
xor bl,bl
|
|
|
|
@@: mov [tbox.ofs.x],bl
|
|
|
|
ret
|
2007-09-01 23:38:00 +02:00
|
|
|
endp
|