From 9747cd39104bedc3ba4fdc9b142473b0da32faa1 Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Wed, 9 Oct 2013 22:46:17 +0000 Subject: [PATCH] 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 --- programs/cmm/eolite/Eolite.c | 70 ++++++++------- programs/cmm/eolite/include/file_menu.h | 113 ++++++++++++------------ programs/cmm/eolite/include/some_code.h | 11 ++- 3 files changed, 101 insertions(+), 93 deletions(-) diff --git a/programs/cmm/eolite/Eolite.c b/programs/cmm/eolite/Eolite.c index b4205e5226..f01d5d4d22 100644 --- a/programs/cmm/eolite/Eolite.c +++ b/programs/cmm/eolite/Eolite.c @@ -31,7 +31,7 @@ ?define T_YES "Да" ?define T_NO "Нет" ?define T_DEL_ERROR_1 "Ошибка. Папка не пустая." - ?define T_DEL_ERROR_2 "Ошибка. Файловая система только для чтения." + ?define WAIT_DELETING_FOLDER "Удаляется папка. Подожите..." ?define NOT_CREATE_FOLDER "Не удалось создать папку." ?define NOT_CREATE_FILE "Не удалось создать файл." ?define ERROR_1 "Ошибка при загрузке библиотеки /rd/1/lib/box_lib.obj" @@ -47,7 +47,7 @@ ?define T_YES "Jah" ?define T_NO "Ei" ?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_FILE "Faili ei saa luua." ?define ERROR_1 "Viga teegi laadimisel /rd/1/lib/box_lib.obj" @@ -63,7 +63,7 @@ ?define T_YES "Yes" ?define T_NO "No" ?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_FILE "File can not be created." ?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 -#define TITLE "Eolite File Manager v1.97.2" -#define ABOUT_TITLE "Eolite v1.97.2" +#define TITLE "Eolite File Manager v1.97.7" +#define ABOUT_TITLE "Eolite v1.97.7" dword col_work = 0xE4DFE1; dword col_border = 0x9098B0; //A0A0B8; //0x819FC5; dword col_padding = 0xC8C9C9; @@ -640,14 +640,14 @@ inline Sorting() void Del_Form() { - int dform_x = files.w - 200 / 2 + files.x-3; + int dform_x = Form.width/2-13; if (!files.count) return; - DrawPopup(dform_x,160,213,80,1,col_work,col_border); - WriteText(-strlen(T_DELETE_FILE)*3+107+dform_x,175,0x80,0,T_DELETE_FILE); + DrawPopup(dform_x,160,220,80,1,col_work,col_border); + WriteText(-strlen(T_DELETE_FILE)*3+110+dform_x,175,0x80,0,T_DELETE_FILE); IF (strlen(#file_name)<28) { - WriteText(strlen(#file_name)*3+107+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+2,190,0x80,0,"?"); + WriteText(-strlen(#file_name)*3+110+dform_x,190,0x80,0,#file_name); } else { @@ -655,46 +655,50 @@ void Del_Form() ESI = 24; WriteText(dform_x+20,190,0,0,#file_name); } - DrawFlatButton(dform_x+26,208,70,20,301,0xFFB6B5,T_YES); - DrawFlatButton(dform_x+119,208,70,20,302,0xC6DFC6,T_NO); + DrawFlatButton(dform_x+27,208,70,20,301,0xFFB6B5,T_YES); + DrawFlatButton(dform_x+120,208,70,20,302,0xC6DFC6,T_NO); del_active=1; } void Del_File2(dword way) { - int del_rezult; dword dirbuf, fcount, i, filename; char del_from[4096], error; - del_rezult = DeleteFile(way); - if (del_rezult) + if (DeleteFile(way)) + { + error = GetDir(#dirbuf, #fcount, way, DIRS_ONLYREAL); + for (i=0; i200 this is only file actions, not supported by folders #ifdef LANG_RUS -char *captions[] = { - "Открыть", "Enter", - "Открыть с помощью...", "CrlEnt", - "Открыть как текст", "F3", - "Открыть как HEX", "F4", - // - "Копировать", "Crl+C", - "Вырезать", "Crl+X", - "Вставить", "Crl+V", - "Переименовать", "F2", - "Удалить", "Del", - "Обновить", "F5", - 0, 0}; +char *file_captions[] = { + "Открыть", "Enter",100, + "Открыть с помощью...", "CrlEnt",201, + "Открыть как текст", "F3",202, + "Открыть как HEX", "F4",203, + "Копировать", "Crl+C",104, + "Вырезать", "Crl+X",105, + "Вставить", "Crl+V",106, + "Переименовать", "F2",107, + "Удалить", "Del",108, + "Обновить", "F5",109, + 0, 0, 0}; #elif LANG_EST -char *captions[] = { - "Ava", "Enter", - "Ava ...", "CrlEnt", - "Vaata tekstina", "F3", - "Vaata HEX", "F4", - // - "Kopeeri", "Crl+C", - "Lїika", "Crl+X", - "Aseta", "Crl+V", - "Nimeta №mber", "F2", - "Kustuta", "Del", - "Vфrskenda", "F5", - 0, 0}; +char *file_captions[] = { + "Ava", "Enter",100, + "Ava ...", "CrlEnt",201, + "Vaata tekstina", "F3",202, + "Vaata HEX", "F4",203, + "Kopeeri", "Crl+C",104, + "Lїika", "Crl+X",105, + "Aseta", "Crl+V",106, + "Nimeta №mber", "F2",107, + "Kustuta", "Del",108, + "Vфrskenda", "F5",109, + 0, 0, 0}; #else -char *captions[] = { - "Open", "Enter", - "Open with...", "CrlEnt", - "View as text", "F3", - "View as HEX", "F4", - // - "Copy", "Crl+C", - "Cut", "Crl+X", - "Paste", "Crl+V", - "Rename", "F2", - "Delete", "Del", - "Refresh", "F5", - 0, 0}; +char *file_captions[] = { + "Open", "Enter",100, + "Open with...", "CrlEnt",201, + "View as text", "F3",202, + "View as HEX", "F4",203, + "Copy", "Crl+C",104, + "Cut", "Crl+X",105, + "Paste", "Crl+V",106, + "Rename", "F2",107, + "Delete", "Del",108, + "Refresh", "F5",109, + 0, 0, 0}; #endif -proc_info MenuForm; void FileMenu() { mouse mm; - word id, key, slot, index; - int ccount=0, cur, newi, linew=10, lineh=18, texty; - for (index=0; captions[index]!=0; index+=2) + word id, key, slot, index, start_y; + proc_info MenuForm; + 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++; - if (strlen(captions[index])>linew) linew = strlen(captions[index]); } linew = linew + 3 * 6 + 50; texty = lineh/2-4; @@ -79,9 +78,9 @@ void FileMenu() case evButton: id=GetButtonID(); if (id==100) Open(); - if (id==101) notify("Not compleated yet"); - if (id==102) FnProcess(3); //F3 - if (id==103) FnProcess(4); //F4 + if (id==201) notify("Not compleated yet"); + if (id==202) FnProcess(3); //F3 + if (id==203) FnProcess(4); //F4 if (id==104) Copy(#file_path, NOCUT); if (id==105) Copy(#file_path, CUT); if (id==106) CreateThread(#Paste,#copy_stak); @@ -103,21 +102,23 @@ void FileMenu() DrawPopupShadow(1,1,linew,ccount*lineh,0); _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); - DrawBar(1,index*lineh+2,1,lineh,0xFFFfff); - if (index==cur) + DefineButton(1,start_y+1,linew,lineh-1,file_captions[index*3+2]+BT_HIDE+BT_NOFRAME,0xFFFFFF); + if ((itdir) && (file_captions[index*3+2]>=200)) continue; + 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 { - DrawBar(2,index*lineh+2,linew-1,lineh,col_work); - WriteText(8,index*lineh+texty+3,0x80,0xf2f2f2,captions[index*2]); + DrawBar(2,start_y+2,linew-1,lineh,col_work); + WriteText(8,start_y+texty+3,0x80,0xf2f2f2,file_captions[index*3]); } - WriteText(7,index*lineh+texty+2,0x80,0x000000,captions[index*2]); - WriteText(-strlen(captions[index*2+1])*6-6+linew,index*lineh+texty+2,0x80,0x888888,captions[index*2+1]); + WriteText(7,start_y+texty+2,0x80,0x000000,file_captions[index*3]); + WriteText(-strlen(file_captions[index*3+1])*6-6+linew,start_y+texty+2,0x80,0x888888,file_captions[index*3+1]); + start_y+=lineh; } } } \ No newline at end of file diff --git a/programs/cmm/eolite/include/some_code.h b/programs/cmm/eolite/include/some_code.h index fcd9e8b550..7878fd723e 100644 --- a/programs/cmm/eolite/include/some_code.h +++ b/programs/cmm/eolite/include/some_code.h @@ -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;} -void ShowMessage(dword message) +void ShowMessage(dword message, pause_duration) { - DrawFlatButton(Form.width/2-13,160,220,80,0,0xFFB6B5, message); - pause(150); - List_ReDraw(); + int form_x=Form.width/2-13; + int form_y=160; + 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)