OpenDialog:

1) Use component PathShow 
2) Edit and restore the file name in the Save Dialog 
3) Small general optimization of code

git-svn-id: svn://kolibrios.org@1435 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Marat Zakiyanov (Mario79) 2010-03-18 20:58:05 +00:00
parent 2e1f635004
commit 4631e5997c
4 changed files with 926 additions and 703 deletions

View File

@ -26,17 +26,17 @@
; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;*****************************************************************************
use32
org 0x0
use32
org 0x0
db 'MENUET01'
dd 0x01
dd START
dd IM_END
dd I_END
dd stacktop
dd param
dd path
db 'MENUET01'
dd 0x01
dd START
dd IM_END
dd I_END
dd stacktop
dd param
dd path
include '../../../../../macros.inc'
include '../../load_lib.mac'
@ -55,8 +55,7 @@ START:
call get_communication_area
load_libraries l_libs_start,end_l_libs
load_libraries l_libs_start,end_l_libs
test eax,eax
jnz button.exit
; initialize sort
@ -114,7 +113,7 @@ control_minimal_window_size:
cmp eax,300
jae @f
mov edx,300
mcall 67,-1,ebx, ,ebx
mcall 67,-1,ebx,,ebx
@@:
.end:
popa
@ -128,9 +127,9 @@ key:
xor ebx,ebx
cmp [extended_key],1
je .extended_key
test al, al
test al,al
jnz still
cmp ah, 0xE0
cmp ah,0xE0
jne @f
mov [extended_key],1
jmp still
@ -279,6 +278,8 @@ change_focus_area_Tab_key_ASCII:
jmp change_focus_area
;---------------------------------------------------------------------
change_focus_area_press_Tab_key:
cmp [open_dialog_type],1
jne still
mov al,[Tab_key_block]
test al,al
jnz still
@ -288,6 +289,8 @@ change_focus_area_press_Tab_key:
jmp still
;---------------------------------------------------------------------
change_focus_area_check_Tab_key:
cmp [open_dialog_type],1
jne still
xor eax,eax
mov [Tab_key_block],al
mov al,[Tab_key]
@ -307,16 +310,16 @@ change_focus_area:
jne @f
mov [file_browser_data_1.select_panel_counter],1
and [edi+44],dword 0xFFFFFFFD ; ed_focus
mov [edi+12],dword 0xffffff; color white
mov [edi+12],dword 0xffffff ; color white
call draw_draw_file_browser1
mcall 66, 1, 1
mcall 66,1,1
jmp still
@@:
mov [file_browser_data_1.select_panel_counter],0
or [edi+44],dword ed_focus
mov [edi+12],dword 0xffffb0 ; color yellow
call draw_draw_file_browser1
mcall 66, 1, 0
mcall 66,1,0
jmp still
;---------------------------------------------------------------------
key_ASCII:
@ -331,33 +334,54 @@ key_ASCII:
call [edit_box_key]
jmp still
.13:
cmp [open_dialog_type],2 ; Select dir
je file_no_folder
cmp [open_dialog_type],1 ; Save file
jne .load_dir
inc [open_dialog_type]
; cmp [open_dialog_type],2 ; Select dir
; je file_no_folder
; cmp [open_dialog_type],1 ; Save file
; jne user_selected_name_action ; load_dir
; inc [open_dialog_type]
jmp file_no_folder
.load_dir:
mov [file_browser_data_1.select_panel_counter],1
xor eax,eax
mov [focus_pointer],al
mcall 66, 1, 1
;.load_dir:
; mov [file_browser_data_1.select_panel_counter],1
; xor eax,eax
; mov [focus_pointer],al
; mcall 66,1,1
xor eax,eax
; xor eax,eax
; mov esi,dir_pach
; cld
;@@:
; lodsb
; test al,al
; jne @r
; sub esi,2
; cmp [esi],byte '/'
; jne @f
; xor eax,eax
; mov [esi],al
;@@:
; call load_next_dir.1
; jmp still
;---------------------------------------------------------------------
user_selected_name_action:
mov eax,[communication_area]
test eax,eax
jnz @f
call control_minimal_window_size
call draw_window
ret
@@:
add eax,4
;copy_path user_selected_name,dir_pach,eax,0
mov esi,dir_pach
cld
@@:
lodsb
test al,al
jne @r
sub esi,2
cmp [esi],byte '/'
jne @f
xor eax,eax
mov [esi],al
@@:
call load_next_dir.1
jmp still
mov edi,eax
call copy_dir_name
mov [edi-1],byte '/'
mov esi,user_selected_name
call copy_dir_name
mov eax,[communication_area]
mov [eax],word 1
jmp button.exit
;---------------------------------------------------------------------
select_disk:
call check_alt
@ -510,12 +534,12 @@ button:
cmp ah,6
je .reload_dir_1
cmp ah,4
je .exit
cmp ah,3
je .open_dir_or_file
cmp ah,3
je .exit
cmp ah,2
je .exit_dir
cmp ah, 1
cmp ah,1
jne still
.exit:
mov eax,[communication_area]
@ -545,8 +569,13 @@ button:
.open_dir_or_file:
cmp [open_dialog_type],2 ;Select dir
je file_no_folder
; cmp [open_dialog_type],1 ;Save file
; je file_no_folder
cmp [open_dialog_type],1 ;Save file
jne @f
mov al,[focus_pointer]
test al,al
jne file_no_folder
@@:
xor ebx,ebx
jmp key.7
;---------------------------------------------------------------------
@ -618,25 +647,25 @@ thread_start:
jmp .still
;---------------------------------------------------------------------
draw_error_window:
mcall 12, 1
mcall 0,[error_window_x] ,[error_window_y], 0x03ff0000
mcall 12,1
mcall 0,[error_window_x],[error_window_y],0x03ff0000
call type_title
mcall 4,<10,30>,0x90ffffff,[N_error]
mov eax,[error_path]
test eax,eax
jz @f
mcall 4,<10,50>, ,[error_path]
mcall 4,<10,50>,,[error_path]
@@:
mov eax,[error_type]
test eax,eax
jz @f
mcall 4,<10,70>, ,[error_type]
mcall 4,<10,70>,,[error_type]
@@:
mcall 12, 2
mcall 12,2
ret
;---------------------------------------------------------------------
start_error_window_thread:
mcall 9, procinfo, -1
mcall 9,procinfo,-1
mov eax,[ebx+46]
shr eax,1
add eax,[ebx+38]
@ -671,7 +700,7 @@ mouse:
mov eax,file_browser_data_1.mouse_keys_delta
cmp [eax],dword 3
jne .check_focus ;.scrollbar
jne .check_focus ; scrollbar
mov [eax],dword 0
call load_next_dir
jmp still
@ -743,6 +772,8 @@ mouse:
jmp .menu_bar_1
;---------------------------------------------------
.check_editboxes:
cmp [open_dialog_type],1
jne .check_scroll_event
mov eax,[edit1+44]
and eax,10b
push dword name_editboxes
@ -906,18 +937,30 @@ get_communication_area:
load_start_directory:
mov eax,[communication_area]
test eax,eax
jz @f
jz .1
movzx ebx,word [eax]
test eax,eax
jz @f
jz .1
add eax,4
mov esi,eax
jmp .1
push esi
mov esi,[communication_area]
add esi,4096-256
mov eax,[esi]
test eax,eax
jnz @f
mov esi,example_name_temp
@@:
mov esi,start_pach
mov edi,user_selected_name
call copy_dir_name
pop esi
jmp .2
.1:
mov esi,start_pach
.2:
mov edi,dir_pach
call copy_dir_name
call load_directory
mov eax,[N_error]
test eax,eax
@ -993,9 +1036,9 @@ error_handler:
xor ebx,ebx
cmp [extended_key],1
je .extended_key
test al, al
test al,al
jnz .still
cmp ah, 0xE0
cmp ah,0xE0
jne @f
mov [extended_key],1
jmp .still
@ -1010,7 +1053,7 @@ error_handler:
mcall 17
cmp ah,5
je .exit
cmp ah, 1
cmp ah,1
jne .still
xor eax,eax
mov [N_error],eax
@ -1026,7 +1069,12 @@ file_no_folder:
mov esi,dir_pach
mov edi,file_name
call copy_dir_name
push ebx
mov al,[focus_pointer]
test al,al
je @f
mov ebx,user_selected_name
@@:
cmp [open_dialog_type],2
je @f
mov esi,file_name
@ -1037,12 +1085,24 @@ file_no_folder:
jnz @f
call control_minimal_window_size
call draw_window
pop ebx
ret
@@:
mov edi,eax
add edi,4
mov esi,file_name
call copy_dir_name
pop esi
mov al,[focus_pointer]
test al,al
jz @f
mov esi,user_selected_name
@@:
mov edi,[communication_area]
add edi,4096-256
call copy_dir_name
mov eax,[communication_area]
mov [eax],word 1
jmp button.exit
@ -1117,7 +1177,7 @@ load_root_directory:
cmp [root_folder_area],dword 0
je @f
mcall 68, 13, [root_folder_area]
mcall 68,13,[root_folder_area]
test eax,eax
jz memory_free_error
@@:
@ -1151,7 +1211,7 @@ type_title:
mov ecx,[ecx]
test ecx,ecx
jz @f
mcall 71,1, ; title ;;param ;file_name ;dir_pach
mcall 71,1,; title ;;param ;file_name ;dir_pach
@@:
ret
;---------------------------------------------------------------------
@ -1227,7 +1287,7 @@ draw_window:
pusha
shr ecx,16
mov bx,cx
add ebx,20 shl 16+ 2
add ebx,20 shl 16+2
mcall 4,,0x90000000,message_ExitDir_button
add ebx,4
mcall
@ -1242,7 +1302,7 @@ draw_window:
shr ecx,16
mov bx,cx
add ebx,5 shl 16+ 4
add ebx,5 shl 16+4
mcall 4,,0x90000000,message_ReloadDir_button
pop ebx
@ -1266,9 +1326,19 @@ draw_window:
mcall 8,,,3
pusha
shr ecx,16
mov bx,cx
add ebx,12 shl 16+ 4
add ebx,6 shl 16+ 4
mcall 4,,0x90000000,message_cancel_button
popa
sub ebx,65 shl 16
mcall 8,,,4
shr ecx,16
mov bx,cx
add ebx,12 shl 16+4
mov edx,[open_dialog_type]
shl edx,2
@ -1281,20 +1351,9 @@ draw_window:
@@:
mcall 4,,0x90000000 ;message_open_button
popa
sub ebx, 65 shl 16
mcall 8,,,4
shr ecx,16
mov bx,cx
add ebx,6 shl 16+ 4
mcall 4,,0x90000000,message_cancel_button
; mcall 47,0x80000,[file_browser_data_1.ini_file_start],<250, 0>,0x0
; mcall 4, <3, 420>, 0, fb_extension_start, 3
; mcall 47,0x80000,[file_browser_data_1.ini_file_start],<250,0>,0x0
; mcall 4,<3,420>,0,fb_extension_start,3
mcall 12,2
ret
@ -1352,48 +1411,118 @@ draw_for_fs_errors:
shr ecx,16
mov bx,cx
add ebx,4 shl 16+ 4
add ebx,4 shl 16+4
mcall 4,,0x90000000,message_cancel_button
ret
;---------------------------------------------------------------------
draw_dir_pach:
mov esi,dir_pach
draw_file_name:
mov esi,user_selected_name
cld
@@:
lodsb
test al,al
jne @r
sub esi,dir_pach
sub esi,user_selected_name
mov eax,esi
dec eax
mov edi, edit1
mov [edi+48], eax ;ed_size
mov [edi+52], eax ;ed_pos
mov edi,edit1
mov [edi+48],eax ;ed_size
mov [edi+52],eax ;ed_pos
;--------------------------------------
mov eax,[file_browser_data_1.x]
mov ebx,eax
shr ebx,16
and eax,0xffff
sub eax,200
mov [edi],eax
add ebx,70
mov [edi+4],ebx
mov eax,[file_browser_data_1.y]
mov ebx,eax
shr ebx,16
and eax,0xffff
add eax,ebx
add eax,5
mov [edi+8],eax
push dword name_editboxes
call [edit_box_draw]
mov bx,[file_browser_data_1.start_x]
add bx,5
shl ebx,16
mov bx,[file_browser_data_1.start_y]
add bx,[file_browser_data_1.size_y]
add bx,9
mcall 4,,0x80000000,message_file_name
ret
;---------------------------------------------------------------------
draw_dir_pach:
mov eax,[file_browser_data_1.x]
mov ebx,eax
shr ebx,16
add ebx,3
and eax,0xffff
sub eax,5
mov [PathShow_data_1.area_size_x],ax
mov [PathShow_data_1.start_x],bx
;--------------------------------------
; top line
mov ebx,[file_browser_data_1.x]
mcall 13,,<7,1>,0x0
; down line
push ebx ecx
mcall ,,<21,1>,
pop ecx ebx
; left line
push ebx
mov bx,1
mov cx,15
mcall
pop ebx
; right line
mov ax,bx
shr ebx,16
add bx,ax
dec ebx
shl ebx,16
mov bx,1
mcall 13
;--------------------------------------
mov ebx,[file_browser_data_1.x]
sub ebx,2
add ebx,1 shl 16
mcall 13,,<8,13>,0xffffff
;--------------------------------------
; prepare for PathShow
push dword PathShow_data_1
call [PathShow_prepare]
; draw for PathShow
push dword PathShow_data_1
call [PathShow_draw]
ret
draw_dir_pach_1:
mov ebx,[file_browser_data_1.x]
mcall 13,,<7,15>,0xffffb0
mov bx,10
add ebx,4 shl 16
mcall 4,,0xC0000000,dir_pach,,0xffffb0
ret
;draw_dir_pach_1:
; mov ebx,[file_browser_data_1.x]
; mcall 13,,<7,15>,0xffffb0
; mov bx,10
; add ebx,4 shl 16
; mcall 4,,0xC0000000,dir_pach,,0xffffb0
; ret
;---------------------------------------------------------------------
draw_draw_file_browser1:
call draw_dir_pach
cmp [open_dialog_type],1
jne @f
call draw_file_name
@@:
xor eax,eax
inc eax
mov [file_browser_data_1.all_redraw],eax
@ -1457,13 +1586,13 @@ prepare_scrollbar_data:
ret
;---------------------------------------------------------------------
get_active_pocess:
mcall 9, procinfo, -1
mcall 9,procinfo,-1
mov eax,[ebx+30]
mov [PID],eax
xor ecx,ecx
@@:
inc ecx
mcall 9, procinfo
mcall 9,procinfo
mov eax,[PID]
cmp eax,[ebx+30]
jne @r
@ -1471,7 +1600,7 @@ get_active_pocess:
ret
;---------------------------------------------------------------------
get_window_param:
mcall 9, procinfo, -1
mcall 9,procinfo,-1
mov eax,[ebx+66]
inc eax
mov [window_high],eax
@ -1489,7 +1618,7 @@ convert_icons:
call [cnv_png_import.Start]
mov ecx,[image_file]
mcall 68, 13,
mcall 68,13,
test eax,eax
jz memory_free_error
@ -1514,7 +1643,7 @@ convert_icons:
mov eax,[ebx+20]
add eax,ebx
; set RAW palette, use else resolution 8bit or less
; set RAW palette,use else resolution 8bit or less
mov [file_browser_data_1.palette_raw],eax
mov eax,[ebx+28]
@ -1539,7 +1668,7 @@ load_ini:
mov [fileinfo.subfunction],dword 5
mov [fileinfo.size],dword 0
mov [fileinfo.return],dword file_info
mcall 70, fileinfo
mcall 70,fileinfo
test eax,eax
jnz .error
@ -1549,14 +1678,14 @@ load_ini:
mov [fileinfo.size],ecx
mov [img_size],ecx
mcall 68, 12
mcall 68,12
test eax,eax
jz memory_get_error
mov [fileinfo.return],eax
mov [image_file],eax
mcall 70, fileinfo
mcall 70,fileinfo
test eax,eax
jnz .error
ret
@ -1574,7 +1703,7 @@ load_icons:
mov [fileinfo.subfunction],dword 5
mov [fileinfo.size],dword 0
mov [fileinfo.return],dword file_info
mcall 70, fileinfo
mcall 70,fileinfo
test eax,eax
jz @f
@ -1586,7 +1715,7 @@ load_icons:
mov [fileinfo.subfunction],dword 5
mov [fileinfo.size],dword 0
mov [fileinfo.return],dword file_info
mcall 70, fileinfo
mcall 70,fileinfo
test eax,eax
jnz .error
@@:
@ -1596,14 +1725,14 @@ load_icons:
mov [fileinfo.size],ecx
mov [img_size],ecx
mcall 68, 12
mcall 68,12
test eax,eax
jz memory_get_error
mov [fileinfo.return],eax
mov [image_file],eax
mcall 70, fileinfo
mcall 70,fileinfo
test eax,eax
jnz .error
ret
@ -1634,14 +1763,14 @@ load_directory:
mov [N_error],eax
cmp [file_browser_data_1.folder_data],eax
je @f
mcall 68, 13, [file_browser_data_1.folder_data]
mcall 68,13,[file_browser_data_1.folder_data]
test eax,eax
jz memory_free_error
@@:
mov [dirinfo.size],dword 0
mov [dirinfo.return],dir_header
mcall 70, dirinfo
mcall 70,dirinfo
test eax,eax
jz @f
xor ebx,ebx
@ -1653,14 +1782,14 @@ load_directory:
mov [dirinfo.size],ecx
imul ecx,304
add ecx,32
mcall 68, 12
mcall 68,12
test eax,eax
jz memory_get_error
mov [dirinfo.return],eax
mov [file_browser_data_1.folder_data],eax
mcall 70, dirinfo
mcall 70,dirinfo
test eax,eax
jnz .error
@ -1685,6 +1814,8 @@ clear_data_fb_and_sb:
ret
;---------------------------------------------------------------------
check_filter:
cmp [open_dialog_type],2 ; Select dir
je .1
xor eax,eax
mov al,[filter_flag]
test eax,eax
@ -1696,6 +1827,7 @@ check_filter:
mov eax,[eax+4096]
test eax,eax
jz @f
.1:
call delete_unsupported_BDFE
@@:
ret
@ -1926,7 +2058,7 @@ files_name_normalize:
ret
;---------------------------------------------------------------------
char_toupper:
; convert character to uppercase, using cp866 encoding
; convert character to uppercase,using cp866 encoding
; in: al=symbol
; out: al=converted symbol
cmp al,'a'
@ -1950,7 +2082,7 @@ char_toupper:
ret
;---------------------------------------------------------------------
char_todown:
; convert character to uppercase, using cp866 encoding
; convert character to uppercase,using cp866 encoding
; in: al=symbol
; out: al=converted symbol
cmp al,'A'
@ -1970,7 +2102,7 @@ char_todown:
.rus1:
; 0x80-0x8F -> 0xA0-0xAF
.az:
add al, 0x20
add al,0x20
ret
;---------------------------------------------------------------------
copy_file_path:
@ -2085,17 +2217,17 @@ err_message_import4 db 'archiver.obj - Wrong import!',0
align 4
l_libs_start:
library01 l_libs system_dir_Boxlib+9, path, file_name, system_dir_Boxlib, \
er_message_found_lib, ihead_f_l, Box_lib_import, er_message_import, ihead_f_i, plugins_directory
library01 l_libs system_dir_Boxlib+9,path,file_name,system_dir_Boxlib,\
er_message_found_lib,ihead_f_l,Box_lib_import,er_message_import,ihead_f_i,plugins_directory
library02 l_libs system_dir_CnvPNG+9, path, file_name, system_dir_CnvPNG,\
er_message_found_lib2, ihead_f_l, cnv_png_import, er_message_import2, ihead_f_i, plugins_directory
library02 l_libs system_dir_CnvPNG+9,path,file_name,system_dir_CnvPNG,\
er_message_found_lib2,ihead_f_l,cnv_png_import,er_message_import2,ihead_f_i,plugins_directory
library03 l_libs system_dir_Sort+9, path, file_name, system_dir_Sort, \
err_message_found_lib3, ihead_f_l, Sort_import, err_message_import3, ihead_f_i, plugins_directory
library03 l_libs system_dir_Sort+9,path,file_name,system_dir_Sort,\
err_message_found_lib3,ihead_f_l,Sort_import,err_message_import3,ihead_f_i,plugins_directory
library04 l_libs system_dir_UNPACK+9, path, file_name, system_dir_UNPACK, \
err_message_found_lib4, ihead_f_l, UNPACK_import, err_message_import4, ihead_f_i, plugins_directory
library04 l_libs system_dir_UNPACK+9,path,file_name,system_dir_UNPACK,\
err_message_found_lib4,ihead_f_l,UNPACK_import,err_message_import4,ihead_f_i,plugins_directory
end_l_libs:
@ -2177,22 +2309,22 @@ edit_box_key dd aEdit_box_key
edit_box_mouse dd aEdit_box_mouse
;version_ed dd aVersion_ed
check_box_draw dd aCheck_box_draw
check_box_mouse dd aCheck_box_mouse
;check_box_draw dd aCheck_box_draw
;check_box_mouse dd aCheck_box_mouse
;version_ch dd aVersion_ch
option_box_draw dd aOption_box_draw
option_box_mouse dd aOption_box_mouse
;option_box_draw dd aOption_box_draw
;option_box_mouse dd aOption_box_mouse
;version_op dd aVersion_op
scrollbar_ver_draw dd aScrollbar_ver_draw
scrollbar_ver_mouse dd aScrollbar_ver_mouse
scrollbar_hor_draw dd aScrollbar_hor_draw
scrollbar_hor_mouse dd aScrollbar_hor_mouse
;scrollbar_hor_draw dd aScrollbar_hor_draw
;scrollbar_hor_mouse dd aScrollbar_hor_mouse
;version_scrollbar dd aVersion_scrollbar
dinamic_button_draw dd aDbutton_draw
dinamic_button_mouse dd aDbutton_mouse
;dinamic_button_draw dd aDbutton_draw
;dinamic_button_mouse dd aDbutton_mouse
;version_dbutton dd aVersion_dbutton
menu_bar_draw dd aMenu_bar_draw
@ -2204,6 +2336,10 @@ FileBrowser_draw dd aFileBrowser_draw
FileBrowser_mouse dd aFileBrowser_mouse
FileBrowser_key dd aFileBrowser_key
;Version_FileBrowser dd aVersion_FileBrowser
PathShow_prepare dd sz_PathShow_prepare
PathShow_draw dd sz_PathShow_draw
;Version_path_show dd szVersion_path_show
dd 0
dd 0
@ -2215,22 +2351,22 @@ aEdit_box_key db 'edit_box_key',0
aEdit_box_mouse db 'edit_box_mouse',0
;aVersion_ed db 'version_ed',0
aCheck_box_draw db 'check_box_draw',0
aCheck_box_mouse db 'check_box_mouse',0
;aCheck_box_draw db 'check_box_draw',0
;aCheck_box_mouse db 'check_box_mouse',0
;aVersion_ch db 'version_ch',0
aOption_box_draw db 'option_box_draw',0
aOption_box_mouse db 'option_box_mouse',0
;aOption_box_draw db 'option_box_draw',0
;aOption_box_mouse db 'option_box_mouse',0
;aVersion_op db 'version_op',0
aScrollbar_ver_draw db 'scrollbar_v_draw',0
aScrollbar_ver_mouse db 'scrollbar_v_mouse',0
aScrollbar_hor_draw db 'scrollbar_h_draw',0
aScrollbar_hor_mouse db 'scrollbar_h_mouse',0
;aScrollbar_hor_draw db 'scrollbar_h_draw',0
;aScrollbar_hor_mouse db 'scrollbar_h_mouse',0
;aVersion_scrollbar db 'version_scrollbar',0
aDbutton_draw db 'dbutton_draw',0
aDbutton_mouse db 'dbutton_mouse',0
;aDbutton_draw db 'dbutton_draw',0
;aDbutton_mouse db 'dbutton_mouse',0
;aVersion_dbutton db 'version_dbutton',0
aMenu_bar_draw db 'menu_bar_draw',0
@ -2242,6 +2378,10 @@ aFileBrowser_draw db 'FileBrowser_draw',0
aFileBrowser_mouse db 'FileBrowser_mouse',0
aFileBrowser_key db 'FileBrowser_key',0
;aVersion_FileBrowser db 'version_FileBrowser',0
sz_PathShow_prepare db 'PathShow_prepare',0
sz_PathShow_draw db 'PathShow_draw',0
;szVersion_path_show db 'version_PathShow',0
;---------------------------------------------------------------------
;---------------------------------------------------------------------
align 4
@ -2260,6 +2400,7 @@ temp_counter_1 dd 0
retrieved_devices_table_counter dd 0
communication_area dd 0
open_dialog_type dd 0
open_dialog_title_pointer:
dd title_0
dd title_1
@ -2277,16 +2418,16 @@ expansion_length dd 0
N_error dd 0
error_type dd 0
error_path dd 0
error_window_x: dd 100 shl 16 + 250
error_window_y: dd 100 shl 16 + 120
error_window_x: dd 100 shl 16+250
error_window_y: dd 100 shl 16+120
;---------------------------------------------------------------------
mouse_scroll_data:
.vertical dw 0
.horizontal dw 0
.vertical dw 0
.horizontal dw 0
mouse_position:
.y dw 0
.x dw 0
.y dw 0
.x dw 0
;---------------------------------------------------------------------
; not change this section!!!
; start section
@ -2413,6 +2554,9 @@ message_ReloadDir_button:
message_ExitDir_button:
db '^',0
message_file_name:
db 'File name:',0
message_0:
db 'Open',0
message_1:
@ -2671,10 +2815,24 @@ file_browser_data_1:
.mouse_pos_old dd 0 ;+196
.marked_counter dd 0 ;+200
;---------------------------------------------------------------------
PathShow_data_1:
.type dd 0 ;+0
.start_y dw 11 ;+4
.start_x dw 10 ;+6
.font_size_x dw 6 ;+8 ; 6 - for font 0, 8 - for font 1
.area_size_x dw 200 ;+10
.font_number dd 0 ;+12 ; 0 - monospace, 1 - variable
.background_flag dd 0 ;+16
.font_color dd 0x0 ;+20
.background_color dd 0x0 ;+24
.text_pointer dd dir_pach ;+28
.work_area_pointer dd text_work_area ;+32
.temp_text_length dd 0 ;+36
;---------------------------------------------------------------------
; for EDITBOX
align 4
name_editboxes:
edit1 edit_box 200,10,7,0xffffff,0xbbddff,0,0,0,4095,dir_pach,mouse_dd,,0
edit1 edit_box 200,10,7,0xffffff,0xbbddff,0,0,0,4095,user_selected_name,mouse_dd,,0
name_editboxes_end:
;mouse_flag: dd 0x0
@ -2695,6 +2853,9 @@ features_table:
.year_table:
db ' '
;---------------------------------------------------------------------
example_name_temp:
db 'temp1.asm',0
;---------------------------------------------------------------------
IM_END:
menu_text_area_1_1:
rb 256
@ -2712,6 +2873,9 @@ retrieved_devices_table:
name_temp_area:
rb 256
;---------------------------------------------------------------------
user_selected_name:
rb 256
;---------------------------------------------------------------------
param:
rb 256
;---------------------------------------------------------------------
@ -2724,6 +2888,9 @@ file_name:
dir_pach:
rb 4096
;---------------------------------------------------------------------
text_work_area:
rb 1024
;---------------------------------------------------------------------
procinfo:
process_info:
rb 1024
@ -2731,4 +2898,3 @@ process_info:
file_info:
rb 40
I_END:

