IRCc 0.25: Use big fonts, improved UTF-8 support.

git-svn-id: svn://kolibrios.org@6026 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
hidnplayr 2016-01-02 21:03:09 +00:00
parent d55f154222
commit 97df225ad2
7 changed files with 131 additions and 68 deletions

View File

@ -113,7 +113,7 @@ draw_window: ; Completely redraw the window, recalculate all coordinates and
jne .not_channel jne .not_channel
mov [scroll1.all_redraw], 1 mov [scroll1.all_redraw], 1
call draw_channel_list call draw_user_list
; draw a vertical separator line when there is no scrollbar ; draw a vertical separator line when there is no scrollbar
cmp [scroll2.all_redraw], 1 cmp [scroll2.all_redraw], 1
@ -138,11 +138,10 @@ draw_window: ; Completely redraw the window, recalculate all coordinates and
mov eax, [xsize] mov eax, [xsize]
mov [edit1.width], eax mov [edit1.width], eax
push dword edit1 invoke edit_box_draw, edit1
call [edit_box_draw]
; draw tabs ; draw tabs
call draw_windowtabs call draw_window_tabs
.exit: .exit:
popa popa
@ -150,7 +149,7 @@ draw_window: ; Completely redraw the window, recalculate all coordinates and
draw_channel_list: draw_user_list:
pusha pusha
@ -167,8 +166,7 @@ draw_channel_list:
mov [scroll1.position], eax mov [scroll1.position], eax
@@: @@:
; OK, draw the scrollbar ; OK, draw the scrollbar
push dword scroll1 invoke scrollbar_draw, scroll1
call [scrollbar_draw]
; dont redraw scrollbar completely next time, ; dont redraw scrollbar completely next time,
; unless draw_window asks us to by setting [scroll1.all_redraw] back to 1 ; unless draw_window asks us to by setting [scroll1.all_redraw] back to 1
@ -211,7 +209,7 @@ draw_channel_list:
pop ebx pop ebx
mov bx, TEXT_Y mov bx, TEXT_Y
mov ecx, [colors.work_text] mov ecx, [colors.work_text]
or ecx, 0x80000000 ; ASCIIZ string or ecx, 0x90000000 ; 8x16 font, zero terminated string
mov eax, 4 ; draw text mov eax, 4 ; draw text
mov edi, [textbox_height] ; how many names will fit on screen mov edi, [textbox_height] ; how many names will fit on screen
@ -226,16 +224,16 @@ draw_channel_list:
mov cx, bx mov cx, bx
mov bx, USERLIST_WIDTH mov bx, USERLIST_WIDTH
shl ecx, 16 shl ecx, 16
mov cx, 10 - 1 mov cx, FONT_HEIGHT
mov edx, 0x00000055 ; blue! mov edx, 0x00000055 ; blue!
mcall 13 mcall 13
popa popa
mov ecx, 0x8000ffff ; cyan! mov ecx, 0x9000ffff ; cyan!
mcall mcall
mov ecx, [colors.work_text] mov ecx, [colors.work_text]
or ecx, 0x80000000 ; ASCIIZ string or ecx, 0x90000000 ; 8x16 font, zero terminated string
jmp .next jmp .next
.nothighlight: .nothighlight:
@ -253,7 +251,7 @@ draw_channel_list:
ret ret
draw_windowtabs: draw_window_tabs:
; Draw horizontal line ; Draw horizontal line

View File

