Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 6023 → Rev 6026

/programs/network/ircc/textbox.inc
24,6 → 24,8
dec ecx
jz .end_of_line
lodsb ; get one character of the string
test al, 0x80
jnz .multiball!
test al, al ; end of string?
jz .almost_done
cmp al, ' ' ; it's a space! remember its position
52,6 → 54,20
 
ret
 
.multiball!:
add esi, 4
and al, 11111000b
cmp al, 11110000b
je .more
dec esi
and al, 11110000b
cmp al, 11100000b
je .more
dec esi
jmp .more
 
 
 
;----------------------------------
; scan untill next line is reached
;
245,11 → 261,45
.no_offset:
xor ebx, ebx
.draw_text:
 
; Prepare to actually draw some text
add ebx, TEXT_X shl 16 + TEXT_Y ; text coordinates
mov ecx, [colors.work_text] ; default text color
or ecx, 0x30000000
mov edx, [edi + window.text_print] ; start of text to print
 
; Scan backwards on line for color escape codes
mov esi, edx
push edx
std
@@:
lodsb
cmp al, 0 ; end of text
je @f
cmp al, 10 ; hard newline
je @f
cmp al, 3 ; mIRC escape code
jne @b
 
cld
lea edx, [esi+2]
call dec_to_esi
jz @f
mov ecx, [irc_colors + 4*esi]
or ecx, 0x30000000 ; UTF-8 text
 
cmp byte[edx], ',' ; background color?
jne @f
inc edx
call dec_to_esi
jz @f
mov edi, [irc_colors + 4*esi]
or ecx, 0x40000000 ; enable background color
@@:
cld
 
pop edx
mov eax, [textbox_height] ; max number of lines to draw
add ebx, TEXT_X shl 16 + TEXT_Y
mov ecx, [colors.work_text] ; default text color
mov edx, [edi + window.text_print]
.drawloop:
cmp byte[edx], 0
je .end_of_text
266,19 → 316,17
mcall 13 ; draw rectangle
popa
 
mov esi, edx
add esi, [textbox_width]
push eax
mov esi, [textbox_width]
.line:
cmp byte[edx], 0
je .end_of_text
 
cmp byte[edx], 13
je .newline_soft
 
cmp byte[edx], 10
je .newline_hard
 
push esi eax
push esi
cmp byte[edx], 3 ; escape code for mIRC colors
jne .no_colors
inc edx
285,6 → 333,7
call dec_to_esi
jz .no_colors
mov ecx, [irc_colors + 4*esi]
or ecx, 0x30000000
 
cmp byte[edx], ',' ; background color?
jne .no_colors
297,20 → 346,38
 
mov esi, 1
mcall 4 ; draw text
 
mov esi, 1
mov al, byte[edx]
test al, 10000000b
jz @f
mov esi, 4
and al, 11111000b
cmp al, 11110000b
je @f
dec esi
and al, 11110000b
cmp al, 11100000b
je @f
dec esi
@@:
 
add ebx, FONT_WIDTH shl 16
inc edx
pop eax esi
cmp edx, esi
jb .line
add edx, esi
pop esi
dec esi
jnz .line
jmp .line_full
 
.newline_hard:
mov ecx, [colors.work_text]
or ecx, 0x30000000
.newline_soft:
inc edx
.line_full:
and ebx, 0x0000ffff
add ebx, TEXT_X shl 16 + FONT_HEIGHT
pop eax
dec eax
jnz .drawloop
.end_of_text: