From 15cb7df15941c9da260d19b22f03b9acda93856c Mon Sep 17 00:00:00 2001 From: hidnplayr Date: Sun, 3 Feb 2013 21:09:16 +0000 Subject: [PATCH] Some more updates for userlist in IRCC. git-svn-id: svn://kolibrios.org@3220 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/branches/net/applications/ircc/gui.inc | 72 ++++++++++++------- .../branches/net/applications/ircc/ircc.asm | 5 +- .../net/applications/ircc/serverparser.inc | 18 +---- 3 files changed, 52 insertions(+), 43 deletions(-) diff --git a/kernel/branches/net/applications/ircc/gui.inc b/kernel/branches/net/applications/ircc/gui.inc index f07fe2cd8e..4c86e79798 100644 --- a/kernel/branches/net/applications/ircc/gui.inc +++ b/kernel/branches/net/applications/ircc/gui.inc @@ -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) diff --git a/kernel/branches/net/applications/ircc/ircc.asm b/kernel/branches/net/applications/ircc/ircc.asm index d77bbfc248..13dd630a4d 100644 --- a/kernel/branches/net/applications/ircc/ircc.asm +++ b/kernel/branches/net/applications/ircc/ircc.asm @@ -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 diff --git a/kernel/branches/net/applications/ircc/serverparser.inc b/kernel/branches/net/applications/ircc/serverparser.inc index 946634a2c8..ec15beb986 100644 --- a/kernel/branches/net/applications/ircc/serverparser.inc +++ b/kernel/branches/net/applications/ircc/serverparser.inc @@ -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