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

@ -55,7 +55,6 @@ START:
call get_communication_area call get_communication_area
load_libraries l_libs_start,end_l_libs load_libraries l_libs_start,end_l_libs
test eax,eax test eax,eax
jnz button.exit jnz button.exit
@ -279,6 +278,8 @@ change_focus_area_Tab_key_ASCII:
jmp change_focus_area jmp change_focus_area
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
change_focus_area_press_Tab_key: change_focus_area_press_Tab_key:
cmp [open_dialog_type],1
jne still
mov al,[Tab_key_block] mov al,[Tab_key_block]
test al,al test al,al
jnz still jnz still
@ -288,6 +289,8 @@ change_focus_area_press_Tab_key:
jmp still jmp still
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
change_focus_area_check_Tab_key: change_focus_area_check_Tab_key:
cmp [open_dialog_type],1
jne still
xor eax,eax xor eax,eax
mov [Tab_key_block],al mov [Tab_key_block],al
mov al,[Tab_key] mov al,[Tab_key]
@ -331,33 +334,54 @@ key_ASCII:
call [edit_box_key] call [edit_box_key]
jmp still jmp still
.13: .13:
cmp [open_dialog_type],2 ; Select dir ; cmp [open_dialog_type],2 ; Select dir
je file_no_folder ; je file_no_folder
cmp [open_dialog_type],1 ; Save file ; cmp [open_dialog_type],1 ; Save file
jne .load_dir ; jne user_selected_name_action ; load_dir
inc [open_dialog_type] ; inc [open_dialog_type]
jmp file_no_folder jmp file_no_folder
.load_dir: ;.load_dir:
mov [file_browser_data_1.select_panel_counter],1 ; mov [file_browser_data_1.select_panel_counter],1
xor eax,eax ; xor eax,eax
mov [focus_pointer],al ; mov [focus_pointer],al
mcall 66, 1, 1 ; 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 mov esi,dir_pach
cld mov edi,eax
@@: call copy_dir_name
lodsb mov [edi-1],byte '/'
test al,al mov esi,user_selected_name
jne @r call copy_dir_name
sub esi,2
cmp [esi],byte '/' mov eax,[communication_area]
jne @f mov [eax],word 1
xor eax,eax jmp button.exit
mov [esi],al
@@:
call load_next_dir.1
jmp still
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
select_disk: select_disk:
call check_alt call check_alt
@ -510,9 +534,9 @@ button:
cmp ah,6 cmp ah,6
je .reload_dir_1 je .reload_dir_1
cmp ah,4 cmp ah,4
je .exit
cmp ah,3
je .open_dir_or_file je .open_dir_or_file
cmp ah,3
je .exit
cmp ah,2 cmp ah,2
je .exit_dir je .exit_dir
cmp ah,1 cmp ah,1
@ -545,8 +569,13 @@ button:
.open_dir_or_file: .open_dir_or_file:
cmp [open_dialog_type],2 ;Select dir cmp [open_dialog_type],2 ;Select dir
je file_no_folder 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 xor ebx,ebx
jmp key.7 jmp key.7
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
@ -671,7 +700,7 @@ mouse:
mov eax,file_browser_data_1.mouse_keys_delta mov eax,file_browser_data_1.mouse_keys_delta
cmp [eax],dword 3 cmp [eax],dword 3
jne .check_focus ;.scrollbar jne .check_focus ; scrollbar
mov [eax],dword 0 mov [eax],dword 0
call load_next_dir call load_next_dir
jmp still jmp still
@ -743,6 +772,8 @@ mouse:
jmp .menu_bar_1 jmp .menu_bar_1
;--------------------------------------------------- ;---------------------------------------------------
.check_editboxes: .check_editboxes:
cmp [open_dialog_type],1
jne .check_scroll_event
mov eax,[edit1+44] mov eax,[edit1+44]
and eax,10b and eax,10b
push dword name_editboxes push dword name_editboxes
@ -906,18 +937,30 @@ get_communication_area:
load_start_directory: load_start_directory:
mov eax,[communication_area] mov eax,[communication_area]
test eax,eax test eax,eax
jz @f jz .1
movzx ebx,word [eax] movzx ebx,word [eax]
test eax,eax test eax,eax
jz @f jz .1
add eax,4 add eax,4
mov esi,eax 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: .1:
mov esi,start_pach
.2:
mov edi,dir_pach mov edi,dir_pach
call copy_dir_name call copy_dir_name
call load_directory call load_directory
mov eax,[N_error] mov eax,[N_error]
test eax,eax test eax,eax
@ -1026,7 +1069,12 @@ file_no_folder:
mov esi,dir_pach mov esi,dir_pach
mov edi,file_name mov edi,file_name
call copy_dir_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 cmp [open_dialog_type],2
je @f je @f
mov esi,file_name mov esi,file_name
@ -1037,12 +1085,24 @@ file_no_folder:
jnz @f jnz @f
call control_minimal_window_size call control_minimal_window_size
call draw_window call draw_window
pop ebx
ret ret
@@: @@:
mov edi,eax mov edi,eax
add edi,4 add edi,4
mov esi,file_name mov esi,file_name
call copy_dir_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,[communication_area]
mov [eax],word 1 mov [eax],word 1
jmp button.exit jmp button.exit
@ -1266,6 +1326,16 @@ draw_window:
mcall 8,,,3 mcall 8,,,3
pusha pusha
shr ecx,16
mov bx,cx
add ebx,6 shl 16+ 4
mcall 4,,0x90000000,message_cancel_button
popa
sub ebx,65 shl 16
mcall 8,,,4
shr ecx,16 shr ecx,16
mov bx,cx mov bx,cx
add ebx,12 shl 16+4 add ebx,12 shl 16+4
@ -1281,17 +1351,6 @@ draw_window:
@@: @@:
mcall 4,,0x90000000 ;message_open_button 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 47,0x80000,[file_browser_data_1.ini_file_start],<250,0>,0x0
; mcall 4,<3,420>,0,fb_extension_start,3 ; mcall 4,<3,420>,0,fb_extension_start,3
@ -1358,42 +1417,112 @@ draw_for_fs_errors:
ret ret
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
draw_dir_pach: draw_file_name:
mov esi,dir_pach mov esi,user_selected_name
cld cld
@@: @@:
lodsb lodsb
test al,al test al,al
jne @r jne @r
sub esi,dir_pach sub esi,user_selected_name
mov eax,esi mov eax,esi
dec eax dec eax
mov edi,edit1 mov edi,edit1
mov [edi+48],eax ;ed_size mov [edi+48],eax ;ed_size
mov [edi+52],eax ;ed_pos mov [edi+52],eax ;ed_pos
;--------------------------------------
mov eax,[file_browser_data_1.x] mov eax,[file_browser_data_1.x]
mov ebx,eax mov ebx,eax
shr ebx,16 shr ebx,16
and eax,0xffff and eax,0xffff
sub eax,200
mov [edi],eax mov [edi],eax
add ebx,70
mov [edi+4],ebx 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 push dword name_editboxes
call [edit_box_draw] 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 ret
draw_dir_pach_1: ;draw_dir_pach_1:
mov ebx,[file_browser_data_1.x] ; mov ebx,[file_browser_data_1.x]
mcall 13,,<7,15>,0xffffb0 ; mcall 13,,<7,15>,0xffffb0
mov bx,10 ; mov bx,10
add ebx,4 shl 16 ; add ebx,4 shl 16
mcall 4,,0xC0000000,dir_pach,,0xffffb0 ; mcall 4,,0xC0000000,dir_pach,,0xffffb0
ret ; ret
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
draw_draw_file_browser1: draw_draw_file_browser1:
call draw_dir_pach call draw_dir_pach
cmp [open_dialog_type],1
jne @f
call draw_file_name
@@:
xor eax,eax xor eax,eax
inc eax inc eax
mov [file_browser_data_1.all_redraw],eax mov [file_browser_data_1.all_redraw],eax
@ -1685,6 +1814,8 @@ clear_data_fb_and_sb:
ret ret
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
check_filter: check_filter:
cmp [open_dialog_type],2 ; Select dir
je .1
xor eax,eax xor eax,eax
mov al,[filter_flag] mov al,[filter_flag]
test eax,eax test eax,eax
@ -1696,6 +1827,7 @@ check_filter:
mov eax,[eax+4096] mov eax,[eax+4096]
test eax,eax test eax,eax
jz @f jz @f
.1:
call delete_unsupported_BDFE call delete_unsupported_BDFE
@@: @@:
ret ret
@ -2177,22 +2309,22 @@ edit_box_key dd aEdit_box_key
edit_box_mouse dd aEdit_box_mouse edit_box_mouse dd aEdit_box_mouse
;version_ed dd aVersion_ed ;version_ed dd aVersion_ed
check_box_draw dd aCheck_box_draw ;check_box_draw dd aCheck_box_draw
check_box_mouse dd aCheck_box_mouse ;check_box_mouse dd aCheck_box_mouse
;version_ch dd aVersion_ch ;version_ch dd aVersion_ch
option_box_draw dd aOption_box_draw ;option_box_draw dd aOption_box_draw
option_box_mouse dd aOption_box_mouse ;option_box_mouse dd aOption_box_mouse
;version_op dd aVersion_op ;version_op dd aVersion_op
scrollbar_ver_draw dd aScrollbar_ver_draw scrollbar_ver_draw dd aScrollbar_ver_draw
scrollbar_ver_mouse dd aScrollbar_ver_mouse scrollbar_ver_mouse dd aScrollbar_ver_mouse
scrollbar_hor_draw dd aScrollbar_hor_draw ;scrollbar_hor_draw dd aScrollbar_hor_draw
scrollbar_hor_mouse dd aScrollbar_hor_mouse ;scrollbar_hor_mouse dd aScrollbar_hor_mouse
;version_scrollbar dd aVersion_scrollbar ;version_scrollbar dd aVersion_scrollbar
dinamic_button_draw dd aDbutton_draw ;dinamic_button_draw dd aDbutton_draw
dinamic_button_mouse dd aDbutton_mouse ;dinamic_button_mouse dd aDbutton_mouse
;version_dbutton dd aVersion_dbutton ;version_dbutton dd aVersion_dbutton
menu_bar_draw dd aMenu_bar_draw menu_bar_draw dd aMenu_bar_draw
@ -2204,6 +2336,10 @@ FileBrowser_draw dd aFileBrowser_draw
FileBrowser_mouse dd aFileBrowser_mouse FileBrowser_mouse dd aFileBrowser_mouse
FileBrowser_key dd aFileBrowser_key FileBrowser_key dd aFileBrowser_key
;Version_FileBrowser dd aVersion_FileBrowser ;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
dd 0 dd 0
@ -2215,22 +2351,22 @@ aEdit_box_key db 'edit_box_key',0
aEdit_box_mouse db 'edit_box_mouse',0 aEdit_box_mouse db 'edit_box_mouse',0
;aVersion_ed db 'version_ed',0 ;aVersion_ed db 'version_ed',0
aCheck_box_draw db 'check_box_draw',0 ;aCheck_box_draw db 'check_box_draw',0
aCheck_box_mouse db 'check_box_mouse',0 ;aCheck_box_mouse db 'check_box_mouse',0
;aVersion_ch db 'version_ch',0 ;aVersion_ch db 'version_ch',0
aOption_box_draw db 'option_box_draw',0 ;aOption_box_draw db 'option_box_draw',0
aOption_box_mouse db 'option_box_mouse',0 ;aOption_box_mouse db 'option_box_mouse',0
;aVersion_op db 'version_op',0 ;aVersion_op db 'version_op',0
aScrollbar_ver_draw db 'scrollbar_v_draw',0 aScrollbar_ver_draw db 'scrollbar_v_draw',0
aScrollbar_ver_mouse db 'scrollbar_v_mouse',0 aScrollbar_ver_mouse db 'scrollbar_v_mouse',0
aScrollbar_hor_draw db 'scrollbar_h_draw',0 ;aScrollbar_hor_draw db 'scrollbar_h_draw',0
aScrollbar_hor_mouse db 'scrollbar_h_mouse',0 ;aScrollbar_hor_mouse db 'scrollbar_h_mouse',0
;aVersion_scrollbar db 'version_scrollbar',0 ;aVersion_scrollbar db 'version_scrollbar',0
aDbutton_draw db 'dbutton_draw',0 ;aDbutton_draw db 'dbutton_draw',0
aDbutton_mouse db 'dbutton_mouse',0 ;aDbutton_mouse db 'dbutton_mouse',0
;aVersion_dbutton db 'version_dbutton',0 ;aVersion_dbutton db 'version_dbutton',0
aMenu_bar_draw db 'menu_bar_draw',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_mouse db 'FileBrowser_mouse',0
aFileBrowser_key db 'FileBrowser_key',0 aFileBrowser_key db 'FileBrowser_key',0
;aVersion_FileBrowser db 'version_FileBrowser',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 align 4
@ -2260,6 +2400,7 @@ temp_counter_1 dd 0
retrieved_devices_table_counter dd 0 retrieved_devices_table_counter dd 0
communication_area dd 0 communication_area dd 0
open_dialog_type dd 0 open_dialog_type dd 0
open_dialog_title_pointer: open_dialog_title_pointer:
dd title_0 dd title_0
dd title_1 dd title_1
@ -2413,6 +2554,9 @@ message_ReloadDir_button:
message_ExitDir_button: message_ExitDir_button:
db '^',0 db '^',0
message_file_name:
db 'File name:',0
message_0: message_0:
db 'Open',0 db 'Open',0
message_1: message_1:
@ -2671,10 +2815,24 @@ file_browser_data_1:
.mouse_pos_old dd 0 ;+196 .mouse_pos_old dd 0 ;+196
.marked_counter dd 0 ;+200 .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 ; for EDITBOX
align 4 align 4
name_editboxes: 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: name_editboxes_end:
;mouse_flag: dd 0x0 ;mouse_flag: dd 0x0
@ -2695,6 +2853,9 @@ features_table:
.year_table: .year_table:
db ' ' db ' '
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
example_name_temp:
db 'temp1.asm',0
;---------------------------------------------------------------------
IM_END: IM_END:
menu_text_area_1_1: menu_text_area_1_1:
rb 256 rb 256
@ -2712,6 +2873,9 @@ retrieved_devices_table:
name_temp_area: name_temp_area:
rb 256 rb 256
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
user_selected_name:
rb 256
;---------------------------------------------------------------------
param: param:
rb 256 rb 256
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
@ -2724,6 +2888,9 @@ file_name:
dir_pach: dir_pach:
rb 4096 rb 4096
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
text_work_area:
rb 1024
;---------------------------------------------------------------------
procinfo: procinfo:
process_info: process_info:
rb 1024 rb 1024
@ -2731,4 +2898,3 @@ process_info:
file_info: file_info:
rb 40 rb 40
I_END: I_END:

