forked from KolibriOS/kolibrios
OpenDialog extension:
1) Open file dialog 2) Save file dialog 3) Select directory dialog git-svn-id: svn://kolibrios.org@1417 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
efabe7d047
commit
fd97893dd7
@ -1,6 +1,6 @@
|
|||||||
;*****************************************************************************
|
;*****************************************************************************
|
||||||
; Open Dialog - for Kolibri OS
|
; Open Dialog - for Kolibri OS
|
||||||
; Copyright (c) 2009, Marat Zakiyanov aka Mario79, aka Mario
|
; Copyright (c) 2009, 2010, Marat Zakiyanov aka Mario79, aka Mario
|
||||||
; All rights reserved.
|
; All rights reserved.
|
||||||
;
|
;
|
||||||
; Redistribution and use in source and binary forms, with or without
|
; Redistribution and use in source and binary forms, with or without
|
||||||
@ -43,6 +43,7 @@ include '../../load_lib.mac'
|
|||||||
include '../../trunk/box_lib.mac'
|
include '../../trunk/box_lib.mac'
|
||||||
;include 'macros.inc'
|
;include 'macros.inc'
|
||||||
;include 'load_lib.mac'
|
;include 'load_lib.mac'
|
||||||
|
;include 'box_lib.mac'
|
||||||
@use_library
|
@use_library
|
||||||
;---------------------------------------------------------------------
|
;---------------------------------------------------------------------
|
||||||
;---------------------------------------------------------------------
|
;---------------------------------------------------------------------
|
||||||
@ -323,12 +324,19 @@ key_ASCII:
|
|||||||
cmp ah,9
|
cmp ah,9
|
||||||
je change_focus_area_Tab_key_ASCII
|
je change_focus_area_Tab_key_ASCII
|
||||||
cmp ah,13
|
cmp ah,13
|
||||||
je .load_dir
|
je .13
|
||||||
cmp ah,27
|
cmp ah,27
|
||||||
je button.exit
|
je button.exit
|
||||||
push dword name_editboxes
|
push dword name_editboxes
|
||||||
call [edit_box_key]
|
call [edit_box_key]
|
||||||
jmp still
|
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]
|
||||||
|
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
|
||||||
@ -513,9 +521,9 @@ button:
|
|||||||
mov eax,[communication_area]
|
mov eax,[communication_area]
|
||||||
test eax,eax
|
test eax,eax
|
||||||
jz @f
|
jz @f
|
||||||
cmp [eax],dword 1
|
cmp [eax],word 1
|
||||||
je @f
|
je @f
|
||||||
mov [eax],dword 3
|
mov [eax],word 3
|
||||||
@@:
|
@@:
|
||||||
mov eax,[N_error]
|
mov eax,[N_error]
|
||||||
test eax,eax
|
test eax,eax
|
||||||
@ -535,6 +543,10 @@ button:
|
|||||||
jmp still
|
jmp still
|
||||||
;---------------------------------------------------------------------
|
;---------------------------------------------------------------------
|
||||||
.open_dir_or_file:
|
.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
|
||||||
xor ebx,ebx
|
xor ebx,ebx
|
||||||
jmp key.7
|
jmp key.7
|
||||||
;---------------------------------------------------------------------
|
;---------------------------------------------------------------------
|
||||||
@ -608,7 +620,7 @@ thread_start:
|
|||||||
draw_error_window:
|
draw_error_window:
|
||||||
mcall 12, 1
|
mcall 12, 1
|
||||||
mcall 0,[error_window_x] ,[error_window_y], 0x03ff0000
|
mcall 0,[error_window_x] ,[error_window_y], 0x03ff0000
|
||||||
mcall 71,1,title
|
call type_title
|
||||||
mcall 4,<10,30>,0x90ffffff,[N_error]
|
mcall 4,<10,30>,0x90ffffff,[N_error]
|
||||||
mov eax,[error_path]
|
mov eax,[error_path]
|
||||||
test eax,eax
|
test eax,eax
|
||||||
@ -886,6 +898,8 @@ get_communication_area:
|
|||||||
jz @f
|
jz @f
|
||||||
mcall 68,22,param,,0x01
|
mcall 68,22,param,,0x01
|
||||||
mov [communication_area],eax
|
mov [communication_area],eax
|
||||||
|
movzx eax,word [eax+2]
|
||||||
|
mov [open_dialog_type],eax
|
||||||
@@:
|
@@:
|
||||||
ret
|
ret
|
||||||
;---------------------------------------------------------------------
|
;---------------------------------------------------------------------
|
||||||
@ -893,7 +907,7 @@ load_start_directory:
|
|||||||
mov eax,[communication_area]
|
mov eax,[communication_area]
|
||||||
test eax,eax
|
test eax,eax
|
||||||
jz @f
|
jz @f
|
||||||
mov ebx,[eax]
|
movzx ebx,word [eax]
|
||||||
test eax,eax
|
test eax,eax
|
||||||
jz @f
|
jz @f
|
||||||
add eax,4
|
add eax,4
|
||||||
@ -1013,9 +1027,11 @@ file_no_folder:
|
|||||||
mov edi,file_name
|
mov edi,file_name
|
||||||
call copy_dir_name
|
call copy_dir_name
|
||||||
|
|
||||||
|
cmp [open_dialog_type],2
|
||||||
|
je @f
|
||||||
mov esi,file_name
|
mov esi,file_name
|
||||||
call copy_dir_path
|
call copy_dir_path
|
||||||
|
@@:
|
||||||
mov eax,[communication_area]
|
mov eax,[communication_area]
|
||||||
test eax,eax
|
test eax,eax
|
||||||
jnz @f
|
jnz @f
|
||||||
@ -1028,7 +1044,7 @@ file_no_folder:
|
|||||||
mov esi,file_name
|
mov esi,file_name
|
||||||
call copy_dir_name
|
call copy_dir_name
|
||||||
mov eax,[communication_area]
|
mov eax,[communication_area]
|
||||||
mov [eax],dword 1
|
mov [eax],word 1
|
||||||
jmp button.exit
|
jmp button.exit
|
||||||
;---------------------------------------------------------------------
|
;---------------------------------------------------------------------
|
||||||
load_root_directory:
|
load_root_directory:
|
||||||
@ -1128,6 +1144,17 @@ memory_get_error:
|
|||||||
mov [N_error],4
|
mov [N_error],4
|
||||||
jmp button.exit
|
jmp button.exit
|
||||||
;---------------------------------------------------------------------
|
;---------------------------------------------------------------------
|
||||||
|
type_title:
|
||||||
|
mov ecx,[open_dialog_type]
|
||||||
|
shl ecx,2
|
||||||
|
add ecx,open_dialog_title_pointer
|
||||||
|
mov ecx,[ecx]
|
||||||
|
test ecx,ecx
|
||||||
|
jz @f
|
||||||
|
mcall 71,1, ; title ;;param ;file_name ;dir_pach
|
||||||
|
@@:
|
||||||
|
ret
|
||||||
|
;---------------------------------------------------------------------
|
||||||
draw_window:
|
draw_window:
|
||||||
|
|
||||||
mcall 12,1
|
mcall 12,1
|
||||||
@ -1136,9 +1163,7 @@ draw_window:
|
|||||||
|
|
||||||
; mov ecx,[communication_area]
|
; mov ecx,[communication_area]
|
||||||
; add ecx,4096+4+4
|
; add ecx,4096+4+4
|
||||||
|
call type_title
|
||||||
mcall 71,1, title ;;param ;file_name ;dir_pach
|
|
||||||
|
|
||||||
call get_window_param
|
call get_window_param
|
||||||
|
|
||||||
mov eax,[window_high]
|
mov eax,[window_high]
|
||||||
@ -1244,7 +1269,18 @@ draw_window:
|
|||||||
shr ecx,16
|
shr ecx,16
|
||||||
mov bx,cx
|
mov bx,cx
|
||||||
add ebx,12 shl 16+ 4
|
add ebx,12 shl 16+ 4
|
||||||
mcall 4,,0x90000000,message_open_button
|
|
||||||
|
mov edx,[open_dialog_type]
|
||||||
|
shl edx,2
|
||||||
|
add edx,message_open_dialog_button
|
||||||
|
mov edx,[edx]
|
||||||
|
|
||||||
|
cmp [open_dialog_type],2 ; Select dir
|
||||||
|
jne @f
|
||||||
|
sub ebx,5 shl 16
|
||||||
|
@@:
|
||||||
|
|
||||||
|
mcall 4,,0x90000000 ;message_open_button
|
||||||
popa
|
popa
|
||||||
|
|
||||||
|
|
||||||
@ -1686,7 +1722,10 @@ delete_unsupported_BDFE:
|
|||||||
@@:
|
@@:
|
||||||
test [eax-40],byte 0x10
|
test [eax-40],byte 0x10
|
||||||
jnz .start
|
jnz .start
|
||||||
|
|
||||||
|
cmp [open_dialog_type],2 ; Select dir
|
||||||
|
je .delete
|
||||||
|
|
||||||
push eax ebx
|
push eax ebx
|
||||||
mov esi,eax
|
mov esi,eax
|
||||||
call search_expansion
|
call search_expansion
|
||||||
@ -2220,6 +2259,18 @@ root1_folder_block dd 0
|
|||||||
temp_counter_1 dd 0
|
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_title_pointer:
|
||||||
|
dd title_0
|
||||||
|
dd title_1
|
||||||
|
dd title_2
|
||||||
|
dd 0
|
||||||
|
|
||||||
|
message_open_dialog_button:
|
||||||
|
dd message_0
|
||||||
|
dd message_1
|
||||||
|
dd message_2
|
||||||
|
dd 0
|
||||||
;---------------------------------------------------------------------
|
;---------------------------------------------------------------------
|
||||||
expansion_length dd 0
|
expansion_length dd 0
|
||||||
;---------------------------------------------------------------------
|
;---------------------------------------------------------------------
|
||||||
@ -2356,17 +2407,26 @@ message:
|
|||||||
message_cancel_button:
|
message_cancel_button:
|
||||||
db 'Cancel',0
|
db 'Cancel',0
|
||||||
|
|
||||||
message_open_button:
|
|
||||||
db 'Open',0
|
|
||||||
|
|
||||||
message_ReloadDir_button:
|
message_ReloadDir_button:
|
||||||
db 'Refresh',0
|
db 'Refresh',0
|
||||||
|
|
||||||
message_ExitDir_button:
|
message_ExitDir_button:
|
||||||
db '^',0
|
db '^',0
|
||||||
|
|
||||||
title:
|
message_0:
|
||||||
|
db 'Open',0
|
||||||
|
message_1:
|
||||||
|
db 'Save',0
|
||||||
|
message_2:
|
||||||
|
db 'Select',0
|
||||||
|
|
||||||
|
|
||||||
|
title_0:
|
||||||
db 'Open Dialog',0
|
db 'Open Dialog',0
|
||||||
|
title_1:
|
||||||
|
db 'Save Dialog',0
|
||||||
|
title_2:
|
||||||
|
db 'Select Dir',0
|
||||||
;---------------------------------------------------------------------
|
;---------------------------------------------------------------------
|
||||||
align 4
|
align 4
|
||||||
menu_data_1:
|
menu_data_1:
|
||||||
|
@ -259,10 +259,14 @@ analyse_out_menu_1:
|
|||||||
; analyse result of Menu 1
|
; analyse result of Menu 1
|
||||||
mov eax,[menu_data_1.cursor_out]
|
mov eax,[menu_data_1.cursor_out]
|
||||||
cmp eax,dword 1
|
cmp eax,dword 1
|
||||||
je OpenDialog_start
|
je OpenDialog_start_0
|
||||||
cmp eax,dword 3
|
cmp eax,dword 2
|
||||||
je button.exit
|
je OpenDialog_start_1
|
||||||
jmp still
|
cmp eax,dword 3
|
||||||
|
je OpenDialog_start_2
|
||||||
|
cmp eax,dword 4
|
||||||
|
je button.exit
|
||||||
|
jmp still
|
||||||
|
|
||||||
analyse_out_menu_2:
|
analyse_out_menu_2:
|
||||||
; analyse result of Menu 2
|
; analyse result of Menu 2
|
||||||
@ -274,6 +278,14 @@ analyse_out_menu_2:
|
|||||||
mcall 51,1,thread3,thread
|
mcall 51,1,thread3,thread
|
||||||
jmp still
|
jmp still
|
||||||
;---------------------------------------------------------------------
|
;---------------------------------------------------------------------
|
||||||
|
OpenDialog_start_0:
|
||||||
|
mov [OpenDialog_data.type],0
|
||||||
|
jmp OpenDialog_start
|
||||||
|
OpenDialog_start_1:
|
||||||
|
mov [OpenDialog_data.type],1
|
||||||
|
jmp OpenDialog_start
|
||||||
|
OpenDialog_start_2:
|
||||||
|
mov [OpenDialog_data.type],2
|
||||||
OpenDialog_start:
|
OpenDialog_start:
|
||||||
; mov ebx,open_dialog_name
|
; mov ebx,open_dialog_name
|
||||||
; mov esi,path
|
; mov esi,path
|
||||||
|
@ -316,8 +316,9 @@ menu_data_1:
|
|||||||
menu_text_area:
|
menu_text_area:
|
||||||
db 'File',0
|
db 'File',0
|
||||||
.1:
|
.1:
|
||||||
db 'OpenDialog',0
|
db 'Open file',0
|
||||||
db 'Test1',0
|
db 'Save file',0
|
||||||
|
db 'Select dir',0
|
||||||
db 'Exit',0
|
db 'Exit',0
|
||||||
.end:
|
.end:
|
||||||
db 0
|
db 0
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
;*****************************************************************************
|
;*****************************************************************************
|
||||||
; Macro for use Open Dialog - for Kolibri OS
|
; Macro for use Open Dialog - for Kolibri OS
|
||||||
; Copyright (c) 2009, Marat Zakiyanov aka Mario79, aka Mario
|
; Copyright (c) 2009 2010, Marat Zakiyanov aka Mario79, aka Mario
|
||||||
; All rights reserved.
|
; All rights reserved.
|
||||||
;
|
;
|
||||||
; Redistribution and use in source and binary forms, with or without
|
; Redistribution and use in source and binary forms, with or without
|
||||||
@ -35,16 +35,16 @@ ret
|
|||||||
macro use_OpenDialog
|
macro use_OpenDialog
|
||||||
{
|
{
|
||||||
OpenDialog:
|
OpenDialog:
|
||||||
od_type equ dword [ebp]
|
od_type equ dword [ebp] ; 0-Open, 1-Save, 2-Dir
|
||||||
od_procinfo equ dword [ebp+4]
|
od_procinfo equ dword [ebp+4] ; Process info area for function 9
|
||||||
od_com_area_name equ dword [ebp+8]
|
od_com_area_name equ dword [ebp+8] ; Name for shared area
|
||||||
od_com_area equ dword [ebp+12]
|
od_com_area equ dword [ebp+12] ; Adress of shared area
|
||||||
od_opendir_pach equ dword [ebp+16]
|
od_opendir_pach equ dword [ebp+16] ; Temp area the directory for show
|
||||||
od_dir_default_pach equ dword [ebp+20]
|
od_dir_default_pach equ dword [ebp+20] ; Default path of directory,
|
||||||
od_start_path equ dword [ebp+24]
|
od_start_path equ dword [ebp+24] ; Location path to OpenDialog
|
||||||
od_draw_window equ dword [ebp+28]
|
od_draw_window equ dword [ebp+28] ; Adress of procedure - draw_window
|
||||||
od_status equ dword [ebp+32]
|
od_status equ dword [ebp+32] ; 0-Cancel, 1-Get path OK, 2-Use alternatives
|
||||||
od_openfile_pach equ dword [ebp+36]
|
od_openfile_pach equ dword [ebp+36] ; Getting path to file
|
||||||
;*****************************************************************************
|
;*****************************************************************************
|
||||||
.init:
|
.init:
|
||||||
pusha
|
pusha
|
||||||
@ -52,7 +52,6 @@ od_openfile_pach equ dword [ebp+36]
|
|||||||
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
|
||||||
; mov edi,communication_area_name+7
|
|
||||||
std
|
std
|
||||||
mov ecx,4
|
mov ecx,4
|
||||||
@@:
|
@@:
|
||||||
@ -80,7 +79,10 @@ OpenDialog_exit
|
|||||||
mov eax,od_com_area
|
mov eax,od_com_area
|
||||||
test eax,eax
|
test eax,eax
|
||||||
jz .1
|
jz .1
|
||||||
mov [eax],dword 2 ; folder for open
|
mov ebx,od_type
|
||||||
|
mov [eax+2],bx
|
||||||
|
|
||||||
|
mov [eax],word 2 ; folder for open
|
||||||
mov edi,eax
|
mov edi,eax
|
||||||
add edi,4
|
add edi,4
|
||||||
|
|
||||||
@ -113,7 +115,7 @@ OpenDialog_exit
|
|||||||
cmp eax,1
|
cmp eax,1
|
||||||
je .red
|
je .red
|
||||||
mov eax,od_com_area
|
mov eax,od_com_area
|
||||||
mov ebx,[eax]
|
movzx ebx,word [eax]
|
||||||
test ebx,ebx
|
test ebx,ebx
|
||||||
jz .still
|
jz .still
|
||||||
cmp ebx,3
|
cmp ebx,3
|
||||||
|
Loading…
Reference in New Issue
Block a user