@ -13,7 +13,7 @@
;; ;; ;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
version equ '0.24' version equ '0.25'
; connection status ; connection status
STATUS_DISCONNECTED = 0 STATUS_DISCONNECTED = 0
@ -43,9 +43,9 @@ UTF8 = 2
USERCMD_MAX_SIZE = 400 USERCMD_MAX_SIZE = 400
WIN_MIN_X = 600 WIN_MIN_X = 600
WIN_MIN_Y = 170 WIN_MIN_Y = 183
TEXT_X = 5 TEXT_X = 2
TEXT_Y = TOP_Y + 2 TEXT_Y = TOP_Y + 2
TOP_SPACE = 2 TOP_SPACE = 2
@ -77,10 +77,10 @@ WINDOW_BTN_CLOSE = 2
WINDOW_BTN_LIST = 3 WINDOW_BTN_LIST = 3
SCROLLBAR_WIDTH = 14 SCROLLBAR_WIDTH = 14
USERLIST_WIDTH = 100 USERLIST_WIDTH = 160
FONT_HEIGHT = 9 FONT_WIDTH = 8
FONT_WIDTH = 6 FONT_HEIGHT = 16
format binary as "" format binary as ""
@ -245,7 +245,7 @@ mainloop:
mov edi, [window_active] mov edi, [window_active]
cmp [edi + window.type], WINDOWTYPE_CHANNEL cmp [edi + window.type], WINDOWTYPE_CHANNEL
jne .no_update jne .no_update
call draw_channel_list call draw_user_list
.no_update: .no_update:
call highlight_updated_tabs call highlight_updated_tabs
@ -280,7 +280,7 @@ button:
mov ebx, [window_active] mov ebx, [window_active]
mov [ebx + window.selected], eax mov [ebx + window.selected], eax
call draw_channel_list call draw_user_list
pop eax pop eax
test eax, 1 shl 25 ; Right mouse button pressed? test eax, 1 shl 25 ; Right mouse button pressed?
@ -378,8 +378,7 @@ main_window_key:
mov [edit1.size], 0 mov [edit1.size], 0
mov [edit1.pos], 0 mov [edit1.pos], 0
push dword edit1 invoke edit_box_draw, edit1
call [edit_box_draw]
call draw_channel_text call draw_channel_text
@ -389,8 +388,7 @@ main_window_key:
jmp mainloop jmp mainloop
mouse: mouse:
push dword edit1 invoke edit_box_mouse, edit1
call [edit_box_mouse]
; mcall 37, 7 ; mcall 37, 7
; movsx eax, ax ; movsx eax, ax
@ -401,12 +399,11 @@ mouse:
cmp [edi + window.type], WINDOWTYPE_CHANNEL cmp [edi + window.type], WINDOWTYPE_CHANNEL
jne @f jne @f
push [scroll1.position] push [scroll1.position]
push dword scroll1 invoke scrollbar_mouse, scroll1
call [scrollbar_mouse]
pop eax pop eax
cmp eax, [scroll1.position] ; did the scrollbar move? cmp eax, [scroll1.position] ; did the scrollbar move?
je @f je @f
call draw_channel_list call draw_user_list
@@: @@:
; TODO: check if scrollbar is active? ; TODO: check if scrollbar is active?
@ -414,8 +411,7 @@ mouse:
mov eax, [edi + window.text_lines] mov eax, [edi + window.text_lines]
cmp eax, [textbox_height] cmp eax, [textbox_height]
jbe @f jbe @f
push dword scroll2 invoke scrollbar_mouse, scroll2
call [scrollbar_mouse]
mov edi, [window_active] mov edi, [window_active]
and [edi+window.flags], not FLAG_SCROLL_LOW and [edi+window.flags], not FLAG_SCROLL_LOW
mov edx, [scroll2.position] mov edx, [scroll2.position]
@ -506,10 +502,8 @@ str_welcome db 3, '3 ___', 3, '7__________', 3, '6_________ ', 3, '
db 3, '3| |', 3, '7| | \', 3, '6 \____', 3, '4 \ \___| |_| \ ___/| | \ |', 10 db 3, '3| |', 3, '7| | \', 3, '6 \____', 3, '4 \ \___| |_| \ ___/| | \ |', 10
db 3, '3|___|', 3, '7|____|_ /', 3, '6\______ /', 3, '4 \___ >____/__|\___ >___| /__|', 10 db 3, '3|___|', 3, '7|____|_ /', 3, '6\______ /', 3, '4 \___ >____/__|\___ >___| /__|', 10
db 3, '3 ', 3, '7 \/ ', 3, '6 \/ ', 3, '4 \/ \/ \/', 10 db 3, '3 ', 3, '7 \/ ', 3, '6 \/ ', 3, '4 \/ \/ \/', 10
db 10
db 'Welcome to KolibriOS IRC client ', version, 10 db 'Welcome to KolibriOS IRC client ', version, 10
db 10 db 'Type /help for help', 10, 0
db 'Type /help for help', 10, 10, 0
str_version db 'VERSION KolibriOS ' str_version db 'VERSION KolibriOS '
str_programname db 'IRC client ', version, 0 str_programname db 'IRC client ', version, 0
@ -577,7 +571,7 @@ import boxlib,\
scrollbar_mouse,'scrollbar_v_mouse' scrollbar_mouse,'scrollbar_v_mouse'
; width, left, top ; width, left, top
edit1 edit_box 0, 0, 0, 0xffffff, 0x6f9480, 0, 0, 0, USERCMD_MAX_SIZE, usercommand, mouse_dd, ed_always_focus, 25, 25 edit1 edit_box 0, 0, 0, 0xffffff, 0x6f9480, 0, 0, 0x000000, USERCMD_MAX_SIZE, usercommand, mouse_dd, ed_always_focus, 25, 25
; xsize, xpos, ysize, ypos, btn_height, max, cur, pos, bgcol, frcol, linecol ; xsize, xpos, ysize, ypos, btn_height, max, cur, pos, bgcol, frcol, linecol
scroll1 scrollbar SCROLLBAR_WIDTH, 0, 0, TOP_Y, SCROLLBAR_WIDTH, 0, 0, 0, 0, 0, 0, 1 scroll1 scrollbar SCROLLBAR_WIDTH, 0, 0, TOP_Y, SCROLLBAR_WIDTH, 0, 0, 0, 0, 0, 0, 1
scroll2 scrollbar SCROLLBAR_WIDTH, 0, 0, TOP_Y, SCROLLBAR_WIDTH, 0, 0, 0, 0, 0, 0, 1 scroll2 scrollbar SCROLLBAR_WIDTH, 0, 0, TOP_Y, SCROLLBAR_WIDTH, 0, 0, 0, 0, 0, 0, 1

