From 1603a31044aa847116cc09612060cc5d5bd4f0d8 Mon Sep 17 00:00:00 2001 From: Serhii Sakhno Date: Wed, 26 Mar 2014 12:51:42 +0000 Subject: [PATCH] Eolite 2.17: copy multiple files / directories git-svn-id: svn://kolibrios.org@4698 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/cmm/eolite/Eolite.c | 14 ++++-- programs/cmm/eolite/include/copy.h | 68 ++++++++++++++++++++++-------- 2 files changed, 60 insertions(+), 22 deletions(-) diff --git a/programs/cmm/eolite/Eolite.c b/programs/cmm/eolite/Eolite.c index cde8b437a0..8b5289ce97 100644 --- a/programs/cmm/eolite/Eolite.c +++ b/programs/cmm/eolite/Eolite.c @@ -80,8 +80,8 @@ enum {ONLY_SHOW, WITH_REDRAW, ONLY_OPEN}; //OpenDir -#define TITLE "Eolite File Manager v2.16.2" -#define ABOUT_TITLE "Eolite v2.16.2" +#define TITLE "Eolite File Manager v2.17" +#define ABOUT_TITLE "Eolite v2.17" dword col_padding, col_selec, col_lpanel; int toolbar_buttons_x[7]={9,46,85,134,167,203}; @@ -305,9 +305,11 @@ void main() Dir_Up(); break; case 24: //cut + add_to_copy(#file_path); Copy(#file_path, CUT); break; case 25: //copy + add_to_copy(#file_path); Copy(#file_path, NOCUT); break; case 26: //paste @@ -385,9 +387,11 @@ void main() RunProgram("/sys/File Managers/Eolite", #path); break; case 024: //Ctrl+X + add_to_copy(#file_path); Copy(#file_path, CUT); break; case 003: //Ctrl+C + add_to_copy(#file_path); Copy(#file_path, NOCUT); break; case 022: //Ctrl+V @@ -429,6 +433,9 @@ void main() case 182: //del Del_Form(); break; + case 185: //ins + add_to_copy(#file_path); + break; case 050...059: //F1-F10 FnProcess(key-49); break; @@ -594,7 +601,6 @@ void Line_ReDraw(dword color, filenum){ name_len=0, attr, y=filenum*files.line_h+files.y; - if (filenum==-1) return; DrawBar(files.x,y,3,files.line_h,color); DrawBar(files.x+19,y,files.w-19,files.line_h,color); DrawBar(files.x+3,y+17,16,1,color); @@ -607,7 +613,7 @@ void Line_ReDraw(dword color, filenum){ if (! TestBit(attr, 4) ) //file or folder? { Put_icon(off+_strrchr(off,'.'), files.x+3, files.line_h/2-7+y, color, 0); - WriteText(7-strlen(ConvertSize(ESDWORD[off-8]))*6+onLeft(75,0),files.line_h-6/2+y,0x80,0,ConvertSize(ESDWORD[off-8])); //size + WriteText(7-strlen(ConvertMemSize(ESDWORD[off-8]))*6+onLeft(75,0),files.line_h-6/2+y,0x80,0,ConvertMemSize(ESDWORD[off-8])); //size } else if (!strcmp("..",off)) diff --git a/programs/cmm/eolite/include/copy.h b/programs/cmm/eolite/include/copy.h index 27b9045c39..f0d2f55758 100644 --- a/programs/cmm/eolite/include/copy.h +++ b/programs/cmm/eolite/include/copy.h @@ -2,18 +2,39 @@ byte copy_to[4096]; byte cut_active=0; +byte id_add_to_copy=0; +byte add_to_copy_active=0; enum {NOCUT, CUT, COPY_PASTE_END}; +struct path_str { + char Item[4096]; +}; + +#define MAX_HISTORY_NUM 10 + Clipboard clipboard; +struct Copy_Path { + dword size; + dword type; + path_str copy_list[MAX_HISTORY_NUM]; +}; + +Copy_Path copy_path; + +void add_to_copy(dword pcth) +{ + add_to_copy_active=1; + strlcpy(#copy_path.copy_list[id_add_to_copy].Item, pcth); + id_add_to_copy++; +} + void Copy(dword pcth, char cut) { - clipboard.data.size = sizeof(buffer_data); - clipboard.data.type = 0; - clipboard.data.encoding = 1; - strcpy(#clipboard.data.buffer_data, pcth); - clipboard.SetSlotData(sizeof(buffer_data), #clipboard.data); + copy_path.type = 3; + copy_path.size = sizeof(copy_path); + clipboard.SetSlotData(sizeof(copy_path), #copy_path); cut_active = cut; } @@ -36,22 +57,30 @@ void Paste() { char copy_rezult; byte copy_from[4096]; + int tst; - strcpy(#copy_from, clipboard.GetSlotData(clipboard.GetSlotCount()-1)+12); - - if (!copy_from) ExitProcess(); - strcpy(#copy_to, #path); - strcat(#copy_to, #copy_from+strrchr(#copy_from,'/')); - if (!strcmp(#copy_from,#copy_to)) - { + for (j = 0; j < MAX_HISTORY_NUM; j++) { + tst = j*4096; + strlcpy(#copy_from, clipboard.GetSlotData(clipboard.GetSlotCount()-1)+8+tst, 4096); + debug(#copy_from); + if (!copy_from) ExitProcess(); strcpy(#copy_to, #path); - strcat(#copy_to, "new_"); strcat(#copy_to, #copy_from+strrchr(#copy_from,'/')); - } - if (strstr(#copy_to, #copy_from)) - { - notify("Copy directory into itself is a bad idea..."); - ExitProcess(); + if (!strcmp(#copy_from,#copy_to)) + { + strcpy(#copy_to, #path); + strcat(#copy_to, "new_"); + strcat(#copy_to, #copy_from+strrchr(#copy_from,'/')); + } + if (strstr(#copy_to, #copy_from)) + { + notify("Copy directory into itself is a bad idea..."); + ExitProcess(); + } + if (copy_rezult = copyf(#copy_from,#copy_to)) + { + Write_Error(copy_rezult); + } } if (copy_rezult = copyf(#copy_from,#copy_to)) { @@ -63,7 +92,10 @@ void Paste() Del_File(true); cut_active=false; } + for (j = 0; j < MAX_HISTORY_NUM; j++) strcpy(#copy_path.copy_list[j].Item, 0); action_buf = COPY_PASTE_END; + add_to_copy_active=0; + id_add_to_copy=0; ActivateWindow(GetProcessSlot(Form.ID)); ExitProcess(); }