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

File diff suppressed because it is too large Load Diff

View File

@ -28,232 +28,240 @@
; import_boxlib procedure written by <Lrz> ; import_boxlib procedure written by <Lrz>
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
use32 use32
org 0x0 org 0x0
db 'MENUET01' db 'MENUET01'
dd 0x01 dd 0x01
dd START dd START
dd IM_END dd IM_END
dd I_END dd I_END
dd stacktop dd stacktop
dd 0x0 dd 0x0
dd path dd path
include '../../../../../macros.inc' include '../../../../../macros.inc'
include '../../load_lib.mac' include '../../load_lib.mac'
;include 'macros.inc' ;include 'macros.inc'
;include 'load_lib.mac' ;include 'load_lib.mac'
@use_library @use_library
include 'opendial.mac' include 'opendial.mac'
use_OpenDialog use_OpenDialog
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
;--- Start of program ---------------------------------------------- ;--- Start of program ----------------------------------------------
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
START: START:
mcall 68, 11 mcall 68,11
mcall 66, 1, 1 mcall 66,1,1
mcall 40, 0x27 mcall 40,0x27
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
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
; unpack deflate ; unpack deflate
mov eax,[unpack_DeflateUnpack2] mov eax,[unpack_DeflateUnpack2]
mov [deflate_unpack],eax mov [deflate_unpack],eax
;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 esi,path
; mov edi,file_name
; mov ebx,icons_file_name copy_path icons_file_name,path,library_path,0
; mov esi,path
; mov edi,file_name mcall 70,fileinfo
copy_path icons_file_name,path,library_path,0 mov [fileinfo+0],dword 0
mcall 70, fileinfo
mov [fileinfo+0],dword 0 mov ecx,[file_info+32]
mov [fileinfo+12],ecx
mov [img_size],ecx
mov ecx,[file_info+32] mcall 68,12
mov [fileinfo+12],ecx
mov [img_size],ecx
mcall 68, 12
mov [fileinfo+16],eax mov [fileinfo+16],eax
mov [image_file],eax mov [image_file],eax
mcall 70, fileinfo mcall 70,fileinfo
xor eax,eax xor eax,eax
mov [return_code],eax mov [return_code],eax
mov eax,image_file mov eax,image_file
call [cnv_png_import.Start] call [cnv_png_import.Start]
mov ecx,[image_file] mov ecx,[image_file]
mcall 68, 13, mcall 68,13,
cmp [return_code],dword 0 cmp [return_code],dword 0
jne button.exit jne button.exit
mov ebx,[raw_pointer] mov ebx,[raw_pointer]
mov eax,[ebx+4] 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_x],ax
mov [dinamic_button_data_1.size_y],ax mov [dinamic_button_data_1.size_y],ax
mov [dinamic_button_data_2.size_x],ax mov [dinamic_button_data_2.size_x],ax
mov [dinamic_button_data_2.size_y],ax mov [dinamic_button_data_2.size_y],ax
mov eax,[ebx+12] 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_1.resolution_raw],eax
mov [dinamic_button_data_2.resolution_raw],eax mov [dinamic_button_data_2.resolution_raw],eax
mov eax,[ebx+20] mov eax,[ebx+20]
add eax,ebx 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_1.palette_raw],eax
mov [dinamic_button_data_2.palette_raw],eax mov [dinamic_button_data_2.palette_raw],eax
mov eax,[ebx+28] mov eax,[ebx+28]
add eax,ebx 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_1.passive_raw],eax
mov [dinamic_button_data_2.passive_raw],eax mov [dinamic_button_data_2.passive_raw],eax
mov ecx,[ebx+4] mov ecx,[ebx+4]
imul ecx,[ebx+4] imul ecx,[ebx+4]
imul ecx,[ebx+12] imul ecx,[ebx+12]
shr ecx,3 shr ecx,3
add eax,ecx 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_1.active_raw],eax
mov [dinamic_button_data_2.active_raw],eax mov [dinamic_button_data_2.active_raw],eax
add eax,ecx 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_1.click_raw],eax
mov [dinamic_button_data_2.click_raw],eax mov [dinamic_button_data_2.click_raw],eax
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
red: red:
call draw_window call draw_window
still: still:
mcall 10 mcall 10
cmp eax,1
je red
cmp eax,2
je key
cmp eax,3
je button
cmp eax,6
je mouse
jmp still
cmp eax,1
je red
cmp eax,2
je key
cmp eax,3
je button
cmp eax,6
je mouse
jmp still
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
key: key:
mcall 2 mcall 2
jmp still jmp still
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
button: button:
mcall 17 mcall 17
cmp ah, 1 cmp ah,1
jne still jne still
.exit: .exit:
mcall -1 mcall -1
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
mouse: mouse:
;----------------------------------------------- ;-----------------------------------------------
cmp [scroll_bar_data_horizontal.delta2],0 cmp [scroll_bar_data_horizontal.delta2],0
jne .horizontal jne .horizontal
.vertical: .vertical:
mov eax,[scroll_bar_data_vertical.max_area] mov eax,[scroll_bar_data_vertical.max_area]
cmp eax,[scroll_bar_data_vertical.cur_area] cmp eax,[scroll_bar_data_vertical.cur_area]
jbe .horizontal jbe .horizontal
; mouse event for Vertical ScrollBar ; mouse event for Vertical ScrollBar
push dword scroll_bar_data_vertical push dword scroll_bar_data_vertical
call [scrollbar_ver_mouse] call [scrollbar_ver_mouse]
mov eax,scroll_bar_data_vertical.redraw mov eax,scroll_bar_data_vertical.redraw
xor ebx,ebx xor ebx,ebx
cmp [eax],ebx cmp [eax],ebx
je @f je @f
mov [eax],ebx mov [eax],ebx
jmp .draw_cube jmp .draw_cube
@@: @@:
cmp [scroll_bar_data_vertical.delta2],0 cmp [scroll_bar_data_vertical.delta2],0
jne still jne still
.horizontal: .horizontal:
mov eax,[scroll_bar_data_horizontal.max_area] mov eax,[scroll_bar_data_horizontal.max_area]
cmp eax,[scroll_bar_data_horizontal.cur_area] cmp eax,[scroll_bar_data_horizontal.cur_area]
jbe .other jbe .other
; mouse event for Horizontal ScrollBar ; mouse event for Horizontal ScrollBar
push dword scroll_bar_data_horizontal push dword scroll_bar_data_horizontal
call [scrollbar_hor_mouse] call [scrollbar_hor_mouse]
mov eax,scroll_bar_data_horizontal.redraw mov eax,scroll_bar_data_horizontal.redraw
xor ebx,ebx xor ebx,ebx
cmp [eax],ebx cmp [eax],ebx
je .other je .other
mov [eax],ebx mov [eax],ebx
.draw_cube: .draw_cube:
call draw_cube call draw_cube
jmp still jmp still
.other: .other:
cmp [scroll_bar_data_vertical.delta2],0 cmp [scroll_bar_data_vertical.delta2],0
jne still jne still
cmp [scroll_bar_data_horizontal.delta2],0 cmp [scroll_bar_data_horizontal.delta2],0
jne still jne still
;----------------------------------------------- ;-----------------------------------------------
.menu_bar_1: .menu_bar_1:
call .set_mouse_flag call .set_mouse_flag
@@: @@:
; mouse event for Menu 1 ; mouse event for Menu 1
push dword menu_data_1 push dword menu_data_1
call [menu_bar_mouse] call [menu_bar_mouse]
cmp [menu_data_1.click],dword 1 cmp [menu_data_1.click],dword 1
jne .menu_bar_2 jne .menu_bar_2
cmp [menu_data_1.cursor_out],dword 0 cmp [menu_data_1.cursor_out],dword 0
jne analyse_out_menu_1 jne analyse_out_menu_1
jmp .menu_bar_1 jmp .menu_bar_1
;-------------------------------------------- ;--------------------------------------------
.menu_bar_2: .menu_bar_2:
; mouse event for Menu 2 ; mouse event for Menu 2
push dword menu_data_2 push dword menu_data_2
call [menu_bar_mouse] call [menu_bar_mouse]
cmp [menu_data_2.click],dword 1 cmp [menu_data_2.click],dword 1
jne .mouse_dinamic_button jne .mouse_dinamic_button
cmp [menu_data_2.cursor_out],dword 0 cmp [menu_data_2.cursor_out],dword 0
jne analyse_out_menu_2 jne analyse_out_menu_2
jmp .menu_bar_1 jmp .menu_bar_1
;-------------------------------------------- ;--------------------------------------------
.mouse_dinamic_button: .mouse_dinamic_button:
; mouse event for Dinamic Button 1 ; mouse event for Dinamic Button 1
push dword dinamic_button_data_1 push dword dinamic_button_data_1
call [dinamic_button_mouse] call [dinamic_button_mouse]
mov eax,dinamic_button_data_1.click mov eax,dinamic_button_data_1.click
cmp [eax],dword 1 cmp [eax],dword 1
jne @f jne @f
mov [eax],dword 0 mov [eax],dword 0
jmp about jmp about
@@: @@:
; mouse event for Dinamic Button 2 ; mouse event for Dinamic Button 2
push dword dinamic_button_data_2 push dword dinamic_button_data_2
call [dinamic_button_mouse] call [dinamic_button_mouse]
mov eax,dinamic_button_data_2.click mov eax,dinamic_button_data_2.click
cmp [eax],dword 1 cmp [eax],dword 1
jne still ;@f jne still ;@f
mov [eax],dword 0 mov [eax],dword 0
jmp button.exit jmp button.exit
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
.set_mouse_flag: .set_mouse_flag:
xor eax,eax xor eax,eax
inc eax inc eax
mov [menu_data_1.get_mouse_flag],eax mov [menu_data_1.get_mouse_flag],eax
mov [menu_data_2.get_mouse_flag],eax mov [menu_data_2.get_mouse_flag],eax
ret ret
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
analyse_out_menu_1: analyse_out_menu_1:
; analyse result of Menu 1 ; analyse result of Menu 1
@ -264,19 +272,19 @@ analyse_out_menu_1:
je OpenDialog_start_1 je OpenDialog_start_1
cmp eax,dword 3 cmp eax,dword 3
je OpenDialog_start_2 je OpenDialog_start_2
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
je about je about
jmp still jmp still
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
about: about:
mcall 51,1,thread3,thread mcall 51,1,thread3,thread
jmp still jmp still
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
OpenDialog_start_0: OpenDialog_start_0:
mov [OpenDialog_data.type],0 mov [OpenDialog_data.type],0
@ -291,138 +299,124 @@ 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
start_OpenDialog OpenDialog_data start_OpenDialog OpenDialog_data
cmp [OpenDialog_data.status],2 ; OpenDialog does not start cmp [OpenDialog_data.status],2 ; OpenDialog does not start
je still ; some kind of alternative, instead OpenDialog je still ; some kind of alternative, instead OpenDialog
cmp [OpenDialog_data.status],1 cmp [OpenDialog_data.status],1
jne still ; OpenDialog user say cancel jne still ; OpenDialog user say cancel
; copy path ; copy path
; prepare path - PathShow ; prepare path - PathShow
push dword PathShow_data_1 push dword PathShow_data_1
call [PathShow_prepare] call [PathShow_prepare]
call draw_window call draw_window
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
mcall 0, <0,400>, <0,400>, 0x03AABBCC, 0x805080D0, 0x005080D0 mcall 0,<0,400>,<0,400>,0x03AABBCC,0x805080D0,0x005080D0
mcall 71, 1, header_1 mcall 71,1,header_1
;--------------------------------------------- ;---------------------------------------------
; draw for Menu 1 ; draw for Menu 1
push dword menu_data_1 push dword menu_data_1
call [menu_bar_draw] call [menu_bar_draw]
; draw for Menu 2 ; draw for Menu 2
push dword menu_data_2 push dword menu_data_2
call [menu_bar_draw] call [menu_bar_draw]
;--------------------------------------------- ;---------------------------------------------
; draw for Dinamic Button 1 ; draw for Dinamic Button 1
push dword dinamic_button_data_1 push dword dinamic_button_data_1
call [dinamic_button_draw] call [dinamic_button_draw]
; draw for Dinamic Button 2 ; draw for Dinamic Button 2
push dword dinamic_button_data_2 push dword dinamic_button_data_2
call [dinamic_button_draw] call [dinamic_button_draw]
;--------------------------------------------- ;---------------------------------------------
mcall 13,<170,200>,<25,15>,0xffffb0 mcall 13,<170,200>,<25,15>,0xffffb0
; mov bx,28 ; mov bx,28
; add ebx,2 shl 16 ; add ebx,2 shl 16
; mcall 4,,0xC0000000,text_work_area,,0xffffb0 ; mcall 4,,0xC0000000,text_work_area,,0xffffb0
; draw for PathShow ; draw for PathShow
push dword PathShow_data_1 push dword PathShow_data_1
call [PathShow_draw] call [PathShow_draw]
;--------------------------------------------- ;---------------------------------------------
; set all_redraw flag for draw all ScrollBar ; set all_redraw flag for draw all ScrollBar
; In some cases it is necessity to draw only the area ; In some cases it is necessity to draw only the area
; of moving of a "runner", for acceleration of output - ; of moving of a "runner", for acceleration of output -
; in this case the flag needs to be reset to 0 (zero). ; in this case the flag needs to be reset to 0 (zero).
xor eax,eax xor eax,eax
inc eax inc eax
mov [scroll_bar_data_vertical.all_redraw],eax mov [scroll_bar_data_vertical.all_redraw],eax
mov [scroll_bar_data_horizontal.all_redraw],eax mov [scroll_bar_data_horizontal.all_redraw],eax
; draw for Vertical ScrollBar ; draw for Vertical ScrollBar
push dword scroll_bar_data_vertical push dword scroll_bar_data_vertical
call [scrollbar_ver_draw] call [scrollbar_ver_draw]
; draw for Horizontal ScrollBar ; draw for Horizontal ScrollBar
push dword scroll_bar_data_horizontal push dword scroll_bar_data_horizontal
call [scrollbar_hor_draw] call [scrollbar_hor_draw]
; reset all_redraw flag ; reset all_redraw flag
xor eax,eax xor eax,eax
mov [scroll_bar_data_vertical.all_redraw],eax mov [scroll_bar_data_vertical.all_redraw],eax
mov [scroll_bar_data_horizontal.all_redraw],eax mov [scroll_bar_data_horizontal.all_redraw],eax
;--------------------------------------------- ;---------------------------------------------
call draw_cube call draw_cube
mcall 12, 2 mcall 12,2
ret ret
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
draw_cube: draw_cube:
mcall 13,<30,301>,<50,301>,0xafafaf mcall 13,<30,301>,<50,301>,0xafafaf
mov ecx,[scroll_bar_data_vertical.position] mov ecx,[scroll_bar_data_vertical.position]
add ecx,50 add ecx,50
shl ecx,16 shl ecx,16
mov cx,30 mov cx,30
mov ebx,[scroll_bar_data_horizontal.position] mov ebx,[scroll_bar_data_horizontal.position]
add ebx,30 add ebx,30
shl ebx,16 shl ebx,16
mov bx,30 mov bx,30
mcall 13, , , 0x0 mcall 13,,,0x0
ret ret
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
include 'data.inc' include 'data.inc'
include 'w_about.inc' include 'w_about.inc'
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
IM_END: IM_END:
rb 1024 rb 1024
thread: thread:
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
rb 1024 rb 1024
stacktop: stacktop:
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
path: path:
rb 4096 rb 4096
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
openfile_pach: openfile_pach:
rb 4096 rb 4096
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
file_name: file_name:
library_path: library_path:
rb 4096 rb 4096
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
plugin_pach: plugin_pach:
rb 4096 rb 4096
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
text_work_area: text_work_area:
rb 4096 rb 4096
;---------------------------------------------------------------------
filename_area:
rb 256
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
file_info: file_info:
rb 40 rb 40
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
procinfo: procinfo:
rb 1024 rb 1024
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
I_END: I_END:

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
@ -166,8 +167,8 @@ menu_bar_activate dd aMenu_bar_activate
;Version_FileBrowser dd aVersion_FileBrowser ;Version_FileBrowser dd aVersion_FileBrowser
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

