From ee74827e6ef2436a7e200fdb27ad1d12c6f7ba43 Mon Sep 17 00:00:00 2001 From: Doczom Date: Thu, 5 Aug 2021 19:52:42 +0000 Subject: [PATCH] KFM: Add function create file git-svn-id: svn://kolibrios.org@9121 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/fs/kfm/trunk/creatfile.inc | 174 ++++++++++++++++++++++++++++ programs/fs/kfm/trunk/key.inc | 6 +- programs/fs/kfm/trunk/kfm.asm | 130 +++++++++++---------- 3 files changed, 244 insertions(+), 66 deletions(-) create mode 100644 programs/fs/kfm/trunk/creatfile.inc diff --git a/programs/fs/kfm/trunk/creatfile.inc b/programs/fs/kfm/trunk/creatfile.inc new file mode 100644 index 0000000000..4447bd3750 --- /dev/null +++ b/programs/fs/kfm/trunk/creatfile.inc @@ -0,0 +1,174 @@ +;------------------------------------------------------------- +create_new_file: + call clear_file_buffer + mov edi, edit1 + mov ed_size, dword 0 + mov ed_pos, dword 0 +default_box + mov [create_dir_name],byte 0 + mcall 66, 1, 0 + jmp .red +.red_1: + call draw_window +.red: + call draw_create_file +.still: + mcall 10 + cmp eax,1 + je .red_1 + cmp eax,2 + je .key_create + cmp eax,3 + je .button_create + mouse_edit_box create_editboxes + jmp .still +;------------------------------------------------------------- +.button_create: + mov eax,17 + mcall + test ah,ah + jz .still + cmp ah,160 + je .exit_with_create + cmp ah,161 + je .exit_without_create + cmp ah,1 + jne .still + mcall -1 +.exit_with_create: + call create_new_file_1 + cmp [select_panel_counter],0 + jne @f + call proc_read_left_folder + jmp .exit_without_create +@@: + call proc_read_right_folder +.exit_without_create: + mcall 66, 1, 1 + jmp red +;------------------------------------------------------------- +.key_create: + mov eax,2 + mcall + cmp ah,13 + je .exit_with_create + cmp ah,27 + je .exit_without_create + key_edit_box create_editboxes + jmp .still +;------------------------------------------------------------- +draw_create_file: + mov ecx,[window_high] + mov ebx,[window_width] + shr ecx,1 + shr ebx,1 + sub ecx,30 + sub ebx,87 + shl ecx,16 + shl ebx,16 + mov cx,60 + mov bx,174 + mcall 13, , ,0x6060ff ;0xff + pusha + shr ebx,16 + add ebx,10 + shr ecx,16 + add ecx,17 + mov eax,create_editboxes + mov dword [eax+4],ebx + mov dword [eax+8],ecx + draw_edit_box create_editboxes + popa + pusha + add ebx,70 shl 16 + add ecx,37 shl 16 + mov cx,15 + mov bx,40 + mov esi,0xffffff + mov edx,0x40000000+160 + mov eax,8 + mcall + add ebx,50 shl 16 + inc edx + mcall + popa + + push ebx ecx + add ebx,70 shl 16 + add ecx,37 shl 16 + mov bx,40 + mov cx,15 + mov edx,0 + push ebx ecx + sub ecx,1 shl 16 + sub ebx,1 shl 16 + mov bx,42 + mov cx,17 + mcall + add ebx,50 shl 16 + mcall + pop ecx ebx + mov edx,0xff7700 + mcall + mov edx,0xaa00 + add ebx,50 shl 16 + mcall + pop ecx ebx + + shr ecx,16 + mov bx,cx + add ebx,30 shl 16+1 + mcall 4, ,0x90ffffff,create_file ;[confirmation_type] + add ebx,48 shl 16+36 + mov edx,type_yes + mcall + add ebx,56 shl 16 + mov edx,type_no + mcall + ret +;------------------------------------------------------------- +create_new_file_1: + mov edx,create_dir_name + cmp [select_panel_counter],0 + jne @f + mov esi,read_folder_name + jmp .start +@@: + mov esi,read_folder_1_name +.start: + mov edi,start_parameter + xor eax,eax +@@: + cld + lodsb + stosb + test eax,eax + jnz @b + mov [edi-1], byte '/' + mov esi,edx + mov [error_pointer], edx ;start_file_data.name +@@: + cld + lodsb + stosb + test eax,eax + jnz @b + call write_file + cmp eax,0 + je @f +; mov ebx,0 +; sub ebx,eax +; mov eax,ebx + call start_error_window_thread +@@: +; call create_directory_f70 + ret +;------------------------------------------------------------- +;clear_file_buffer: +; xor eax,eax +; mov edi,create_dir_name +; mov ecx,256/4 +; cld +; rep stosd +; ret +;------------------------------------------------------------- \ No newline at end of file diff --git a/programs/fs/kfm/trunk/key.inc b/programs/fs/kfm/trunk/key.inc index 83c6e4b390..13e1f15bdb 100644 --- a/programs/fs/kfm/trunk/key.inc +++ b/programs/fs/kfm/trunk/key.inc @@ -632,12 +632,14 @@ f_key_f5: f_key_f6: ;sort_date: cmp [shift_flag],1 - je still + je .shift cmp [ctrl_flag],1 je .ctrl cmp [alt_flag],1 je still jmp move_file_f6 +.shift: + jmp still .ctrl: cmp [select_panel_counter],1 je right_sort_date @@ -668,7 +670,7 @@ f_key_f9: je still cmp [alt_flag],1 je still - jmp create_directory;create_file + jmp create_new_file; create_directory; ;--------------------------------------------------------------------- f_key_f12: cmp [shift_flag],1 diff --git a/programs/fs/kfm/trunk/kfm.asm b/programs/fs/kfm/trunk/kfm.asm index 98e1f8447b..c4ae05e047 100644 --- a/programs/fs/kfm/trunk/kfm.asm +++ b/programs/fs/kfm/trunk/kfm.asm @@ -5,14 +5,14 @@ ; ; Redistribution and use in source and binary forms, with or without ; modification, are permitted provided that the following conditions are met: -; * Redistributions of source code must retain the above copyright -; notice, this list of conditions and the following disclaimer. -; * Redistributions in binary form must reproduce the above copyright -; notice, this list of conditions and the following disclaimer in the -; documentation and/or other materials provided with the distribution. -; * Neither the name of the nor the -; names of its contributors may be used to endorse or promote products -; derived from this software without specific prior written permission. +; * Redistributions of source code must retain the above copyright +; notice, this list of conditions and the following disclaimer. +; * Redistributions in binary form must reproduce the above copyright +; notice, this list of conditions and the following disclaimer in the +; documentation and/or other materials provided with the distribution. +; * Neither the name of the nor the +; names of its contributors may be used to endorse or promote products +; derived from this software without specific prior written permission. ; ; THIS SOFTWARE IS PROVIDED BY Marat Zakiyanov ''AS IS'' AND ANY ; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED @@ -28,23 +28,23 @@ ; KFM v0.47j 12/03/2014 ;--------------------------------------------------------------------- use32 -org 0x0 +org 0x0 - db 'MENUET01' - dd 0x01 - dd START - dd I_END - dd mem - dd stacktop - dd 0x0 - dd path + db 'MENUET01' + dd 0x01 + dd START + dd I_END + dd mem + dd stacktop + dd 0x0 + dd path ;include 'lang.inc' ;include 'kglobals.inc' ;include 'macros.inc' include '../../../macros.inc' -include '../../../config.inc' ;for nightbuild -;include '../../../debug.inc' ;for nightbuild +include '../../../config.inc' ;for nightbuild +;include '../../../debug.inc' ;for nightbuild ;define __DEBUG__ 1 ;define __DEBUG_LEVEL__ 1 @@ -60,10 +60,10 @@ include 'files.inc' STRLEN = 1024 ;--------------------------------------------------------------------- START: - mcall 9,procinfo,-1 - mov ecx,[ebx+30] ; PID - mcall 18,21 - mov [active_process],eax ; WINDOW SLOT + mcall 9,procinfo,-1 + mov ecx,[ebx+30] ; PID + mcall 18,21 + mov [active_process],eax ; WINDOW SLOT mov [appl_memory],mem mov ax,[select_disk_char] mov [read_folder_name],ax @@ -79,29 +79,29 @@ START: call proc_read_left_folder test eax,eax - jz @f + jz @f cmp eax,6 jne read_folder_error @@: call proc_read_right_folder test eax,eax - jz @f + jz @f cmp eax,6 - je @f + je @f ; if /hd read error for start then use /rd mov esi,retrieved_devices_table+1 call copy_folder_name_1 call proc_read_right_folder test eax,eax - jz @f + jz @f cmp eax,6 jne read_folder_1_error @@: - mcall 40, 0x27 - jmp red_1 + mcall 40, 0x27 + jmp red_1 ;--------------------------------------------------------------------- red: call get_window_param @@ -110,12 +110,12 @@ red: test [window_status],100b jnz red_1 cmp [window_high],180 - ja @f + ja @f mov esi,180 mcall 67,-1,ebx,ebx @@: cmp [window_width],495 - ja red_1 + ja red_1 mov edx,495 mcall 67,-1,ebx, ,ebx red_1: @@ -127,41 +127,41 @@ still: call check_active_process_for_clear_all_flags cmp eax,1 - je red + je red cmp eax,2 - je key + je key cmp eax,3 - je button + je button cmp eax,6 - je mouse + je mouse jmp still ;--------------------------------------------------------------------- check_active_process_for_clear_all_flags: - push eax - mcall 18,7 - cmp [active_process],eax - je .exit - - xor eax,eax - cmp [shift_flag],al - jne .clear_all_flags - - cmp [ctrl_flag],al - jne .clear_all_flags - - cmp [ctrl_flag],al - je .exit + push eax + mcall 18,7 + cmp [active_process],eax + je .exit + + xor eax,eax + cmp [shift_flag],al + jne .clear_all_flags + + cmp [ctrl_flag],al + jne .clear_all_flags + + cmp [ctrl_flag],al + je .exit ;-------------------------------------- .clear_all_flags: - mov [shift_flag],al - mov [ctrl_flag],al - mov [alt_flag],al - call erase_fbutton - call draw_fbutton + mov [shift_flag],al + mov [ctrl_flag],al + mov [alt_flag],al + call erase_fbutton + call draw_fbutton ;-------------------------------------- .exit: - pop eax - ret + pop eax + ret ;--------------------------------------------------------------------- get_window_param: mcall 9, procinfo, -1 @@ -177,17 +177,17 @@ get_window_param: ;--------------------------------------------------------------------- draw_window: mcall 12, 1 - xor esi,esi + xor esi,esi mcall 0, <20,728>, <20,460>, 0x43cccccc ; 0x805080D0, 0x005080D0 call get_window_param mcall 71, 1, header_text - test [window_status],100b ; window is rolled up - jnz .exit + test [window_status],100b ; window is rolled up + jnz .exit - test [window_status],10b ; window is minimized to panel - jnz .exit + test [window_status],10b ; window is minimized to panel + jnz .exit ; create_dir_name ; start_parameter @@ -199,12 +199,12 @@ draw_window: ; start_parameter ; start_file_data.name ; read_icon_file.name - ; read_file_features.name ;path ;header + ; read_file_features.name ;path ;header cmp [window_high],180 - jb .exit + jb .exit cmp [window_width],495 - jb .exit + jb .exit call draw_fbutton call draw_left_panel @@ -367,6 +367,8 @@ include 'copy.inc' ;--------------------------------------------------------------------- include 'creatdir.inc' ;--------------------------------------------------------------------- +include 'creatfile.inc' +;--------------------------------------------------------------------- include 'confirm.inc' ;--------------------------------------------------------------------- include 'err_wind.inc'