View File

@ -1,6 +1,6 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;; ;; ;;
;; Copyright (C) KolibriOS team 2004-2014. All rights reserved. ;; ;; Copyright (C) KolibriOS team 2004-2016. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;; ;; Distributed under terms of the GNU General Public License ;;
;; ;; ;; ;;
;; Written by hidnplayr@kolibrios.org ;; ;; Written by hidnplayr@kolibrios.org ;;
@ -961,7 +961,7 @@ cmd_353: ; channel usernames reply
jmp .add jmp .add
.done: .done:
call draw_channel_list call draw_user_list
.fail: .fail:
ret ret
@ -1059,7 +1059,7 @@ cmd_322: ; LIST
jz .fail jz .fail
mov [window_active], ebx mov [window_active], ebx
call draw_windowtabs call draw_window_tabs
pop esi pop esi
call print_asciiz call print_asciiz
mov al, 10 mov al, 10

View File

@ -1,6 +1,6 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;; ;; ;;
;; Copyright (C) KolibriOS team 2004-2014. All rights reserved. ;; ;; Copyright (C) KolibriOS team 2004-2016. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;; ;; Distributed under terms of the GNU General Public License ;;
;; ;; ;; ;;
;; Written by hidnplayr@kolibrios.org ;; ;; Written by hidnplayr@kolibrios.org ;;
@ -210,7 +210,7 @@ socket_receive:
pusha pusha
; TODO: read more data if we receive one full packet ; FIXME: make this a proper stream!
.nextpacket: .nextpacket:
mcall recv, [socketnum], packetbuf, 1024, MSG_DONTWAIT ; read a packet mcall recv, [socketnum], packetbuf, 1024, MSG_DONTWAIT ; read a packet
@ -219,30 +219,33 @@ socket_receive:
dec eax dec eax
jz .disconnected jz .disconnected
; ok we have data, now feed it to the recoder ; ok we have data, now feed it to the command splicer
lea edx, [packetbuf + eax] ; edx = end pointer mov ecx, eax
mov esi, packetbuf ; esi = start pointer mov esi, packetbuf ; esi = start pointer
.nextcommand: .nextcommand:
mov edi, servercommand mov edi, servercommand
.byteloop: .byteloop:
call get_next_byte ; reads byte from [esi] to al lodsb
jnc .nextpacket ; if CF is set, we need more data (TODO: dont throw away old data!!!)
cmp al, 10 cmp al, 10
je .got_command je .got_command
cmp al, 13 cmp al, 13
je .got_command je .got_command
stosb stosb
jmp .byteloop dec ecx
jnz .byteloop
;;; FIXME
jmp .nextpacket
; we have a command, call the serverparser ; we have a command, call the serverparser
.got_command: .got_command:
mov byte[edi], 0 ; mark the end of the command mov byte[edi], 0 ; mark the end of the command
push esi edx push esi ecx
call server_parser call server_parser
pop edx esi pop ecx esi
jmp .nextcommand test ecx, ecx
jnz .nextcommand
.done: .done:
popa popa

