From 8effd409afa70b9a567809f111208f2a4778a923 Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Mon, 1 Apr 2013 15:41:17 +0000 Subject: [PATCH] Eolite 1.8: improved menu, rename fixed git-svn-id: svn://kolibrios.org@3439 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/cmm/eolite/Eolite.c | 22 ++++++++-------- programs/cmm/eolite/include/file_menu.h | 35 ++++++++++++++++--------- programs/cmm/eolite/txt/History.txt | 4 +-- programs/cmm/lib/socket.h | 2 +- programs/cmm/liza/liza.c | 2 +- programs/cmm/liza/mail_box.c | 2 +- 6 files changed, 39 insertions(+), 28 deletions(-) diff --git a/programs/cmm/eolite/Eolite.c b/programs/cmm/eolite/Eolite.c index 88da320462..9591d03f7b 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.77" -#define ABOUT_TITLE "Eolite v1.77" +#define TITLE "Eolite File Manager v1.8" +#define ABOUT_TITLE "Eolite v1.80" dword col_work = 0xE4DFE1; dword col_border = 0x819FC5; dword col_padding = 0xC8C9C9; @@ -45,10 +45,9 @@ byte copy_file[4096], temp[4096]; byte - cut_active, - rename_active, - del_active; -byte + cut_active=0, + rename_active=0, + del_active=0, show_dev_name=1, sort_num=2, isdir; @@ -185,13 +184,14 @@ void main() //Button pressed----------------------------------------------------------------------------- case evButton: id=GetButtonID(); - IF (id==1) ExitProcess(); - - IF (del_active) + if (id==1) ExitProcess(); + if (rename_active) break; + if (del_active) { IF (id==301) || (id==302) Del_File(302-id); break; } + switch(id) { case 21: //Back @@ -350,6 +350,7 @@ void main() files.SetSizes(192, 57, onLeft(192,27), onTop(57,6), disc_num*16+195,files.line_h); if (Form.height < files.min_h) MoveSize(OLD,OLD,OLD,files.min_h); if (Form.width<480) MoveSize(OLD,OLD,480,OLD); + GetProcessInfo(#Form, SelfInfo); //if win_size changed draw_window(); } } @@ -380,6 +381,7 @@ inline fastcall void draw_window() DrawFlatButton(onLeft(27,0),onTop(22,0),16,16,0,col_work,"\x19"); Open_Dir(#path,ONLY_SHOW); if (del_active) Del_Form(); + if (rename_active) ActionsProcess(2); } @@ -467,7 +469,6 @@ void List_ReDraw() void Line_ReDraw(dword color, filenum){ dword text_col=0, name_len=0, y=filenum*files.line_h+57; - IF (rename_active==1) ReName(false); DrawBar(192,y,3,files.line_h,color); DrawBar(192+19,y,onLeft(46,192),files.line_h,color); DrawBar(195,y+17,16,1,color); if (files.line_h>18) DrawBar(195,y+18,16,files.line_h-18,color); @@ -755,7 +756,6 @@ void ActionsProcess(char N) break; case 2: if (!files.count) break; - DeleteButton(files.current+201); edit2.flags=100000000000010b; //set active edit2.width=onLeft(24,217); edit2.top=files.current*files.line_h+59; diff --git a/programs/cmm/eolite/include/file_menu.h b/programs/cmm/eolite/include/file_menu.h index 54e779f345..d522d0feb7 100644 --- a/programs/cmm/eolite/include/file_menu.h +++ b/programs/cmm/eolite/include/file_menu.h @@ -2,7 +2,7 @@ char *captions[] = { "Open", "Enter", - "Open with...", "Ctrl+Ent", + "Open with...", "CrlEnt", "View as text", "F3", "View as HEX", "F4", "Rename", "F2", @@ -12,14 +12,15 @@ char *captions[] = { void FileMenu() { proc_info MenuForm; + mouse mm; word id, key, slot; - int ccount=0, linew=10, lineh=18, texty; + int ccount=0, cur, newi, linew=10, lineh=18, texty; for (i=0; captions[i]!=0; i+=2) { ccount++; if (strlen(captions[i])>linew) linew = strlen(captions[i]); } - linew = linew + 3 * 6 + 70; + linew = linew + 3 * 6 + 50; texty = lineh/2-4; SetEventMask(100111b); @@ -29,6 +30,14 @@ void FileMenu() case evMouse: slot = GetProcessSlot(MenuForm.ID); 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 (cur<>newi) + { + cur=newi; + goto _ITEMS_DRAW; + } break; case evButton: @@ -47,20 +56,22 @@ void FileMenu() break; case evReDraw: _MENU_DRAW: - DefineAndDrawWindow(m.x+Form.left+5,m.y+Form.top+GetSkinHeight(),linew+2,ccount*lineh+2,0x01,0xEEEeee,0x01fffFFF); + DefineAndDrawWindow(m.x+Form.left+5,m.y+Form.top+GetSkinHeight(),linew+2,ccount*lineh+5,0x01, 0, 0, 0x01fffFFF); GetProcessInfo(#MenuForm, SelfInfo); /* _PutImage(1,23, 16,44, #factions); //иконки */ - DrawRectangle(0,0,linew+1,ccount*lineh+1,col_border); - PutShadow(linew+2,1,1,ccount*lineh+1,0,1); - PutShadow(1,ccount*lineh+2,linew+1,1,0,1); + DrawRectangle(0,0,linew+1,ccount*lineh+2,col_border); + DrawBar(1,1,linew,1,0xFFFfff); + PutShadow(linew+2,1,1,ccount*lineh+2,0,1); + PutShadow(1,ccount*lineh+3,linew+2,1,0,1); + _ITEMS_DRAW: for (i=0; captions[i*2]!=0; i++) { - DefineButton(1,i*lineh,linew,lineh-1,i+100+BT_HIDE,0xFFFFFF); - DrawBar(1,i*lineh+1,1,lineh,0xFFFfff); - DrawBar(2,i*lineh+1,linew-1,lineh,col_work); - WriteText(6,i*lineh+texty+1,0x80,0x000000,captions[i*2]); - WriteText(-strlen(captions[i*2+1])*6-7+linew,i*lineh+texty+1,0x80,0x999999,captions[i*2+1]); + DefineButton(1,i*lineh+1,linew,lineh-1,i+100+BT_HIDE+BT_NOFRAME,0xFFFFFF); + DrawBar(1,i*lineh+2,1,lineh,0xFFFfff); + if (i==cur) DrawBar(2,i*lineh+2,linew-1,lineh,0xFFFfff); else DrawBar(2,i*lineh+2,linew-1,lineh,col_work); + WriteText(7,i*lineh+texty+2,0x80,0x000000,captions[i*2]); + WriteText(-strlen(captions[i*2+1])*6-6+linew,i*lineh+texty+2,0x80,0x999999,captions[i*2+1]); } } } \ No newline at end of file diff --git a/programs/cmm/eolite/txt/History.txt b/programs/cmm/eolite/txt/History.txt index 940ed0eaad..7423482eee 100644 --- a/programs/cmm/eolite/txt/History.txt +++ b/programs/cmm/eolite/txt/History.txt @@ -1,6 +1,6 @@ -01.05.13 -- v1.77 +01.05.13 -- v1.8 - исправлено падение при изменении размера окна (нашёл 0CodErr); -- меню файлов (не закончено); +- меню файлов; - перевод программы на элемент list_box: упрощение кода, гибкость элемента, задел на двупанельность; - вместо кнопок файлов теперь используются события мыши; diff --git a/programs/cmm/lib/socket.h b/programs/cmm/lib/socket.h index 476ef4b99e..23b6fd471c 100644 --- a/programs/cmm/lib/socket.h +++ b/programs/cmm/lib/socket.h @@ -21,7 +21,7 @@ inline fastcall int StatusSocket( ECX) $int 0x40 } -inline fastcall dword ReadSocket( ECX) +inline fastcall dword ReadSocket( ECX) //ecx - handle { $mov eax,53 $mov ebx,3 diff --git a/programs/cmm/liza/liza.c b/programs/cmm/liza/liza.c index 088fd5d358..c46b22a8ef 100644 --- a/programs/cmm/liza/liza.c +++ b/programs/cmm/liza/liza.c @@ -147,7 +147,7 @@ void OpenMailDat() void SaveAndExit() { char write_data[512], pass_b64[256]; - if (!CloseSocket(socket)) debug("An error occurred during closing of the socket"); + CloseSocket(socket); strcpy(#write_data, #email_text); strcat(#write_data, "\n"); base64_encode stdcall (#pass_text, #pass_b64, strlen(#pass_text)); diff --git a/programs/cmm/liza/mail_box.c b/programs/cmm/liza/mail_box.c index 0cac48e51c..bec93ddb18 100644 --- a/programs/cmm/liza/mail_box.c +++ b/programs/cmm/liza/mail_box.c @@ -132,7 +132,7 @@ void MailBoxLoop() if (id==EXIT_MAIL) { StopLoading(); - if (!CloseSocket(socket)) debug("An error occurred during closing of the socket"); + CloseSocket(socket); LoginBoxLoop(); } if (id==CHANGE_CHARSET)