Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 3981 → Rev 4060

/programs/network/ircc/encodings.inc
130,103 → 130,6
 
 
 
print_character:
 
pusha
 
cmp bl, 13 ; line beginning
jne nobol
 
mov ecx, [pos]
inc ecx
boll1:
dec ecx
mov eax, ecx
xor edx, edx
mov ebx, [textbox_width]
div ebx
test edx, edx
jnz boll1
mov [pos], ecx
jmp newdata
nobol:
 
cmp bl, 10 ; line down
jne nolf
 
addx1:
inc [pos]
mov eax, [pos]
xor edx, edx
mov ecx, [textbox_width]
div ecx
test edx, edx
jnz addx1
mov eax, [pos]
jmp cm1
nolf:
no_lf_ret:
 
 
cmp bl, 15 ; character
jbe newdata
 
mov eax, [irc_data]
shl eax, 8
mov al, bl
mov [irc_data], eax
 
mov eax, [pos]
;---- draw data
pusha
 
and ebx, 0xff
add eax, [text_start]
mov [eax], bl
 
popa
;---- draw data
 
mov eax, [pos]
inc eax
cm1:
mov ebx, [scroll+4]
imul ebx, [textbox_width]
cmp eax, ebx
jb noeaxz
 
mov esi, [text_start]
add esi, [textbox_width]
 
mov edi, [text_start]
mov ecx, ebx
rep movsb
 
mov esi, [text_start]
mov ecx, [textbox_width]
imul ecx, 61
add esi, ecx
 
mov edi, [text_start]
mov ecx, [textbox_width]
imul ecx, 60
add edi, ecx
mov ecx, ebx
rep movsb
 
mov eax, ebx
sub eax, [textbox_width]
noeaxz:
mov [pos], eax
 
newdata:
call window_is_updated
 
popa
ret
 
 
 
recode_to_cp866:
rep movsb
ret
/programs/network/ircc/gui.inc
225,68 → 225,6
ret
 
 
 
 
draw_channel_text:
 
pusha
 
mov eax, 4 ; draw text
mov ebx, TEXT_X shl 16 + TEXT_Y
mov ecx, 12 ; 12 lines max ?
mov esi, [textbox_width]
 
.dct:
pusha
mov cx, bx
shl ecx, 16
mov cx, 9 ; character height
mov eax, 13 ; draw rectangle
mov ebx, TEXT_X shl 16
mov bx, word[textbox_width]
imul bx, 6 ; character width
mov edx, [colors.work]
mcall
popa
 
push ecx
mov ecx, [colors.work_text]
cmp word[edx], '* '
jne .no_red
mov ecx, 0x00aa0000
jmp .draw
.no_red:
 
cmp word[edx], '**'
jne .no_light_blue
cmp byte[edx+2], '*'
jne .no_light_blue
mov ecx, 0x000000aa
jmp .draw
.no_light_blue:
 
cmp byte[edx], '#'
jne .no_blue
mov ecx, 0x0000aa00
; jmp .draw
.no_blue:
 
.draw:
mcall
add edx, [textbox_width]
add ebx, 10 ; height distance between lines
 
pop ecx
loop .dct
 
mov eax, [window_active]
and [eax + window.flags], not FLAG_UPDATED ; clear the 'window is updated' flag
 
popa
ret
 
 
 
draw_windowtabs:
 
; Create the buttons
/programs/network/ircc/ircc.asm
73,6 → 73,7
 
USERLIST_X = 98
 
TEXTBOX_LINES = 12
 
format binary as ""
 
121,6 → 122,7
include "socket.inc"
include "gui.inc"
include "users.inc"
include "textbox.inc"
 
 
START:
163,8 → 165,6
mov [ebx + window.data_ptr], eax
mov [ebx + window.flags], 0
mov [ebx + window.type], WINDOWTYPE_SERVER
add eax, window_data.text
mov [text_start], eax
 
call window_refresh
 
431,16 → 431,12
status dd STATUS_DISCONNECTED
 
