4 Commits

Author SHA1 Message Date
70b05aaa86 fix for calling tl_on_enter function, stack fix
All checks were successful
Build system / Check kernel codestyle (pull_request) Successful in 21s
Build system / Build (pull_request) Successful in 8m44s
2025-04-04 18:00:39 +03:00
a617d45245 Ftpc: icons are taken from @reshare
All checks were successful
Build system / Check kernel codestyle (pull_request) Successful in 28s
Build system / Build (pull_request) Successful in 5m3s
2025-04-01 22:06:22 +03:00
929a75f751 Ftpc: added option to show|hide log
All checks were successful
Build system / Check kernel codestyle (pull_request) Successful in 25s
Build system / Build (pull_request) Successful in 7m47s
2025-03-31 21:58:41 +03:00
9d0cfa8dfb Ftpc: change sorting of folders and files, clean code 2025-03-30 14:54:32 +03:00
10 changed files with 325 additions and 153 deletions

View File

@@ -49,8 +49,6 @@ img_files = {
{"MEDIA/IMGF/INVSOL.OBJ", "common/media/ImgF/invSol.obj"}, {"MEDIA/IMGF/INVSOL.OBJ", "common/media/ImgF/invSol.obj"},
{"MEDIA/PIXIESKN.PNG", SRC_PROGS .. "/cmm/pixie2/pixieskn.png"}, {"MEDIA/PIXIESKN.PNG", SRC_PROGS .. "/cmm/pixie2/pixieskn.png"},
{"NETWORK/FTPC.INI", SRC_PROGS .. "/network/ftpc/ftpc.ini"}, {"NETWORK/FTPC.INI", SRC_PROGS .. "/network/ftpc/ftpc.ini"},
{"NETWORK/FTPC_SYS.PNG", SRC_PROGS .. "/network/ftpc/ftpc_sys.png"},
{"NETWORK/FTPC_NOD.PNG", SRC_PROGS .. "/network/ftpc/ftpc_nod.png"},
{"NETWORK/FTPD.INI", "common/network/ftpd.ini"}, {"NETWORK/FTPD.INI", "common/network/ftpd.ini"},
{"NETWORK/KNMAP", "common/network/knmap"}, {"NETWORK/KNMAP", "common/network/knmap"},
{"NETWORK/USERS.INI", "common/network/users.ini"}, {"NETWORK/USERS.INI", "common/network/users.ini"},

View File

@@ -1,7 +1,6 @@
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> TreeList <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> box_lib.obj ; SPDX-License-Identifier: GPL-2.0-only
; <EFBFBD><EFBFBD> <20><><EFBFBD> <20><EFBFBD><E0A8AC><EFBFBD><EFBFBD><EFBFBD> GPL2 <20><><EFBFBD><E6A5AD><EFBFBD> ; TreeList: used as a ListBox or Tree control (determined by settings)
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><E4A8AA><EFBFBD><EFBFBD> 12.01.2021 IgorA ; Copyright (C) 2009-2025 IgorA <aie85playm@gmail.com>
struct TreeNode struct TreeNode
type dw ? ;+ 0 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><> type dw ? ;+ 0 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><>
@@ -14,6 +13,52 @@ struct TreeNode
ends ends
;input:
; ecx - 0xXX...... font options
;output:
; eax - font height in pixels
align 4
proc get_font_h uses ebx
mov eax,ecx
shr eax,24
bt eax,4
jc @f
bt eax,5
jc @f
mov ebx,9
jmp .siz0
@@:
mov ebx,16
.siz0:
and eax,7
inc eax
imul eax,ebx
ret
endp
;input:
; ecx - 0xXX...... font options
;output:
; eax - font width in pixels
align 4
proc get_font_w uses ebx
mov eax,ecx
shr eax,24
bt eax,4
jc @f
bt eax,5
jc @f
mov ebx,6
jmp .siz0
@@:
mov ebx,8
.siz0:
and eax,7
inc eax
imul eax,ebx
ret
endp
;<3B><EFBFBD><EBA4A5><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ᯨ᪠ <20> <20><EFBFBD><E1ADAE><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>樨 (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) ;<3B><EFBFBD><EBA4A5><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ᯨ᪠ <20> <20><EFBFBD><E1ADAE><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>樨 (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
align 16 align 16
proc tl_data_init uses eax ecx edi, tlist:dword proc tl_data_init uses eax ecx edi, tlist:dword
@@ -125,6 +170,7 @@ proc tl_key uses ebx ecx edi, tlist:dword
cmp tl_on_press,0 cmp tl_on_press,0
je @f je @f
call tl_on_press call tl_on_press
jmp .no_edit
@@: @@:
cmp ah,byte[ecx+1] ;Space cmp ah,byte[ecx+1] ;Space
jne @f jne @f
@@ -463,34 +509,24 @@ proc tl_draw, tlist:dword
cmp tl_capt_cy,9 ;9 - minimum caption height cmp tl_capt_cy,9 ;9 - minimum caption height
jl @f jl @f
mov ebx,edi ;calculate cursor position call tl_draw_caption_cur_pos
mov eax,tl_cur_pos
inc eax
lea edi,[txt_capt_cur.v]
stdcall tl_convert_to_str, 5
mov edi,ebx
mov eax,tl_tim_undo mov eax,tl_tim_undo
or eax,eax
jz @f
mov ebx,edi ;save edi
lea edi,[txt_capt_otm.v] lea edi,[txt_capt_otm.v]
stdcall tl_convert_to_str, 5 stdcall tl_convert_to_str, 5
mov edi,ebx ;restore edi mov edi,ebx ;restore edi
mov eax,SF_DRAW_TEXT ;captions
mov ebx,tl_box_left
shl ebx,16
add ebx,5*65536+3
add ebx,tl_box_top
mov ecx,tl_col_txt
or ecx,0x80000000
lea edx,[txt_capt_cur]
int 0x40
mov ebx,tl_box_left mov ebx,tl_box_left
shl ebx,16 shl ebx,16
add ebx,100*65536+3 add ebx,100*65536+3
mov ecx,tl_col_txt
and ecx,0x00ffffff
or ecx,0x80000000
add ebx,tl_box_top add ebx,tl_box_top
lea edx,[txt_capt_otm] lea edx,[txt_capt_otm]
int 0x40 mcall SF_DRAW_TEXT ;undo
@@: @@:
;cycle to nodes ;cycle to nodes
@@ -1163,10 +1199,11 @@ proc tl_draw_node_caption uses ebx ecx edx esi
ror ecx,16 ror ecx,16
mov ebx,ecx mov ebx,ecx
add bx,tl_img_cy ;<3B><><EFBFBD><E0A0A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><E0A0AD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> add bx,tl_img_cy ;<3B><><EFBFBD><E0A0A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><E0A0AD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
sub bx,9 ;<3B><EFBFBD><E2ADA8><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><E2A5AA><EFBFBD>
mov ecx,tl_col_txt mov ecx,tl_col_txt
and ecx,0xffffff call get_font_h
mcall SF_DRAW_TEXT sub bx,ax ;<3B><EFBFBD><E2ADA8><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><E2A5AA><EFBFBD>
and ecx,0x37ffffff
mcall SF_DRAW_TEXT ;node text
@@: @@:
ret ret
endp endp
@@ -1179,13 +1216,15 @@ endp
align 4 align 4
proc tl_get_draw_text_len uses eax ecx edx proc tl_get_draw_text_len uses eax ecx edx
mov esi,eax ;<3B><><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> mov esi,eax ;<3B><><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>
mov ecx,tl_col_txt
call get_font_w
mov ecx,eax
mov eax,tl_box_left mov eax,tl_box_left
add eax,tl_box_width add eax,tl_box_width
cmp eax,ebx cmp eax,ebx
jle .text_null ;<3B><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><> <20><><EFBFBD><E0A0AD> jle .text_null ;<3B><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><> <20><><EFBFBD><E0A0AD>
sub eax,ebx sub eax,ebx
xor edx,edx xor edx,edx
mov ecx,6 ;<3B><><EFBFBD> <20><><EFBFBD><EFBFBD><E2A5AC><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
div ecx ;ᬮ<>ਬ ᪮<>쪮 ᨬ<><E1A8AC><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD> div ecx ;ᬮ<>ਬ ᪮<>쪮 ᨬ<><E1A8AC><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD>
cmp esi,eax cmp esi,eax
jl @f jl @f
@@ -1858,10 +1897,8 @@ pushad
.po8: .po8:
call tl_node_move_po8 ;㧫<> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>塞 8 <20><><EFBFBD> call tl_node_move_po8 ;㧫<> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>塞 8 <20><><EFBFBD>
.cur_mov: .cur_mov:
push dword edi stdcall tl_cur_perv, edi
call tl_cur_perv stdcall tl_draw, edi
push dword edi
call tl_draw
@@: @@:
popad popad
ret ret
@@ -1981,10 +2018,11 @@ tl_draw_caption_cur_pos:
add ebx,5*65536+3 add ebx,5*65536+3
add ebx,tl_box_top add ebx,tl_box_top
mov ecx,tl_col_txt mov ecx,tl_col_txt
and ecx,0x00ffffff
or ecx,0xc0000000 ;0x40000000 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E8A8A2><EFBFBD> 䮭 梥⮬ edi or ecx,0xc0000000 ;0x40000000 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E8A8A2><EFBFBD> 䮭 梥⮬ edi
lea edx,[txt_capt_cur] lea edx,[txt_capt_cur]
mov edi,tl_col_zag mov edi,tl_col_zag
mcall SF_DRAW_TEXT ;captions mcall SF_DRAW_TEXT ;row number
popad popad
@@: @@:
ret ret
@@ -2253,6 +2291,6 @@ align 4
jge @f jge @f
or al,0x30 ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>塞 ᨬ<><E1A8AC><EFBFBD> '0' or al,0x30 ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>塞 ᨬ<><E1A8AC><EFBFBD> '0'
stosb ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> al <20> <20><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> [edi] stosb ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> al <20> <20><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> [edi]
mov byte[edi],0 mov word[edi],' ' ;add space symbol and 0
@@: @@:
ret ret

View File

@@ -343,7 +343,7 @@ void kos_Main()
void drawGameWindow() void drawGameWindow()
{ {
kos_DefineAndDrawWindow(windowX, windowY, WINDOW_WIDTH, WINDOW_HEIGHT, 0x34, 0x00FFFF, 0, 0, (Dword)HEADER_STRING); kos_DefineAndDrawWindow(windowX, windowY, WINDOW_WIDTH, WINDOW_HEIGHT, 0x33, 0x00FFFF, 0, 0, (Dword)HEADER_STRING);
bird.draw(); bird.draw();
for (int i = 0; i < tubeNumber; ++i) for (int i = 0; i < tubeNumber; ++i)
tubes[i].draw(); tubes[i].draw();
@@ -370,7 +370,7 @@ void redrawGameWindow()
void drawGameoverWindow() void drawGameoverWindow()
{ {
kos_DefineAndDrawWindow(windowX, windowY, WINDOW_WIDTH, WINDOW_HEIGHT, 0x34, 0x000000, 0, 0, (Dword)HEADER_STRING); kos_DefineAndDrawWindow(windowX, windowY, WINDOW_WIDTH, WINDOW_HEIGHT, 0x33, 0x000000, 0, 0, (Dword)HEADER_STRING);
kos_WriteTextToWindow(125, 50, 0x82, 0xFFFFFF, GAMEOVER_STRING, 0); kos_WriteTextToWindow(125, 50, 0x82, 0xFFFFFF, GAMEOVER_STRING, 0);
kos_WriteTextToWindow(135, 100, 0x81, 0xFFFFFF, scoreString, 0); kos_WriteTextToWindow(135, 100, 0x81, 0xFFFFFF, scoreString, 0);
kos_WriteTextToWindow(50, 150, 0x81, 0xFFFFFF, ANY_KEY_STRING, 0); kos_WriteTextToWindow(50, 150, 0x81, 0xFFFFFF, ANY_KEY_STRING, 0);
@@ -387,7 +387,7 @@ void WriteBorderedText(Word x, Word y, Byte fontType, Dword textColor, const cha
void drawMenuWindow() void drawMenuWindow()
{ {
kos_DefineAndDrawWindow(windowX, windowY, WINDOW_WIDTH, WINDOW_HEIGHT, 0x34, 0x00FFFF, 0, 0, (Dword)HEADER_STRING); kos_DefineAndDrawWindow(windowX, windowY, WINDOW_WIDTH, WINDOW_HEIGHT, 0x33, 0x00FFFF, 0, 0, (Dword)HEADER_STRING);
WriteBorderedText(85, 40, 0x4, 0xFFFFFF, HEADER_STRING, 6, 0x000000, 2); WriteBorderedText(85, 40, 0x4, 0xFFFFFF, HEADER_STRING, 6, 0x000000, 2);
WriteBorderedText(185, 80, 0x84, 0xFFFFFF, HEADER_STRING + 7, 0, 0x000000, 2); WriteBorderedText(185, 80, 0x84, 0xFFFFFF, HEADER_STRING + 7, 0, 0x000000, 2);

View File

@@ -1,6 +1,6 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;; ;; ;;
;; Copyright (C) KolibriOS team 2013-2021. All rights reserved. ;; ;; Copyright (C) KolibriOS team 2013-2025. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;; ;; Distributed under terms of the GNU General Public License ;;
;; ;; ;; ;;
;; ftpc.asm - FTP client for KolibriOS ;; ;; ftpc.asm - FTP client for KolibriOS ;;
@@ -36,8 +36,8 @@ use32
dd 1 ; header version dd 1 ; header version
dd start ; entry point dd start ; entry point
dd i_end ; initialized size dd i_end ; initialized size
dd mem+0x1000 ; required memory dd mem ; required memory
dd mem+0x1000 ; stack pointer dd stacktop ; stack pointer
dd buf_cmd ; parameters dd buf_cmd ; parameters
dd path ; path dd path ; path
@@ -83,12 +83,12 @@ start: ;////////////////////////////////////////////////////////////////////////
;< none ;; ;< none ;;
;;================================================================================================;; ;;================================================================================================;;
; initialize heap for using dynamic blocks ; initialize heap for using dynamic blocks
mcall 68, 11 mcall SF_SYS_MISC, SSF_HEAP_INIT
test eax, eax test eax, eax
je exit2 je exit2
; disable all events except network event ; disable all events except network event
mcall 40, EV_STACK mcall SF_SET_EVENTS_MASK, EV_STACK
; load libraries ; load libraries
stdcall dll.Load, @IMPORT stdcall dll.Load, @IMPORT
test eax, eax test eax, eax
@@ -125,16 +125,16 @@ start: ;////////////////////////////////////////////////////////////////////////
mov [acti_port_stop], ax mov [acti_port_stop], ax
invoke ini.get_str, path, str_general, str_dir, buf_buffer1, BUFFERSIZE, 0 invoke ini.get_str, path, str_general, str_dir, buf_buffer1, BUFFERSIZE, 0
mcall 30, 1, buf_buffer1 ; set working directory mcall SF_CURRENT_FOLDER, SSF_SET_CF, buf_buffer1 ; set working directory
; initialize log file ; initialize log file
invoke ini.get_str, path, str_general, str_logfile, log_file, 512, 0 invoke ini.get_str, path, str_general, str_logfile, log_file, 512, 0
mov [filestruct2.subfn], 2 mov [filestruct2.subfn], SSF_CREATE_FILE
mov [filestruct2.offset], 0 mov [filestruct2.offset], 0
mov [filestruct2.size], 0 mov [filestruct2.size], 0
mov [filestruct2.ptr], 0 mov [filestruct2.ptr], 0
mov [filestruct2.name], log_file mov [filestruct2.name], log_file
mcall 70, filestruct2 mcall SF_FILE, filestruct2
; Usage: ftpc [-cli] [ftp://username:password@server:port/path] ; Usage: ftpc [-cli] [ftp://username:password@server:port/path]
@@ -355,7 +355,7 @@ wait_for_servercommand: ;///////////////////////////////////////////////////////
; receive socket data with timeout ; receive socket data with timeout
.receive: .receive:
mcall 26, 9 mcall SF_SYSTEM_GET, SSF_TIME_COUNT
add eax, TIMEOUT*100 add eax, TIMEOUT*100
mov [timeout], eax mov [timeout], eax
.again: .again:
@@ -365,11 +365,11 @@ wait_for_servercommand: ;///////////////////////////////////////////////////////
je .closed je .closed
cmp ebx, EWOULDBLOCK cmp ebx, EWOULDBLOCK
jne .sock_err jne .sock_err
mcall 26, 9 mcall SF_SYSTEM_GET, SSF_TIME_COUNT
mov ebx, [timeout] mov ebx, [timeout]
sub ebx, eax sub ebx, eax
jle .timeout jle .timeout
mcall 23 ; Wait for event with timeout mcall SF_WAIT_EVENT_TIMEOUT ; Wait for event with timeout
jmp .again jmp .again
.sock_err: .sock_err:
@@ -524,7 +524,7 @@ transfer_queued:
; Error occured, we reached the end of the buffer before [queued] reached 0 ; Error occured, we reached the end of the buffer before [queued] reached 0
mov [queued], 0 mov [queued], 0
mcall 68, 13, [ptr_fname] ; free buffer mcall SF_SYS_MISC, SSF_MEM_FREE, [ptr_fname] ; free buffer
test eax, eax test eax, eax
jz error_heap jz error_heap
jmp wait_for_usercommand jmp wait_for_usercommand
@@ -535,7 +535,7 @@ transfer_queued:
dec [queued] dec [queued]
jnz cmd_retr jnz cmd_retr
mcall 68, 13, [ptr_fname] ; free buffer mcall SF_SYS_MISC, SSF_MEM_FREE, [ptr_fname] ; free buffer
test eax, eax test eax, eax
jz error_heap jz error_heap
jmp cmd_retr jmp cmd_retr
@@ -655,12 +655,12 @@ write_to_file: ;////////////////////////////////////////////////////////////////
mov eax, 0 mov eax, 0
ret ret
@@: @@:
mov [filestruct2.subfn], 3 mov [filestruct2.subfn], SSF_WRITE_FILE
m2m [filestruct2.offset], [logfile_offset] m2m [filestruct2.offset], [logfile_offset]
mov [filestruct2.size], ecx mov [filestruct2.size], ecx
mov [filestruct2.ptr], eax mov [filestruct2.ptr], eax
mov [filestruct2.name], log_file mov [filestruct2.name], log_file
mcall 70, filestruct2 mcall SF_FILE, filestruct2
test eax, eax test eax, eax
jz @f jz @f
mov [logfile_offset], -1 ; disable logging mov [logfile_offset], -1 ; disable logging
@@ -754,13 +754,13 @@ wait_for_keypress:
exit: exit:
mcall close, [controlsocket] mcall close, [controlsocket]
exit2: exit2:
mcall -1 mcall SF_TERMINATE_PROCESS
; data ; data
str_title db 'FTP client for KolibriOS',0 str_title db 'FTP client for KolibriOS',0
str_welcome db 'FTP client for KolibriOS v0.16',10 str_welcome db 'FTP client for KolibriOS v0.18',10
db 10,0 db 10,0
str_srv_addr db 'Please enter ftp server address.',10,0 str_srv_addr db 'Please enter ftp server address.',10,0
@@ -971,6 +971,7 @@ param_path rb 1024
param_port rb 6 param_port rb 6
sc system_colors sc system_colors
rb 1024 align 16
rb 4096
stacktop:
mem: mem:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 283 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 640 B

View File

@@ -7,6 +7,8 @@ include '../../load_lib.mac'
icon_tl_sys dd 0 icon_tl_sys dd 0
icon_tl_nod dd 0 icon_tl_nod dd 0
lbl_after_enter dd 0
show_log db 0 ; 0 - hide log, 1 - show log
TLIST_SZ = 325+16 ;=341. 16 is x-size of scroll bar TLIST_SZ = 325+16 ;=341. 16 is x-size of scroll bar
TLIST1_X = 50 TLIST1_X = 50
@@ -15,6 +17,9 @@ BT_SZ_X = 40
SYS_COL = 0xe6e6e6 SYS_COL = 0xe6e6e6
BT_COL = 0xcccccc BT_COL = 0xcccccc
STR_COL = 0x595959 ;0x000000 STR_COL = 0x595959 ;0x000000
ICON_TOP_B = 2 ; top border
ICON_LEFT_B = 2 ; left border
ICON_SIZE = (18+ICON_LEFT_B)*(18+ICON_TOP_B)*3
; TODO: automatic resizing of GUI elements on window resizing ; TODO: automatic resizing of GUI elements on window resizing
@@ -45,8 +50,8 @@ gui: ;//////////////////////////////////////////////////////////////////////////
test eax, eax test eax, eax
jnz .exit jnz .exit
mcall 48, 3, sc, sizeof.system_colors mcall SF_STYLE_SETTINGS, SSF_GET_COLORS, sc, sizeof.system_colors
mcall 40, 0xC0000027 ; set event mask mcall SF_SET_EVENTS_MASK, 0xC0000027 ; set event mask
ret ret
.server_addr: .server_addr:
@@ -73,37 +78,36 @@ gui: ;//////////////////////////////////////////////////////////////////////////
; initialize tree list elements ; initialize tree list elements
stdcall [tl_data_init], tree1 stdcall [tl_data_init], tree1
stdcall [tl_data_init], tree2 stdcall [tl_data_init], tree2
or dword[tree1.style], 8 ;tl_cursor_pos_limited - restrict cursor move to existing nodes
or dword[tree2.style], 8 ;tl_cursor_pos_limited
; read icons
load_image_file 'ftpc_sys.png', icon_tl_sys
mov [filestruct.ptr], eax or dword[tree1.style], 8 ;tl_cursor_pos_limited - restrict cursor move to existing nodes
mov [filestruct.subfn], 0 or dword[tree2.style], 8 ;tl_cursor_pos_limited
mov [filestruct.offset], 54
mov [filestruct.size], ecx ; read icons
mcall 70, filestruct mcall SF_SYS_MISC, SSF_MEM_OPEN, str_icon_18,, 0
cmp ebx, 0 or eax, eax
jl @f jz @f
mov esi, eax
mov ecx, ICON_SIZE*11
mcall SF_SYS_MISC, SSF_MEM_ALLOC
mov ecx, eax
mov [icon_tl_sys], eax
stdcall copy_icon, eax,esi,31 ;active cursor
add eax, ICON_SIZE*3 ;skip not used icons
stdcall img_to_gray, ecx, eax, ICON_SIZE/3 ;not active cursor
m2m dword[tree1.data_img_sys], dword[icon_tl_sys] m2m dword[tree1.data_img_sys], dword[icon_tl_sys]
m2m dword[tree2.data_img_sys], dword[icon_tl_sys] m2m dword[tree2.data_img_sys], dword[icon_tl_sys]
@@:
; read nodes icon file ; read nodes icon file
load_image_file 'ftpc_nod.png', icon_tl_nod mov ecx, ICON_SIZE*2
mcall SF_SYS_MISC, SSF_MEM_ALLOC
mov [icon_tl_nod], eax
stdcall copy_icon, eax,esi,2
stdcall copy_icon, eax,esi,0
mov [filestruct.ptr], eax
;mov [filestruct.subfn], 0
;mov [filestruct.offset], 54
mov [filestruct.size], ecx
mcall 70, filestruct
cmp ebx, 0
jl @f
m2m dword[tree1.data_img], dword[icon_tl_nod] m2m dword[tree1.data_img], dword[icon_tl_nod]
m2m dword[tree2.data_img], dword[icon_tl_nod] m2m dword[tree2.data_img], dword[icon_tl_nod]
@@: @@:
call .draw call .draw
; create initial tree list for root_dir ; create initial tree list for root_dir
@@ -121,7 +125,7 @@ gui: ;//////////////////////////////////////////////////////////////////////////
align 4 align 4
.still: .still:
mcall 10 mcall SF_WAIT_EVENT
dec eax dec eax
jz .redraw jz .redraw
@@ -146,65 +150,79 @@ gui: ;//////////////////////////////////////////////////////////////////////////
align 4 align 4
.draw: .draw:
mcall 12, 1 mcall SF_REDRAW, SSF_BEGIN_DRAW
; main window ; main window
mcall 0, <35,830>, <20,555>, 0x34000000+SYS_COL, 0x805080DD, str_title mcall SF_CREATE_WINDOW, <35,830>, <20,555-160>, 0x34000000+SYS_COL, 0x805080DD, str_title
;------------------------- ;-------------------------
; textedit components ; textedit components
;------------------------- ;-------------------------
mcall 9, procinfo, -1 mcall SF_THREAD_INFO, procinfo, -1
mov edi, tedit0 mov edi, tedit0
call EvSize call EvSize
movzx ebx,word[procinfo.client_box.width] movzx ebx,word[procinfo.client_box.width]
inc bx inc bx
mcall 13, , ted_wnd_t mcall SF_DRAW_RECT, , ted_wnd_t
stdcall [ted_draw], tedit0
; draw "disconnect" button ; draw "disconnect" button
mcall 8, <50,95>, <25,25>, 3, BT_COL mcall SF_DEFINE_BUTTON, <50,95>, <25,25>, 3, BT_COL
; string "disconnect" ; string "disconnect"
mcall 4, <50+5,25+5>, 0xb0000000+STR_COL, str_disconnect mcall SF_DRAW_TEXT, <50+5,25+5>, 0xb0000000+STR_COL, str_disconnect
; draw "Show|Hide log" button
mcall SF_DEFINE_BUTTON, <50,79>, <326,25>, 10, BT_COL
; string "Show|Hide log"
cmp [show_log],0
je @f
stdcall [ted_draw], tedit0
mov edx, str_hide_log
jmp .end_log_1
@@:
mov edx, str_show_log
.end_log_1:
mcall SF_DRAW_TEXT, <50+5,326+5>, 0xb0000000+STR_COL
cmp [show_log],0
je @f
; draw "Copy" button ; draw "Copy" button
mcall 8, <50,40>, <326,25>, 4, BT_COL mcall SF_DEFINE_BUTTON, <129+5,40>, <326,25>, 4, BT_COL
; string "copy" ; string "copy"
mcall 4, <50+5,326+5>, 0xb0000000+STR_COL, str_copy mcall SF_DRAW_TEXT, <129+10,326+5>, 0xb0000000+STR_COL, str_copy
@@:
; draw "Search" button ; draw "Search" button
mcall 8, <TLIST2_X+TLIST_SZ-55,55>, <20,25>, 5, BT_COL mcall SF_DEFINE_BUTTON, <TLIST2_X+TLIST_SZ-55,55>, <20,25>, 5, BT_COL
; string "Search" ; string "Search"
mcall 4, <TLIST2_X+TLIST_SZ-55+5,20+5>, 0xb0000000+STR_COL, str_search mcall SF_DRAW_TEXT, <TLIST2_X+TLIST_SZ-55+5,20+5>, 0xb0000000+STR_COL, str_search
; draw "LIST" button ; draw "LIST" button
mcall 8, <TLIST2_X+TLIST_SZ-4*BT_SZ_X-15,BT_SZ_X>, <50,25>, 12, BT_COL mcall SF_DEFINE_BUTTON, <TLIST2_X+TLIST_SZ-4*BT_SZ_X-15,BT_SZ_X>, <50,25>, 12, BT_COL
; string "LIST" ; string "LIST"
mcall 4, <TLIST2_X+TLIST_SZ-4*BT_SZ_X-15+5,50+5>, 0xb0000000+STR_COL, str_list mcall SF_DRAW_TEXT, <TLIST2_X+TLIST_SZ-4*BT_SZ_X-15+5,50+5>, 0xb0000000+STR_COL, str_list
; draw "DELE" button ; draw "DELE" button
mcall 8, <TLIST2_X+TLIST_SZ-3*BT_SZ_X-10,BT_SZ_X>, <50,25>, 7, BT_COL mcall SF_DEFINE_BUTTON, <TLIST2_X+TLIST_SZ-3*BT_SZ_X-10,BT_SZ_X>, <50,25>, 7, BT_COL
; string "DELE" ; string "DELE"
mcall 4, <TLIST2_X+TLIST_SZ-3*BT_SZ_X-10+5,50+5>, 0xb0000000+STR_COL, str_dele mcall SF_DRAW_TEXT, <TLIST2_X+TLIST_SZ-3*BT_SZ_X-10+5,50+5>, 0xb0000000+STR_COL, str_dele
; draw "RDIR" button ; draw "RDIR" button
mcall 8, <TLIST2_X+TLIST_SZ-2*BT_SZ_X-5,BT_SZ_X>, <50,25>, 8, BT_COL mcall SF_DEFINE_BUTTON, <TLIST2_X+TLIST_SZ-2*BT_SZ_X-5,BT_SZ_X>, <50,25>, 8, BT_COL
; string "RDIR" ; string "RDIR"
mcall 4, <TLIST2_X+TLIST_SZ-2*BT_SZ_X-5+5,50+5>, 0xb0000000+STR_COL, str_rdir mcall SF_DRAW_TEXT, <TLIST2_X+TLIST_SZ-2*BT_SZ_X-5+5,50+5>, 0xb0000000+STR_COL, str_rdir
; draw "RMD" button ; draw "RMD" button
mcall 8, <TLIST2_X+TLIST_SZ-BT_SZ_X,BT_SZ_X>, <50,25>, 9, BT_COL mcall SF_DEFINE_BUTTON, <TLIST2_X+TLIST_SZ-BT_SZ_X,BT_SZ_X>, <50,25>, 9, BT_COL
; string "RMD" ; string "RMD"
mcall 4, <TLIST2_X+TLIST_SZ-BT_SZ_X+5,50+5>, 0xb0000000+STR_COL, str_rmd mcall SF_DRAW_TEXT, <TLIST2_X+TLIST_SZ-BT_SZ_X+5,50+5>, 0xb0000000+STR_COL, str_rmd
; draw "mkd" button ; draw "mkd" button
mcall 8, <TLIST2_X+TLIST_SZ-BT_SZ_X,BT_SZ_X>, <80,20>, 6, BT_COL mcall SF_DEFINE_BUTTON, <TLIST2_X+TLIST_SZ-BT_SZ_X,BT_SZ_X>, <80,20>, 6, BT_COL
; string "mkd" ; string "mkd"
mcall 4, <TLIST2_X+TLIST_SZ-BT_SZ_X+5,80+5>, 0xb0000000+STR_COL, str_mkd mcall SF_DRAW_TEXT, <TLIST2_X+TLIST_SZ-BT_SZ_X+5,80+5>, 0xb0000000+STR_COL, str_mkd
; draw "cancel" button ; draw "cancel" button
;mcall 8, <555,55>, <308,25>, 10, BT_COL ;mcall SF_DEFINE_BUTTON, <555,55>, <308,25>, 10, BT_COL
; string "Cancel" ; string "Cancel"
;mcall 4, <555+5,308+5>, 0xb0000000+STR_COL, str_abort ;mcall SF_DRAW_TEXT, <555+5,308+5>, 0xb0000000+STR_COL, str_abort
; draw "change volume" button ; draw "change volume" button
mcall 8, <TLIST1_X+TLIST_SZ-55,55>, <100-20,22>, 11, BT_COL mcall SF_DEFINE_BUTTON, <TLIST1_X+TLIST_SZ-55,55>, <100-20,22>, 11, BT_COL
; string "Change" ; string "Change"
mcall 4, <TLIST1_X+TLIST_SZ-55+5,100-20+5>, 0xb0000000+STR_COL, str_change mcall SF_DRAW_TEXT, <TLIST1_X+TLIST_SZ-55+5,100-20+5>, 0xb0000000+STR_COL, str_change
;-------------------------- ;--------------------------
; tree list components ; tree list components
@@ -222,12 +240,12 @@ gui: ;//////////////////////////////////////////////////////////////////////////
stdcall [edit_box_draw], edit_volume stdcall [edit_box_draw], edit_volume
stdcall [edit_box_draw], edit_search stdcall [edit_box_draw], edit_search
mcall 12,2 mcall SF_REDRAW, SSF_END_DRAW
ret ret
align 16 align 16
.mouse: .mouse:
mcall 37, 1 mcall SF_MOUSE_GET, SSF_WINDOW_POSITION
cmp word[tedit0.wnd.top], ax cmp word[tedit0.wnd.top], ax
jg .no_edit jg .no_edit
@@ -235,7 +253,7 @@ gui: ;//////////////////////////////////////////////////////////////////////////
cmp word[tedit0.wnd.left], ax cmp word[tedit0.wnd.left], ax
jg .no_edit jg .no_edit
mcall 37, 3 mcall SF_MOUSE_GET, SSF_BUTTON_EXT
bt eax, 24 bt eax, 24
jnc @f jnc @f
@@ -243,12 +261,19 @@ gui: ;//////////////////////////////////////////////////////////////////////////
jmp .still jmp .still
@@: @@:
cmp [show_log],0
je .still
stdcall [ted_mouse], tedit0 stdcall [ted_mouse], tedit0
jmp .still jmp .still
.no_edit: .no_edit:
mov [lbl_after_enter], 0
stdcall [tl_mouse], tree1 stdcall [tl_mouse], tree1
stdcall [tl_mouse], tree2 stdcall [tl_mouse], tree2
cmp [lbl_after_enter], 0
jz @f
jmp [lbl_after_enter]
@@:
stdcall [edit_box_mouse], edit_mkd stdcall [edit_box_mouse], edit_mkd
stdcall [edit_box_mouse], edit_volume stdcall [edit_box_mouse], edit_volume
stdcall [edit_box_mouse], edit_search stdcall [edit_box_mouse], edit_search
@@ -256,9 +281,14 @@ gui: ;//////////////////////////////////////////////////////////////////////////
align 16 align 16
.key: .key:
mcall 2 mcall SF_GET_KEY
mov [lbl_after_enter], 0
stdcall [tl_key], tree1 stdcall [tl_key], tree1
stdcall [tl_key], tree2 stdcall [tl_key], tree2
cmp [lbl_after_enter], 0
jz @f
jmp [lbl_after_enter]
@@:
stdcall [edit_box_key], edit_mkd stdcall [edit_box_key], edit_mkd
stdcall [edit_box_key], edit_volume stdcall [edit_box_key], edit_volume
stdcall [edit_box_key], edit_search stdcall [edit_box_key], edit_search
@@ -266,13 +296,19 @@ gui: ;//////////////////////////////////////////////////////////////////////////
align 16 align 16
.button: .button:
mcall 17 mcall SF_GET_BUTTON
cmp ah, 3 cmp ah, 3
jne @f jne @f
ijmp eax, interface_addr, interface.server_addr ijmp eax, interface_addr, interface.server_addr
jmp .still jmp .still
@@:
cmp ah, 10
jne @f
call show_hide_log
jmp .still
@@: @@:
cmp ah, 4 cmp ah, 4
jne @f jne @f
@@ -310,7 +346,7 @@ gui: ;//////////////////////////////////////////////////////////////////////////
@@: @@:
cmp ah, 1 cmp ah, 1
je .exit je .exit
jmp .still jmp .still
.print: .print:
@@ -327,7 +363,10 @@ gui: ;//////////////////////////////////////////////////////////////////////////
cmp byte[esi], 0 cmp byte[esi], 0
jne @b jne @b
stdcall [ted_text_add], tedit0, tedit_buffer, ecx, ebx stdcall [ted_text_add], tedit0, tedit_buffer, ecx, ebx
cmp [show_log],0
je .end_log_2
stdcall [ted_draw], tedit0 stdcall [ted_draw], tedit0
.end_log_2:
; write to log file ; write to log file
mov eax, [esp+36] mov eax, [esp+36]
sub ecx, 2 ; 0a0d is not included sub ecx, 2 ; 0a0d is not included
@@ -424,6 +463,8 @@ gui: ;//////////////////////////////////////////////////////////////////////////
mov byte[edi], 0 mov byte[edi], 0
; add node to tree list ; add node to tree list
and dword[tree2.style], not 8
stdcall [tl_cur_next], tree2
cmp word[node_entry2], 'fi' cmp word[node_entry2], 'fi'
jne @f jne @f
stdcall [tl_node_add], tree2, 0, node_entry2 stdcall [tl_node_add], tree2, 0, node_entry2
@@ -470,6 +511,8 @@ gui: ;//////////////////////////////////////////////////////////////////////////
jne @b jne @b
.done_parsing: .done_parsing:
stdcall [tl_cur_beg], tree2
or dword[tree2.style], 8
call .draw ; to update tree list immediately in case of "auto_list" call .draw ; to update tree list immediately in case of "auto_list"
pop eax pop eax
pop edx pop edx
@@ -494,7 +537,7 @@ gui: ;//////////////////////////////////////////////////////////////////////////
;;================================================================================================;; ;;================================================================================================;;
; detect abort ; detect abort
mcall 17 mcall SF_GET_BUTTON
cmp ah, 10 cmp ah, 10
je cmd_abor je cmd_abor
@@ -578,7 +621,8 @@ fun_on_enter:
cmp byte[esi], 0 cmp byte[esi], 0
jne @b jne @b
mov word[edi], 0x000a mov word[edi], 0x000a
jmp cmd_stor mov [lbl_after_enter], cmd_stor
ret
; Function to call when you press [Enter] ; Function to call when you press [Enter]
@@ -591,7 +635,8 @@ fun_on_enter2:
cmp dword[esi], 0x2E2E cmp dword[esi], 0x2E2E
jne @f jne @f
mov [auto_list], 1 mov [auto_list], 1
jmp cmd_cdup mov [lbl_after_enter], cmd_cdup
ret
@@: @@:
cmp word[eax], 'fo' cmp word[eax], 'fo'
@@ -610,12 +655,14 @@ fun_on_enter2:
; newline in console code ; newline in console code
cmp word[eax], 'fo' cmp word[eax], 'fo'
je @f je @f
jmp cmd_retr mov [lbl_after_enter], cmd_retr
ret
@@: @@:
stdcall [tl_info_clear], tree2 stdcall [tl_info_clear], tree2
mov [auto_list], 1 mov [auto_list], 1
jmp cmd_cwd mov [lbl_after_enter], cmd_cwd
ret
;;================================================================================================;; ;;================================================================================================;;
@@ -641,7 +688,7 @@ populate_local_tree_list: ;/////////////////////////////////////////////////////
jne @f jne @f
; removes last file name from filestruct.name ; removes last file name from filestruct.name
mcall 30, 2, filestruct.name,1024 ; get absolute path for cwd mcall SF_CURRENT_FOLDER, SSF_GET_CF, filestruct.name,1024 ; get absolute path for cwd
lea edi, [filestruct.name+eax] ; edi = pointer to the tail of file name lea edi, [filestruct.name+eax] ; edi = pointer to the tail of file name
mov al, '/' mov al, '/'
mov ecx, -1 mov ecx, -1
@@ -652,15 +699,15 @@ populate_local_tree_list: ;/////////////////////////////////////////////////////
mov ecx, filestruct.name mov ecx, filestruct.name
@@: @@:
mcall 30, 1, ; set cwd mcall SF_CURRENT_FOLDER, SSF_SET_CF ; set cwd
mcall 30, 2, filestruct.name, 1024 ; get absolute path for cwd mcall SF_CURRENT_FOLDER, SSF_GET_CF, filestruct.name, 1024 ; get absolute path for cwd
; clear all nodes in tree list ; clear all nodes in tree list
stdcall [tl_info_clear], tree1 stdcall [tl_info_clear], tree1
mov [filestruct.offset], 0 mov [filestruct.offset], 0
; read 32 blocks ; read 32 blocks
.outer: .outer:
mcall 70, filestruct mcall SF_FILE, filestruct
;int3 ;int3
test eax, eax test eax, eax
jz @f jz @f
@@ -746,6 +793,16 @@ EvSize:
ret ret
;
show_hide_log:
mov esi, 555
xor [show_log],1
jnz @f
sub esi, 160
@@:
mcall SF_CHANGE_WINDOW, -1, -1, -1
ret
;;================================================================================================;; ;;================================================================================================;;
filter_remote_list: ;/////////////////////////////////////////////////////////////////////////////;; filter_remote_list: ;/////////////////////////////////////////////////////////////////////////////;;
;;------------------------------------------------------------------------------------------------;; ;;------------------------------------------------------------------------------------------------;;
@@ -861,11 +918,81 @@ search: ;///////////////////////////////////////////////////////////////////////
pop edi esi edx ecx ebx pop edi esi edx ecx ebx
ret ret
align 4
proc copy_icon uses ebx ecx esi edi, buf_d:dword, buf_s:dword, ind:dword
;;------------------------------------------------------------------------------------------------;;
;> buf_d = pointer to destination buffer 24-bit
;> buf_s = pointer to source buffer 32-bit (with icons)
;> ind = icon index
;;------------------------------------------------------------------------------------------------;;
;< eax = pointer to destination buffer + icon size
;;------------------------------------------------------------------------------------------------;;
mov edi, [buf_d]
mov ecx, (18+ICON_LEFT_B)*ICON_TOP_B*3
mov al, 0xff
rep stosb ; make top border
; copy icon
mov esi, [ind]
imul esi, 18*18*4
add esi, [buf_s]
mov ebx, 18
.cycle0:
mov ecx, ICON_LEFT_B*3
rep stosb ; make left border
mov ecx, 18
@@:
movsw
movsb
inc esi ; skip transparent byte
loop @b
dec ebx
jnz .cycle0
mov eax, edi
ret
endp
align 4
proc img_to_gray, buf_rgb:dword, buf_g24:dword, pixels:dword
;;------------------------------------------------------------------------------------------------;;
; function for generating gray icons
;;------------------------------------------------------------------------------------------------;;
;> buf_rgb - buffer with input 24-bit color image
;> buf_g24 - buffer with output 24-bit gray image
;> pixels - number of pixels in the image
;;------------------------------------------------------------------------------------------------;;
pushad
mov esi, [buf_rgb]
mov edi, [buf_g24]
mov ecx, [pixels]
mov ebx, 3
@@:
movzx eax, byte[esi]
movzx edx, byte[esi+1]
add eax, edx
movzx edx, byte[esi+2]
add eax, edx
xor edx, edx
div ebx
mov ah, al
mov word[edi], ax
mov byte[edi+2], al
add esi, 3
add edi, 3
loop @b
popad
ret
endp
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;hed db 'FTP Client for KolibriOS',0 ;hed db 'FTP Client for KolibriOS',0
str_change db 'Change',0 str_change db 'Change',0
str_disconnect db 'Disconnect',0 str_disconnect db 'Disconnect',0
str_show_log db 'Show log',0
str_hide_log db 'Hide log',0
str_copy db 'Copy',0 str_copy db 'Copy',0
str_mkd db 'MKD',0 str_mkd db 'MKD',0
str_dele db 'DELE',0 str_dele db 'DELE',0
@@ -876,15 +1003,17 @@ str_search db 'Search',0
str_list db 'LIST',0 str_list db 'LIST',0
str_null db 0 str_null db 0
str_icon_18 db 'ICONS18',0
;---------------------- ;----------------------
; tree list elements ; tree list elements
;---------------------- ;----------------------
tree1 tree_list 64, 500, tl_list_box_mode, 16, 16, \ tree1 tree_list 64, 500, tl_list_box_mode, 18+ICON_LEFT_B, 18+ICON_TOP_B, \
0xffffff, BT_COL, 0x000000, TLIST1_X, 105, TLIST_SZ-16, 185, 14, 4,\ 0xffffff, BT_COL, 0x10000000, TLIST1_X, 105, TLIST_SZ-16, 185, 14, 4,\
0, el_focus, wScr, fun_on_enter 0, el_focus, wScr, fun_on_enter
tree2 tree_list 64, 500, tl_list_box_mode, 16, 16, \ tree2 tree_list 64, 500, tl_list_box_mode, 18+ICON_LEFT_B, 18+ICON_TOP_B, \
0xffffff, BT_COL, 0x000000, TLIST2_X, 105, TLIST_SZ-16, 185, 14, 4, \ 0xffffff, BT_COL, 0x10000000, TLIST2_X, 105, TLIST_SZ-16, 185, 14, 4, \
0, el_focus, wScr2, fun_on_enter2 0, el_focus, wScr2, fun_on_enter2
; editbox for mkd ; editbox for mkd

View File

@@ -27,7 +27,7 @@ login_gui: ;////////////////////////////////////////////////////////////////////
.get_username: .get_username:
; in case of error when either login_gui.server_addr or ; in case of error when either login_gui.server_addr or
; login_gui.get_username is called, should resize window ; login_gui.get_username is called, should resize window
mcall 67, WIN_X, WIN_Y, WIN_W, WIN_H ; resize to login gui window size mcall SF_CHANGE_WINDOW, WIN_X, WIN_Y, WIN_W, WIN_H ; resize to login gui window size
.redraw: .redraw:
call .draw call .draw
@@ -44,22 +44,22 @@ login_gui: ;////////////////////////////////////////////////////////////////////
align 4 align 4
.draw: .draw:
mcall 12, 1 mcall SF_REDRAW, SSF_BEGIN_DRAW
mcall 48, 3, sc, 40 mcall SF_STYLE_SETTINGS, SSF_GET_COLORS, sc, 40
edit_boxes_set_sys_color edit_usr,editboxes_end,sc edit_boxes_set_sys_color edit_usr,editboxes_end,sc
mov edx, 0x34000000 mov edx, 0x34000000
or edx, [sc.work] or edx, [sc.work]
mcall 0, <WIN_X,WIN_W>, <WIN_Y,WIN_H>, , 0x805080DD, str_title mcall SF_CREATE_WINDOW, <WIN_X,WIN_W>, <WIN_Y,WIN_H>, , 0x805080DD, str_title
call .draw_editboxes call .draw_editboxes
; draw "connect" button ; draw "connect" button
mcall 8, <162,65>, <150,25>, 2, [sc.work_button] mcall SF_DEFINE_BUTTON, <162,65>, <150,25>, 2, [sc.work_button]
; draw strings ; draw strings
mov ecx, 0x90000000 mov ecx, 0x90000000
or ecx, [sc.work_text] or ecx, [sc.work_text]
mcall 4, <3, 8>, , gui_str_usr mcall SF_DRAW_TEXT, <3, 8>, , gui_str_usr
mcall , <3,PAD*1+8>, , gui_str_pass mcall , <3,PAD*1+8>, , gui_str_pass
mcall , <3,PAD*2+8>, , gui_str_server mcall , <3,PAD*2+8>, , gui_str_server
mcall , <3,PAD*3+8>, , gui_str_port mcall , <3,PAD*3+8>, , gui_str_port
@@ -74,12 +74,12 @@ login_gui: ;////////////////////////////////////////////////////////////////////
mcall mcall
mov [str_error_addr], gui_str_null ; reset error string address mov [str_error_addr], gui_str_null ; reset error string address
mcall 12, 2 mcall SF_REDRAW, SSF_END_DRAW
ret ret
align 4 align 4
.still: .still:
mcall 10 ; wait for event mcall SF_WAIT_EVENT
dec eax dec eax
jz .redraw jz .redraw
dec eax dec eax
@@ -96,7 +96,7 @@ login_gui: ;////////////////////////////////////////////////////////////////////
jmp .still jmp .still
.button: .button:
mcall 17 mcall SF_GET_BUTTON
dec ah dec ah
jz .exit jz .exit
@@ -107,7 +107,7 @@ login_gui: ;////////////////////////////////////////////////////////////////////
jmp .still jmp .still
.key: .key:
mcall 2 mcall SF_GET_KEY
cmp ah,13 cmp ah,13
je .connect je .connect
@@ -122,12 +122,17 @@ login_gui: ;////////////////////////////////////////////////////////////////////
stdcall [edit_box_key], edit_path stdcall [edit_box_key], edit_path
jmp .still jmp .still
.connect: .connect:
mcall 67, 35, 20, 830, 555 ; resize to main gui window's coordinates mov esi, 555
or [show_log],0
jnz @f
sub esi, 160
@@:
mcall SF_CHANGE_WINDOW, 35, 20, 830 ; resize to main gui window's coordinates
cmp [param_server_addr], 0 cmp [param_server_addr], 0
jne gui.main jne gui.main
mov [str_error_addr], gui_str_no_srvr mov [str_error_addr], gui_str_no_srvr
jmp .redraw jmp .redraw

View File

@@ -190,10 +190,11 @@ data_loop:
mov [filestruct.ptr], buf_buffer2 mov [filestruct.ptr], buf_buffer2
mov [filestruct.size], eax mov [filestruct.size], eax
push eax push eax
mcall 70, filestruct mcall SF_FILE, filestruct
test eax, eax test eax, eax
jz @f jz @f
call error_fs call error_fs
add esp, 4 ; fix stack
jmp close_datacon jmp close_datacon
@@: @@:
pop eax pop eax
@@ -204,7 +205,7 @@ data_loop:
; storing, send all data ; storing, send all data
.stor: .stor:
mcall 70, filestruct mcall SF_FILE, filestruct
cmp eax, 6 ; end of file cmp eax, 6 ; end of file
je .last_call je .last_call
test eax, eax ; error test eax, eax ; error
@@ -244,7 +245,7 @@ data_loop:
mov ecx, eax ; eax is size of buffer received mov ecx, eax ; eax is size of buffer received
inc ecx inc ecx
add ecx, [size_fname] ; added old size to form new required size add ecx, [size_fname] ; added old size to form new required size
mcall 68, 20, , [ptr_fname] ; realloc mcall SF_SYS_MISC, SSF_MEM_REALLOC, , [ptr_fname]
test eax, eax test eax, eax
je error_heap je error_heap
mov [ptr_fname], eax ; eax contains the new block now mov [ptr_fname], eax ; eax contains the new block now

View File

@@ -82,13 +82,13 @@ cmd_retr:
mov ecx, 256-5 mov ecx, 256-5
call set_filename call set_filename
mov [filestruct.subfn], 2 ; create/rewrite file mov [filestruct.subfn], SSF_CREATE_FILE ; create/rewrite file
mov [filestruct.offset], 0 mov [filestruct.offset], 0
mov [filestruct.offset+4], 0 mov [filestruct.offset+4], 0
mov [filestruct.size], 0 mov [filestruct.size], 0
mov [filestruct.ptr], 0 mov [filestruct.ptr], 0
mcall 70, filestruct mcall SF_FILE, filestruct
test eax, eax test eax, eax
jz @f jz @f
call error_fs call error_fs
@@ -96,7 +96,7 @@ cmd_retr:
@@: @@:
; Prepare to write to the file ; Prepare to write to the file
mov [filestruct.subfn], 3 ; write to file mov [filestruct.subfn], SSF_WRITE_FILE
mov [operation], OPERATION_RETR mov [operation], OPERATION_RETR
; Request the file from server ; Request the file from server
@@ -138,7 +138,7 @@ cmd_stor:
mov [operation], OPERATION_STOR mov [operation], OPERATION_STOR
; get file size ; get file size
mov [filestruct.subfn], 5 mov [filestruct.subfn], SSF_GET_INFO
mov [filestruct.offset], 0 mov [filestruct.offset], 0
mov [filestruct.offset+4], 0 mov [filestruct.offset+4], 0
mov [filestruct.size], 0 mov [filestruct.size], 0
@@ -148,12 +148,12 @@ cmd_stor:
mov ecx, 256-5 mov ecx, 256-5
call set_filename call set_filename
mcall 70, filestruct mcall SF_FILE, filestruct
mov eax, dword[folder_buf+32] ; supports file size upto 4GB mov eax, dword[folder_buf+32] ; supports file size upto 4GB
mov [file_size], eax mov [file_size], eax
mov [filestruct.subfn], 0 ; read file mov [filestruct.subfn], SSF_READ_FILE
; mov [filestruct.offset], 0 ; mov [filestruct.offset], 0
; mov [filestruct.offset+4], 0 ; mov [filestruct.offset+4], 0
mov [filestruct.size], BUFFERSIZE mov [filestruct.size], BUFFERSIZE
@@ -191,12 +191,12 @@ cmd_lcwd:
mov byte[esi-1], 0 mov byte[esi-1], 0
; check whether entered path is valid (folder exists) ; check whether entered path is valid (folder exists)
mov [filestruct2.subfn], 5 mov [filestruct2.subfn], SSF_GET_INFO
mov [filestruct2.offset], 0 mov [filestruct2.offset], 0
mov [filestruct2.size], 0 mov [filestruct2.size], 0
mov [filestruct2.ptr], folder_buf mov [filestruct2.ptr], folder_buf
mov [filestruct2.name], buf_cmd+5 mov [filestruct2.name], buf_cmd+5
mcall 70, filestruct2 mcall SF_FILE, filestruct2
test eax, eax test eax, eax
jz @f jz @f
cmp eax, 2 cmp eax, 2
@@ -205,10 +205,10 @@ cmd_lcwd:
jmp wait_for_usercommand jmp wait_for_usercommand
@@: @@:
mcall 30, 1, buf_cmd+5 ; set working directory mcall SF_CURRENT_FOLDER, SSF_SET_CF, buf_cmd+5 ; set working directory
.print: .print:
mcall 30, 2, buf_cmd, 256 ; and read it again mcall SF_CURRENT_FOLDER, SSF_GET_CF, buf_cmd, 256 ; and read it again
icall eax, interface_addr, interface.print, str_lcwd, buf_cmd, str_newline icall eax, interface_addr, interface.print, str_lcwd, buf_cmd, str_newline
jmp wait_for_usercommand jmp wait_for_usercommand