View File

@ -68,6 +68,16 @@ load_libraries l_libs_start,end_l_libs
; OpenDialog initialisation ; OpenDialog initialisation
init_OpenDialog OpenDialog_data 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 ebx,icons_file_name
; mov esi,path ; mov esi,path
@ -152,8 +162,6 @@ still:
cmp eax,6 cmp eax,6
je mouse je mouse
jmp still jmp still
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
key: key:
mcall 2 mcall 2
@ -267,7 +275,7 @@ analyse_out_menu_1:
cmp eax,dword 4 cmp eax,dword 4
je button.exit je button.exit
jmp still jmp still
;---------------------------------------------------------------------
analyse_out_menu_2: analyse_out_menu_2:
; analyse result of Menu 2 ; analyse result of Menu 2
cmp [menu_data_2.cursor_out],dword 2 cmp [menu_data_2.cursor_out],dword 2
@ -291,7 +299,6 @@ OpenDialog_start:
; mov esi,path ; mov esi,path
; mov edi,library_path ; mov edi,library_path
; call copy_file_path ; call copy_file_path
call get_filter_data
copy_path open_dialog_name,path,library_path,0 copy_path open_dialog_name,path,library_path,0
@ -311,22 +318,6 @@ start_OpenDialog OpenDialog_data
jmp still ; OpenDialog user selected the target file 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: draw_window:
mcall 12,1 mcall 12,1
@ -418,6 +409,9 @@ plugin_pach:
text_work_area: text_work_area:
rb 4096 rb 4096
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
filename_area:
rb 256
;---------------------------------------------------------------------
file_info: file_info:
rb 40 rb 40
;--------------------------------------------------------------------- ;---------------------------------------------------------------------

