Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 4617 → Rev 4621

/programs/network/ircc/ircc.asm
13,7 → 13,7
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
version equ '0.17'
version equ '0.18'
 
; connection status
STATUS_DISCONNECTED = 0
313,9 → 313,10
je exit
mov [window_active], edx
 
mov [scroll2.position], 1 ;;; FIXME
push [edx + window.text_line_print]
pop [scroll2.position]
 
call draw_window
 
jmp mainloop
 
exit:
517,10 → 518,6
 
status dd STATUS_DISCONNECTED
 
 
textbox_height dd 12 ; in characters
textbox_width dd 78 ; in characters, not pixels ;)
 
window_active dd windows
window_print dd windows
 
572,6 → 569,9
ysize dd ?
mouse_dd dd ?
 
textbox_height dd ? ; in characters
textbox_width dd ? ; in characters, not pixels ;)
 
colors system_colors
 
irc_server_name rb MAX_SERVER_NAME ; TODO: move this server URL into window struct
581,7 → 581,6
user_real_name rb MAX_REAL_LEN
quit_msg rb 250
 
diff16 "windows", 0, $ + 1*sizeof.window ;+ 6
windows rb MAX_WINDOWS*sizeof.window
 
IM_END:
/programs/network/ircc/textbox.inc
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 ;;
35,10 → 35,7
inc edx
jmp .next_line
.soft_nl:
inc edx
mov byte[esi-1], ' '
mov ebx, esi
jmp .more
.space:
mov ebx, esi ; last detected space
jmp .more
62,9 → 59,9
 
mov ecx, [textbox_width]
.loop:
cmp byte[esi], 0
je .done
lodsb
test al, al
jz .done
cmp al, 10
je .done
cmp al, 13
132,7 → 129,6
ret
 
.uh_ow:
 
pusha
mov edi, [esi + window.text_start]
mov [esi + window.text_print], edi
165,13 → 161,20
add [edi + window.text_lines], edx
mov [edi + window.text_scanned], esi
 
; should we scroll up/down some lines ? ; TODO: only scroll down automatically when scrollbar is at lowest position ?
; Is scrollbar at lowest position?
mov edx, [scroll2.position]
test edx, edx
jz .yesscroll
add edx, [scroll2.cur_area]
sub edx, [scroll2.max_area]
jne .noscroll
.yesscroll:
; Scrollbar was at lowest position, scroll down automatically when new text arrived.
mov edx, [edi + window.text_lines]
sub edx, [textbox_height]
jle .noscroll ; There are less lines of text than fit into the window, dont scroll..
sub edx, [edi + window.text_line_print]
je .noscroll ; We are already at the bottom pos, dont scroll..
 
.scroll_to_pos: ; edx = number of lines to go up/down (flags must indicate direction)
pushf
add [edi + window.text_line_print], edx
179,12 → 182,13
popf
ja .loop_forward
std ; set direction flag so we can scan backwards
dec esi
dec esi ; move our cursor just in front of newline, for scanning backwards
dec edx ;;;;; FIXME: this seems to be needed, but why ???
.loop_backward:
call text_nextline
inc edx
jnz .loop_backward
inc esi
inc esi ; move the cursor just after last newline
cld
jmp .ok
197,22 → 201,25
mov [edi + window.text_print], esi
.noscroll:
 
mov edx, [edi + window.text_print]
; Calculate start coordinates (align text to bottom)
; Calculate start offset coordinates (align text to bottom)
mov ebx, [textbox_height]
sub ebx, [edi + window.text_lines]
jae @f
jb .no_offset
imul ebx, FONT_HEIGHT
push [edi + window.text_start]
pop [edi + window.text_print]
jmp .draw_text
.no_offset:
xor ebx, ebx
@@:
imul ebx, FONT_HEIGHT
add ebx, TEXT_X shl 16 + TEXT_Y
 
.draw_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
mov ecx, [colors.work_text] ; default text color
mov edx, [edi + window.text_print]
.drawloop:
cmp byte[edx], 0
je .end
je .end_of_text
 
; Clear one row of characters
pusha
230,7 → 237,7
add esi, [textbox_width]
.line:
cmp byte[edx], 0
je .end
je .end_of_text
 
cmp byte[edx], 13
je .newline_soft
274,17 → 281,14
add ebx, TEXT_X shl 16 + FONT_HEIGHT
dec eax
jnz .drawloop
.end_of_text:
 
; take care of the scrollbar
.scrollbar:
; Update and draw scrollbar when nescessary
mov edi, [window_active]
mov edx, [edi + window.text_lines]
cmp edx, [textbox_height]
ja .draw_scroll
mov [scroll2.position], 0 ; disable scrollbar
jmp .scroll_done
jbe .scroll_done
 
.draw_scroll:
mov [scroll2.max_area], edx
mov eax, [edi + window.text_line_print]
mov [scroll2.position], eax
291,10 → 295,9
 
push dword scroll2 ; redraw scrollbar
call [scrollbar_draw]
 
mov [scroll2.all_redraw], 0 ; next time, dont redraw it completely
.scroll_done:
.end:
 
ret
 
 
310,9 → 313,8
cmp al, 9
ja .done
inc edx
shl esi, 1 ; esi * 2
lea esi, [esi + 4*esi] ; esi * 5
add esi, eax
lea esi, [esi*4 + esi] ; esi * 5
lea esi, [esi*2 + eax] ; esi * 2 + eax
jmp .loop
.done:
cmp esi, 16
/programs/network/ircc/window.inc
37,7 → 37,7
mov [ebx + window.data_ptr], eax
mov [ebx + window.flags], 0
 
add eax, window_data.text+1 ; let text begin at offset 1, this way the text will be prepended with a 0
add eax, window_data.text+2 ; let text begin at offset 2, this way the text will be prepended with two null bytes
mov [ebx + window.text_start], eax
mov [ebx + window.text_print], eax
mov [ebx + window.text_write], eax