text_start dd ? ; pointer to current textbox data
irc_data dd 0x0 ; encoder
textbox_width dd 80 ; in characters, not pixels ;)
pos dd 66 * 11 ; encoder
text_pos dd ? ; text writing cursor
 
window_active dd windows
window_print dd windows
 
scroll dd 1
dd 12
 
align 4
@IMPORT:
 
/programs/network/ircc/serverparser.inc
48,7 → 48,7
 
dd '322 ', cmd_322 ; RPL_LIST
dd '323 ', cmd_323 ; RPL_LISTEND
dd '328 ', cmd_328
dd '328 ', cmd_328 ; RPL_CHANNEL_URL
dd '332 ', cmd_topic
dd '333 ', cmd_333 ; nickname and time of topic
dd '353 ', cmd_353 ; name reply
/programs/network/ircc/textbox.inc
0,0 → 1,123
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2004-2013. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;;
;; ;;
;; ;;
;; GNU GENERAL PUBLIC LICENSE ;;
;; Version 2, June 1991 ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 
print_text: ; eax = start ptr
; dl = end char
pusha
ptr2:
mov bl, [eax]
 
cmp bl, dl
je .done
test bl, bl
jz .done
call print_character
 
inc eax
jmp ptr2
 
.done:
popa
ret
 
 
 
print_text2: ; esi = ptr to ASCIIZ string
 
pusha
.loop:
lodsb
test al, al
jz .done
mov bl, al
call print_character
jmp .loop
 
.done:
popa
ret
 
 
 
; Character in bl
print_character:
 
pusha
mov ecx, TEXTBOX_LINES
imul ecx, [textbox_width]
mov esi, [text_start]
 
cmp bl, 10 ; line down
je .linefeed
 
mov eax, [text_pos]
mov byte[esi + eax], bl ; write the byte
inc [text_pos]
 
cmp [text_pos], ecx
jb .done
 
.linefeed:
; scroll all text one line to the top
mov edi, esi
add esi, [textbox_width]
rep movsb
 
mov ecx, TEXTBOX_LINES - 1
imul ecx, [textbox_width]
mov [text_pos], ecx
 
.done:
call window_is_updated
 
popa
ret
 
 
 
draw_channel_text: ; edx = pointer to text
 
pusha
 
mov ebx, TEXT_X shl 16 + TEXT_Y
mov ecx, TEXTBOX_LINES
 
.drawloop:
pusha
mov cx, bx
shl ecx, 16
mov cx, 9 ; character height
mov ebx, TEXT_X shl 16
mov bx, word[textbox_width]
imul bx, 6 ; character width
mov edx, [colors.work]
mcall 13 ; draw rectangle
popa
 
push ecx
mov ecx, [colors.work_text]
 
.draw:
mov esi, [textbox_width]
mcall 4 ; draw text
add edx, [textbox_width]
add ebx, 10 ; height distance between lines
 
pop ecx
loop .drawloop
 
mov eax, [window_active]
and [eax + window.flags], not FLAG_UPDATED ; clear the 'window is updated' flag
 
popa
ret
 
/programs/network/ircc/window.inc
65,11 → 65,12
 
window_refresh:
 
; set the correct buffer pointers ; FIXME: what is it good for?
mov eax, [textbox_width] ;
imul eax, 11 ;
mov [pos], eax ;
; set text write cursor to beginning of last line
mov eax, [textbox_width]
imul eax, TEXTBOX_LINES - 1
mov [text_pos], eax
 
; set the textbuffer pointer
mov eax, [window_print]
mov eax, [eax + window.data_ptr]
add eax, window_data.text
233,42 → 234,7
ret
 
 
print_text: ; eax = start ptr
; dl = end char
pusha
ptr2:
mov bl, [eax]
 
cmp bl, dl
je ptr_ret
cmp bl, 0
je ptr_ret
call print_character
 
inc eax
jmp ptr2
 
ptr_ret:
popa
ret
 
 
print_text2: ; esi = ptr to ASCIIZ string
 
pusha
.loop:
lodsb
test al, al
jz .done
mov bl, al
call print_character
jmp .loop
 
.done:
popa
ret
 
 
if TIMESTAMP
print_timestamp: