From 45d0c69fdd553e7bcc3e2c141c8b5621ce830e0f Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Mon, 9 Mar 2015 18:49:34 +0000 Subject: [PATCH] Eolite 2.65: better copying window (sparate GUI and functionality, show copy file icon, "Abort" button) git-svn-id: svn://kolibrios.org@5514 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/cmm/eolite/Eolite.c | 26 ++++++---- programs/cmm/eolite/include/copy.h | 60 +++++++++++++++--------- programs/cmm/eolite/include/properties.h | 6 +-- 3 files changed, 58 insertions(+), 34 deletions(-) diff --git a/programs/cmm/eolite/Eolite.c b/programs/cmm/eolite/Eolite.c index ded41fca36..32bf71fb33 100644 --- a/programs/cmm/eolite/Eolite.c +++ b/programs/cmm/eolite/Eolite.c @@ -39,11 +39,13 @@ ?define NOT_CREATE_FOLDER "Не удалось создать папку." ?define NOT_CREATE_FILE "Не удалось создать файл." ?define ERROR_1 "Ошибка при загрузке библиотеки /rd/1/lib/box_lib.obj" - ?define T_PASTE_WINDOW "Копирую..." + ?define T_PASTE_WINDOW_TITLE "Копирую..." ?define T_PASTE_WINDOW_TEXT "Копируется файл:" + ?define T_PASTE_WINDOW_BUTTON "Прервать" + ?define INFO_AFTER_COPY "Копирование завершено" ?define T_CANCEL_PASTE "Копирование прекращено. Папка скопирована не полностью." ?define T_SELECT_APP_TO_OPEN_WITH "Выберите программу для открытия файла" - ?define DEL_MORE_FILES_1 "эти элементы (" + ?define DEL_MORE_FILES_1 "выбранные элементы (" ?define DEL_MORE_FILES_2 " шт.)?" #elif LANG_EST ?define T_FILE "Fail" @@ -59,12 +61,14 @@ ?define NOT_CREATE_FOLDER "Kataloogi ei saa luua." ?define NOT_CREATE_FILE "Faili ei saa luua." ?define ERROR_1 "Viga teegi laadimisel /rd/1/lib/box_lib.obj" - ?define T_PASTE_WINDOW "Kopeerin..." + ?define T_PASTE_WINDOW_TITLE "Kopeerin..." ?define T_PASTE_WINDOW_TEXT "Kopeerin faili:" + ?define T_PASTE_WINDOW_BUTTON "Abort" + ?define INFO_AFTER_COPY "Copy finished" ?define T_CANCEL_PASTE "Copy process terminated. Folder copied incompletely." ?define T_SELECT_APP_TO_OPEN_WITH "Select application to open file" - ?define DEL_MORE_FILES_1 "эти элементы (" - ?define DEL_MORE_FILES_2 " шт.)?" + ?define DEL_MORE_FILES_1 "selected items(" + ?define DEL_MORE_FILES_2 " pcs.)?" #else ?define T_FILE "File" ?define T_TYPE "Type" @@ -79,18 +83,20 @@ ?define NOT_CREATE_FOLDER "Folder can not be created." ?define NOT_CREATE_FILE "File can not be created." ?define ERROR_1 "Error while loading library /rd/1/lib/box_lib.obj" - ?define T_PASTE_WINDOW "Copying..." + ?define T_PASTE_WINDOW_TITLE "Copying..." ?define T_PASTE_WINDOW_TEXT "Copying file:" + ?define T_PASTE_WINDOW_BUTTON "Abort" + ?define INFO_AFTER_COPY "Copy finished" ?define T_CANCEL_PASTE "Copy process terminated. Folder copied incompletely." ?define T_SELECT_APP_TO_OPEN_WITH "Select application to open file" - ?define DEL_MORE_FILES_1 "эти элементы (" - ?define DEL_MORE_FILES_2 " шт.)?" + ?define DEL_MORE_FILES_1 "selected items(" + ?define DEL_MORE_FILES_2 " pcs.)?" #endif enum {ONLY_SHOW, WITH_REDRAW, ONLY_OPEN}; //OpenDir -#define TITLE "Eolite File Manager v2.64" -#define ABOUT_TITLE "Eolite v2.64" +#define TITLE "Eolite File Manager v2.65" +#define ABOUT_TITLE "Eolite v2.65" dword col_padding, col_selec, col_lpanel; int toolbar_buttons_x[7]={9,46,85,134,167,203}; diff --git a/programs/cmm/eolite/include/copy.h b/programs/cmm/eolite/include/copy.h index fca98acde0..94636c787b 100644 --- a/programs/cmm/eolite/include/copy.h +++ b/programs/cmm/eolite/include/copy.h @@ -1,14 +1,6 @@ -//Leency 2008-2014 - -#ifdef LANG_RUS - ?define INFO_AFTER_COPY "Копирование завершено" -#elif LANG_EST - ?define INFO_AFTER_COPY "Copy finished" -#else - ?define INFO_AFTER_COPY "Copy finished" -#endif byte copy_to[4096]; +byte copy_from[4096]; byte cut_active=0; enum {NOCUT, CUT, COPY_PASTE_END}; @@ -53,25 +45,18 @@ void Copy(dword pcth, char cut) free(buff_data); } -void copyf_Draw_Progress(dword filename) { - DrawRectangle(0,0,WIN_COPY_W-5, 15,sc.work); - WriteText(5,8, 0x80, sc.work_text, T_PASTE_WINDOW_TEXT); - DrawBar(5, 26, WIN_COPY_W-10, 10, sc.work); - WriteText(5,26, 0x80, sc.work_text, filename); -} void Paste() { char copy_rezult; - byte copy_from[4096]; int j; - int cnt = 0; + int cnt = 0; dword buf; buf = clipboard.GetSlotData(clipboard.GetSlotCount()-1); - if (DSDWORD[buf+4] != 3) return; + if (DSDWORD[buf+4] != 3) return; cnt = ESINT[buf+8]; - for (j = 0; j < cnt; j++) { + for (j = 0; j < cnt; j++) { strlcpy(#copy_from, j*4096+buf+10, 4096); if (!copy_from) CopyExit(); strcpy(#copy_to, #path); @@ -87,11 +72,13 @@ void Paste() notify("Copy directory into itself is a bad idea..."); CopyExit(); } + + DisplayCopyfForm(); + if (copy_rezult = copyf(#copy_from,#copy_to)) { Write_Error(copy_rezult); } - else if (cut_active) { strcpy(#file_path, #copy_from); @@ -107,9 +94,40 @@ void Paste() CopyExit(); } -void CopyExit() +#define WIN_COPY_W 345 +#define WIN_COPY_H 80 +proc_info Copy_Form; + +void DisplayCopyfForm() { + switch(CheckEvent()) + { + case evButton: + notify(T_CANCEL_PASTE); + CopyExit(); + break; + + case evReDraw: + DefineAndDrawWindow(Form.left+Form.width-200,Form.top+90,WIN_COPY_W,GetSkinHeight()+WIN_COPY_H,0x34,sc.work,T_PASTE_WINDOW_TITLE); + GetProcessInfo(#Copy_Form, SelfInfo); + WriteText(45, 11, 0x80, sc.work_text, T_PASTE_WINDOW_TEXT); + DrawFlatButton(Copy_Form.cwidth - 90, Copy_Form.cheight - 32, 80, 22, 10, sc.work_button, T_PASTE_WINDOW_BUTTON); + DrawBar(8, 10, 32, 32, 0xFFFfff); + break; + } +} + +void CopyExit() { action_buf = COPY_PASTE_END; ActivateWindow(GetProcessSlot(Form.ID)); ExitProcess(); +} + + +void copyf_Draw_Progress(dword copying_filename) { + if (Copy_Form.cwidth==0) return; + DisplayCopyfForm(); + Put_icon(copying_filename+strrchr(copying_filename,'.'), 16, 19, 0xFFFfff, 0); + DrawBar(45, 29, Copy_Form.cwidth-40, 10, sc.work); + WriteText(45, 29, 0x80, sc.work_text, copying_filename); } \ No newline at end of file diff --git a/programs/cmm/eolite/include/properties.h b/programs/cmm/eolite/include/properties.h index 25f809fab6..3d324860f5 100644 --- a/programs/cmm/eolite/include/properties.h +++ b/programs/cmm/eolite/include/properties.h @@ -170,7 +170,7 @@ void properties_dialog() if (selected_count) { - Put_icon('', 18, 20, 0xFFFfff, 0); + Put_icon('', 18, 19, 0xFFFfff, 0); strcpy(#folder_info, SET_6); strcat(#folder_info, itoa(file_count)); strcat(#folder_info, SET_7); @@ -186,9 +186,9 @@ void properties_dialog() else { if ( file_info_general.isfolder ) - Put_icon("", 18, 20, 0xFFFfff, 0); + Put_icon("", 18, 19, 0xFFFfff, 0); else - Put_icon(#file_name2+strrchr(#file_name2,'.'), 18, 20, 0xFFFfff, 0); + Put_icon(#file_name2+strrchr(#file_name2,'.'), 18, 19, 0xFFFfff, 0); WriteText(50, 13, 0x80, 0x000000, PR_T_NAME); edit_box_draw stdcall (#file_name_ed);