Eolite 1.97.7: new message style, short menu for folders, simple message while deleting folder (need to fix redraw)

git-svn-id: svn://kolibrios.org@3997 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2013-10-09 22:46:17 +00:00
parent 14c88125a7
commit 9747cd3910
3 changed files with 101 additions and 93 deletions

View File

@ -31,7 +31,7 @@
?define T_YES "„ " ?define T_YES "„ "
?define T_NO "<EFBFBD>¥â" ?define T_NO "<EFBFBD>¥â"
?define T_DEL_ERROR_1 "Žè¨¡ª . <20> ¯ª  ­¥ ¯ãáâ ï." ?define T_DEL_ERROR_1 "Žè¨¡ª . <20> ¯ª  ­¥ ¯ãáâ ï."
?define T_DEL_ERROR_2 "Žè¨¡ª . ” ©«®¢ ï á¨á⥬  ⮫쪮 ¤«ï ç⥭¨ï." ?define WAIT_DELETING_FOLDER "“¤ «ï¥âáï ¯ ¯ª . <20>®¤®¦¨â¥..."
?define NOT_CREATE_FOLDER "<EFBFBD>¥ 㤠«®áì ᮧ¤ âì ¯ ¯ªã." ?define NOT_CREATE_FOLDER "<EFBFBD>¥ 㤠«®áì ᮧ¤ âì ¯ ¯ªã."
?define NOT_CREATE_FILE "<EFBFBD>¥ 㤠«®áì ᮧ¤ âì ä ©«." ?define NOT_CREATE_FILE "<EFBFBD>¥ 㤠«®áì ᮧ¤ âì ä ©«."
?define ERROR_1 "Žè¨¡ª  ¯à¨ § £à㧪¥ ¡¨¡«¨®â¥ª¨ /rd/1/lib/box_lib.obj" ?define ERROR_1 "Žè¨¡ª  ¯à¨ § £à㧪¥ ¡¨¡«¨®â¥ª¨ /rd/1/lib/box_lib.obj"
@ -47,7 +47,7 @@
?define T_YES "Jah" ?define T_YES "Jah"
?define T_NO "Ei" ?define T_NO "Ei"
?define T_DEL_ERROR_1 "Viga. Kataloog ei ole tühi." ?define T_DEL_ERROR_1 "Viga. Kataloog ei ole tühi."
?define T_DEL_ERROR_2 "Viga. Failisüsteem ainult loetav." ?define WAIT_DELETING_FOLDER "Deleting folder. Please, wait..."
?define NOT_CREATE_FOLDER "Kataloogi ei saa luua." ?define NOT_CREATE_FOLDER "Kataloogi ei saa luua."
?define NOT_CREATE_FILE "Faili ei saa luua." ?define NOT_CREATE_FILE "Faili ei saa luua."
?define ERROR_1 "Viga teegi laadimisel /rd/1/lib/box_lib.obj" ?define ERROR_1 "Viga teegi laadimisel /rd/1/lib/box_lib.obj"
@ -63,7 +63,7 @@
?define T_YES "Yes" ?define T_YES "Yes"
?define T_NO "No" ?define T_NO "No"
?define T_DEL_ERROR_1 "Error. Folder isn't empty." ?define T_DEL_ERROR_1 "Error. Folder isn't empty."
?define T_DEL_ERROR_2 "Error. Filesystem read-only." ?define WAIT_DELETING_FOLDER "Deleting folder. Please, wait..."
?define NOT_CREATE_FOLDER "Folder can not be created." ?define NOT_CREATE_FOLDER "Folder can not be created."
?define NOT_CREATE_FILE "File 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 ERROR_1 "Error while loading library /rd/1/lib/box_lib.obj"
@ -73,8 +73,8 @@
enum {ONLY_SHOW, WITH_REDRAW, ONLY_OPEN}; //OpenDir enum {ONLY_SHOW, WITH_REDRAW, ONLY_OPEN}; //OpenDir
#define TITLE "Eolite File Manager v1.97.2" #define TITLE "Eolite File Manager v1.97.7"
#define ABOUT_TITLE "Eolite v1.97.2" #define ABOUT_TITLE "Eolite v1.97.7"
dword col_work = 0xE4DFE1; dword col_work = 0xE4DFE1;
dword col_border = 0x9098B0; //A0A0B8; //0x819FC5; dword col_border = 0x9098B0; //A0A0B8; //0x819FC5;
dword col_padding = 0xC8C9C9; dword col_padding = 0xC8C9C9;
@ -640,14 +640,14 @@ inline Sorting()
void Del_Form() void Del_Form()
{ {
int dform_x = files.w - 200 / 2 + files.x-3; int dform_x = Form.width/2-13;
if (!files.count) return; if (!files.count) return;
DrawPopup(dform_x,160,213,80,1,col_work,col_border); DrawPopup(dform_x,160,220,80,1,col_work,col_border);
WriteText(-strlen(T_DELETE_FILE)*3+107+dform_x,175,0x80,0,T_DELETE_FILE); WriteText(-strlen(T_DELETE_FILE)*3+110+dform_x,175,0x80,0,T_DELETE_FILE);
IF (strlen(#file_name)<28) IF (strlen(#file_name)<28)
{ {
WriteText(strlen(#file_name)*3+107+dform_x+2,190,0x80,0,"?"); WriteText(strlen(#file_name)*3+110+dform_x+2,190,0x80,0,"?");
WriteText(-strlen(#file_name)*3+107+dform_x,190,0x80,0,#file_name); WriteText(-strlen(#file_name)*3+110+dform_x,190,0x80,0,#file_name);
} }
else else
{ {
@ -655,23 +655,25 @@ void Del_Form()
ESI = 24; ESI = 24;
WriteText(dform_x+20,190,0,0,#file_name); WriteText(dform_x+20,190,0,0,#file_name);
} }
DrawFlatButton(dform_x+26,208,70,20,301,0xFFB6B5,T_YES); DrawFlatButton(dform_x+27,208,70,20,301,0xFFB6B5,T_YES);
DrawFlatButton(dform_x+119,208,70,20,302,0xC6DFC6,T_NO); DrawFlatButton(dform_x+120,208,70,20,302,0xC6DFC6,T_NO);
del_active=1; del_active=1;
} }
void Del_File2(dword way) void Del_File2(dword way)
{ {
int del_rezult;
dword dirbuf, fcount, i, filename; dword dirbuf, fcount, i, filename;
char del_from[4096], error; char del_from[4096], error;
del_rezult = DeleteFile(way); if (DeleteFile(way))
if (del_rezult)
{ {
error = GetDir(#dirbuf, #fcount, way, DIRS_ONLYREAL); error = GetDir(#dirbuf, #fcount, way, DIRS_ONLYREAL);
for (i=0; i<fcount; i++) for (i=0; i<fcount; i++)
{ {
//need redraw window during this process
//like this:
//if CheckEvent()==Redraw DrawWindow();
//i'm too tired to code now...
filename = i*304+dirbuf+72; filename = i*304+dirbuf+72;
strcpy(#del_from, way); strcpy(#del_from, way);
chrcat(#del_from, '/'); chrcat(#del_from, '/');
@ -688,13 +690,15 @@ void Del_File2(dword way)
void Del_File(byte dodel) void Del_File(byte dodel)
{ {
int del_rezult;
if (dodel==true) if (dodel==true)
{ {
List_ReDraw();
if (itdir) ShowMessage(WAIT_DELETING_FOLDER, 0);
Del_File2(#file_path); Del_File2(#file_path);
} }
del_active=0; del_active=0;
DeleteButton(301); DeleteButton(302); DeleteButton(301);
DeleteButton(302);
Open_Dir(#path,WITH_REDRAW); Open_Dir(#path,WITH_REDRAW);
} }
@ -717,7 +721,7 @@ void ReName(byte rename)
if (del_rezult!=0) if (del_rezult!=0)
{ {
Write_Error(del_rezult); Write_Error(del_rezult);
ShowMessage(T_DEL_ERROR_1); ShowMessage(T_DEL_ERROR_1, 150);
return; return;
} }
ELSE CreateDir(#temp); ELSE CreateDir(#temp);
@ -828,7 +832,7 @@ void FnProcess(char N)
else else
{ {
Write_Error(EAX); Write_Error(EAX);
ShowMessage(NOT_CREATE_FOLDER); ShowMessage(NOT_CREATE_FOLDER, 150);
} }
break; break;
case 7: case 7:
@ -842,7 +846,7 @@ void FnProcess(char N)
else else
{ {
Write_Error(EAX); Write_Error(EAX);
ShowMessage(NOT_CREATE_FILE); ShowMessage(NOT_CREATE_FILE, 150);
} }
break; break;
case 10: //F10 case 10: //F10

View File

@ -1,60 +1,59 @@
//Leency 2008-2013 //Leency 2008-2013
//pay attension: >200 this is only file actions, not supported by folders
#ifdef LANG_RUS #ifdef LANG_RUS
char *captions[] = { char *file_captions[] = {
"Žâªàëâì", "Enter", "Žâªàëâì", "Enter",100,
"Žâªàëâì á ¯®¬®éìî...", "CrlEnt", "Žâªàëâì á ¯®¬®éìî...", "CrlEnt",201,
"Žâªàëâì ª ª ⥪áâ", "F3", "Žâªàëâì ª ª ⥪áâ", "F3",202,
"Žâªàëâì ª ª HEX", "F4", "Žâªàëâì ª ª HEX", "F4",203,
// "Š®¯¨à®¢ âì", "Crl+C",104,
"Š®¯¨à®¢ âì", "Crl+C", "‚ë१ âì", "Crl+X",105,
"‚ë१ âì", "Crl+X", "‚áâ ¢¨âì", "Crl+V",106,
"‚áâ ¢¨âì", "Crl+V", "<EFBFBD>¥à¥¨¬¥­®¢ âì", "F2",107,
"<EFBFBD>¥à¥¨¬¥­®¢ âì", "F2", "“¤ «¨âì", "Del",108,
"“¤ «¨âì", "Del", "Ž¡­®¢¨âì", "F5",109,
"Ž¡­®¢¨âì", "F5", 0, 0, 0};
0, 0};
#elif LANG_EST #elif LANG_EST
char *captions[] = { char *file_captions[] = {
"Ava", "Enter", "Ava", "Enter",100,
"Ava ...", "CrlEnt", "Ava ...", "CrlEnt",201,
"Vaata tekstina", "F3", "Vaata tekstina", "F3",202,
"Vaata HEX", "F4", "Vaata HEX", "F4",203,
// "Kopeeri", "Crl+C",104,
"Kopeeri", "Crl+C", "Lõika", "Crl+X",105,
"Lõika", "Crl+X", "Aseta", "Crl+V",106,
"Aseta", "Crl+V", "Nimeta ümber", "F2",107,
"Nimeta ümber", "F2", "Kustuta", "Del",108,
"Kustuta", "Del", "Värskenda", "F5",109,
"Värskenda", "F5", 0, 0, 0};
0, 0};
#else #else
char *captions[] = { char *file_captions[] = {
"Open", "Enter", "Open", "Enter",100,
"Open with...", "CrlEnt", "Open with...", "CrlEnt",201,
"View as text", "F3", "View as text", "F3",202,
"View as HEX", "F4", "View as HEX", "F4",203,
// "Copy", "Crl+C",104,
"Copy", "Crl+C", "Cut", "Crl+X",105,
"Cut", "Crl+X", "Paste", "Crl+V",106,
"Paste", "Crl+V", "Rename", "F2",107,
"Rename", "F2", "Delete", "Del",108,
"Delete", "Del", "Refresh", "F5",109,
"Refresh", "F5", 0, 0, 0};
0, 0};
#endif #endif
proc_info MenuForm;
void FileMenu() void FileMenu()
{ {
mouse mm; mouse mm;
word id, key, slot, index; word id, key, slot, index, start_y;
int ccount=0, cur, newi, linew=10, lineh=18, texty; proc_info MenuForm;
for (index=0; captions[index]!=0; index+=2) int ccount=0, cur=0, newi, linew=10, lineh=18, texty;
for (index=0; file_captions[index]!=0; index+=3)
{ {
if (itdir) && (file_captions[index+2]>=200) continue;
if (strlen(file_captions[index])>linew) linew = strlen(file_captions[index]);
ccount++; ccount++;
if (strlen(captions[index])>linew) linew = strlen(captions[index]);
} }
linew = linew + 3 * 6 + 50; linew = linew + 3 * 6 + 50;
texty = lineh/2-4; texty = lineh/2-4;
@ -79,9 +78,9 @@ void FileMenu()
case evButton: case evButton:
id=GetButtonID(); id=GetButtonID();
if (id==100) Open(); if (id==100) Open();
if (id==101) notify("Not compleated yet"); if (id==201) notify("Not compleated yet");
if (id==102) FnProcess(3); //F3 if (id==202) FnProcess(3); //F3
if (id==103) FnProcess(4); //F4 if (id==203) FnProcess(4); //F4
if (id==104) Copy(#file_path, NOCUT); if (id==104) Copy(#file_path, NOCUT);
if (id==105) Copy(#file_path, CUT); if (id==105) Copy(#file_path, CUT);
if (id==106) CreateThread(#Paste,#copy_stak); if (id==106) CreateThread(#Paste,#copy_stak);
@ -103,21 +102,23 @@ void FileMenu()
DrawPopupShadow(1,1,linew,ccount*lineh,0); DrawPopupShadow(1,1,linew,ccount*lineh,0);
_ITEMS_DRAW: _ITEMS_DRAW:
for (index=0; captions[index*2]!=0; index++) for (index=0, start_y=0; file_captions[index*3]!=0; index++)
{ {
DefineButton(1,index*lineh+1,linew,lineh-1,index+100+BT_HIDE+BT_NOFRAME,0xFFFFFF); DefineButton(1,start_y+1,linew,lineh-1,file_captions[index*3+2]+BT_HIDE+BT_NOFRAME,0xFFFFFF);
DrawBar(1,index*lineh+2,1,lineh,0xFFFfff); if ((itdir) && (file_captions[index*3+2]>=200)) continue;
if (index==cur) DrawBar(1,start_y+2,1,lineh,0xFFFfff);
if (start_y/lineh==cur)
{ {
DrawBar(2,index*lineh+2,linew-1,lineh,0xFFFfff); DrawBar(2,start_y+2,linew-1,lineh,0xFFFfff);
} }
else else
{ {
DrawBar(2,index*lineh+2,linew-1,lineh,col_work); DrawBar(2,start_y+2,linew-1,lineh,col_work);
WriteText(8,index*lineh+texty+3,0x80,0xf2f2f2,captions[index*2]); WriteText(8,start_y+texty+3,0x80,0xf2f2f2,file_captions[index*3]);
} }
WriteText(7,index*lineh+texty+2,0x80,0x000000,captions[index*2]); WriteText(7,start_y+texty+2,0x80,0x000000,file_captions[index*3]);
WriteText(-strlen(captions[index*2+1])*6-6+linew,index*lineh+texty+2,0x80,0x888888,captions[index*2+1]); WriteText(-strlen(file_captions[index*3+1])*6-6+linew,start_y+texty+2,0x80,0x888888,file_captions[index*3+1]);
start_y+=lineh;
} }
} }
} }

View File

@ -5,11 +5,14 @@ dword onLeft(dword right,left) {EAX=Form.width-right-left;}
dword onTop(dword down,up) {EAX=Form.height-GetSkinHeight()-down-up;} dword onTop(dword down,up) {EAX=Form.height-GetSkinHeight()-down-up;}
void ShowMessage(dword message) void ShowMessage(dword message, pause_duration)
{ {
DrawFlatButton(Form.width/2-13,160,220,80,0,0xFFB6B5, message); int form_x=Form.width/2-13;
pause(150); int form_y=160;
List_ReDraw(); DrawPopup(form_x,form_y,220,80,1,col_work,col_border);
WriteText(-strlen(message)*3+110+form_x,80/2-4+form_y,0x80,0,message);
pause(pause_duration);
if (pause_duration) List_ReDraw();
} }
inline fastcall signed int _strrchr( ESI,BL) inline fastcall signed int _strrchr( ESI,BL)