Some more updates for userlist in IRCC.

git-svn-id: svn://kolibrios.org@3220 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
hidnplayr 2013-02-03 21:09:16 +00:00
parent cacc7f4975
commit 15cb7df159
3 changed files with 52 additions and 43 deletions

View File

@ -33,6 +33,7 @@ draw_window:
add edx, 0x33000000
mov edi, str_programname
mcall
mcall 12, 2 ;; when do we actually need this??
mov ebx, [xsize]
mov ecx, [ysize]
@ -50,6 +51,7 @@ draw_window:
cmp [edi + window.type], WINDOWTYPE_CHANNEL
jne .not_channel
; draw a vertical separator line
mov ebx, [xsize]
sub ebx, USERLIST_X + SCROLLBAR_WIDTH + 3
push bx
@ -59,29 +61,7 @@ draw_window:
add ecx, TOP_Y SHL 16 -(15) ;;;;
mcall
call print_channel_list
; scrollbar
mov eax, [ysize]
sub eax, TOP_Y + 15 ;;;;
push eax
mov [scroll1.y_size], ax
mov eax, [xsize]
sub eax, SCROLLBAR_WIDTH
mov [scroll1.x_pos], ax
pop eax ; scrollbar height
xor edx, edx
mov ecx, 10
div ecx
mov [scroll1.cur_area], eax
mov [scroll1.all_redraw], 1
push dword scroll1
call [scrollbar_v_draw]
call redraw_channel_list
.not_channel:
mov edx, [edi + window.data_ptr]
@ -104,15 +84,59 @@ draw_window:
call draw_windownames
mcall 12, 2
popa
ret
redraw_channel_list:
; First, calculate scrollbar
mov ebx, [window_open]
mov eax, [ebx + window.users] ; number of users in the open window
mov [scroll1.max_area], eax
mov eax, [ysize]
sub eax, TOP_Y + 15 ;;;;
push eax
mov [scroll1.y_size], ax
mov eax, [xsize]
sub eax, SCROLLBAR_WIDTH
mov [scroll1.x_pos], ax
pop eax ; scrollbar height
xor edx, edx
mov ecx, 10
div ecx
mov [scroll1.cur_area], eax
; Do we need a scrollbar?
cmp eax, [scroll1.max_area]
jae .noscroll
; Is the current position greater then the max position?
cmp eax, [scroll1.position]
ja @f
mov [scroll1.position], eax
@@:
; OK, draw the scrollbar
mov [scroll1.all_redraw], 1
push dword scroll1
call [scrollbar_v_draw]
jmp print_channel_list
.noscroll:
mov [scroll1.position], 0
print_channel_list:
pusha
; Now, draw the usernames themselves
mov eax, 13 ; draw rectangle (clear list)

View File

@ -284,11 +284,12 @@ mouse:
push dword edit1
call [edit_box_mouse]
; TODO: check if scrollbar is active
push dword scroll1
call [scrollbar_v_mouse]
; TODO: check if scrollbar moved
call print_channel_list ;;;
call print_channel_list
jmp still
@ -415,7 +416,7 @@ I_END:
; width, left, top
edit1 edit_box 0, 0, 0, 0xffffff, 0x6f9480, 0, 0, 0, USERCMD_MAX_SIZE, usercommand, mouse_dd, ed_focus, 25, 25
; xsize, xpos, ysize, ypos, max, cur, pos, bgcol, frcol, linecol
scroll1 scrollbar SCROLLBAR_WIDTH, 300, 150, TOP_Y, 10, 100, 0, 0, 0, 0, 0, 5
scroll1 scrollbar SCROLLBAR_WIDTH, 300, 150, TOP_Y, 10, 100, 0, 0, 0, 0, 0, 1
main_PID dd ? ; identifier of main thread

View File

@ -823,7 +823,6 @@ cmd_353: ; channel usernames reply
add edx, MAX_NICK_LEN
mov edi, edx
;;; cmp edi, .. ; TODO: Check for buffer overflow
jmp .namesloop ;;;;
.newname:
inc [ebx + window.users]
@ -838,23 +837,8 @@ cmd_353: ; channel usernames reply
jmp .namesloop
.done:
call users_calculate
call print_channel_list
ret
users_calculate:
mov ebx, [window_print]
mov eax, [ebx + window.users]
mov [scroll1.max_area], eax
; TODO: check if cur pos isnt greater then max
; OK, now redraw the scrollbar
mov [scroll1.all_redraw], 1
push dword scroll1
call [scrollbar_v_draw]
call redraw_channel_list
ret