View File

@ -44,16 +44,16 @@ include '../../../../../macros.inc'
include '../../load_lib.mac'
;include 'macros.inc'
;include 'load_lib.mac'
@use_library
@use_library
include 'opendial.mac'
use_OpenDialog
use_OpenDialog
;---------------------------------------------------------------------
;--- Start of program ----------------------------------------------
;---------------------------------------------------------------------
START:
mcall 68, 11
mcall 66, 1, 1
mcall 40, 0x27
mcall 68,11
mcall 66,1,1
mcall 40,0x27
;---------------------------------------------------------------------
load_libraries l_libs_start,end_l_libs
@ -65,9 +65,19 @@ load_libraries l_libs_start,end_l_libs
mov eax,[unpack_DeflateUnpack2]
mov [deflate_unpack],eax
;OpenDialog initialisation
; OpenDialog initialisation
init_OpenDialog OpenDialog_data
mov edi,filename_area
mov esi,start_temp_file_name
xor eax,eax
cld
@@:
lodsb
stosb
test eax,eax
jnz @b
; mov ebx,icons_file_name
; mov esi,path
@ -75,7 +85,7 @@ init_OpenDialog OpenDialog_data
copy_path icons_file_name,path,library_path,0
mcall 70, fileinfo
mcall 70,fileinfo
mov [fileinfo+0],dword 0
@ -84,14 +94,14 @@ init_OpenDialog OpenDialog_data
mov [img_size],ecx
mcall 68, 12
mcall 68,12
mov [fileinfo+16],eax
mov [image_file],eax
mcall 70, fileinfo
mcall 70,fileinfo
xor eax,eax
mov [return_code],eax
@ -99,30 +109,30 @@ init_OpenDialog OpenDialog_data
call [cnv_png_import.Start]
mov ecx,[image_file]
mcall 68, 13,
mcall 68,13,
cmp [return_code],dword 0
jne button.exit
mov ebx,[raw_pointer]
mov eax,[ebx+4]
; set of button size
; set of button size
mov [dinamic_button_data_1.size_x],ax
mov [dinamic_button_data_1.size_y],ax
mov [dinamic_button_data_2.size_x],ax
mov [dinamic_button_data_2.size_y],ax
mov eax,[ebx+12]
; set of RAW resolution to pixel
; set of RAW resolution to pixel
mov [dinamic_button_data_1.resolution_raw],eax
mov [dinamic_button_data_2.resolution_raw],eax
mov eax,[ebx+20]
add eax,ebx
; set RAW palette, use else resolution 8bit or less
; set RAW palette, use else resolution 8bit or less
mov [dinamic_button_data_1.palette_raw],eax
mov [dinamic_button_data_2.palette_raw],eax
mov eax,[ebx+28]
add eax,ebx
; set RAW area for passive button
; set RAW area for passive button
mov [dinamic_button_data_1.passive_raw],eax
mov [dinamic_button_data_2.passive_raw],eax
mov ecx,[ebx+4]
@ -130,11 +140,11 @@ init_OpenDialog OpenDialog_data
imul ecx,[ebx+12]
shr ecx,3
add eax,ecx
; set RAW area for active button
; set RAW area for active button
mov [dinamic_button_data_1.active_raw],eax
mov [dinamic_button_data_2.active_raw],eax
add eax,ecx
; RAW area for click button
; RAW area for click button
mov [dinamic_button_data_1.click_raw],eax
mov [dinamic_button_data_2.click_raw],eax
;---------------------------------------------------------------------
@ -152,8 +162,6 @@ still:
cmp eax,6
je mouse
jmp still
;---------------------------------------------------------------------
key:
mcall 2
@ -161,7 +169,7 @@ still:
;---------------------------------------------------------------------
button:
mcall 17
cmp ah, 1
cmp ah,1
jne still
.exit:
mcall -1
@ -267,7 +275,7 @@ analyse_out_menu_1:
cmp eax,dword 4
je button.exit
jmp still
;---------------------------------------------------------------------
analyse_out_menu_2:
; analyse result of Menu 2
cmp [menu_data_2.cursor_out],dword 2
@ -291,7 +299,6 @@ OpenDialog_start:
; mov esi,path
; mov edi,library_path
; call copy_file_path
call get_filter_data
copy_path open_dialog_name,path,library_path,0
@ -309,29 +316,13 @@ start_OpenDialog OpenDialog_data
call draw_window
jmp still ; OpenDialog user selected the target file
; [OpenDialog_data.openfile_pach] pointer of area the target file
; [OpenDialog_data.openfile_pach] pointer of area the target file
;---------------------------------------------------------------------
get_filter_data:
mov edi,[OpenDialog_data.com_area]
test edi,edi
jnz @f
add esp,4
jmp still
@@:
add edi,4096+4
mov esi,Filter
mov ecx,[esi]
inc ecx
cld
rep movsb
mov edi,[OpenDialog_data.com_area]
mov [edi+4096],dword 1
ret
;---------------------------------------------------------------------
draw_window:
mcall 12, 1
mcall 0, <0,400>, <0,400>, 0x03AABBCC, 0x805080D0, 0x005080D0
mcall 71, 1, header_1
mcall 12,1
mcall 0,<0,400>,<0,400>,0x03AABBCC,0x805080D0,0x005080D0
mcall 71,1,header_1
;---------------------------------------------
; draw for Menu 1
push dword menu_data_1
@ -376,7 +367,7 @@ draw_window:
mov [scroll_bar_data_horizontal.all_redraw],eax
;---------------------------------------------
call draw_cube
mcall 12, 2
mcall 12,2
ret
;---------------------------------------------------------------------
draw_cube:
@ -389,7 +380,7 @@ draw_cube:
add ebx,30
shl ebx,16
mov bx,30
mcall 13, , , 0x0
mcall 13,,,0x0
ret
;---------------------------------------------------------------------
include 'data.inc'
@ -418,6 +409,9 @@ plugin_pach:
text_work_area:
rb 4096
;---------------------------------------------------------------------
filename_area:
rb 256
;---------------------------------------------------------------------
file_info:
rb 40
;---------------------------------------------------------------------

