diff --git a/data/Tupfile.lua b/data/Tupfile.lua index 972d12d82..c42d146b1 100644 --- a/data/Tupfile.lua +++ b/data/Tupfile.lua @@ -49,8 +49,6 @@ img_files = { {"MEDIA/IMGF/INVSOL.OBJ", "common/media/ImgF/invSol.obj"}, {"MEDIA/PIXIESKN.PNG", SRC_PROGS .. "/cmm/pixie2/pixieskn.png"}, {"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/KNMAP", "common/network/knmap"}, {"NETWORK/USERS.INI", "common/network/users.ini"}, diff --git a/programs/network/ftpc/ftpc.asm b/programs/network/ftpc/ftpc.asm index c8f32eea6..793a82a68 100644 --- a/programs/network/ftpc/ftpc.asm +++ b/programs/network/ftpc/ftpc.asm @@ -760,7 +760,7 @@ exit2: ; data 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 str_srv_addr db 'Please enter ftp server address.',10,0 @@ -971,6 +971,6 @@ param_path rb 1024 param_port rb 6 sc system_colors -rb 1024 +rb 2048 mem: diff --git a/programs/network/ftpc/ftpc_nod.png b/programs/network/ftpc/ftpc_nod.png deleted file mode 100755 index 09c292a01..000000000 Binary files a/programs/network/ftpc/ftpc_nod.png and /dev/null differ diff --git a/programs/network/ftpc/ftpc_sys.png b/programs/network/ftpc/ftpc_sys.png deleted file mode 100755 index 8081e4e01..000000000 Binary files a/programs/network/ftpc/ftpc_sys.png and /dev/null differ diff --git a/programs/network/ftpc/gui.inc b/programs/network/ftpc/gui.inc index b4821c9d6..5b520830e 100755 --- a/programs/network/ftpc/gui.inc +++ b/programs/network/ftpc/gui.inc @@ -16,6 +16,8 @@ BT_SZ_X = 40 SYS_COL = 0xe6e6e6 BT_COL = 0xcccccc STR_COL = 0x595959 ;0x000000 +ICON_TOP_B = 2 +ICON_SIZE = 18*(18+ICON_TOP_B)*3 ; TODO: automatic resizing of GUI elements on window resizing @@ -74,37 +76,36 @@ gui: ;////////////////////////////////////////////////////////////////////////// ; initialize tree list elements stdcall [tl_data_init], tree1 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 - mov [filestruct.subfn], 0 - mov [filestruct.offset], 54 - mov [filestruct.size], ecx - mcall SF_FILE, filestruct - cmp ebx, 0 - jl @f + 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 + mcall SF_SYS_MISC, SSF_MEM_OPEN, str_icon_18,, 0 + or eax, eax + 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[tree2.data_img_sys], dword[icon_tl_sys] - @@: ; 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 SF_FILE, filestruct - cmp ebx, 0 - jl @f m2m dword[tree1.data_img], dword[icon_tl_nod] m2m dword[tree2.data_img], dword[icon_tl_nod] - + @@: call .draw ; create initial tree list for root_dir @@ -901,6 +902,67 @@ search: ;/////////////////////////////////////////////////////////////////////// pop edi esi edx ecx ebx ret + +align 4 +proc copy_icon uses ecx esi edi, buf_d:dword, buf_s:dword, ind:dword +;;------------------------------------------------------------------------------------------------;; +;> buf_d = pointer to destination buffer +;> buf_s = pointer to source buffer (with icons) +;> ind = icon index +;;------------------------------------------------------------------------------------------------;; +;< eax = pointer to destination buffer + icon size +;;------------------------------------------------------------------------------------------------;; + mov edi, [buf_d] + mov ecx, 18*ICON_TOP_B*3 + mov al, 0xff + rep stosb ; make top border + ; copy icon + mov ecx, 18*18 + mov esi, [ind] + imul esi, ecx + shl esi, 2 + add esi, [buf_s] + @@: + movsw + movsb + inc esi + loop @b + mov eax, edi + ret +endp + +;descrition: +; function for generating gray icons +;input: +; 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 +align 4 +proc img_to_gray, buf_rgb:dword, buf_g24:dword, pixels:dword +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 @@ -918,15 +980,17 @@ str_search db 'Search',0 str_list db 'LIST',0 str_null db 0 +str_icon_18 db 'ICONS18',0 + ;---------------------- ; tree list elements ;---------------------- -tree1 tree_list 64, 500, tl_list_box_mode, 16, 16, \ - 0xffffff, BT_COL, 0x000000, TLIST1_X, 105, TLIST_SZ-16, 185, 14, 4,\ +tree1 tree_list 64, 500, tl_list_box_mode, 18, 18+ICON_TOP_B, \ + 0xffffff, BT_COL, 0x10000000, TLIST1_X, 105, TLIST_SZ-16, 185, 14, 4,\ 0, el_focus, wScr, fun_on_enter -tree2 tree_list 64, 500, tl_list_box_mode, 16, 16, \ - 0xffffff, BT_COL, 0x000000, TLIST2_X, 105, TLIST_SZ-16, 185, 14, 4, \ +tree2 tree_list 64, 500, tl_list_box_mode, 18, 18+ICON_TOP_B, \ + 0xffffff, BT_COL, 0x10000000, TLIST2_X, 105, TLIST_SZ-16, 185, 14, 4, \ 0, el_focus, wScr2, fun_on_enter2 ; editbox for mkd