IRCc 0.24: Make better use of available space on screen.
git-svn-id: svn://kolibrios.org@6023 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
45a7eeea24
commit
e48064d090
@ -1,6 +0,0 @@
|
|||||||
@erase lang.inc
|
|
||||||
@echo lang fix en >lang.inc
|
|
||||||
@fasm -m 16384 ircc.asm ircc
|
|
||||||
@kpack ircc
|
|
||||||
@erase lang.inc
|
|
||||||
@pause
|
|
@ -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 ;;
|
||||||
@ -11,7 +11,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
draw_window: ; Completely redraw the window, recalculate all coordinates and sizes
|
draw_window: ; Completely redraw the window, recalculate all coordinates and sizes
|
||||||
|
|
||||||
pusha
|
pusha
|
||||||
@ -53,25 +52,14 @@ draw_window: ; Completely redraw the window, recalculate all coordinates and
|
|||||||
add edx, 0x33000000
|
add edx, 0x33000000
|
||||||
mov edi, str_programname
|
mov edi, str_programname
|
||||||
mcall
|
mcall
|
||||||
mcall 12, 2
|
mcall 12, 2
|
||||||
|
|
||||||
test [thread_info.wnd_state], 100b ; skip if window rolled up
|
test [thread_info.wnd_state], 100b ; skip if window is rolled up
|
||||||
jne .exit
|
jne .exit
|
||||||
|
|
||||||
mov ebx, [xsize]
|
|
||||||
mov ecx, [ysize]
|
|
||||||
sub cx, BOTTOM_Y ;;;;
|
|
||||||
push cx
|
|
||||||
shl ecx, 16
|
|
||||||
pop cx
|
|
||||||
mov edx, [colors.work_graph]
|
|
||||||
mcall 38 ; draw bottom line
|
|
||||||
mov ecx, TOP_Y SHL 16 + TOP_Y
|
|
||||||
mcall ; draw top line
|
|
||||||
|
|
||||||
; calculate available space for textbox and coordinates for scrollbars
|
; calculate available space for textbox and coordinates for scrollbars
|
||||||
mov eax, [ysize]
|
mov eax, [ysize]
|
||||||
sub eax, TOP_Y + BOTTOM_Y - 1 ;;;;
|
sub eax, TOP_Y + INPUTBOX_HEIGHT - 1 ;;;;
|
||||||
mov [scroll2.y_size], ax
|
mov [scroll2.y_size], ax
|
||||||
mov [scroll1.y_size], ax
|
mov [scroll1.y_size], ax
|
||||||
sub eax, 4 ;;;;
|
sub eax, 4 ;;;;
|
||||||
@ -137,14 +125,14 @@ draw_window: ; Completely redraw the window, recalculate all coordinates and
|
|||||||
shl ebx, 16
|
shl ebx, 16
|
||||||
pop bx
|
pop bx
|
||||||
mov ecx, [ysize]
|
mov ecx, [ysize]
|
||||||
add ecx, TOP_Y shl 16 - (BOTTOM_Y)
|
add ecx, TOP_Y shl 16 - (INPUTBOX_HEIGHT)
|
||||||
mov edx, [colors.work_graph]
|
mov edx, [colors.work_graph]
|
||||||
mcall 38
|
mcall 38
|
||||||
.not_channel:
|
.not_channel:
|
||||||
|
|
||||||
; draw editbox
|
; draw editbox
|
||||||
mov eax, [ysize]
|
mov eax, [ysize]
|
||||||
sub eax, 13 ;;;;;;
|
sub eax, INPUTBOX_HEIGHT
|
||||||
mov [edit1.top], eax
|
mov [edit1.top], eax
|
||||||
|
|
||||||
mov eax, [xsize]
|
mov eax, [xsize]
|
||||||
@ -267,11 +255,18 @@ draw_channel_list:
|
|||||||
|
|
||||||
draw_windowtabs:
|
draw_windowtabs:
|
||||||
|
|
||||||
|
; Draw horizontal line
|
||||||
|
|
||||||
|
mov ebx, [xsize]
|
||||||
|
mov edx, [colors.work_graph]
|
||||||
|
mov ecx, TOP_Y SHL 16 + TOP_Y
|
||||||
|
mcall 38
|
||||||
|
|
||||||
; Create the buttons
|
; Create the buttons
|
||||||
|
|
||||||
mov eax, 8
|
mov eax, 8
|
||||||
mov ebx, 5 shl 16 + 120
|
mov ebx, TAB_WIDTH
|
||||||
mov ecx, 12 shl 16 + 12
|
mov ecx, TOP_SPACE shl 16 + TAB_HEIGHT
|
||||||
mov edx, WINDOW_BTN_START
|
mov edx, WINDOW_BTN_START
|
||||||
mov edi, windows
|
mov edi, windows
|
||||||
.more_btn:
|
.more_btn:
|
||||||
@ -283,23 +278,22 @@ draw_windowtabs:
|
|||||||
@@:
|
@@:
|
||||||
mcall
|
mcall
|
||||||
inc edx
|
inc edx
|
||||||
add ebx, 125 shl 16
|
add ebx, (TAB_WIDTH + TAB_SPACE) shl 16
|
||||||
add edi, sizeof.window
|
add edi, sizeof.window
|
||||||
cmp [edi + window.data_ptr], 0
|
cmp [edi + window.data_ptr], 0
|
||||||
jne .more_btn
|
jne .more_btn
|
||||||
|
|
||||||
; Draw the close window button
|
; Draw the close window button
|
||||||
|
|
||||||
mov edi, [window_active]
|
mov edi, [window_active]
|
||||||
cmp [edi + window.type], WINDOWTYPE_SERVER ; dont let the user close server window
|
cmp [edi + window.type], WINDOWTYPE_SERVER ; dont let the user close server window
|
||||||
je @f
|
je @f
|
||||||
|
|
||||||
; mov eax, 8
|
; mov eax, 8
|
||||||
mov ebx, [xsize]
|
mov ebx, [xsize]
|
||||||
sub ebx, 12
|
sub ebx, SCROLLBAR_WIDTH
|
||||||
shl ebx, 16
|
shl ebx, 16
|
||||||
mov bx, 12
|
mov bx, SCROLLBAR_WIDTH
|
||||||
mov ecx, 6 shl 16 + 12
|
mov ecx, TOP_SPACE shl 16 + TAB_HEIGHT - 1
|
||||||
mov edx, WINDOW_BTN_CLOSE
|
mov edx, WINDOW_BTN_CLOSE
|
||||||
mov esi, 0x00aa0000 ; red !
|
mov esi, 0x00aa0000 ; red !
|
||||||
mcall
|
mcall
|
||||||
@ -308,14 +302,14 @@ draw_windowtabs:
|
|||||||
; Draw the windownames onto the buttons
|
; Draw the windownames onto the buttons
|
||||||
|
|
||||||
mov eax, 4
|
mov eax, 4
|
||||||
mov ebx, 10 shl 16 + 15
|
mov ebx, 5 shl 16 + TOP_SPACE + 4 ;;;;
|
||||||
mov esi, MAX_WINDOWS
|
mov esi, MAX_WINDOWS
|
||||||
mov edi, windows
|
mov edi, windows
|
||||||
.more:
|
.more:
|
||||||
mov ecx, [colors.work_button_text]
|
mov ecx, [colors.work_button_text]
|
||||||
test [edi + window.flags], FLAG_UPDATED
|
test [edi + window.flags], FLAG_UPDATED
|
||||||
jz @f
|
jz @f
|
||||||
mov ecx, 0x00aa0000 ; RED!
|
mov ecx, 0x00aa0000 ; RED!
|
||||||
@@:
|
@@:
|
||||||
or ecx, 0x80000000 ; ASCIIZ string
|
or ecx, 0x80000000 ; ASCIIZ string
|
||||||
lea edx, [edi + window.name]
|
lea edx, [edi + window.name]
|
||||||
@ -323,7 +317,7 @@ draw_windowtabs:
|
|||||||
add edi, sizeof.window ; get ptr to next window
|
add edi, sizeof.window ; get ptr to next window
|
||||||
cmp [edi + window.data_ptr], 0
|
cmp [edi + window.data_ptr], 0
|
||||||
je .enough
|
je .enough
|
||||||
add ebx, 125 shl 16
|
add ebx, (TAB_WIDTH + TAB_SPACE) shl 16
|
||||||
dec esi
|
dec esi
|
||||||
jnz .more
|
jnz .more
|
||||||
.enough:
|
.enough:
|
||||||
@ -334,7 +328,7 @@ draw_windowtabs:
|
|||||||
|
|
||||||
highlight_updated_tabs:
|
highlight_updated_tabs:
|
||||||
mov eax, 4
|
mov eax, 4
|
||||||
mov ebx, 10 shl 16 + 15
|
mov ebx, 5 shl 16 + TOP_SPACE + 4 ;;;;
|
||||||
mov ecx, 0x80aa0000
|
mov ecx, 0x80aa0000
|
||||||
mov esi, MAX_WINDOWS
|
mov esi, MAX_WINDOWS
|
||||||
mov edi, windows
|
mov edi, windows
|
||||||
@ -347,7 +341,7 @@ highlight_updated_tabs:
|
|||||||
add edi, sizeof.window ; get ptr to next window
|
add edi, sizeof.window ; get ptr to next window
|
||||||
cmp [edi + window.data_ptr], 0
|
cmp [edi + window.data_ptr], 0
|
||||||
je .enough_
|
je .enough_
|
||||||
add ebx, 125 shl 16
|
add ebx, (TAB_WIDTH + TAB_SPACE) shl 16
|
||||||
dec esi
|
dec esi
|
||||||
jnz .more_
|
jnz .more_
|
||||||
.enough_:
|
.enough_:
|
||||||
|
@ -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 ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; IRC client for KolibriOS ;;
|
;; IRC client for KolibriOS ;;
|
||||||
@ -13,85 +13,89 @@
|
|||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
version equ '0.23'
|
version equ '0.24'
|
||||||
|
|
||||||
; connection status
|
; connection status
|
||||||
STATUS_DISCONNECTED = 0
|
STATUS_DISCONNECTED = 0
|
||||||
STATUS_RESOLVING = 1
|
STATUS_RESOLVING = 1
|
||||||
STATUS_CONNECTING = 2
|
STATUS_CONNECTING = 2
|
||||||
STATUS_CONNECTED = 3
|
STATUS_CONNECTED = 3
|
||||||
|
|
||||||
; window flags
|
; window flags
|
||||||
FLAG_UPDATED = 1 shl 0
|
FLAG_UPDATED = 1 shl 0
|
||||||
FLAG_RECEIVING_NAMES = 1 shl 1
|
FLAG_RECEIVING_NAMES = 1 shl 1
|
||||||
FLAG_SCROLL_LOW = 1 shl 2
|
FLAG_SCROLL_LOW = 1 shl 2
|
||||||
|
|
||||||
; window types
|
; window types
|
||||||
WINDOWTYPE_NONE = 0
|
WINDOWTYPE_NONE = 0
|
||||||
WINDOWTYPE_SERVER = 1
|
WINDOWTYPE_SERVER = 1
|
||||||
WINDOWTYPE_CHANNEL = 2
|
WINDOWTYPE_CHANNEL = 2
|
||||||
WINDOWTYPE_CHAT = 3
|
WINDOWTYPE_CHAT = 3
|
||||||
WINDOWTYPE_LIST = 4
|
WINDOWTYPE_LIST = 4
|
||||||
WINDOWTYPE_DCC = 5
|
WINDOWTYPE_DCC = 5
|
||||||
|
|
||||||
; supported encodings
|
; supported encodings
|
||||||
CP866 = 0
|
CP866 = 0
|
||||||
CP1251 = 1
|
CP1251 = 1
|
||||||
UTF8 = 2
|
UTF8 = 2
|
||||||
|
|
||||||
; settings
|
; settings
|
||||||
USERCMD_MAX_SIZE = 400
|
USERCMD_MAX_SIZE = 400
|
||||||
|
|
||||||
WIN_MIN_X = 600
|
WIN_MIN_X = 600
|
||||||
WIN_MIN_Y = 170
|
WIN_MIN_Y = 170
|
||||||
|
|
||||||
TEXT_X = 5
|
TEXT_X = 5
|
||||||
TEXT_Y = TOP_Y + 2
|
TEXT_Y = TOP_Y + 2
|
||||||
|
|
||||||
TOP_Y = 24
|
TOP_SPACE = 2
|
||||||
BOTTOM_Y = 15
|
TAB_HEIGHT = 14
|
||||||
|
TAB_WIDTH = 120
|
||||||
|
TAB_SPACE = 5
|
||||||
|
TOP_Y = TOP_SPACE+ TAB_HEIGHT
|
||||||
|
INPUTBOX_HEIGHT = 13
|
||||||
|
|
||||||
MAX_WINDOWS = 20
|
MAX_WINDOWS = 20
|
||||||
MAX_USERS = 4096
|
MAX_USERS = 4096
|
||||||
TEXT_BUFFERSIZE = 1024*1024
|
TEXT_BUFFERSIZE = 1024*1024
|
||||||
|
|
||||||
MAX_NICK_LEN = 32
|
MAX_NICK_LEN = 32
|
||||||
MAX_REAL_LEN = 32 ; realname
|
MAX_REAL_LEN = 32 ; realname
|
||||||
MAX_SERVER_NAME = 256
|
MAX_SERVER_NAME = 256
|
||||||
|
|
||||||
MAX_CHANNEL_LEN = 40
|
MAX_CHANNEL_LEN = 40
|
||||||
MAX_CHANNELS = 37
|
MAX_CHANNELS = 37
|
||||||
|
|
||||||
MAX_COMMAND_LEN = 512
|
MAX_COMMAND_LEN = 512
|
||||||
|
|
||||||
TIMESTAMP = 3 ; 3 = hh:mm:ss, 2 = hh:mm, 0 = no timestamp
|
TIMESTAMP = 3 ; 3 = hh:mm:ss, 2 = hh:mm, 0 = no timestamp
|
||||||
|
|
||||||
MAX_WINDOWNAME_LEN = 256
|
MAX_WINDOWNAME_LEN = 256
|
||||||
|
|
||||||
WINDOW_BTN_START = 100
|
WINDOW_BTN_START = 100
|
||||||
WINDOW_BTN_CLOSE = 2
|
WINDOW_BTN_CLOSE = 2
|
||||||
WINDOW_BTN_LIST = 3
|
WINDOW_BTN_LIST = 3
|
||||||
|
|
||||||
SCROLLBAR_WIDTH = 14
|
SCROLLBAR_WIDTH = 14
|
||||||
USERLIST_WIDTH = 100
|
USERLIST_WIDTH = 100
|
||||||
|
|
||||||
FONT_HEIGHT = 9
|
FONT_HEIGHT = 9
|
||||||
FONT_WIDTH = 6
|
FONT_WIDTH = 6
|
||||||
|
|
||||||
format binary as ""
|
format binary as ""
|
||||||
|
|
||||||
use32
|
use32
|
||||||
|
|
||||||
org 0x0
|
org 0x0
|
||||||
|
|
||||||
db 'MENUET01' ; 8 byte id
|
db 'MENUET01' ; 8 byte id
|
||||||
dd 1 ; header version
|
dd 1 ; header version
|
||||||
dd START ; program start
|
dd START ; program start
|
||||||
dd I_END ; program image size
|
dd I_END ; program image size
|
||||||
dd IM_END+2048 ; required amount of memory
|
dd IM_END+2048 ; required amount of memory
|
||||||
dd IM_END+2048
|
dd IM_END+2048
|
||||||
dd param
|
dd param
|
||||||
dd path
|
dd path
|
||||||
|
|
||||||
include "../../macros.inc"
|
include "../../macros.inc"
|
||||||
include "../../proc32.inc"
|
include "../../proc32.inc"
|
||||||
@ -100,28 +104,28 @@ include "../../network.inc"
|
|||||||
include "../../struct.inc"
|
include "../../struct.inc"
|
||||||
include "../../develop/libraries/box_lib/trunk/box_lib.mac"
|
include "../../develop/libraries/box_lib/trunk/box_lib.mac"
|
||||||
|
|
||||||
struct window
|
struct window
|
||||||
data_ptr dd ?
|
data_ptr dd ?
|
||||||
flags db ?
|
flags db ?
|
||||||
type db ?
|
type db ?
|
||||||
name rb MAX_WINDOWNAME_LEN
|
name rb MAX_WINDOWNAME_LEN
|
||||||
users dd ?
|
users dd ?
|
||||||
users_scroll dd ?
|
users_scroll dd ?
|
||||||
selected dd ? ; selected user, 0 if none selected
|
selected dd ? ; selected user, 0 if none selected
|
||||||
|
|
||||||
text_start dd ? ; pointer to current textbox data
|
text_start dd ? ; pointer to current textbox data
|
||||||
text_end dd ?
|
text_end dd ?
|
||||||
text_print dd ? ; pointer to first character to print on screen
|
text_print dd ? ; pointer to first character to print on screen
|
||||||
text_line_print dd ? ; line number of that character
|
text_line_print dd ? ; line number of that character
|
||||||
text_write dd ? ; write pointer
|
text_write dd ? ; write pointer
|
||||||
text_lines dd ? ; total number of lines
|
text_lines dd ? ; total number of lines
|
||||||
text_scanned dd ? ; pointer to beginning of unscanned data (we still need to count number of lines, insert newline characters,..)
|
text_scanned dd ? ; pointer to beginning of unscanned data (we still need to count number of lines, insert newline characters,..)
|
||||||
|
|
||||||
ends
|
ends
|
||||||
|
|
||||||
struct window_data
|
struct window_data
|
||||||
text rb TEXT_BUFFERSIZE
|
text rb TEXT_BUFFERSIZE
|
||||||
names rb MAX_NICK_LEN * MAX_USERS
|
names rb MAX_NICK_LEN * MAX_USERS
|
||||||
ends
|
ends
|
||||||
|
|
||||||
include "encodings.inc"
|
include "encodings.inc"
|
||||||
@ -136,220 +140,220 @@ include "textbox.inc"
|
|||||||
|
|
||||||
START:
|
START:
|
||||||
|
|
||||||
mcall 68, 11 ; init heap so we can allocate memory dynamically
|
mcall 68, 11 ; init heap so we can allocate memory dynamically
|
||||||
|
|
||||||
; wanted events
|
; wanted events
|
||||||
mcall 40, EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_STACK+EVM_MOUSE+EVM_MOUSE_FILTER
|
mcall 40, EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_STACK+EVM_MOUSE+EVM_MOUSE_FILTER
|
||||||
|
|
||||||
; load libraries
|
; load libraries
|
||||||
stdcall dll.Load, @IMPORT
|
stdcall dll.Load, @IMPORT
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jnz exit
|
jnz exit
|
||||||
|
|
||||||
; find path to main settings file (ircc.ini)
|
; find path to main settings file (ircc.ini)
|
||||||
mov edi, path ; Calculate the length of zero-terminated string
|
mov edi, path ; Calculate the length of zero-terminated string
|
||||||
xor al, al
|
xor al, al
|
||||||
mov ecx, 1024
|
mov ecx, 1024
|
||||||
repne scasb
|
repne scasb
|
||||||
dec edi
|
dec edi
|
||||||
mov eax, '.ini'
|
mov eax, '.ini'
|
||||||
stosd
|
stosd
|
||||||
xor al, al
|
xor al, al
|
||||||
stosb
|
stosb
|
||||||
|
|
||||||
; Fill the window buffer with zeros
|
; Fill the window buffer with zeros
|
||||||
mov edi, windows
|
mov edi, windows
|
||||||
mov ecx, (sizeof.window*MAX_WINDOWS+3)/4
|
mov ecx, (sizeof.window*MAX_WINDOWS+3)/4
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
rep stosd
|
rep stosd
|
||||||
|
|
||||||
; clear command area too
|
; clear command area too
|
||||||
mov edi, servercommand
|
mov edi, servercommand
|
||||||
mov ecx, 600/4
|
mov ecx, 600/4
|
||||||
rep stosd
|
rep stosd
|
||||||
|
|
||||||
; allocate window data block
|
; allocate window data block
|
||||||
mov ebx, windows
|
mov ebx, windows
|
||||||
call window_create_textbox
|
call window_create_textbox
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz error
|
jz error
|
||||||
mov [ebx + window.type], WINDOWTYPE_SERVER
|
mov [ebx + window.type], WINDOWTYPE_SERVER
|
||||||
|
|
||||||
; get system colors
|
; get system colors
|
||||||
mcall 48, 3, colors, 40
|
mcall 48, 3, colors, 40
|
||||||
|
|
||||||
; set edit box and scrollbar colors
|
; set edit box and scrollbar colors
|
||||||
mov eax, [colors.work]
|
mov eax, [colors.work]
|
||||||
mov [scroll1.bg_color], eax
|
mov [scroll1.bg_color], eax
|
||||||
mov [scroll2.bg_color], eax
|
mov [scroll2.bg_color], eax
|
||||||
|
|
||||||
mov eax, [colors.work_button]
|
mov eax, [colors.work_button]
|
||||||
mov [scroll1.front_color], eax
|
mov [scroll1.front_color], eax
|
||||||
mov [scroll2.front_color], eax
|
mov [scroll2.front_color], eax
|
||||||
|
|
||||||
mov eax, [colors.work_text]
|
mov eax, [colors.work_text]
|
||||||
mov [scroll1.line_color], eax
|
mov [scroll1.line_color], eax
|
||||||
mov [scroll2.line_color], eax
|
mov [scroll2.line_color], eax
|
||||||
|
|
||||||
mov [scroll1.type], 1 ; 0 = simple, 1 = skinned
|
mov [scroll1.type], 1 ; 0 = simple, 1 = skinned
|
||||||
mov [scroll2.type], 1
|
mov [scroll2.type], 1
|
||||||
|
|
||||||
; get settings from ini
|
; get settings from ini
|
||||||
invoke ini.get_str, path, str_user, str_nick, user_nick, MAX_NICK_LEN, default_nick
|
invoke ini.get_str, path, str_user, str_nick, user_nick, MAX_NICK_LEN, default_nick
|
||||||
invoke ini.get_str, path, str_user, str_real, user_real_name, MAX_REAL_LEN, default_real
|
invoke ini.get_str, path, str_user, str_real, user_real_name, MAX_REAL_LEN, default_real
|
||||||
invoke ini.get_str, path, str_user, str_quitmsg, quit_msg, 250, default_quit
|
invoke ini.get_str, path, str_user, str_quitmsg, quit_msg, 250, default_quit
|
||||||
|
|
||||||
; Welcome user
|
; Welcome user
|
||||||
mov esi, str_welcome
|
mov esi, str_welcome
|
||||||
call print_asciiz
|
call print_asciiz
|
||||||
|
|
||||||
; Check if parameter contains an URL
|
; Check if parameter contains an URL
|
||||||
cmp byte[param], 0
|
cmp byte[param], 0
|
||||||
je @f
|
je @f
|
||||||
mov esi, param
|
mov esi, param
|
||||||
mov ecx, 1024
|
mov ecx, 1024
|
||||||
call cmd_usr_server.now
|
call cmd_usr_server.now
|
||||||
@@:
|
@@:
|
||||||
|
|
||||||
; Draw window a first time, so we can figure out skin size
|
; Draw window a first time, so we can figure out skin size
|
||||||
call draw_window
|
call draw_window
|
||||||
|
|
||||||
redraw:
|
redraw:
|
||||||
call draw_window
|
call draw_window
|
||||||
|
|
||||||
mainloop:
|
mainloop:
|
||||||
mcall 10 ; wait for event
|
mcall 10 ; wait for event
|
||||||
|
|
||||||
dec eax
|
dec eax
|
||||||
jz redraw
|
jz redraw
|
||||||
|
|
||||||
dec eax
|
dec eax
|
||||||
jz main_window_key
|
jz main_window_key
|
||||||
|
|
||||||
dec eax
|
dec eax
|
||||||
jz button
|
jz button
|
||||||
|
|
||||||
cmp al, 3
|
cmp al, 3
|
||||||
je mouse
|
je mouse
|
||||||
|
|
||||||
call process_network_event
|
call process_network_event
|
||||||
|
|
||||||
mov edi, [window_active]
|
mov edi, [window_active]
|
||||||
test [edi + window.flags], FLAG_UPDATED
|
test [edi + window.flags], FLAG_UPDATED
|
||||||
jz .no_update
|
jz .no_update
|
||||||
call draw_channel_text
|
call draw_channel_text
|
||||||
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_channel_list
|
||||||
.no_update:
|
.no_update:
|
||||||
call highlight_updated_tabs
|
call highlight_updated_tabs
|
||||||
|
|
||||||
jmp mainloop
|
jmp mainloop
|
||||||
|
|
||||||
button:
|
button:
|
||||||
|
|
||||||
mcall 17 ; get id
|
mcall 17 ; get id
|
||||||
ror eax, 8
|
ror eax, 8
|
||||||
|
|
||||||
cmp ax, 1 ; close program
|
cmp ax, 1 ; close program
|
||||||
je exit
|
je exit
|
||||||
|
|
||||||
cmp ax, WINDOW_BTN_CLOSE
|
cmp ax, WINDOW_BTN_CLOSE
|
||||||
jne @f
|
jne @f
|
||||||
call cmd_usr_close_window
|
call cmd_usr_close_window
|
||||||
jmp mainloop
|
jmp mainloop
|
||||||
|
|
||||||
@@:
|
@@:
|
||||||
cmp ax, WINDOW_BTN_LIST
|
cmp ax, WINDOW_BTN_LIST
|
||||||
jne @f
|
jne @f
|
||||||
|
|
||||||
push eax
|
push eax
|
||||||
|
|
||||||
mcall 37, 1 ; Get mouse position
|
mcall 37, 1 ; Get mouse position
|
||||||
sub ax, TEXT_Y
|
sub ax, TEXT_Y
|
||||||
mov bl, FONT_HEIGHT
|
mov bl, FONT_HEIGHT
|
||||||
div bl
|
div bl
|
||||||
and eax, 0x000000ff
|
and eax, 0x000000ff
|
||||||
inc eax
|
inc eax
|
||||||
add eax, [scroll1.position]
|
add eax, [scroll1.position]
|
||||||
mov ebx, [window_active]
|
mov ebx, [window_active]
|
||||||
mov [ebx + window.selected], eax
|
mov [ebx + window.selected], eax
|
||||||
|
|
||||||
call draw_channel_list
|
call draw_channel_list
|
||||||
|
|
||||||
pop eax
|
pop eax
|
||||||
test eax, 1 shl 25 ; Right mouse button pressed?
|
test eax, 1 shl 25 ; Right mouse button pressed?
|
||||||
jz mainloop
|
jz mainloop
|
||||||
|
|
||||||
; TODO: check if selected nick is my nick!
|
; TODO: check if selected nick is my nick!
|
||||||
|
|
||||||
; Right mouse BTN was pressed, open chat window
|
; Right mouse BTN was pressed, open chat window
|
||||||
mov ebx, [window_active]
|
mov ebx, [window_active]
|
||||||
mov eax, [ebx + window.selected]
|
mov eax, [ebx + window.selected]
|
||||||
dec eax
|
dec eax
|
||||||
imul eax, MAX_NICK_LEN
|
imul eax, MAX_NICK_LEN
|
||||||
mov ebx, [ebx + window.data_ptr]
|
mov ebx, [ebx + window.data_ptr]
|
||||||
lea esi, [ebx + window_data.names + eax]
|
lea esi, [ebx + window_data.names + eax]
|
||||||
call window_open
|
call window_open
|
||||||
test ebx, ebx
|
test ebx, ebx
|
||||||
jz mainloop
|
jz mainloop
|
||||||
mov [window_active], ebx
|
mov [window_active], ebx
|
||||||
call redraw
|
call redraw
|
||||||
|
|
||||||
jmp mainloop
|
jmp mainloop
|
||||||
|
|
||||||
@@:
|
@@:
|
||||||
sub ax, WINDOW_BTN_START
|
sub ax, WINDOW_BTN_START
|
||||||
jb exit
|
jb exit
|
||||||
|
|
||||||
cmp ax, MAX_WINDOWS
|
cmp ax, MAX_WINDOWS
|
||||||
ja exit
|
ja exit
|
||||||
|
|
||||||
; Save users scrollbar position
|
; Save users scrollbar position
|
||||||
push [scroll1.position]
|
push [scroll1.position]
|
||||||
mov edx, [window_active]
|
mov edx, [window_active]
|
||||||
pop [edx + window.users_scroll]
|
pop [edx + window.users_scroll]
|
||||||
|
|
||||||
; OK, time to switch to another window.
|
; OK, time to switch to another window.
|
||||||
mov dx, sizeof.window
|
mov dx, sizeof.window
|
||||||
mul dx
|
mul dx
|
||||||
shl edx, 16
|
shl edx, 16
|
||||||
mov dx, ax
|
mov dx, ax
|
||||||
add edx, windows
|
add edx, windows
|
||||||
cmp [edx + window.type], WINDOWTYPE_NONE
|
cmp [edx + window.type], WINDOWTYPE_NONE
|
||||||
je exit
|
je exit
|
||||||
mov [window_active], edx
|
mov [window_active], edx
|
||||||
|
|
||||||
push [edx + window.text_line_print]
|
push [edx + window.text_line_print]
|
||||||
pop [scroll2.position]
|
pop [scroll2.position]
|
||||||
|
|
||||||
push [edx + window.users_scroll]
|
push [edx + window.users_scroll]
|
||||||
pop [scroll1.position]
|
pop [scroll1.position]
|
||||||
|
|
||||||
call draw_window
|
call draw_window
|
||||||
jmp mainloop
|
jmp mainloop
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
|
||||||
cmp [socketnum], 0
|
cmp [socketnum], 0
|
||||||
je @f
|
je @f
|
||||||
mov esi, quit_msg
|
mov esi, quit_msg
|
||||||
call quit_server
|
call quit_server
|
||||||
@@:
|
@@:
|
||||||
|
|
||||||
error:
|
error:
|
||||||
|
|
||||||
mcall -1
|
mcall -1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
main_window_key:
|
main_window_key:
|
||||||
|
|
||||||
mcall 2
|
mcall 2
|
||||||
|
|
||||||
push dword edit1
|
push dword edit1
|
||||||
call [edit_box_key]
|
call [edit_box_key]
|
||||||
|
|
||||||
; cmp ah, 178
|
; cmp ah, 178
|
||||||
; jne .no_up
|
; jne .no_up
|
||||||
@ -364,251 +368,251 @@ main_window_key:
|
|||||||
; jmp mainloop
|
; jmp mainloop
|
||||||
;
|
;
|
||||||
; .no_down:
|
; .no_down:
|
||||||
cmp ah, 13 ; enter
|
cmp ah, 13 ; enter
|
||||||
jne no_send2
|
jne no_send2
|
||||||
|
|
||||||
call user_parser
|
call user_parser
|
||||||
|
|
||||||
mov eax, [edit1.size]
|
mov eax, [edit1.size]
|
||||||
|
|
||||||
mov [edit1.size], 0
|
mov [edit1.size], 0
|
||||||
mov [edit1.pos], 0
|
mov [edit1.pos], 0
|
||||||
|
|
||||||
push dword edit1
|
push dword edit1
|
||||||
call [edit_box_draw]
|
call [edit_box_draw]
|
||||||
|
|
||||||
call draw_channel_text
|
call draw_channel_text
|
||||||
|
|
||||||
jmp mainloop
|
jmp mainloop
|
||||||
no_send2:
|
no_send2:
|
||||||
|
|
||||||
jmp mainloop
|
jmp mainloop
|
||||||
|
|
||||||
mouse:
|
mouse:
|
||||||
push dword edit1
|
push dword edit1
|
||||||
call [edit_box_mouse]
|
call [edit_box_mouse]
|
||||||
|
|
||||||
; mcall 37, 7
|
; mcall 37, 7
|
||||||
; movsx eax, ax
|
; movsx eax, ax
|
||||||
; add [scroll2.position], eax
|
; add [scroll2.position], eax
|
||||||
|
|
||||||
; TODO: check if scrollbar is active?
|
; TODO: check if scrollbar is active?
|
||||||
mov edi, [window_active]
|
mov edi, [window_active]
|
||||||
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
|
push dword scroll1
|
||||||
call [scrollbar_mouse]
|
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_channel_list
|
||||||
@@:
|
@@:
|
||||||
|
|
||||||
; TODO: check if scrollbar is active?
|
; TODO: check if scrollbar is active?
|
||||||
mov edi, [window_active]
|
mov edi, [window_active]
|
||||||
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
|
push dword scroll2
|
||||||
call [scrollbar_mouse]
|
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]
|
||||||
add edx, [scroll2.cur_area]
|
add edx, [scroll2.cur_area]
|
||||||
sub edx, [scroll2.max_area]
|
sub edx, [scroll2.max_area]
|
||||||
jne .not_low
|
jne .not_low
|
||||||
or [edi+window.flags], FLAG_SCROLL_LOW
|
or [edi+window.flags], FLAG_SCROLL_LOW
|
||||||
.not_low:
|
.not_low:
|
||||||
mov edx, [scroll2.position]
|
mov edx, [scroll2.position]
|
||||||
sub edx, [edi + window.text_line_print]
|
sub edx, [edi + window.text_line_print]
|
||||||
je @f
|
je @f
|
||||||
call draw_channel_text.scroll_to_pos
|
call draw_channel_text.scroll_to_pos
|
||||||
@@:
|
@@:
|
||||||
|
|
||||||
jmp mainloop
|
jmp mainloop
|
||||||
|
|
||||||
|
|
||||||
; DATA AREA
|
; DATA AREA
|
||||||
|
|
||||||
encoding_text:
|
encoding_text:
|
||||||
db 'CP866 '
|
db 'CP866 '
|
||||||
db 'CP1251'
|
db 'CP1251'
|
||||||
db 'UTF-8 '
|
db 'UTF-8 '
|
||||||
encoding_text_len = 6
|
encoding_text_len = 6
|
||||||
|
|
||||||
join_header db 3, '3* ', 0
|
join_header db 3, '3* ', 0
|
||||||
quit_header db 3, '5* ', 0
|
quit_header db 3, '5* ', 0
|
||||||
nick_header db 3, '2* ', 0
|
nick_header db 3, '2* ', 0
|
||||||
kick_header db 3, '5* ', 0
|
kick_header db 3, '5* ', 0
|
||||||
mode_header db 3, '2* ', 0
|
mode_header db 3, '2* ', 0
|
||||||
part_header db 3, '5* ', 0
|
part_header db 3, '5* ', 0
|
||||||
topic_header db 3, '3* ', 0
|
topic_header db 3, '3* ', 0
|
||||||
action_header db 3, '6* ', 0
|
action_header db 3, '6* ', 0
|
||||||
ctcp_header db 3, '13-> [', 0
|
ctcp_header db 3, '13-> [', 0
|
||||||
msg_header db 3, '7-> *', 0
|
msg_header db 3, '7-> *', 0
|
||||||
ctcp_version db '] VERSION', 10, 0
|
ctcp_version db '] VERSION', 10, 0
|
||||||
ctcp_ping db '] PING', 10, 0
|
ctcp_ping db '] PING', 10, 0
|
||||||
ctcp_time db '] TIME', 10, 0
|
ctcp_time db '] TIME', 10, 0
|
||||||
|
|
||||||
has_left_channel db ' has left ', 0
|
has_left_channel db ' has left ', 0
|
||||||
joins_channel db ' has joined ', 0
|
joins_channel db ' has joined ', 0
|
||||||
is_now_known_as db ' is now known as ', 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
|
sets_mode db ' sets mode ', 0
|
||||||
str_kicked db ' is kicked from ', 0
|
str_kicked db ' is kicked from ', 0
|
||||||
str_by db ' by ', 0
|
str_by db ' by ', 0
|
||||||
str_nickchange db 'Nickname is now ', 0
|
str_nickchange db 'Nickname is now ', 0
|
||||||
str_realchange db 'Real name is now ', 0
|
str_realchange db 'Real name is now ', 0
|
||||||
str_talking db 'Now talking in ', 0
|
str_talking db 'Now talking in ', 0
|
||||||
str_topic db 'Topic is "', 0
|
str_topic db 'Topic is "', 0
|
||||||
str_topic_end db '"', 10, 0
|
str_topic_end db '"', 10, 0
|
||||||
str_setby db 'Set by ', 0
|
str_setby db 'Set by ', 0
|
||||||
|
|
||||||
str_connecting db 3, '3* Connecting to ', 0
|
str_connecting db 3, '3* Connecting to ', 0
|
||||||
str_sockerr db 3, '5* Socket error', 10, 0
|
str_sockerr db 3, '5* Socket error', 10, 0
|
||||||
str_dnserr db 3, '5* Unable to resolve hostname', 10, 0
|
str_dnserr db 3, '5* Unable to resolve hostname', 10, 0
|
||||||
str_refused db 3, '5* Connection refused', 10, 0
|
str_refused db 3, '5* Connection refused', 10, 0
|
||||||
str_srv_disconnected db 3, '5* Server disconnected', 10, 0
|
str_srv_disconnected db 3, '5* Server disconnected', 10, 0
|
||||||
str_disconnected db 3, '5* Disconnected', 10, 0
|
str_disconnected db 3, '5* Disconnected', 10, 0
|
||||||
str_reconnect db 3, '5* Connection reset by user', 10, 0
|
str_reconnect db 3, '5* Connection reset by user', 10, 0
|
||||||
str_notconnected db 3, '5* Not connected to server', 10, 0
|
str_notconnected db 3, '5* Not connected to server', 10, 0
|
||||||
str_notchannel db 3, '5* You are not on a channel', 10, 0
|
str_notchannel db 3, '5* You are not on a channel', 10, 0
|
||||||
|
|
||||||
str_1 db 3, '13 -', 0
|
str_1 db 3, '13 -', 0
|
||||||
str_2 db '- ', 0
|
str_2 db '- ', 0
|
||||||
|
|
||||||
str_list db 'list', 0
|
str_list db 'list', 0
|
||||||
|
|
||||||
str_help db 'The following commands are available:', 10
|
str_help db 'The following commands are available:', 10
|
||||||
db 10
|
db 10
|
||||||
db '/nick <nick> : change nickname', 10
|
db '/nick <nick> : change nickname', 10
|
||||||
db '/real <real name> : change real name', 10
|
db '/real <real name> : change real name', 10
|
||||||
db '/server <address> : connect to server', 10
|
db '/server <address> : connect to server', 10
|
||||||
db '/code <code> : change codepage (cp866, cp1251, or utf8)', 10
|
db '/code <code> : change codepage (cp866, cp1251, or utf8)', 10
|
||||||
db '/join <channel> : join a channel', 10
|
db '/join <channel> : join a channel', 10
|
||||||
db '/part <channel> : part from a channel', 10
|
db '/part <channel> : part from a channel', 10
|
||||||
db '/quit : quit server', 10
|
db '/quit : quit server', 10
|
||||||
db '/msg <user> : send a private message', 10
|
db '/msg <user> : send a private message', 10
|
||||||
db '/ctcp <user> : send a message using client to client protocol', 10
|
db '/ctcp <user> : send a message using client to client protocol', 10
|
||||||
db 10
|
db 10
|
||||||
db 'Other commands are send straight to server.', 10
|
db 'Other commands are send straight to server.', 10
|
||||||
db 10, 0
|
db 10, 0
|
||||||
|
|
||||||
str_welcome db 3, '3 ___', 3, '7__________', 3, '6_________ ', 3, '4 __ __ __', 10
|
str_welcome 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 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 10
|
||||||
db 'Welcome to the KolibriOS IRC client v', version, 10
|
db 'Welcome to KolibriOS IRC client ', version, 10
|
||||||
db 10
|
db 10
|
||||||
db 'Type /help for help', 10, 10, 0
|
db 'Type /help for help', 10, 10, 0
|
||||||
|
|
||||||
str_version db 'VERSION '
|
str_version db 'VERSION KolibriOS '
|
||||||
str_programname db 'KolibriOS IRC client v', version, 0
|
str_programname db 'IRC client ', version, 0
|
||||||
|
|
||||||
str_user db 'user', 0
|
str_user db 'user', 0
|
||||||
str_nick db 'nick', 0
|
str_nick db 'nick', 0
|
||||||
str_real db 'realname', 0
|
str_real db 'realname', 0
|
||||||
str_email db 'email', 0
|
str_email db 'email', 0
|
||||||
str_quitmsg db 'quitmsg', 0
|
str_quitmsg db 'quitmsg', 0
|
||||||
|
|
||||||
default_nick db 'kolibri_user', 0
|
default_nick db 'kolibri_user', 0
|
||||||
default_real db 'Kolibri User', 0
|
default_real db 'Kolibri User', 0
|
||||||
default_quit db 'KolibriOS forever', 0
|
default_quit db 'KolibriOS forever', 0
|
||||||
|
|
||||||
irc_colors dd 0xffffff ; 0 white
|
irc_colors dd 0xffffff ; 0 white
|
||||||
dd 0x000000 ; 1 black
|
dd 0x000000 ; 1 black
|
||||||
dd 0x00007f ; 2 blue (navy)
|
dd 0x00007f ; 2 blue (navy)
|
||||||
dd 0x009300 ; 3 green
|
dd 0x009300 ; 3 green
|
||||||
dd 0xff0000 ; 4 red
|
dd 0xff0000 ; 4 red
|
||||||
dd 0x7f0000 ; 5 brown (maroon)
|
dd 0x7f0000 ; 5 brown (maroon)
|
||||||
dd 0x9c009c ; 6 purple
|
dd 0x9c009c ; 6 purple
|
||||||
dd 0xfc7f00 ; 7 olive
|
dd 0xfc7f00 ; 7 olive
|
||||||
dd 0xffff00 ; 8 yellow
|
dd 0xffff00 ; 8 yellow
|
||||||
dd 0x00fc00 ; 9 light green
|
dd 0x00fc00 ; 9 light green
|
||||||
dd 0x009393 ; 10 teal
|
dd 0x009393 ; 10 teal
|
||||||
dd 0x00ffff ; 11 cyan
|
dd 0x00ffff ; 11 cyan
|
||||||
dd 0x0000fc ; 12 royal blue
|
dd 0x0000fc ; 12 royal blue
|
||||||
dd 0xff00ff ; 13 pink
|
dd 0xff00ff ; 13 pink
|
||||||
dd 0x7f7f7f ; 14 grey
|
dd 0x7f7f7f ; 14 grey
|
||||||
dd 0xd4d0c4 ; 15 light grey (silver)
|
dd 0xd4d0c4 ; 15 light grey (silver)
|
||||||
|
|
||||||
sockaddr1:
|
sockaddr1:
|
||||||
dw AF_INET4
|
dw AF_INET4
|
||||||
.port dw 0x0b1a ; 6667 FIXMEEEEEE
|
.port dw 0x0b1a ; 6667 FIXMEEEEEE
|
||||||
.ip dd 0
|
.ip dd 0
|
||||||
rb 10
|
rb 10
|
||||||
|
|
||||||
|
|
||||||
status dd STATUS_DISCONNECTED
|
status dd STATUS_DISCONNECTED
|
||||||
|
|
||||||
window_active dd windows
|
window_active dd windows
|
||||||
window_print dd windows
|
window_print dd windows
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
@IMPORT:
|
@IMPORT:
|
||||||
|
|
||||||
library network, 'network.obj',\
|
library network, 'network.obj',\
|
||||||
libini, 'libini.obj',\
|
libini, 'libini.obj',\
|
||||||
boxlib, 'box_lib.obj'
|
boxlib, 'box_lib.obj'
|
||||||
|
|
||||||
import network,\
|
import network,\
|
||||||
getaddrinfo, 'getaddrinfo',\
|
getaddrinfo, 'getaddrinfo',\
|
||||||
freeaddrinfo, 'freeaddrinfo',\
|
freeaddrinfo, 'freeaddrinfo',\
|
||||||
inet_ntoa, 'inet_ntoa'
|
inet_ntoa, 'inet_ntoa'
|
||||||
|
|
||||||
import libini,\
|
import libini,\
|
||||||
ini.get_str, 'ini_get_str',\
|
ini.get_str, 'ini_get_str',\
|
||||||
ini.get_int, 'ini_get_int'
|
ini.get_int, 'ini_get_int'
|
||||||
|
|
||||||
import boxlib,\
|
import boxlib,\
|
||||||
edit_box_draw, 'edit_box',\
|
edit_box_draw, 'edit_box',\
|
||||||
edit_box_key, 'edit_box_key',\
|
edit_box_key, 'edit_box_key',\
|
||||||
edit_box_mouse, 'edit_box_mouse',\
|
edit_box_mouse, 'edit_box_mouse',\
|
||||||
scrollbar_draw, 'scrollbar_v_draw',\
|
scrollbar_draw, 'scrollbar_v_draw',\
|
||||||
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, 0, 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
|
||||||
|
|
||||||
usercommand db '/server chat.freenode.net', 0
|
usercommand db '/server chat.freenode.net', 0
|
||||||
rb MAX_COMMAND_LEN
|
rb MAX_COMMAND_LEN
|
||||||
|
|
||||||
I_END:
|
I_END:
|
||||||
|
|
||||||
utf8_bytes_rest dd ? ; bytes rest in current UTF8 sequence
|
utf8_bytes_rest dd ? ; bytes rest in current UTF8 sequence
|
||||||
utf8_char dd ? ; first bits of current UTF8 character
|
utf8_char dd ? ; first bits of current UTF8 character
|
||||||
|
|
||||||
packetbuf rb 1024 ; buffer for packets to server
|
packetbuf rb 1024 ; buffer for packets to server
|
||||||
path rb 1024
|
path rb 1024
|
||||||
param rb 1024
|
param rb 1024
|
||||||
|
|
||||||
servercommand rb 600
|
servercommand rb 600
|
||||||
|
|
||||||
thread_info process_information
|
thread_info process_information
|
||||||
xsize dd ?
|
xsize dd ?
|
||||||
ysize dd ?
|
ysize dd ?
|
||||||
mouse_dd dd ?
|
mouse_dd dd ?
|
||||||
|
|
||||||
textbox_height dd ? ; in characters
|
textbox_height dd ? ; in characters
|
||||||
textbox_width dd ? ; in characters, not pixels ;)
|
textbox_width dd ? ; in characters, not pixels ;)
|
||||||
|
|
||||||
colors system_colors
|
colors system_colors
|
||||||
|
|
||||||
irc_server_name rb MAX_SERVER_NAME ; TODO: move this server URL into window struct
|
irc_server_name rb MAX_SERVER_NAME ; TODO: move this server URL into window struct
|
||||||
socketnum dd ? ; TODO: same for socket
|
socketnum dd ? ; TODO: same for socket
|
||||||
|
|
||||||
user_nick rb MAX_NICK_LEN
|
user_nick rb MAX_NICK_LEN
|
||||||
user_real_name rb MAX_REAL_LEN
|
user_real_name rb MAX_REAL_LEN
|
||||||
quit_msg rb 250
|
quit_msg rb 250
|
||||||
|
|
||||||
windows rb MAX_WINDOWS*sizeof.window
|
windows rb MAX_WINDOWS*sizeof.window
|
||||||
|
|
||||||
IM_END:
|
IM_END:
|
@ -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 ;;
|
||||||
@ -13,44 +13,44 @@
|
|||||||
|
|
||||||
text_insert_newlines: ; esi = ASCIIZ string
|
text_insert_newlines: ; esi = ASCIIZ string
|
||||||
|
|
||||||
xor edx, edx ; number of lines of text
|
xor edx, edx ; number of lines of text
|
||||||
cmp byte[esi], 0
|
cmp byte[esi], 0
|
||||||
je .done
|
je .done
|
||||||
.next_line:
|
.next_line:
|
||||||
xor ebx, ebx
|
xor ebx, ebx
|
||||||
mov ecx, [textbox_width]
|
mov ecx, [textbox_width]
|
||||||
inc ecx
|
inc ecx
|
||||||
.more:
|
.more:
|
||||||
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, 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
|
||||||
je .space
|
je .space
|
||||||
cmp al, 13 ; we already inserted a newline once, make it a space again
|
cmp al, 13 ; we already inserted a newline once, make it a space again
|
||||||
je .soft_nl
|
je .soft_nl
|
||||||
cmp al, 10 ; it's a newline, continue onto the next line
|
cmp al, 10 ; it's a newline, continue onto the next line
|
||||||
jne .more
|
jne .more
|
||||||
inc edx
|
inc edx
|
||||||
jmp .next_line
|
jmp .next_line
|
||||||
.soft_nl:
|
.soft_nl:
|
||||||
mov byte[esi-1], ' '
|
mov byte[esi-1], ' '
|
||||||
.space:
|
.space:
|
||||||
mov ebx, esi ; last detected space
|
mov ebx, esi ; last detected space
|
||||||
jmp .more
|
jmp .more
|
||||||
.end_of_line:
|
.end_of_line:
|
||||||
inc edx
|
inc edx
|
||||||
test ebx, ebx ; did we detect any spaces on this line?
|
test ebx, ebx ; did we detect any spaces on this line?
|
||||||
jz .next_line ; no: just continue onto the next line
|
jz .next_line ; no: just continue onto the next line
|
||||||
mov byte[ebx-1], 13 ; yes: replace last space on line with a soft newline
|
mov byte[ebx-1], 13 ; yes: replace last space on line with a soft newline
|
||||||
mov esi, ebx ; and continue parsing just after last space
|
mov esi, ebx ; and continue parsing just after last space
|
||||||
jmp .next_line ;
|
jmp .next_line ;
|
||||||
.almost_done:
|
.almost_done:
|
||||||
dec esi
|
dec esi
|
||||||
.done:
|
.done:
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
;----------------------------------
|
;----------------------------------
|
||||||
; scan untill next line is reached
|
; scan untill next line is reached
|
||||||
@ -61,20 +61,20 @@ text_insert_newlines: ; esi = ASCIIZ string
|
|||||||
;----------------------------------
|
;----------------------------------
|
||||||
text_nextline:
|
text_nextline:
|
||||||
|
|
||||||
mov ecx, [textbox_width]
|
mov ecx, [textbox_width]
|
||||||
.loop:
|
.loop:
|
||||||
lodsb
|
lodsb
|
||||||
test al, al
|
test al, al
|
||||||
jz .done
|
jz .done
|
||||||
cmp al, 10
|
cmp al, 10
|
||||||
je .done
|
je .done
|
||||||
cmp al, 13
|
cmp al, 13
|
||||||
je .done
|
je .done
|
||||||
dec ecx
|
dec ecx
|
||||||
jnz .loop
|
jnz .loop
|
||||||
.done:
|
.done:
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
;----------------------------------
|
;----------------------------------
|
||||||
@ -86,21 +86,21 @@ text_nextline:
|
|||||||
;----------------------------------
|
;----------------------------------
|
||||||
print_string:
|
print_string:
|
||||||
|
|
||||||
push eax
|
push eax
|
||||||
.loop:
|
.loop:
|
||||||
lodsb
|
lodsb
|
||||||
cmp al, bl
|
cmp al, bl
|
||||||
je .done
|
je .done
|
||||||
cmp al, 13
|
cmp al, 13
|
||||||
je .loop
|
je .loop
|
||||||
test al, al
|
test al, al
|
||||||
jz .done
|
jz .done
|
||||||
call print_char
|
call print_char
|
||||||
jmp .loop
|
jmp .loop
|
||||||
.done:
|
.done:
|
||||||
pop eax
|
pop eax
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
;----------------------------------
|
;----------------------------------
|
||||||
@ -111,17 +111,17 @@ print_string:
|
|||||||
;----------------------------------
|
;----------------------------------
|
||||||
print_asciiz:
|
print_asciiz:
|
||||||
|
|
||||||
push eax
|
push eax
|
||||||
.loop:
|
.loop:
|
||||||
lodsb
|
lodsb
|
||||||
test al, al
|
test al, al
|
||||||
jz .done
|
jz .done
|
||||||
call print_char
|
call print_char
|
||||||
jmp .loop
|
jmp .loop
|
||||||
.done:
|
.done:
|
||||||
pop eax
|
pop eax
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
;----------------------------------
|
;----------------------------------
|
||||||
@ -132,252 +132,252 @@ print_asciiz:
|
|||||||
;----------------------------------
|
;----------------------------------
|
||||||
print_char:
|
print_char:
|
||||||
|
|
||||||
push esi edi
|
push esi edi
|
||||||
mov esi, [window_print]
|
mov esi, [window_print]
|
||||||
mov edi, [esi + window.text_write]
|
mov edi, [esi + window.text_write]
|
||||||
stosb
|
stosb
|
||||||
cmp edi, [esi + window.text_end]
|
cmp edi, [esi + window.text_end]
|
||||||
jae .uh_ow
|
jae .uh_ow
|
||||||
mov [esi + window.text_write], edi
|
mov [esi + window.text_write], edi
|
||||||
.continue:
|
.continue:
|
||||||
or [esi + window.flags], FLAG_UPDATED
|
or [esi + window.flags], FLAG_UPDATED
|
||||||
pop edi esi
|
pop edi esi
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.uh_ow:
|
.uh_ow:
|
||||||
pusha
|
pusha
|
||||||
mov edi, [esi + window.text_start]
|
mov edi, [esi + window.text_start]
|
||||||
mov [esi + window.text_print], edi
|
mov [esi + window.text_print], edi
|
||||||
lea esi, [edi + TEXT_BUFFERSIZE/2]
|
lea esi, [edi + TEXT_BUFFERSIZE/2]
|
||||||
call text_nextline
|
call text_nextline
|
||||||
mov ecx, TEXT_BUFFERSIZE/8
|
mov ecx, TEXT_BUFFERSIZE/8
|
||||||
rep movsd
|
rep movsd
|
||||||
mov esi, edi
|
mov esi, edi
|
||||||
call text_insert_newlines
|
call text_insert_newlines
|
||||||
|
|
||||||
mov ebx, [window_print]
|
mov ebx, [window_print]
|
||||||
mov [ebx + window.text_lines], edx
|
mov [ebx + window.text_lines], edx
|
||||||
mov [ebx + window.text_scanned], esi
|
mov [ebx + window.text_scanned], esi
|
||||||
mov [ebx + window.text_write], esi
|
mov [ebx + window.text_write], esi
|
||||||
mov [ebx + window.text_line_print], 0
|
mov [ebx + window.text_line_print], 0
|
||||||
popa
|
popa
|
||||||
|
|
||||||
jmp .continue
|
jmp .continue
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
draw_channel_text:
|
draw_channel_text:
|
||||||
|
|
||||||
mov edi, [window_active]
|
mov edi, [window_active]
|
||||||
and [edi + window.flags], not FLAG_UPDATED ; clear the 'window is updated' flag
|
and [edi + window.flags], not FLAG_UPDATED ; clear the 'window is updated' flag
|
||||||
|
|
||||||
; Scan new text for newlines
|
; Scan new text for newlines
|
||||||
mov esi, [edi + window.text_scanned]
|
mov esi, [edi + window.text_scanned]
|
||||||
call text_insert_newlines
|
call text_insert_newlines
|
||||||
add [edi + window.text_lines], edx
|
add [edi + window.text_lines], edx
|
||||||
mov [edi + window.text_scanned], esi
|
mov [edi + window.text_scanned], esi
|
||||||
|
|
||||||
; Is scrollbar at lowest position?
|
; Is scrollbar at lowest position?
|
||||||
test [edi + window.flags], FLAG_SCROLL_LOW
|
test [edi + window.flags], FLAG_SCROLL_LOW
|
||||||
jnz .yesscroll ;Yes
|
jnz .yesscroll ;Yes
|
||||||
cmp [scroll2.all_redraw], 1 ;No
|
cmp [scroll2.all_redraw], 1 ;No
|
||||||
jnz .noscroll
|
jnz .noscroll
|
||||||
mov edx, [textbox_height]
|
mov edx, [textbox_height]
|
||||||
add edx, [edi + window.text_line_print]
|
add edx, [edi + window.text_line_print]
|
||||||
cmp edx, [edi + window.text_lines]
|
cmp edx, [edi + window.text_lines]
|
||||||
jl .noscroll
|
jl .noscroll
|
||||||
.yesscroll:
|
.yesscroll:
|
||||||
; Scrollbar was at lowest position, scroll down automatically when new text arrived.
|
; Scrollbar was at lowest position, scroll down automatically when new text arrived.
|
||||||
mov edx, [edi + window.text_lines]
|
mov edx, [edi + window.text_lines]
|
||||||
sub edx, [textbox_height]
|
sub edx, [textbox_height]
|
||||||
jle .noscroll ; There are less lines of text than fit into the window, dont scroll..
|
jle .noscroll ; There are less lines of text than fit into the window, dont scroll..
|
||||||
sub edx, [edi + window.text_line_print]
|
sub edx, [edi + window.text_line_print]
|
||||||
je .noscroll ; We are already at the bottom pos, dont scroll..
|
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)
|
.scroll_to_pos: ; edx = number of lines to go up/down (flags must indicate direction)
|
||||||
pushf
|
pushf
|
||||||
add [edi + window.text_line_print], edx
|
add [edi + window.text_line_print], edx
|
||||||
mov esi, [edi + window.text_print]
|
mov esi, [edi + window.text_print]
|
||||||
popf
|
popf
|
||||||
ja .loop_forward
|
ja .loop_forward
|
||||||
std ; set direction flag so we can scan backwards
|
std ; set direction flag so we can scan backwards
|
||||||
dec esi
|
dec esi
|
||||||
dec esi ; move our cursor just in front of newline, for scanning backwards
|
dec esi ; move our cursor just in front of newline, for scanning backwards
|
||||||
.loop_backward:
|
.loop_backward:
|
||||||
call text_nextline
|
call text_nextline
|
||||||
inc edx
|
inc edx
|
||||||
jnz .loop_backward
|
jnz .loop_backward
|
||||||
inc esi
|
inc esi
|
||||||
inc esi ; move the cursor just after last newline
|
inc esi ; move the cursor just after last newline
|
||||||
cld
|
cld
|
||||||
jmp .ok
|
jmp .ok
|
||||||
|
|
||||||
.loop_forward:
|
.loop_forward:
|
||||||
call text_nextline
|
call text_nextline
|
||||||
dec edx
|
dec edx
|
||||||
jnz .loop_forward
|
jnz .loop_forward
|
||||||
.ok:
|
.ok:
|
||||||
mov [edi + window.text_print], esi
|
mov [edi + window.text_print], esi
|
||||||
.noscroll:
|
.noscroll:
|
||||||
|
|
||||||
; Update and draw scrollbar when nescessary
|
; Update and draw scrollbar when nescessary
|
||||||
mov edx, [edi + window.text_lines]
|
mov edx, [edi + window.text_lines]
|
||||||
cmp edx, [textbox_height]
|
cmp edx, [textbox_height]
|
||||||
jbe .scroll_done
|
jbe .scroll_done
|
||||||
|
|
||||||
mov [scroll2.max_area], edx
|
mov [scroll2.max_area], edx
|
||||||
mov eax, [edi + window.text_line_print]
|
mov eax, [edi + window.text_line_print]
|
||||||
mov [scroll2.position], eax
|
mov [scroll2.position], eax
|
||||||
|
|
||||||
push dword scroll2 ; redraw scrollbar
|
push dword scroll2 ; redraw scrollbar
|
||||||
call [scrollbar_draw]
|
call [scrollbar_draw]
|
||||||
mov [scroll2.all_redraw], 0 ; next time, dont redraw it completely
|
mov [scroll2.all_redraw], 0 ; next time, dont redraw it completely
|
||||||
.scroll_done:
|
.scroll_done:
|
||||||
|
|
||||||
; Calculate start offset coordinates (align text to bottom)
|
; Calculate start offset coordinates (align text to bottom)
|
||||||
mov ebx, [textbox_height]
|
mov ebx, [textbox_height]
|
||||||
sub ebx, [edi + window.text_lines]
|
sub ebx, [edi + window.text_lines]
|
||||||
jb .no_offset
|
jb .no_offset
|
||||||
imul ebx, FONT_HEIGHT
|
imul ebx, FONT_HEIGHT
|
||||||
push [edi + window.text_start]
|
push [edi + window.text_start]
|
||||||
pop [edi + window.text_print]
|
pop [edi + window.text_print]
|
||||||
jmp .draw_text
|
jmp .draw_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
|
mov eax, [textbox_height] ; max number of lines to draw
|
||||||
add ebx, TEXT_X shl 16 + TEXT_Y
|
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]
|
mov edx, [edi + window.text_print]
|
||||||
.drawloop:
|
.drawloop:
|
||||||
cmp byte[edx], 0
|
cmp byte[edx], 0
|
||||||
je .end_of_text
|
je .end_of_text
|
||||||
|
|
||||||
; Clear one row of characters
|
; Clear one row of characters
|
||||||
pusha
|
pusha
|
||||||
mov cx, bx
|
mov cx, bx
|
||||||
shl ecx, 16
|
shl ecx, 16
|
||||||
mov cx, FONT_HEIGHT
|
mov cx, FONT_HEIGHT
|
||||||
mov ebx, TEXT_X shl 16
|
mov ebx, TEXT_X shl 16
|
||||||
mov bx, word[textbox_width]
|
mov bx, word[textbox_width]
|
||||||
imul bx, FONT_WIDTH
|
imul bx, FONT_WIDTH
|
||||||
mov edx, [colors.work]
|
mov edx, [colors.work]
|
||||||
mcall 13 ; draw rectangle
|
mcall 13 ; draw rectangle
|
||||||
popa
|
popa
|
||||||
|
|
||||||
mov esi, edx
|
mov esi, edx
|
||||||
add esi, [textbox_width]
|
add 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 eax
|
||||||
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]
|
||||||
|
|
||||||
cmp byte[edx], ',' ; background color?
|
cmp byte[edx], ',' ; background color?
|
||||||
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 edi, [irc_colors + 4*esi]
|
mov edi, [irc_colors + 4*esi]
|
||||||
or ecx, 0x40000000
|
or ecx, 0x40000000
|
||||||
.no_colors:
|
.no_colors:
|
||||||
|
|
||||||
mov esi, 1
|
mov esi, 1
|
||||||
mcall 4 ; draw text
|
mcall 4 ; draw text
|
||||||
add ebx, FONT_WIDTH shl 16
|
add ebx, FONT_WIDTH shl 16
|
||||||
inc edx
|
inc edx
|
||||||
pop eax esi
|
pop eax esi
|
||||||
cmp edx, esi
|
cmp edx, esi
|
||||||
jb .line
|
jb .line
|
||||||
jmp .line_full
|
jmp .line_full
|
||||||
|
|
||||||
.newline_hard:
|
.newline_hard:
|
||||||
mov ecx, [colors.work_text]
|
mov ecx, [colors.work_text]
|
||||||
.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
|
||||||
dec eax
|
dec eax
|
||||||
jnz .drawloop
|
jnz .drawloop
|
||||||
.end_of_text:
|
.end_of_text:
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
dec_to_esi:
|
dec_to_esi:
|
||||||
|
|
||||||
xor esi, esi
|
xor esi, esi
|
||||||
.loop:
|
.loop:
|
||||||
movzx eax, byte[edx]
|
movzx eax, byte[edx]
|
||||||
sub al, '0'
|
sub al, '0'
|
||||||
jb .done
|
jb .done
|
||||||
cmp al, 9
|
cmp al, 9
|
||||||
ja .done
|
ja .done
|
||||||
inc edx
|
inc edx
|
||||||
lea esi, [esi*4 + esi] ; esi * 5
|
lea esi, [esi*4 + esi] ; esi * 5
|
||||||
lea esi, [esi*2 + eax] ; esi * 2 + eax
|
lea esi, [esi*2 + eax] ; esi * 2 + eax
|
||||||
jmp .loop
|
jmp .loop
|
||||||
.done:
|
.done:
|
||||||
cmp esi, 16
|
cmp esi, 16
|
||||||
jae .fail
|
jae .fail
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.fail:
|
.fail:
|
||||||
xor esi, esi
|
xor esi, esi
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if TIMESTAMP
|
if TIMESTAMP
|
||||||
print_timestamp:
|
print_timestamp:
|
||||||
|
|
||||||
pusha
|
pusha
|
||||||
mcall 3 ; get system time
|
mcall 3 ; get system time
|
||||||
mov ebx, eax
|
mov ebx, eax
|
||||||
|
|
||||||
mov al, '['
|
mov al, '['
|
||||||
call print_char
|
call print_char
|
||||||
mov ecx, TIMESTAMP
|
mov ecx, TIMESTAMP
|
||||||
.loop:
|
.loop:
|
||||||
mov al, bl
|
mov al, bl
|
||||||
shr al, 4
|
shr al, 4
|
||||||
add al, '0'
|
add al, '0'
|
||||||
call print_char
|
call print_char
|
||||||
|
|
||||||
mov al, bl
|
mov al, bl
|
||||||
and al, 0x0f
|
and al, 0x0f
|
||||||
add al, '0'
|
add al, '0'
|
||||||
call print_char
|
call print_char
|
||||||
|
|
||||||
dec ecx
|
dec ecx
|
||||||
jz .done
|
jz .done
|
||||||
|
|
||||||
mov al, ':'
|
mov al, ':'
|
||||||
call print_char
|
call print_char
|
||||||
shr ebx, 8
|
shr ebx, 8
|
||||||
jmp .loop
|
jmp .loop
|
||||||
.done:
|
.done:
|
||||||
mov al, ']'
|
mov al, ']'
|
||||||
call print_char
|
call print_char
|
||||||
mov al, ' '
|
mov al, ' '
|
||||||
call print_char
|
call print_char
|
||||||
|
|
||||||
popa
|
popa
|
||||||
ret
|
ret
|
||||||
end if
|
end if
|
@ -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 ;;
|
||||||
|
@ -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 ;;
|
||||||
|
@ -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 ;;
|
||||||
@ -19,36 +19,36 @@
|
|||||||
|
|
||||||
window_create_textbox:
|
window_create_textbox:
|
||||||
|
|
||||||
push ebx
|
push ebx
|
||||||
; allocate the window data block
|
; allocate the window data block
|
||||||
mcall 68, 12, sizeof.window_data
|
mcall 68, 12, sizeof.window_data
|
||||||
test eax, eax
|
test eax, eax
|
||||||
pop ebx
|
pop ebx
|
||||||
jz .fail
|
jz .fail
|
||||||
|
|
||||||
; fill it with all zeros
|
; fill it with all zeros
|
||||||
push eax
|
push eax
|
||||||
mov edi, eax
|
mov edi, eax
|
||||||
mov ecx, (sizeof.window_data+3)/4
|
mov ecx, (sizeof.window_data+3)/4
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
rep stosd
|
rep stosd
|
||||||
pop eax
|
pop eax
|
||||||
|
|
||||||
mov [ebx + window.data_ptr], eax
|
mov [ebx + window.data_ptr], eax
|
||||||
mov [ebx + window.flags], FLAG_SCROLL_LOW
|
mov [ebx + window.flags], FLAG_SCROLL_LOW
|
||||||
|
|
||||||
add eax, window_data.text+2 ; let text begin at offset 2, this way the text will be prepended with two null bytes
|
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_start], eax
|
||||||
mov [ebx + window.text_print], eax
|
mov [ebx + window.text_print], eax
|
||||||
mov [ebx + window.text_write], eax
|
mov [ebx + window.text_write], eax
|
||||||
mov [ebx + window.text_scanned], eax
|
mov [ebx + window.text_scanned], eax
|
||||||
mov [ebx + window.text_lines], 0
|
mov [ebx + window.text_lines], 0
|
||||||
mov [ebx + window.text_line_print], 0
|
mov [ebx + window.text_line_print], 0
|
||||||
add eax, TEXT_BUFFERSIZE-1
|
add eax, TEXT_BUFFERSIZE-1
|
||||||
mov [ebx + window.text_end], eax
|
mov [ebx + window.text_end], eax
|
||||||
|
|
||||||
.fail:
|
.fail:
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
; window_set_name
|
; window_set_name
|
||||||
@ -62,58 +62,58 @@ window_create_textbox:
|
|||||||
|
|
||||||
window_set_name:
|
window_set_name:
|
||||||
|
|
||||||
lea edi, [ebx + window.name]
|
lea edi, [ebx + window.name]
|
||||||
mov ecx, MAX_WINDOWNAME_LEN
|
mov ecx, MAX_WINDOWNAME_LEN
|
||||||
.loop:
|
.loop:
|
||||||
lodsb
|
lodsb
|
||||||
cmp al, 0x21 ; name ends with 0, space or !
|
cmp al, 0x21 ; name ends with 0, space or !
|
||||||
jbe .addzero
|
jbe .addzero
|
||||||
stosb
|
stosb
|
||||||
dec ecx
|
dec ecx
|
||||||
jnz .loop
|
jnz .loop
|
||||||
.addzero:
|
.addzero:
|
||||||
xor al, al
|
xor al, al
|
||||||
stosb
|
stosb
|
||||||
|
|
||||||
push esi ebx
|
push esi ebx
|
||||||
call draw_windowtabs
|
call draw_windowtabs
|
||||||
pop ebx esi
|
pop ebx esi
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
window_close: ; closes the 'print' window
|
window_close: ; closes the 'print' window
|
||||||
|
|
||||||
; Remove the window (overwrite current structure with trailing ones)
|
; Remove the window (overwrite current structure with trailing ones)
|
||||||
mov edi, [window_print]
|
mov edi, [window_print]
|
||||||
push [edi + window.data_ptr] ; remember data ptr so we can free it later
|
push [edi + window.data_ptr] ; remember data ptr so we can free it later
|
||||||
lea esi, [edi + sizeof.window]
|
lea esi, [edi + sizeof.window]
|
||||||
mov ecx, windows + MAX_WINDOWS*sizeof.window
|
mov ecx, windows + MAX_WINDOWS*sizeof.window
|
||||||
sub ecx, esi
|
sub ecx, esi
|
||||||
rep movsb
|
rep movsb
|
||||||
|
|
||||||
; Completely zero the trailing window block (there will always be one!)
|
; Completely zero the trailing window block (there will always be one!)
|
||||||
mov ecx, sizeof.window
|
mov ecx, sizeof.window
|
||||||
xor al, al
|
xor al, al
|
||||||
rep stosb
|
rep stosb
|
||||||
|
|
||||||
; free the window data block
|
; free the window data block
|
||||||
pop ecx
|
pop ecx
|
||||||
mcall 68, 13
|
mcall 68, 13
|
||||||
|
|
||||||
; We closed this window so we need to show another
|
; We closed this window so we need to show another
|
||||||
mov edi, [window_active]
|
mov edi, [window_active]
|
||||||
cmp [edi + window.data_ptr], 0
|
cmp [edi + window.data_ptr], 0
|
||||||
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
|
||||||
call draw_window
|
call draw_window
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
; window_find:
|
; window_find:
|
||||||
@ -125,33 +125,33 @@ window_close: ; closes the 'print' window
|
|||||||
|
|
||||||
window_find:
|
window_find:
|
||||||
|
|
||||||
mov ebx, windows
|
mov ebx, windows
|
||||||
mov eax, MAX_WINDOWS
|
mov eax, MAX_WINDOWS
|
||||||
.scanloop:
|
.scanloop:
|
||||||
push esi
|
push esi
|
||||||
cmp [ebx + window.type], WINDOWTYPE_NONE
|
cmp [ebx + window.type], WINDOWTYPE_NONE
|
||||||
je .try_next
|
je .try_next
|
||||||
lea edi, [ebx + window.name]
|
lea edi, [ebx + window.name]
|
||||||
mov ecx, MAX_WINDOWNAME_LEN
|
mov ecx, MAX_WINDOWNAME_LEN
|
||||||
repe cmpsb
|
repe cmpsb
|
||||||
cmp byte[edi-1], 0 ; last equall character was null? yes, the strings match!
|
cmp byte[edi-1], 0 ; last equall character was null? yes, the strings match!
|
||||||
je .got_it
|
je .got_it
|
||||||
cmp byte[edi], 0 ; we're at the end of string1.. ?
|
cmp byte[edi], 0 ; we're at the end of string1.. ?
|
||||||
jne .try_next
|
jne .try_next
|
||||||
cmp byte[esi], 0x21 ; and the end of string2? yes!
|
cmp byte[esi], 0x21 ; and the end of string2? yes!
|
||||||
jbe .got_it
|
jbe .got_it
|
||||||
.try_next:
|
.try_next:
|
||||||
pop esi
|
pop esi
|
||||||
add ebx, sizeof.window
|
add ebx, sizeof.window
|
||||||
dec eax
|
dec eax
|
||||||
jnz .scanloop
|
jnz .scanloop
|
||||||
|
|
||||||
xor ebx, ebx
|
xor ebx, ebx
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.got_it:
|
.got_it:
|
||||||
add esp, 4
|
add esp, 4
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -166,48 +166,48 @@ window_find:
|
|||||||
window_open:
|
window_open:
|
||||||
|
|
||||||
; Skip heading spaces
|
; Skip heading spaces
|
||||||
lodsb
|
lodsb
|
||||||
cmp al, ' '
|
cmp al, ' '
|
||||||
je window_open
|
je window_open
|
||||||
cmp al, ':'
|
cmp al, ':'
|
||||||
je window_open
|
je window_open
|
||||||
dec esi
|
dec esi
|
||||||
|
|
||||||
call window_find
|
call window_find
|
||||||
test ebx, ebx
|
test ebx, ebx
|
||||||
jnz .got_it
|
jnz .got_it
|
||||||
|
|
||||||
; create channel window - search for empty slot
|
; create channel window - search for empty slot
|
||||||
.create_it:
|
.create_it:
|
||||||
mov ebx, windows
|
mov ebx, windows
|
||||||
mov ecx, MAX_WINDOWS
|
mov ecx, MAX_WINDOWS
|
||||||
.scanloop2:
|
.scanloop2:
|
||||||
cmp [ebx + window.type], WINDOWTYPE_NONE
|
cmp [ebx + window.type], WINDOWTYPE_NONE
|
||||||
je .free_found
|
je .free_found
|
||||||
add ebx, sizeof.window
|
add ebx, sizeof.window
|
||||||
dec ecx
|
dec ecx
|
||||||
jnz .scanloop2
|
jnz .scanloop2
|
||||||
jmp .error
|
jmp .error
|
||||||
|
|
||||||
.free_found:
|
.free_found:
|
||||||
call window_create_textbox
|
call window_create_textbox
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz .error
|
jz .error
|
||||||
mov [ebx + window.type], WINDOWTYPE_CHAT ; FIXME: let caller handle this ?
|
mov [ebx + window.type], WINDOWTYPE_CHAT ; FIXME: let caller handle this ?
|
||||||
|
|
||||||
call window_set_name
|
call window_set_name
|
||||||
|
|
||||||
.got_it:
|
.got_it:
|
||||||
lodsb
|
lodsb
|
||||||
cmp al, ' '
|
cmp al, ' '
|
||||||
je .got_it
|
je .got_it
|
||||||
cmp al, ':'
|
cmp al, ':'
|
||||||
je .got_it
|
je .got_it
|
||||||
dec esi
|
dec esi
|
||||||
|
|
||||||
mov [window_print], ebx
|
mov [window_print], ebx
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.error:
|
.error:
|
||||||
xor ebx, ebx
|
xor ebx, ebx
|
||||||
ret
|
ret
|
Loading…
Reference in New Issue
Block a user