View File

@ -24,6 +24,8 @@ text_insert_newlines: ; esi = ASCIIZ string
dec ecx dec ecx
jz .end_of_line jz .end_of_line
lodsb ; get one character of the string lodsb ; get one character of the string
test al, 0x80
jnz .multiball!
test al, al ; end of string? test al, al ; end of string?
jz .almost_done jz .almost_done
cmp al, ' ' ; it's a space! remember its position cmp al, ' ' ; it's a space! remember its position
@ -52,6 +54,20 @@ text_insert_newlines: ; esi = ASCIIZ string
ret 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 ; scan untill next line is reached
; ;
@ -245,11 +261,45 @@ draw_channel_text:
.no_offset: .no_offset:
xor ebx, ebx xor ebx, ebx
.draw_text: .draw_text:
; Prepare to actually draw some text ; Prepare to actually draw some text
mov eax, [textbox_height] ; max number of lines to draw add ebx, TEXT_X shl 16 + TEXT_Y ; text coordinates
add ebx, TEXT_X shl 16 + TEXT_Y
mov ecx, [colors.work_text] ; default text color mov ecx, [colors.work_text] ; default text color
mov edx, [edi + window.text_print] 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
.drawloop: .drawloop:
cmp byte[edx], 0 cmp byte[edx], 0
je .end_of_text je .end_of_text
@ -266,25 +316,24 @@ draw_channel_text:
mcall 13 ; draw rectangle mcall 13 ; draw rectangle
popa popa
mov esi, edx push eax
add esi, [textbox_width] mov esi, [textbox_width]
.line: .line:
cmp byte[edx], 0 cmp byte[edx], 0
je .end_of_text je .end_of_text
cmp byte[edx], 13 cmp byte[edx], 13
je .newline_soft je .newline_soft
cmp byte[edx], 10 cmp byte[edx], 10
je .newline_hard je .newline_hard
push esi eax push esi
cmp byte[edx], 3 ; escape code for mIRC colors cmp byte[edx], 3 ; escape code for mIRC colors
jne .no_colors jne .no_colors
inc edx inc edx
call dec_to_esi call dec_to_esi
jz .no_colors jz .no_colors
mov ecx, [irc_colors + 4*esi] mov ecx, [irc_colors + 4*esi]
or ecx, 0x30000000
cmp byte[edx], ',' ; background color? cmp byte[edx], ',' ; background color?
jne .no_colors jne .no_colors
@ -297,20 +346,38 @@ draw_channel_text:
mov esi, 1 mov esi, 1
mcall 4 ; draw text 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 add ebx, FONT_WIDTH shl 16
inc edx add edx, esi
pop eax esi pop esi
cmp edx, esi dec esi
jb .line jnz .line
jmp .line_full jmp .line_full
.newline_hard: .newline_hard:
mov ecx, [colors.work_text] mov ecx, [colors.work_text]
or ecx, 0x30000000
.newline_soft: .newline_soft:
inc edx inc edx
.line_full: .line_full:
and ebx, 0x0000ffff and ebx, 0x0000ffff
add ebx, TEXT_X shl 16 + FONT_HEIGHT add ebx, TEXT_X shl 16 + FONT_HEIGHT
pop eax
dec eax dec eax
jnz .drawloop jnz .drawloop
.end_of_text: .end_of_text:

View File

@ -440,6 +440,7 @@ cmd_usr_part:
cmd_usr_close_window: cmd_usr_close_window:
mov esi, [window_active] mov esi, [window_active]
mov [window_print], esi
cmp [esi + window.type], WINDOWTYPE_SERVER cmp [esi + window.type], WINDOWTYPE_SERVER
je .not_channel je .not_channel

View File

@ -76,7 +76,7 @@ window_set_name:
stosb stosb
push esi ebx push esi ebx
call draw_windowtabs call draw_window_tabs
pop ebx esi pop ebx esi
ret ret
@ -107,7 +107,7 @@ window_close: ; closes the 'print' window
jne @f jne @f
sub edi, sizeof.window sub edi, sizeof.window
mov [window_active], edi mov [window_active], edi
mov [window_print], edi ;;;;;;;; mov [window_print], edi
@@: @@:
; At last, redraw everything ; At last, redraw everything