From 7bf3b20fccd06d2b15d56db2d13e3c194a293633 Mon Sep 17 00:00:00 2001 From: "Marat Zakiyanov (Mario79)" Date: Wed, 12 Mar 2014 02:26:12 +0000 Subject: [PATCH] KFM 0.47j - dynamic generation the buttons "select disk" git-svn-id: svn://kolibrios.org@4631 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/fs/kfm/trunk/button.inc | 402 ++++++++++++----------------- programs/fs/kfm/trunk/data.inc | 22 -- programs/fs/kfm/trunk/detect.inc | 49 ---- programs/fs/kfm/trunk/draw.inc | 168 +----------- programs/fs/kfm/trunk/drw_dbut.inc | 77 ++++++ programs/fs/kfm/trunk/kfm.asm | 9 +- programs/fs/kfm/trunk/menu_bar.inc | 6 +- programs/fs/kfm/trunk/text.inc | 26 +- 8 files changed, 257 insertions(+), 502 deletions(-) create mode 100644 programs/fs/kfm/trunk/drw_dbut.inc diff --git a/programs/fs/kfm/trunk/button.inc b/programs/fs/kfm/trunk/button.inc index 201cb64367..0d52ff6047 100644 --- a/programs/fs/kfm/trunk/button.inc +++ b/programs/fs/kfm/trunk/button.inc @@ -1,267 +1,199 @@ +;------------------------------------------------------------------------------ button: - mcall 17 + mcall 17 +;-------------------------------------- .1: - cmp ah,101 - je f_key_f1 - cmp ah,102 - je f_key_f2 - cmp ah,103 - je f_key_f3 ;sort_name - cmp ah,104 - je f_key_f4 ;sort_type - cmp ah,105 - je f_key_f5 ;sort_size - cmp ah,106 - je f_key_f6 ;sort_date - cmp ah,107 - je f_key_f7 ;create dir - cmp ah,108 - je f_key_f8 ;delete_file - cmp ah,112 - je f_key_f12 - cmp ah,120 - jne .121 - mov esi,read_folder_device_name.rd - call copy_folder_name - jmp left_panel_read_folder - .121: - cmp ah,121 - jne .122 - mov esi,read_folder_device_name.fd - call copy_folder_name - jmp left_panel_read_folder - .122: - cmp ah,122 - jne .123 - mov esi,read_folder_device_name.hd0 - call copy_folder_name - jmp left_panel_read_folder - .123: - cmp ah,123 - jne .124 - mov esi,read_folder_device_name.hd1 - call copy_folder_name - jmp left_panel_read_folder - .124: - cmp ah,124 - jne .125 - mov esi,read_folder_device_name.hd2 - call copy_folder_name - jmp left_panel_read_folder - .125: - cmp ah,125 - jne .126 - mov esi,read_folder_device_name.hd3 - call copy_folder_name - jmp left_panel_read_folder - .126: - cmp ah,126 - jne .127 - mov esi,read_folder_device_name.cd0 - call copy_folder_name - jmp left_panel_read_folder - .127: - cmp ah,127 - jne .128 - mov esi,read_folder_device_name.cd1 - call copy_folder_name - jmp left_panel_read_folder - .128: - cmp ah,128 - jne .129 - mov esi,read_folder_device_name.cd2 - call copy_folder_name - jmp left_panel_read_folder - .129: - cmp ah,129 - jne .130 - mov esi,read_folder_device_name.cd3 - call copy_folder_name - jmp left_panel_read_folder - .130: - cmp ah,130 - jne .131 - mov esi,read_folder_device_name.rd - call copy_folder_name_1 - jmp right_panel_read_folder - .131: - cmp ah,131 - jne .132 - mov esi,read_folder_device_name.fd - call copy_folder_name_1 - jmp right_panel_read_folder - .132: - cmp ah,132 - jne .133 - mov esi,read_folder_device_name.hd0 - call copy_folder_name_1 - jmp right_panel_read_folder - .133: - cmp ah,133 - jne .134 - mov esi,read_folder_device_name.hd1 - call copy_folder_name_1 - jmp right_panel_read_folder - .134: - cmp ah,134 - jne .135 - mov esi,read_folder_device_name.hd2 - call copy_folder_name_1 - jmp right_panel_read_folder - .135: - cmp ah,135 - jne .136 - mov esi,read_folder_device_name.hd3 - call copy_folder_name_1 - jmp right_panel_read_folder - .136: - cmp ah,136 - jne .137 - mov esi,read_folder_device_name.cd0 - call copy_folder_name_1 - jmp right_panel_read_folder - .137: - cmp ah,137 - jne .138 - mov esi,read_folder_device_name.cd1 - call copy_folder_name_1 - jmp right_panel_read_folder - .138: - cmp ah,138 - jne .139 - mov esi,read_folder_device_name.cd2 - call copy_folder_name_1 - jmp right_panel_read_folder - .139: - cmp ah,139 - jne .140 - mov esi,read_folder_device_name.cd3 - call copy_folder_name_1 - jmp right_panel_read_folder - .140: - cmp ah,140 - je draw_left_select_disk_menu - cmp ah,141 - je draw_right_select_disk_menu - cmp ah,142 - je left_sort_name - cmp ah,143 - je left_sort_type - cmp ah,144 - je left_sort_size - cmp ah,145 - je left_sort_date - cmp ah,146 - je right_sort_name - cmp ah,147 - je right_sort_type - cmp ah,148 - je right_sort_size - cmp ah,149 - je right_sort_date - cmp ah,150 - je exit_dir_1 - cmp ah,151 - je reload_dir - cmp ah,152 - je create_directory - cmp ah,153 - je copy_file_f5 - cmp ah,154 - je move_file_f6 - cmp ah,157 - je delete_file - cmp ah, 1 - jne still - .exit: - mcall -1 + cmp ah,101 + je f_key_f1 + + cmp ah,102 + je f_key_f2 + + cmp ah,103 + je f_key_f3 ;sort_name + + cmp ah,104 + je f_key_f4 ;sort_type + + cmp ah,105 + je f_key_f5 ;sort_size + + cmp ah,106 + je f_key_f6 ;sort_date + + cmp ah,107 + je f_key_f7 ;create di + + cmp ah,108 + je f_key_f8 ;delete_file + + cmp ah,112 + je f_key_f12 +;-------------------------------------- +.120: + cmp ah,120 + jb .140 + + cmp ah,139 + ja .140 + + sub ah,120 + movzx eax,ah + imul eax,10 + add eax,retrieved_devices_table+1 + mov esi,eax ; selected path + + cmp [select_panel_counter],0 + jne @f + + call copy_folder_name + jmp left_panel_read_folder +;-------------------------------------- +@@: + call copy_folder_name_1 + jmp right_panel_read_folder +;-------------------------------------- +.140: + cmp ah,140 + je draw_left_select_disk_menu + + cmp ah,141 + je draw_right_select_disk_menu + + cmp ah,142 + je left_sort_name + + cmp ah,143 + je left_sort_type + + cmp ah,144 + je left_sort_size + + cmp ah,145 + je left_sort_date + + cmp ah,146 + je right_sort_name + + cmp ah,147 + je right_sort_type + + cmp ah,148 + je right_sort_size + + cmp ah,149 + je right_sort_date + + cmp ah,150 + je exit_dir_1 + + cmp ah,151 + je reload_dir + + cmp ah,152 + je create_directory + + cmp ah,153 + je copy_file_f5 + + cmp ah,154 + je move_file_f6 + + cmp ah,157 + je delete_file + + cmp ah, 1 + jne still +;-------------------------------------- +.exit: + mcall -1 ;--------------------------------------------------------------------- reload_dir: - cmp [select_panel_counter],0 - jne @f - call proc_read_left_folder -; mov [left_panel_clear_all],1 - call draw_left_panel - jmp still + cmp [select_panel_counter],0 + jne @f + call proc_read_left_folder +; mov [left_panel_clear_all],1 + call draw_left_panel + jmp still @@: - call proc_read_right_folder -; mov [right_panel_clear_all],1 - call draw_right_panel - jmp still + call proc_read_right_folder +; mov [right_panel_clear_all],1 + call draw_right_panel + jmp still ;--------------------------------------------------------------------- reload_dir_all: - call proc_read_left_folder - call proc_read_right_folder - jmp red + call proc_read_left_folder + call proc_read_right_folder + jmp red ;--------------------------------------------------------------------- exit_dir_1: - mov [exit_dir],1 - jmp key_28.1 + mov [exit_dir],1 + jmp key_28.1 ;--------------------------------------------------------------------- left_panel_read_folder: - mov [left_start_draw_cursor_line],0 - jmp proc_read_folder + mov [left_start_draw_cursor_line],0 + jmp proc_read_folder ;--------------------------------------------------------------------- right_panel_read_folder: - mov [right_start_draw_cursor_line],0 - jmp proc_read_folder_1 + mov [right_start_draw_cursor_line],0 + jmp proc_read_folder_1 ;--------------------------------------------------------------------- left_sort_name: - xor eax,eax - cmp [left_sort_flag],eax - je still - mov [left_sort_flag],eax - jmp left_sort_date.1 + xor eax,eax + cmp [left_sort_flag],eax + je still + mov [left_sort_flag],eax + jmp left_sort_date.1 ;--------------------------------------------------------------------- left_sort_type: - cmp [left_sort_flag],1 - je still - mov [left_sort_flag],1 - jmp left_sort_date.1 + cmp [left_sort_flag],1 + je still + mov [left_sort_flag],1 + jmp left_sort_date.1 ;--------------------------------------------------------------------- left_sort_size: - cmp [left_sort_flag],2 - je still - mov [left_sort_flag],2 - jmp left_sort_date.1 + cmp [left_sort_flag],2 + je still + mov [left_sort_flag],2 + jmp left_sort_date.1 ;--------------------------------------------------------------------- left_sort_date: - cmp [left_sort_flag],3 - je still - mov [left_sort_flag],3 + cmp [left_sort_flag],3 + je still + mov [left_sort_flag],3 .1: - call draw_left_sort_button - call left_sort_files -; mov [left_panel_clear_all],1 - call draw_left_panel - jmp still + call draw_left_sort_button + call left_sort_files +; mov [left_panel_clear_all],1 + call draw_left_panel + jmp still ;--------------------------------------------------------------------- right_sort_name: - xor eax,eax - cmp [right_sort_flag],eax - je still - mov [right_sort_flag],eax - jmp right_sort_date.1 + xor eax,eax + cmp [right_sort_flag],eax + je still + mov [right_sort_flag],eax + jmp right_sort_date.1 ;--------------------------------------------------------------------- right_sort_type: - cmp [right_sort_flag],1 - je still - mov [right_sort_flag],1 - jmp right_sort_date.1 + cmp [right_sort_flag],1 + je still + mov [right_sort_flag],1 + jmp right_sort_date.1 ;--------------------------------------------------------------------- right_sort_size: - cmp [right_sort_flag],2 - je still - mov [right_sort_flag],2 - jmp right_sort_date.1 + cmp [right_sort_flag],2 + je still + mov [right_sort_flag],2 + jmp right_sort_date.1 ;--------------------------------------------------------------------- right_sort_date: - cmp [right_sort_flag],3 - je still - mov [right_sort_flag],3 + cmp [right_sort_flag],3 + je still + mov [right_sort_flag],3 .1: - call draw_right_sort_button - call right_sort_files - call draw_right_panel - jmp still + call draw_right_sort_button + call right_sort_files + call draw_right_panel + jmp still ;--------------------------------------------------------------------- \ No newline at end of file diff --git a/programs/fs/kfm/trunk/data.inc b/programs/fs/kfm/trunk/data.inc index bb61140a53..5988b5db85 100644 --- a/programs/fs/kfm/trunk/data.inc +++ b/programs/fs/kfm/trunk/data.inc @@ -84,28 +84,6 @@ scroll_pointer rb 1 scroll_pointer_1 rb 1 ;--------------------------------------------------------------------- align 4 -device_present: - .rd rb 1 - .fd rb 1 - .hd0 rb 1 - .hd1 rb 1 - .hd2 rb 1 - .hd3 rb 1 - .cd0 rb 1 - .cd1 rb 1 - .cd2 rb 1 - .cd3 rb 1 -;device_present_text_counter rd 1 -device_present_buffer: - .fd rb 1 - .hd_cd rb 1 - .hd0_part rb 1 - .hd1_part rb 1 - .hd2_part rb 1 - .hd3_part rb 1 - rb 4 -;--------------------------------------------------------------------- -align 4 max_progress_value rd 1 current_progress_value rd 1 current_progress_value_1 rd 1 diff --git a/programs/fs/kfm/trunk/detect.inc b/programs/fs/kfm/trunk/detect.inc index 76dd7389e8..f1ba3b21a2 100644 --- a/programs/fs/kfm/trunk/detect.inc +++ b/programs/fs/kfm/trunk/detect.inc @@ -1,52 +1,3 @@ -device_detect: ; f1811 - mcall 18,11,1,device_present_buffer - mov [device_present.rd],1 - cmp [device_present_buffer.fd],0 - je @f - mov [device_present.fd],1 -@@: - mov al,[device_present_buffer.hd_cd] - test al,10b - je @f - mov [device_present.cd3],1 - jmp .ide2 -@@: - test al,1b - je @f - mov [device_present.hd3],1 -.ide2: -@@: - test al,1000b - je @f - mov [device_present.cd2],1 - jmp .ide1 -@@: - test al,100b - je @f - mov [device_present.hd2],1 -.ide1: -@@: - test al,100000b - je @f - mov [device_present.cd1],1 - jmp .ide0 -@@: - test al,10000b - je @f - mov [device_present.hd1],1 -.ide0: -@@: - test al,10000000b - je @f - mov [device_present.cd0],1 - jmp .end -@@: - test al,1000000b - je @f - mov [device_present.hd0],1 -.end: -@@: - ret ;--------------------------------------------------------------------- device_detect_f70: mov ax,[select_disk_char] diff --git a/programs/fs/kfm/trunk/draw.inc b/programs/fs/kfm/trunk/draw.inc index 4b98082c6b..cba76f2a90 100644 --- a/programs/fs/kfm/trunk/draw.inc +++ b/programs/fs/kfm/trunk/draw.inc @@ -244,172 +244,8 @@ draw_right_select_disk_button: mov edx,0x40000000+141 jmp draw_left_select_disk_button.1 ;------------------------------------------------------------------------------ -draw_device_button: - mov edi,device_present - mov edx,120 - mov bx,[left_panel_x.start_x] - mov cx,[left_panel_y.start_y] - mov eax,[left_panel_x] - mov [temp_panel_end],eax - mov [temp_counter],0 - call .draw - mov edx,130 - mov bx,[right_panel_x.start_x] - mov cx,[right_panel_y.start_y] - mov eax,[right_panel_x] - mov [temp_panel_end],eax - mov [temp_counter],1 -;-------------------------------------- -.draw: - shl ebx,16 - mov bx,25 - sub cx,30 - shl ecx,16 - mov cx,12 - mov eax,8 - mov esi,0xaa00 - cmp [edi],byte 1 - jne @f - - mov ebp,read_folder_device_name.rd - call .draw_1 -;-------------------------------------- -@@: - inc edx - cmp [edi+1],byte 1 - jne @f - - mov ebp,read_folder_device_name.fd - call .draw_1 -;-------------------------------------- -@@: - inc edx - cmp [edi+2],byte 1 - jne @f - - mov ebp,read_folder_device_name.hd0 - call .draw_1 -;-------------------------------------- -@@: - inc edx - cmp [edi+3],byte 1 - jne @f - - mov ebp,read_folder_device_name.hd1 - call .draw_1 -;-------------------------------------- -@@: - inc edx - cmp [edi+4],byte 1 - jne @f - - mov ebp,read_folder_device_name.hd2 - call .draw_1 -;-------------------------------------- -@@: - inc edx - cmp [edi+5],byte 1 - jne @f - - mov ebp,read_folder_device_name.hd3 - call .draw_1 -;-------------------------------------- -@@: - inc edx - cmp [edi+6],byte 1 - jne @f - - mov ebp,read_folder_device_name.cd0 - call .draw_1 -;-------------------------------------- -@@: - inc edx - cmp [edi+7],byte 1 - jne @f - - mov ebp,read_folder_device_name.cd1 - call .draw_1 -;-------------------------------------- -@@: - inc edx - cmp [edi+8],byte 1 - jne @f - - mov ebp,read_folder_device_name.cd2 - call .draw_1 -;-------------------------------------- -@@: - inc edx - cmp [edi+9],byte 1 - jne @f - - mov ebp,read_folder_device_name.cd3 - call .draw_1 -;-------------------------------------- -@@: - push ebx - mov ebx,[temp_panel_end] - mov ax,bx - shr ebx,16 - add eax,ebx - pop ebx - ror ebx,16 - sub ax,bx - rol ebx,16 - mov bx,ax - add ecx,1 - add ebx,1 - mcall 13,,,0xcccccc - cmp [temp_counter],0 - je @f - - mov ax,bx - shr ebx,16 - add bx,ax - mov eax,[window_width] - sub eax,4 - sub ax,bx - cmp eax,0 - jbe @f - - shl ebx,16 - mov bx,ax - mov ax,[right_panel_y.size_y] - add ax,[right_panel_y.start_y] - shr ecx,16 - sub ax,cx - shl ecx,16 - mov cx,ax - mcall 13,,,0xcccccc - ret -;-------------------------------------- -.draw_1: - mcall - pusha - mov eax,ebx - inc eax - shl eax,16 - add ebx,eax - mov bx,1 - inc ecx - mcall 13,,,0xcccccc - popa - pusha - mov edx,ebp - shr ecx,16 - mov bx,cx - add ebx,2 shl 16 +3 - mcall 4,,0x90000000 - sub ebx,1 shl 16 + 1 - mcall ,,0x90ffffff - popa - add ebx,27 shl 16 -;-------------------------------------- -@@: - ret -;------------------------------------------------------------------------------ -draw_ATAPI_tray_control: - ret +;draw_ATAPI_tray_control: +; ret ;------------------------------------------------------------------------------ calc_max_panel_line: xor eax,eax diff --git a/programs/fs/kfm/trunk/drw_dbut.inc b/programs/fs/kfm/trunk/drw_dbut.inc new file mode 100644 index 0000000000..cb1e6ce3a4 --- /dev/null +++ b/programs/fs/kfm/trunk/drw_dbut.inc @@ -0,0 +1,77 @@ +;------------------------------------------------------------------------------ +draw_device_button: + call device_detect_f70 + mov edi,[retrieved_devices_table_counter] + mov edx,120 + mov bx,[left_panel_x.start_x] + mov cx,[left_panel_y.start_y] + shl ebx,16 +; mov bx,50 ; button size X + sub cx,30 + shl ecx,16 + mov cx,12 + mov esi,0xaa00 + mov ebp,retrieved_devices_table +;-------------------------------------- +.loop: + push esi + mov esi,ebp + cld +@@: + lodsb + test al,al + jnz @b + + sub esi,ebp + lea esi,[esi*3] + shl esi,1 + mov bx,si + pop esi + + mcall 8 + + pusha + mov eax,ebx + inc eax + shl eax,16 + add ebx,eax + mov bx,2 + inc ecx + mcall 13,,,0xcccccc + popa + + pusha + mov edx,ebp + inc edx + shr ecx,16 + mov bx,cx + add ebx,4 shl 16 +3 + mcall 4,,0x90000000 + sub ebx,1 shl 16 + 1 + mcall ,,0x90ffffff + popa + + mov eax,ebx + shl eax,16 + add ebx,eax + add ebx,3 shl 16 + + inc edx + add ebp,10 + dec edi + jnz .loop + + xor eax,eax + mov ax,[right_panel_x.start_x] + add ax,[right_panel_x.size_x] + ror ebx,16 + sub ax,bx + rol ebx,16 + inc ax + mov bx,ax + + add ecx,1 + add ebx,1 + mcall 13,,,0xcccccc + ret +;------------------------------------------------------------------------------ diff --git a/programs/fs/kfm/trunk/kfm.asm b/programs/fs/kfm/trunk/kfm.asm index 877a96bd8d..e4dfc51480 100644 --- a/programs/fs/kfm/trunk/kfm.asm +++ b/programs/fs/kfm/trunk/kfm.asm @@ -1,6 +1,6 @@ ;***************************************************************************** ; KFM - Kolibri File Manager -; Copyright (c) 2006 - 2013, Marat Zakiyanov aka Mario79, aka Mario +; Copyright (c) 2006 - 2014, Marat Zakiyanov aka Mario79, aka Mario ; All rights reserved. ; ; Redistribution and use in source and binary forms, with or without @@ -25,7 +25,7 @@ ; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ;***************************************************************************** -; KFM v0.47i 24/12/2013 +; KFM v0.47j 12/03/2014 ;--------------------------------------------------------------------- use32 org 0x0 @@ -83,7 +83,6 @@ START: call load_buttons_and_convert_to_img call load_initiation_file call add_memory_for_folders - call device_detect call device_detect_f70 call select_starting_directories mcall 66, 1, 1 @@ -243,7 +242,7 @@ draw_window: call draw_right_sort_button call draw_menu_bar call draw_buttons_panel - call draw_ATAPI_tray_control +; call draw_ATAPI_tray_control ; mcall 47,0x80000,[left_scroll_compens],<300, 5>,0xffffff ; call mouse.draw_data @@ -460,6 +459,8 @@ include 'openfile.inc' ;--------------------------------------------------------------------- include 'draw.inc' ;--------------------------------------------------------------------- +include 'drw_dbut.inc' +;--------------------------------------------------------------------- include 'menu_bar.inc' ;--------------------------------------------------------------------- include 'menu_drv.inc' diff --git a/programs/fs/kfm/trunk/menu_bar.inc b/programs/fs/kfm/trunk/menu_bar.inc index 1a41f42f60..002f75afa8 100644 --- a/programs/fs/kfm/trunk/menu_bar.inc +++ b/programs/fs/kfm/trunk/menu_bar.inc @@ -31,7 +31,11 @@ draw_menu_bar: mov bx,[right_panel_x.start_x] sub bx,2 rol ebx,16 - mcall + push ecx + sub ecx,13 + add ecx,13 shl 16 + mcall ; middle vertical line + pop ecx pop ebx mov ax,cx dec ax diff --git a/programs/fs/kfm/trunk/text.inc b/programs/fs/kfm/trunk/text.inc index 4095744ab2..6f864122db 100644 --- a/programs/fs/kfm/trunk/text.inc +++ b/programs/fs/kfm/trunk/text.inc @@ -1,4 +1,4 @@ -header_text db 'Kolibri File Manager v0.47i 24/12/2013',0 +header_text db 'Kolibri File Manager v0.47j 12/03/2014',0 ;--------------------------------------------------------------------- fbutton_name: .f1 db '1 Help',0 @@ -56,30 +56,6 @@ fbutton_name_alt: .f11 db '11',0 .f12 db '12',0 ;--------------------------------------------------------------------- -;device_present_name: -; .rd db 'rd ',0 -; .fd db 'fd ',0 -; .hd0 db 'hd0',0 -; .hd1 db 'hd1',0 -; .hd2 db 'hd2',0 -; .hd3 db 'hd3',0 -; .cd0 db 'cd0',0 -; .cd1 db 'cd1',0 -; .cd2 db 'cd2',0 -; .cd3 db 'cd3',0 -;--------------------------------------------------------------------- -read_folder_device_name: - .rd db 'rd',0 - .fd db 'fd',0 - .hd0 db 'hd0',0 - .hd1 db 'hd1',0 - .hd2 db 'hd2',0 - .hd3 db 'hd3',0 - .cd0 db 'cd0',0 - .cd1 db 'cd1',0 - .cd2 db 'cd2',0 - .cd3 db 'cd3',0 -;--------------------------------------------------------------------- select_disk_char: db '/',0 ;---------------------------------------------------------------------