diff --git a/programs/fs/Eolite/trunk/Eolite.c-- b/programs/fs/Eolite/trunk/Eolite.c-- index 2dc46e12dc..22c9eb801b 100644 --- a/programs/fs/Eolite/trunk/Eolite.c-- +++ b/programs/fs/Eolite/trunk/Eolite.c-- @@ -20,9 +20,12 @@ int BUTTON_HEIGHT=18; #define ONLY_OPEN 2 //переменные -#define title "Eolite File Manager v1.45" -dword selection_col = 0x94AECE; -dword lpanel_col = 0x00699C; +#define title "Eolite File Manager v1.5" +dword col_work = 0xE4DFE1; +dword col_border = 0x819FC5; +dword col_padding = 0xC8C9C9; +dword col_selec = 0x94AECE; +dword col_lpanel = 0x00699C; /* @@ -61,6 +64,7 @@ char tmp_disk_del_param[3]="d0\0"; dword file_mas[6898]; int j, i, mouse_dd; +int scroll_used; struct path_string { char Item[4096]; @@ -75,8 +79,8 @@ edit_box edit2= {250,213,80,0xFFFFCC,0x94AECE,0xFFFFCC,0xffffff,0,248,#file_name proc_info Form; dword buf, off; //для текста и буфера -#include "include\about_dialog.h" #include "include\some_code.h" +#include "include\about_dialog.h" #include "include\sorting.h" #include "include\icons_f.h" #include "include\ini.h" @@ -87,14 +91,13 @@ void main() { word key, id; mouse m; - int scroll_used; load_editbox_lib(); GetSystemDiscs(); GetIni(1); - edit1.shift_color=selection_col; - edit2.shift_color=selection_col; + edit1.shift_color=col_selec; + edit2.shift_color=col_selec; if (param) { @@ -108,185 +111,185 @@ void main() loop() switch(WaitEvent()) { case evMouse: - IF (del_active) break; - - id=GetSlot(Form.ID); - IF (id<>GetActiveProcess()) break; //если окно не активно на события мыши не реагируем - - IF (!rename_active) edit_box_mouse stdcall(#edit1); ELSE edit_box_mouse stdcall(#edit2); - - m.get(); + IF (del_active) break; + + id=GetSlot(Form.ID); + IF (id<>GetActiveProcess()) break; //если окно не активно на события мыши не реагируем + + IF (!rename_active) edit_box_mouse stdcall(#edit1); ELSE edit_box_mouse stdcall(#edit2); + + m.get(); - if (m.x>=Form.width-26) && (m.x<=Form.width-6) && (m.y>40) && (m.y<57) + if (m.x>=Form.width-26) && (m.x<=Form.width-6) && (m.y>40) && (m.y<57) + { + IF (m.lkm==1) DrawRegion_3D(onLeft(26,0),41,14,14,0xC7C7C7,0xFFFFFF); + WHILE (m.lkm==1) && (za_kadrom>0) { - IF (m.lkm==1) DrawRegion_3D(onLeft(26,0),41,14,14,0xC7C7C7,0xFFFFFF); - WHILE (m.lkm==1) && (za_kadrom>0) - { - Pause(10); - za_kadrom--; - List_ReDraw(); - m.get(); - } - DrawRegion_3D(onLeft(26,0),41,14,14,0xFFFFFF,0xC7C7C7); + Pause(10); + za_kadrom--; + List_ReDraw(); + m.get(); } + DrawRegion_3D(onLeft(26,0),41,14,14,0xFFFFFF,0xC7C7C7); + } - if (m.x>=Form.width-26) && (m.x<=Form.width-6) && (m.y>onTop(22,0)+1) && (m.y=Form.width-26) && (m.x<=Form.width-6) && (m.y>onTop(22,0)+1) && (m.y0) - { - if (za_kadrom>0) za_kadrom--; - if (curbtn0) za_kadrom--; - if (curbtn0) curbtn--; - List_ReDraw(); - if (za_kadrom0) curbtn--; - List_ReDraw(); - } - //скролл - if (!m.lkm) scroll_used=NULL; - if (m.x>=Form.width-26) && (m.x<=Form.width-6) && (m.y>56) && (m.ym.y) || (m.y<0) || (m.y>4000) m.y=scroll_size/2+57; //если курсор над окном - id=za_kadrom; //сохраняем старое количество - j= scroll_size/2; - za_kadrom = m.y -j -57 * count; - za_kadrom /= onTop(22,57); - IF (f_visible+za_kadrom>count) za_kadrom=count-f_visible; - IF (id<>za_kadrom) List_ReDraw(); //чтоб лишний раз не перерисовывать - } - break; + //колёсико мыши + IF (m.vert==65535) && (za_kadrom>0) + { + if (za_kadrom>0) za_kadrom--; + if (curbtn0) za_kadrom--; + if (curbtn0) curbtn--; + List_ReDraw(); + if (za_kadrom0) curbtn--; + List_ReDraw(); + } + //скролл + if (!m.lkm) && (scroll_used) { scroll_used=NULL; TVScroll(); } + if (m.x>=Form.width-26) && (m.x<=Form.width-6) && (m.y>56) && (m.ym.y) || (m.y<0) || (m.y>4000) m.y=scroll_size/2+57; //если курсор над окном + id=za_kadrom; //сохраняем старое количество + j= scroll_size/2; + za_kadrom = m.y -j -57 * count; + za_kadrom /= onTop(22,57); + IF (f_visible+za_kadrom>count) za_kadrom=count-f_visible; + IF (id<>za_kadrom) List_ReDraw(); //чтоб лишний раз не перерисовывать + } + break; //Button pressed----------------------------------------------------------------------------- case evButton: - id=GetButtonID(); - IF (id==1) ExitProcess(); + id=GetButtonID(); + IF (id==1) ExitProcess(); - IF (del_active) - { - IF (id==301) || (id==302) Del_File(302-id); - break; - } - switch(id) - { - case 21: //Back - GoBack(); - break; - case 22: //Forward - if (HistoryPath(GO_FORWARD)) - { - za_kadrom=curbtn=NULL; //вверх списка - Open_Dir(#path,WITH_REDRAW); - } - break; - case 23: //up! - Dir_Up(); - break; - case 24: //cut - key=24; - case 25: //copy - goto CTRLC_MARK; - case 26: //paste - Paste(); - break; - case 27: //goto edit_path - Goto_edit_path(); - break; - case 31...33: //sort - IF(sort_num==1) DrawBar(onLeft(192,168)/2+210,45,6,9,0xE4DFE1); - IF(sort_num==2) DrawBar(onLeft(115,0),45,6,9,0xE4DFE1); - IF(sort_num==3) DrawBar(onLeft(44,0),45,6,9,0xE4DFE1); - sort_num=id-30; - Open_Dir(#path,1); - break; - case 30: //about - CreateThread(#about_dialog,#stak); - break; - case 77: - IF (show_actions==1) show_actions=0; ELSE show_actions=1; - DrawLeftPanel(); - break; - case 78: //rescan devices - Tip(56, "Devices", 78, "-"); - Pause(10); - GetSystemDiscs(); - Open_Dir(#path,WITH_REDRAW); - DrawLeftPanel(); - break; - case 80: //rename - goto REN_MARK; - case 81: //Delete file - Del_Form(); - break; - case 82: //create folder - NEW_FOLDER_MARK: - copystr(#path, #temp); - copystr("New folder", #temp+strlen(#temp)); - CreateFolder(#temp); - IF (!EAX){ - SelectFile("New folder"); - goto REN_MARK; - } - ELSE - { - Write_Error(EAX); - ShowMessage("Folder can not be created."); - } - break; - case 100...120: - DEVICE_MARK: - DrawRegion_3D(17,id-100*16+74,159,16, 0, 0); //выделение - copystr(#disk_list[id-100].Item, #path); - za_kadrom=curbtn=0; - Open_Dir(#path,1); - Pause(5); - DrawRegion_3D(17,id-100*16+74,159,16, 0xFFFFFF, 0xFFFFFF); - break; - case 130...160: - tmp_disk_del_param[1]=disk_list[id-130].Item[4]; - RunProgram("/sys/tmpdisk", #tmp_disk_del_param); - Pause(10); - GetSystemDiscs(); - Open_Dir(#path,WITH_REDRAW); - DrawLeftPanel(); - break; - default: - if (id<200) break; //кнопки из списка файлов - if (curbtn!=id-201) {FileList_ReDraw(id-201-curbtn); break;} - else - OPEN_MARK: - if (!isdir) GetIni(0); else - if (!strcmp(#file_name,"..")) Dir_Up(); - else - { - OPEN_DEV: - copystr(#file_path, #path); - IF (strcmp(#path+strlen(#path)-1,"/")<>0) copystr("/",#path+strlen(#path)); //если нет, + "/" - za_kadrom=curbtn=0; - Open_Dir(#path,1); - } - } + IF (del_active) + { + IF (id==301) || (id==302) Del_File(302-id); break; + } + switch(id) + { + case 21: //Back + GoBack(); + break; + case 22: //Forward + if (HistoryPath(GO_FORWARD)) + { + za_kadrom=curbtn=NULL; //вверх списка + Open_Dir(#path,WITH_REDRAW); + } + break; + case 23: //up! + Dir_Up(); + break; + case 24: //cut + key=24; + case 25: //copy + goto CTRLC_MARK; + case 26: //paste + Paste(); + break; + case 27: //goto edit_path + Goto_edit_path(); + break; + case 31...33: //sort + IF(sort_num==1) DrawFilledBar(onLeft(192,168)/2+210,42,6,10); + IF(sort_num==2) DrawFilledBar(onLeft(115,0),42,6,10); + IF(sort_num==3) DrawFilledBar(onLeft(44,0),42,6,10); + sort_num=id-30; + Open_Dir(#path,1); + break; + case 30: //about + CreateThread(#about_dialog,#stak); + break; + case 77: + IF (show_actions==1) show_actions=0; ELSE show_actions=1; + DrawLeftPanel(); + break; + case 78: //rescan devices + Tip(56, "Devices", 78, "-"); + Pause(10); + GetSystemDiscs(); + Open_Dir(#path,WITH_REDRAW); + DrawLeftPanel(); + break; + case 80: //rename + goto REN_MARK; + case 81: //Delete file + Del_Form(); + break; + case 82: //create folder + NEW_FOLDER_MARK: + copystr(#path, #temp); + copystr("New folder", #temp+strlen(#temp)); + CreateFolder(#temp); + IF (!EAX){ + SelectFile("New folder"); + goto REN_MARK; + } + ELSE + { + Write_Error(EAX); + ShowMessage("Folder can not be created."); + } + break; + case 100...120: + DEVICE_MARK: + DrawRegion_3D(17,id-100*16+74,159,16, 0, 0); //выделение + copystr(#disk_list[id-100].Item, #path); + za_kadrom=curbtn=0; + Open_Dir(#path,1); + Pause(5); + DrawRegion_3D(17,id-100*16+74,159,16, 0xFFFFFF, 0xFFFFFF); + break; + case 130...160: + tmp_disk_del_param[1]=disk_list[id-130].Item[4]; + RunProgram("/sys/tmpdisk", #tmp_disk_del_param); + Pause(10); + GetSystemDiscs(); + Open_Dir(#path,WITH_REDRAW); + DrawLeftPanel(); + break; + default: + if (id<200) break; //кнопки из списка файлов + if (curbtn!=id-201) {FileList_ReDraw(id-201-curbtn); break;} + else + OPEN_MARK: + if (!isdir) GetIni(0); else + if (!strcmp(#file_name,"..")) Dir_Up(); + else + { + OPEN_DEV: + copystr(#file_path, #path); + IF (strcmp(#path+strlen(#path)-1,"/")<>0) copystr("/",#path+strlen(#path)); //если нет, + "/" + za_kadrom=curbtn=0; + Open_Dir(#path,1); + } + } + break; //Key pressed----------------------------------------------------------------------------- case evKey: key = GetKey(); @@ -417,40 +420,41 @@ inline fastcall void draw_window() int min_size_y = disc_num*16+195; if (GetScreenHeight()<480) - DefineAndDrawWindow(20,0,582,GetScreenHeight()-30,0x73,0xE4DFE1,title); + DefineAndDrawWindow(20,0,582,GetScreenHeight()-30,0x73,col_work,title); else - DefineAndDrawWindow(98,90,582,482,0x73,0xE4DFE1,title); - Form.GetInfo(#Form, SelfInfo); - if (Form.status_window>2) return; //ничего не делать если окно схлопнуто в заголовок + DefineAndDrawWindow(98,90,582,482,0x73,col_work,title); + GetProcessInfo(#Form, SelfInfo); + if (Form.status_window>2) return; if (Form.heightf_visible-1) //если мы в конце списка файлов развернём окно появяться пустяе белые кнопки { za_kadrom=count-f_visible; curbtn=f_visible-1; } //это если выделение после схлопывания окна за кадром - FOR (j=0; jj) Line_ReDraw(0xFFFFFF, j); ELSE Line_ReDraw(selection_col, curbtn); + FOR (j=0; jj) Line_ReDraw(0xFFFFFF, j); ELSE Line_ReDraw(col_selec, curbtn); DrawBar(192,paint_x,onLeft(27,192),onTop(paint_x,6),0xFFFFFF); //заливка белым доконца - DrawBar(onLeft(168,0),paint_x,1,onTop(paint_x,6),0xE4DFE1); //полоса серая вертикальная 1 - DrawBar(onLeft(95,0),paint_x,1,onTop(paint_x,6),0xE4DFE1); //полоса серая вертикальная 2 + DrawBar(onLeft(168,0),paint_x,1,onTop(paint_x,6),col_work); //полоса серая вертикальная 1 + DrawBar(onLeft(95,0),paint_x,1,onTop(paint_x,6),col_work); //полоса серая вертикальная 2 TVScroll(); } @@ -571,8 +575,8 @@ void Line_ReDraw(dword color, filenum){ name_len = onLeft(215,165)/6; IF (strlen(off)0) DefineButton(159,y+1,16,16,id+BT_HIDE+BT_NOFRAME,0xE4DFE1); //кнопа для стрелки WriteText(165,y+5,0x80,0,arrow,0); //стрелка вниз @@ -134,15 +135,15 @@ void LeftPanelBackground() { int actions_y=disc_num*16; int start_y = show_actions*51+actions_y+108; - DrawBar(2,41,190,15,lpanel_col); //синий прямоугольник - над девайсами - DrawBar(17,actions_y+75,160,15,lpanel_col); //синий прямоугольник - под девайсами - DrawBar(2,56,15,actions_y+103,lpanel_col); //синий прямоугольник - слева - DrawBar(177,56,15,actions_y+103,lpanel_col); //синий прямоугольник - справа + DrawBar(2,41,190,15,col_lpanel); //синий прямоугольник - над девайсами + DrawBar(17,actions_y+75,160,15,col_lpanel); //синий прямоугольник - под девайсами + DrawBar(2,56,15,actions_y+103,col_lpanel); //синий прямоугольник - слева + DrawBar(177,56,15,actions_y+103,col_lpanel); //синий прямоугольник - справа if (onTop(start_y, 6) < 268) PutPaletteImage(#blue_hl, 190, onTop(start_y, 6), 2, start_y, #blue_hl_pal); else { - DrawBar(2,start_y,190,onTop(start_y,6+268),lpanel_col); + DrawBar(2,start_y,190,onTop(start_y,6+268),col_lpanel); PutPaletteImage(#blue_hl, 190, 268, 2, onTop(268,6), #blue_hl_pal); } } diff --git a/programs/fs/Eolite/trunk/include/some_code.h b/programs/fs/Eolite/trunk/include/some_code.h index ab864616ff..2f4a188e7d 100644 --- a/programs/fs/Eolite/trunk/include/some_code.h +++ b/programs/fs/Eolite/trunk/include/some_code.h @@ -25,14 +25,45 @@ dword ConvertSize(dword bytes) return #size_prefix; } + +dword col_palette[14] = {0xD2D3D3,0xD4D4D4,0xD6D5D6,0xD8D7D8,0xDAD8D9,0xDCDADB, +0xDFDCDD,0xE1DDDE,0xE2DEE0,0xE4DFE1,0xE3DFE1,0xE3DFE1,0xE3DFE1,0xE3DFE1,0xE3DFE1}; + inline fastcall void TVScroll() { //Прокрутка - dword on_y; - if (count<=0) {DrawFlatButton(onLeft(27,0),57,16,onTop(22,58),0,0xE4DFE1,""); return;} + dword on_y, i; + if (count<=0) {DrawFlatButton(onLeft(27,0),57,16,onTop(22,58),0,col_work,""); return;} on_y = za_kadrom * onTop(22,57) / count +57; scroll_size=onTop(22,57) * f_visible - f_visible / count; if (scroll_size<20) scroll_size = 20; //устанавливаем минимальный размер скролла if (scroll_size>onTop(22,57)-on_y+56) || (za_kadrom+f_visible>=count) on_y=onTop(23+scroll_size,0); //для большого списка - DrawFlatButton(onLeft(27,0),on_y,16,scroll_size,0,0xE4DFE1,"");//ползунок - DrawBar(onLeft(26,0),57,15,on_y-57,0xCED0D0);//поле до ползунка - DrawBar(onLeft(26,0),on_y+scroll_size+1,15,onTop(22,57)-scroll_size-on_y+56,0xCED0D0); //поле после ползунка + DrawFlatButton(onLeft(27,0),on_y,16,scroll_size,0,-1,"");//ползунок + if (!scroll_used) for (i=0; i<13; i++) DrawBar(onLeft(25-i,0), on_y+2, 1, scroll_size-3, col_palette[13-i]); + if (scroll_used) for (i=0; i<13; i++) DrawBar(onLeft(25-i,0), on_y+2, 1, scroll_size-3, col_palette[i]); + //поле до ползунка + if (on_y>58) DrawBar(onLeft(26,0),57,15,1, 0xC7C9C9); + DrawBar(onLeft(26,0),58,1, on_y-58,0xC7C9C9); + DrawBar(onLeft(25,0),58,14,on_y-58,0xCED0D0); + //поле после ползунка + if (onTop(22,57)-scroll_size+55>on_y) DrawBar(onLeft(26,0),on_y+scroll_size+1,15,1,0xC7C9C9); + DrawBar(onLeft(26,0),on_y+scroll_size+2,1,onTop(22,57)-scroll_size-on_y+55,0xC7C9C9); + DrawBar(onLeft(25,0),on_y+scroll_size+2,14,onTop(22,57)-scroll_size-on_y+55,0xCED0D0); +} + +void DrawFlatButton(dword x,y,width,height,id,color,text) +{ + int fill_h; + DrawRegion_3D(x,y,width,height,col_border,col_border); + DrawRegion_3D(x+1,y+1,width-2,height-2,0xFEFEFE,col_padding); + PutPixel(x+width-1, y+1, col_work); + DrawFilledBar(x+2, y+2, width-3, height-3); + IF (id<>0) DefineButton(x+1,y+1,width-2,height-2,id+BT_HIDE,0xEFEBEF); + WriteText(-strlen(text)*6+width/2+x+1,height/2-3+y,0x80,0,text,0); +} + +void DrawFilledBar(dword x, y, w, h) +{ + int i, fill_h; + if (h <= 14) fill_h = h; else fill_h = 14; + for (i=0; i8000) return; EAX = 13; EBX = x<<16+w; ECX = y<<16+h; @@ -276,15 +279,6 @@ void DrawRegion_3D(dword x,y,width,height,color1,color2) DrawBar(x,y+height,width,1,color2); } -void DrawFlatButton(dword x,y,width,height,id,color,text) -{ - DrawRegion_3D(x,y,width,height,0x94AECE,0x94AECE); - DrawRegion_3D(x+1,y+1,width-2,height-2,0xFFFFFF,0xC7C7C7); - DrawBar(x+2,y+2,width-3,height-3,color); - IF (id<>0) DefineButton(x+1,y+1,width-2,height-2,id+BT_HIDE,0xEFEBEF); - WriteText(-strlen(text)*6+width/2+x+1,height/2-3+y,0x80,0,text,0); -} - void PutPaletteImage(dword EBX,w,h,x,y, EDI) { EAX = 65;