View File

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

View File

@ -45,6 +45,8 @@ od_start_path equ dword [ebp+24] ; Location path to OpenDialog
od_draw_window equ dword [ebp+28] ; Adress of procedure - draw_window 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_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_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: .init:
pusha pusha
@ -99,7 +101,29 @@ OpenDialog_exit
mov esi,od_dir_default_pach ;communication_area_default_pach mov esi,od_dir_default_pach ;communication_area_default_pach
@@: @@:
call .copy 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 eax,od_com_area_name
mov [start_open_dialog.parameter],eax mov [start_open_dialog.parameter],eax
@ -124,27 +148,69 @@ OpenDialog_exit
test ebx,ebx test ebx,ebx
jz .still jz .still
cmp ebx,3 cmp ebx,3
je .2 ;still je .2
cmp ebx,1 cmp ebx,1
jne .still jne .still
mov esi,od_com_area mov esi,od_com_area
add esi,4 add esi,4
mov edi,od_openfile_pach ;string mov edi,od_openfile_pach
call .copy call .copy
mov od_status,1 mov od_status,1
mov esi,od_openfile_pach mov esi,od_openfile_pach
mov edi,od_opendir_pach mov edi,od_opendir_pach
call .copy_dir_path 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: .2:
mov od_status,0 mov od_status,0
jmp .3 ; still jmp .3
.1: .1:
mov od_status,2 ; thread1 mov od_status,2
.3: .3:
OpenDialog_exit 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: .copy:
xor eax,eax xor eax,eax
cld cld
@ -170,6 +236,10 @@ OpenDialog_exit
stosb stosb
test eax,eax test eax,eax
jnz @b jnz @b
cmp od_type,dword 2
jne @f
ret
@@:
mov esi,edi mov esi,edi
dec esi dec esi
@@: @@:
@ -178,19 +248,6 @@ OpenDialog_exit
cmp al,'/' cmp al,'/'
jnz @b 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 cld
ret ret