More scrolling bugfixes, added some commands.

git-svn-id: svn://kolibrios.org@4622 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
hidnplayr 2014-03-09 16:07:08 +00:00
parent 83400f932d
commit a6a2dda144
4 changed files with 99 additions and 66 deletions

View File

@ -1,6 +1,6 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2004-2013. All rights reserved. ;;
;; Copyright (C) KolibriOS team 2004-2014. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;;
;; ;;
;; Written by hidnplayr@kolibrios.org ;;
@ -95,11 +95,22 @@ draw_window: ; Completely redraw the window, recalculate all coordinates and
mov [textbox_width], eax
; recalculate text line breaks (because height/width might have changed..)
mov edi, [window_active]
; meanwhile, recalculate line number of current line
mov esi, [edi + window.text_print]
mov al, byte[esi]
push eax
mov byte[esi], 0
push esi
mov esi, [edi + window.text_start]
call text_insert_newlines
mov [edi + window.text_lines], edx
mov [edi + window.text_scanned], esi
mov [edi + window.text_line_print], edx
pop esi
pop eax
mov byte[esi], al
; and redraw the textbox (and scrollbar if needed)
mov [scroll2.all_redraw], 1

View File

@ -13,7 +13,7 @@
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
version equ '0.18'
version equ '0.19'
; connection status
STATUS_DISCONNECTED = 0
@ -436,7 +436,7 @@ ctcp_time db '] TIME', 10, 0
has_left_channel db ' has left ', 0
joins_channel db ' has joined ', 0
is_now_known_as db ' is now known as ', 0
has_quit_irc db ' has quit IRC', 10, 0
has_quit_irc db ' has quit IRC.', 10, 0
sets_mode db ' sets mode ', 0
str_kicked db ' is kicked from ', 0

View File

@ -47,20 +47,37 @@ server_parser:
server_commands:
dd '001 ', cmd_justprint
dd '002 ', cmd_justprint
dd '003 ', cmd_justprint
dd '004 ', cmd_justprint
dd '005 ', cmd_justprint
dd '250 ', cmd_justprint
dd '251 ', cmd_justprint
dd '252 ', cmd_justprint
dd '253 ', cmd_justprint
dd '254 ', cmd_justprint
dd '255 ', cmd_justprint
dd '265 ', cmd_justprint
dd '266 ', cmd_justprint
dd '322 ', cmd_322 ; RPL_LIST
dd '323 ', cmd_323 ; RPL_LISTEND
dd '324 ', cmd_324 ;;;;
dd '328 ', cmd_328 ; RPL_CHANNEL_URL
dd '329 ', cmd_329
dd '324 ', cmd_justprint
dd '328 ', cmd_justprint ; RPL_CHANNEL_URL
dd '329 ', cmd_justprint
dd '332 ', cmd_topic
dd '333 ', cmd_333 ; nickname and time of topic
dd '353 ', cmd_353 ; name reply
dd '366 ', cmd_366 ; end of names list
dd '372 ', cmd_372 ; motd
dd '375 ', cmd_375 ; start of motd
dd '376 ', cmd_376 ; end of motd
dd '421 ', cmd_421 ; unknown command
dd '433 ', cmd_433 ; nickname already in use
dd '372 ', cmd_justprint ; motd
dd '375 ', cmd_justprint ; start of motd
dd '376 ', cmd_justprint ; end of motd
dd '421 ', cmd_justprint ; unknown command
dd '433 ', cmd_justprint ; nickname already in use
dd 'join', cmd_join
dd 'kick', cmd_kick
dd 'mode', cmd_mode
@ -151,27 +168,27 @@ skip_parameter:
cmd_324:
cmd_329:
cmd_328:
cmd_421:
cmd_372:
cmd_375:
cmd_376:
cmd_433:
cmd_justprint:
add esi, 4
jmp cmd_notice.loop
call skip_parameter
call print_text2
mov esi, str_newline
call print_text2
ret
cmd_notice:
if TIMESTAMP
call print_timestamp
end if
cmp byte[servercommand], ':'
jne .gogogo
mov byte [esi-1], 0
if TIMESTAMP
call print_timestamp
end if
push esi
mov esi, str_1
call print_text2
@ -184,25 +201,10 @@ cmd_notice:
.gogogo:
add esi, 6
.loop:
inc esi
cmp byte [esi], 0
je .fail
cmp byte [esi], ' '
jne .loop
.loop2:
inc esi
cmp byte [esi], 0
je .fail
cmp byte [esi], ' '
je .loop2
cmp byte [esi], ':'
je .loop2
.fail:
call skip_parameter
call skip_parameter
call print_text2
mov esi, str_newline
call print_text2
@ -827,11 +829,12 @@ cmd_mode:
cmp byte [esi+4], ' '
jne .fail
add esi, 5 ; skip 'MODE '
push esi
call window_find
test ebx, ebx
jz .fail
jz .user
mov [esp], esi
mov [window_print], ebx
push esi
if TIMESTAMP
call print_timestamp
@ -853,9 +856,33 @@ cmd_mode:
mov esi, str_newline
call print_text2
;;; TODO: change username if needed
; TODO: keep track of user modes in username list
.fail:
ret
.user:
if TIMESTAMP
call print_timestamp
end if
mov esi, mode_header
call print_text2
mov eax, [esp]
mov dl, ' '
call print_text
mov esi, sets_mode
call print_text2
pop esi
call skip_parameter
call print_text2
mov esi, str_newline
call print_text2
ret
@ -942,7 +969,7 @@ cmd_topic:
cmd_333:
add esi, 4 ; skip '333 '
call skip_parameter ;;;;
call skip_parameter
call window_open
if TIMESTAMP
@ -956,9 +983,6 @@ cmd_333:
mov esi, str_setby
call print_text2
; pop esi
; call print_text2
pop eax
mov dl, '!'
call print_text

View File

@ -201,6 +201,20 @@ draw_channel_text:
mov [edi + window.text_print], esi
.noscroll:
; Update and draw scrollbar when nescessary
mov edx, [edi + window.text_lines]
cmp edx, [textbox_height]
jbe .scroll_done
mov [scroll2.max_area], edx
mov eax, [edi + window.text_line_print]
mov [scroll2.position], eax
push dword scroll2 ; redraw scrollbar
call [scrollbar_draw]
mov [scroll2.all_redraw], 0 ; next time, dont redraw it completely
.scroll_done:
; Calculate start offset coordinates (align text to bottom)
mov ebx, [textbox_height]
sub ebx, [edi + window.text_lines]
@ -262,7 +276,6 @@ draw_channel_text:
or ecx, 0x40000000
.no_colors:
.draw:
mov esi, 1
mcall 4 ; draw text
add ebx, FONT_WIDTH shl 16
@ -283,21 +296,6 @@ draw_channel_text:
jnz .drawloop
.end_of_text:
; Update and draw scrollbar when nescessary
mov edi, [window_active]
mov edx, [edi + window.text_lines]
cmp edx, [textbox_height]
jbe .scroll_done
mov [scroll2.max_area], edx
mov eax, [edi + window.text_line_print]
mov [scroll2.position], eax
push dword scroll2 ; redraw scrollbar
call [scrollbar_draw]
mov [scroll2.all_redraw], 0 ; next time, dont redraw it completely
.scroll_done:
ret