From 2e36ea6cf7836f2b9f83c3c9ac37f1c238588e5b Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Tue, 2 Apr 2013 13:33:32 +0000 Subject: [PATCH] Eolite: better menu selection, F5 / Tmpdisk: small fix, less debug / Installer: fixes, copyf() unification git-svn-id: svn://kolibrios.org@3440 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/cmm/eolite/Eolite.c | 20 ++-- programs/cmm/eolite/include/file_menu.h | 4 +- programs/cmm/eolite/include/left_panel.h | 2 +- programs/cmm/installer/installation.c | 13 +-- programs/cmm/installer/main.c | 1 - programs/cmm/lib/copyf.h | 124 ++++++++++---------- programs/cmm/lib/file_system.h | 137 ++++++++++------------- programs/cmm/tmpdisk/tmpdisk.c | 5 +- 8 files changed, 146 insertions(+), 160 deletions(-) diff --git a/programs/cmm/eolite/Eolite.c b/programs/cmm/eolite/Eolite.c index 9591d03f7b..05ce335d14 100644 --- a/programs/cmm/eolite/Eolite.c +++ b/programs/cmm/eolite/Eolite.c @@ -24,8 +24,8 @@ #define WITH_REDRAW 1 #define ONLY_OPEN 2 -#define TITLE "Eolite File Manager v1.8" -#define ABOUT_TITLE "Eolite v1.80" +#define TITLE "Eolite File Manager v1.81" +#define ABOUT_TITLE "Eolite v1.81" dword col_work = 0xE4DFE1; dword col_border = 0x819FC5; dword col_padding = 0xC8C9C9; @@ -221,14 +221,6 @@ void main() sort_num=id-30; Open_Dir(#path,WITH_REDRAW); break; - case 78: //rescan devices - Tip(56, "Devices", 78, "-"); - pause(10); - GetIni(1); - SystemDiscsGet(); - Open_Dir(#path,WITH_REDRAW); - DrawLeftPanel(); - break; case 50...60: //Actions ActionsProcess(id-50); break; @@ -770,8 +762,14 @@ void ActionsProcess(char N) case 4: IF (!isdir) RunProgram("/sys/develop/heed", #file_path); break; - case 5: + case 5: //refresh cur dir & devs + Tip(56, "Devices", 55, "-"); + Open_Dir(#path,WITH_REDRAW); + pause(10); + GetIni(1); + SystemDiscsGet(); Open_Dir(#path,1); + DrawLeftPanel(); break; case 6: strcpy(#temp, #path); diff --git a/programs/cmm/eolite/include/file_menu.h b/programs/cmm/eolite/include/file_menu.h index d522d0feb7..4d13e4758c 100644 --- a/programs/cmm/eolite/include/file_menu.h +++ b/programs/cmm/eolite/include/file_menu.h @@ -7,6 +7,7 @@ char *captions[] = { "View as HEX", "F4", "Rename", "F2", "Delete", "Del", + //"Refresh", "F5", 0}; void FileMenu() @@ -32,7 +33,7 @@ void FileMenu() if (slot != GetActiveProcess()) ExitProcess(); mm.get(); newi = mm.y - 1 / lineh; - //if (m.y<0) || (newi+1>items_num) || (m.x<0) || (m.x>ITEM_WIDTH) break; + if (mm.y<=0) || (mm.y>ccount*lineh+5) || (mm.x<0) || (mm.x>linew) newi=-1; if (cur<>newi) { cur=newi; @@ -48,6 +49,7 @@ void FileMenu() if (id==103) ActionsProcess(4); if (id==104) ActionsProcess(2); if (id==105) Del_Form(); + if (id==106) ActionsProcess(5); ExitProcess(); break; diff --git a/programs/cmm/eolite/include/left_panel.h b/programs/cmm/eolite/include/left_panel.h index 0f4b9a1477..8ebe6abb35 100644 --- a/programs/cmm/eolite/include/left_panel.h +++ b/programs/cmm/eolite/include/left_panel.h @@ -51,7 +51,7 @@ void SystemDiscsDraw() char dev_name[10], disc_name[100]; int i, dev_icon; - Tip(56, "Devices", 78, "="); + Tip(56, "Devices", 55, "="); for (i=0; i<20; i++) DeleteButton(100+i); for (i=0;i'/') //абсолютный путь? - { - strcpy(#from, #program_path); - strcat(#from, params); - from[border+strlen(#program_path)-1]=NULL; - } + dword error; + BDVK CopyFile_atr1; + if (!from1) || (!in1) { notify("Error: too less copyf params!"); notify(from1); notify(in1); return; } + error = GetFileInfo(from1, #CopyFile_atr1); + if (error) + debug("Error: copyf->GetFileInfo"); else - { - strcat(#from, params); - from[border-1]=NULL; - } - strcpy(#to, params+border); - - GetFileInfo(#from, #from_atr); - if (TestBit(from_atr.attr, 4)==1) - CopyFolder(#from, #to); - else - CopyFile(#from, #to); + if (isdir(from1)) CopyFolder(from1, in1); else CopyFile(from1, in1); } +:int CopyFile(dword copy_from3, copy_in3) +{ + BDVK CopyFile_atr; + dword error, cbuf; + debug(copy_from3); + error = GetFileInfo(copy_from3, #CopyFile_atr); + if (error) + {debug("Error: CopyFile->GetFileInfo"); debug(copy_from3);} + else + { + cbuf = malloc(CopyFile_atr.sizelo); + error = ReadFile(0, CopyFile_atr.sizelo, cbuf, copy_from3); + if (error) + debug("Error: CopyFile->ReadFile"); + else + { + error = WriteFile(CopyFile_atr.sizelo, cbuf, copy_in3); + if (error) debug("Error: CopyFile->WriteFile"); + } + } + free(cbuf); + if (error) debug(copy_from3); + return error; +} -void CopyFolder(dword from, to) +:void CopyFolder(dword from2, in2) { dword dirbuf, fcount, filename; int i, error, isdir; - char copy_from[4096], copy_in[4096]; - char from2[4096], to2[4096]; + char copy_from2[4096], copy_in2[4096]; - error = GetDir(#dirbuf, #fcount, from); - if (error) { debug_error(from, error); return; } - - if ((strcmp(to, "/sys")!=0) && (strcmp(to, "/tmp9/1")!=0)) + error = GetDir(#dirbuf, #fcount, from2); + if (error) { - error = CreateDir(to); - if (error) debug_error(to, error); + debug("Error: CopyFolder->GetDir"); + debug_error(from2, error); + debug_error(in2, error); + free(dirbuf); + return; } - chrcat(to, '/'); - chrcat(from, '/'); + + if ((strcmp(in2, "/sys")!=0) && (strcmp(in2, "/tmp9/1")!=0)) + { + error = CreateDir(in2); + if (error) debug_error(in2, error); + } + chrcat(in2, '/'); + chrcat(from2, '/'); for (i=0; i