View File

@ -7,6 +7,7 @@ ok_btn db 'Ok',0
labelt3 db 'About program',0
;---------------------------------------------------------------------
start_temp_file_name: db 'ctrldemo_test',0
icons_file_name: db 'reload_16x16_8b.png',0
system_dir1 db '/sys/lib/'
plugin_BMP_name db 'cnv_bmp.obj',0
@ -167,7 +168,7 @@ menu_bar_activate dd aMenu_bar_activate
PathShow_prepare dd sz_PathShow_prepare
PathShow_draw dd sz_PathShow_draw
;Version_path_show dd szVersion_path_show
dd 0
dd 0
@ -435,6 +436,8 @@ OpenDialog_data:
.draw_window dd draw_window ;+28
.status dd 0 ;+32
.openfile_pach dd openfile_pach ;+36
.filename_area dd filename_area ;+40
.filter_area dd Filter
communication_area_name:
db 'FFFFFFFF_open_dialog',0
@ -444,7 +447,8 @@ communication_area_default_pach:
db '/rd/1',0
Filter:
dd Filter.end - Filter
dd Filter.end - Filter.1
.1:
db 'JPEG',0
db 'JPG',0
db 'JPE',0
@ -452,6 +456,8 @@ db 'PNG',0
db 'GIF',0
db 'BMP',0
db 'KEX',0
db 'DAT',0
db 'INI',0
.end:
db 0
;---------------------------------------------------------------------