@ -26,29 +26,31 @@
; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;***************************************************************************** ;*****************************************************************************
;***************************************************************************** ;*****************************************************************************
macro OpenDialog_exit macro OpenDialog_exit
{ {
popa popa
ret ret
} }
;***************************************************************************** ;*****************************************************************************
macro use_OpenDialog macro use_OpenDialog
{ {
OpenDialog: OpenDialog:
od_type equ dword [ebp] ; 0-Open, 1-Save, 2-Dir od_type equ dword [ebp] ; 0-Open, 1-Save, 2-Dir
od_procinfo equ dword [ebp+4] ; Process info area for function 9 od_procinfo equ dword [ebp+4] ; Process info area for function 9
od_com_area_name equ dword [ebp+8] ; Name for shared area od_com_area_name equ dword [ebp+8] ; Name for shared area
od_com_area equ dword [ebp+12] ; Adress of shared area od_com_area equ dword [ebp+12] ; Adress of shared area
od_opendir_pach equ dword [ebp+16] ; Temp area the directory for show od_opendir_pach equ dword [ebp+16] ; Temp area the directory for show
od_dir_default_pach equ dword [ebp+20] ; Default path of directory, od_dir_default_pach equ dword [ebp+20] ; Default path of directory,
od_start_path equ dword [ebp+24] ; Location path to OpenDialog 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
mcall 9, od_procinfo, -1 mcall 9,od_procinfo,-1
mov ebx,[ebx+30] mov ebx,[ebx+30]
mov edi,od_com_area_name mov edi,od_com_area_name
add edi,7 add edi,7
@ -72,8 +74,8 @@ od_openfile_pach equ dword [ebp+36] ; Getting path to file
mcall 68,22,od_com_area_name,8192,0x09 mcall 68,22,od_com_area_name,8192,0x09
mov od_com_area,eax mov od_com_area,eax
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
OpenDialog_exit OpenDialog_exit
@ -84,10 +86,10 @@ OpenDialog_exit
mov eax,od_com_area mov eax,od_com_area
test eax,eax test eax,eax
jz .1 jz .1
mov ebx,od_type mov ebx,od_type
mov [eax+2],bx mov [eax+2],bx
mov [eax],word 2 ; folder for open mov [eax],word 2 ; folder for open
mov edi,eax mov edi,eax
add edi,4 add edi,4
@ -96,17 +98,39 @@ OpenDialog_exit
mov al,[esi] mov al,[esi]
test eax,eax test eax,eax
jnz @f jnz @f
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
mov eax,od_start_path mov eax,od_start_path
mov [start_open_dialog.name],eax mov [start_open_dialog.name],eax
mcall 70, start_open_dialog mcall 70,start_open_dialog
shr eax,31 shr eax,31
test eax,eax test eax,eax
jnz .1 jnz .1
@ -116,7 +140,7 @@ OpenDialog_exit
call od_draw_window call od_draw_window
popa popa
.still: .still:
mcall 23, 50 mcall 23,50
cmp eax,1 cmp eax,1
je .red je .red
mov eax,od_com_area mov eax,od_com_area
@ -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
@ -156,54 +222,45 @@ OpenDialog_exit
ret ret
;---------------------------------------------- ;----------------------------------------------
.copy_dir_path: .copy_dir_path:
xor eax,eax xor eax,eax
cmp [esi],al cmp [esi],al
jne @f jne @f
mov [edi],al mov [edi],al
mov [ebx],al mov [ebx],al
xor ebx,ebx xor ebx,ebx
inc ebx inc ebx
ret ret
@@: @@:
cld cld
lodsb lodsb
stosb stosb
test eax,eax test eax,eax
jnz @b jnz @b
mov esi,edi cmp od_type,dword 2
dec esi jne @f
ret
@@: @@:
std mov esi,edi
lodsb dec esi
cmp al,'/' @@:
jnz @b std
lodsb
cmp al,'/'
jnz @b
; push esi mov [esi+1],byte 0
; add esi,2 cld
;; 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
cld
ret ret
;---------------------------------------------- ;----------------------------------------------
align 4 align 4
start_open_dialog: start_open_dialog:
.subfunction dd 7 .subfunction dd 7
.flags dd 0 .flags dd 0
.parameter dd 0 ;od_com_area_name .parameter dd 0 ;od_com_area_name
.reserved1 dd 0 .reserved1 dd 0
.reserved2 dd 0 .reserved2 dd 0
db 0 db 0
.name: dd 0 ;od_start_path .name: dd 0 ;od_start_path
} }
;***************************************************************************** ;*****************************************************************************
macro init_OpenDialog od_ptr macro init_OpenDialog od_ptr