View File

@ -45,10 +45,12 @@ od_start_path equ dword [ebp+24] ; Location path to OpenDialog
od_draw_window equ dword [ebp+28] ; Adress of procedure - draw_window
od_status equ dword [ebp+32] ; 0-Cancel, 1-Get path OK, 2-Use alternatives
od_openfile_pach equ dword [ebp+36] ; Getting path to file
od_filename_area equ dword [ebp+40] ; Adress of file name area
od_filter_area equ dword [ebp+44] ; Adress of filter area
;*****************************************************************************
.init:
pusha
mcall 9, od_procinfo, -1
mcall 9,od_procinfo,-1
mov ebx,[ebx+30]
mov edi,od_com_area_name
add edi,7
@ -99,14 +101,36 @@ OpenDialog_exit
mov esi,od_dir_default_pach ;communication_area_default_pach
@@:
call .copy
;----------------------------------------------
; copy file name to shared area
cmp od_type,dword 1
jne .4
mov edi,od_com_area
add edi,4096-256
mov esi,od_filename_area
; xor eax,eax
; mov al,[esi]
; test eax,eax
test esi,esi
jnz @f
mov esi,.null
@@:
call .copy
.4:
;----------------------------------------------
cmp od_type,dword 2
je @f
call .get_filter_data
@@:
;----------------------------------------------
mov eax,od_com_area_name
mov [start_open_dialog.parameter],eax
mov eax,od_start_path
mov [start_open_dialog.name],eax
mcall 70, start_open_dialog
mcall 70,start_open_dialog
shr eax,31
test eax,eax
jnz .1
@ -116,7 +140,7 @@ OpenDialog_exit
call od_draw_window
popa
.still:
mcall 23, 50
mcall 23,50
cmp eax,1
je .red
mov eax,od_com_area
@ -124,27 +148,69 @@ OpenDialog_exit
test ebx,ebx
jz .still
cmp ebx,3
je .2 ;still
je .2
cmp ebx,1
jne .still
mov esi,od_com_area
add esi,4
mov edi,od_openfile_pach ;string
mov edi,od_openfile_pach
call .copy
mov od_status,1
mov esi,od_openfile_pach
mov edi,od_opendir_pach
call .copy_dir_path
jmp .3 ;kopen_1
;----------------------------------------------
; copy file name from shared area
cmp od_type,dword 1
jne @f
mov esi,od_com_area
add esi,4096-256
mov edi,od_filename_area
; xor eax,eax
; mov al,[edi]
; test eax,eax
test edi,edi
jz @f
call .copy
@@:
;----------------------------------------------
jmp .3
.2:
mov od_status,0
jmp .3 ; still
jmp .3
.1:
mov od_status,2 ; thread1
mov od_status,2
.3:
OpenDialog_exit
;----------------------------------------------
.null:
dd 0
;----------------------------------------------
.get_filter_data:
mov edi,od_com_area
test edi,edi
jnz @f
; add esp,4
; jmp still
ret
@@:
add edi,4096+4
mov esi,od_filter_area
mov ecx,[esi]
test ecx,ecx
jnz @f
mov edi,od_com_area
mov [edi+4096],dword 0
ret
@@:
inc ecx
cld
rep movsb
mov edi,od_com_area
mov [edi+4096],dword 1
ret
;----------------------------------------------
.copy:
xor eax,eax
cld
@ -170,6 +236,10 @@ OpenDialog_exit
stosb
test eax,eax
jnz @b
cmp od_type,dword 2
jne @f
ret
@@:
mov esi,edi
dec esi
@@:
@ -178,20 +248,7 @@ OpenDialog_exit
cmp al,'/'
jnz @b
; push esi
; add esi,2
;; mov edi,ebx ;file_name
;; xor ebx,ebx
;@@:
; cld
; lodsb
;; stosb
; inc ebx
; test eax,eax
; jnz @b
; pop esi
mov [esi+1], byte 0
mov [esi+1],byte 0
cld
ret
;----------------------------------------------