From 56efa5dc907f774aa60a4f722a5e43999ecf2ebb Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Wed, 4 Apr 2012 22:18:49 +0000 Subject: [PATCH] Eolite 1.1 git-svn-id: svn://kolibrios.org@2568 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/fs/Eolite/trunk/Eolite.c-- | 173 ++++++++---------- programs/fs/Eolite/trunk/History.txt | 13 ++ programs/fs/Eolite/trunk/ReadMe_en.txt | 1 + programs/fs/Eolite/trunk/ReadMe_ru.txt | 1 + programs/fs/Eolite/trunk/compile.bat | 2 +- .../{about_dialog.h-- => about_dialog.h} | 2 +- programs/fs/Eolite/trunk/include/devices.h | 70 +++++++ .../trunk/include/{icons_f.h-- => icons_f.h} | 0 .../Eolite/trunk/include/{ini.h-- => ini.h} | 4 +- .../include/{some_code.h-- => some_code.h} | 0 .../trunk/include/{sorting.h-- => sorting.h} | 0 .../lib/{edit_box_lib.h-- => edit_box_lib.h} | 0 .../lib/{file_system.h-- => file_system.h} | 0 .../trunk/lib/{kolibri.h-- => kolibri.h} | 41 ++++- .../Eolite/trunk/lib/{memory.h-- => memory.h} | 0 15 files changed, 199 insertions(+), 108 deletions(-) rename programs/fs/Eolite/trunk/include/{about_dialog.h-- => about_dialog.h} (93%) create mode 100644 programs/fs/Eolite/trunk/include/devices.h rename programs/fs/Eolite/trunk/include/{icons_f.h-- => icons_f.h} (100%) rename programs/fs/Eolite/trunk/include/{ini.h-- => ini.h} (93%) rename programs/fs/Eolite/trunk/include/{some_code.h-- => some_code.h} (100%) rename programs/fs/Eolite/trunk/include/{sorting.h-- => sorting.h} (100%) rename programs/fs/Eolite/trunk/lib/{edit_box_lib.h-- => edit_box_lib.h} (100%) rename programs/fs/Eolite/trunk/lib/{file_system.h-- => file_system.h} (100%) rename programs/fs/Eolite/trunk/lib/{kolibri.h-- => kolibri.h} (86%) rename programs/fs/Eolite/trunk/lib/{memory.h-- => memory.h} (100%) diff --git a/programs/fs/Eolite/trunk/Eolite.c-- b/programs/fs/Eolite/trunk/Eolite.c-- index 17fa76ecea..bfedbf90ac 100644 --- a/programs/fs/Eolite/trunk/Eolite.c-- +++ b/programs/fs/Eolite/trunk/Eolite.c-- @@ -1,10 +1,10 @@ //Leency & Veliant -=- KolibriOS Team -=- 2012 //GNU GPL licence. -#include "lib\kolibri.h--" -#include "lib\memory.h--" -#include "lib\edit_box_lib.h--" -#include "lib\file_system.h--" +#include "lib\kolibri.h" +#include "lib\memory.h" +#include "lib\edit_box_lib.h" +#include "lib\file_system.h" #include "imgs\toolbar.txt" #include "imgs\left_p.txt" @@ -16,9 +16,8 @@ int BUTTON_HEIGHT=18; #define ONLY_OPEN 2 //переменные -#define title "Eolite File Manager v1.0" -#define videlenie 0x94AECE //0xFEA4B7,0x8BCDFF,0xB8C9B8}; //цвет выделенного элемента из списка файлов -byte toolbar_buttons_x[6]={9,46,85,134,167,203}; +#define title "Eolite File Manager v1.1" +dword videlenie=0x94AECE; //цвет выделенного элемента из списка файлов // int but_num, count, @@ -31,7 +30,7 @@ byte cut_active, byte show_actions=1, sort_num=2, isdir; -char path[4096]="/rd/1/", +char path[4096], edit_path[4096], file_path[4096], file_name[4096], @@ -39,76 +38,47 @@ char path[4096]="/rd/1/", temp[4096]; byte PathHistory[4096]; +int toolbar_buttons_x[6]={9,46,85,134,167,203}; + dword file_mas[6898]; int j, i, mouse_dd; dword stak[100]; //окно About -edit_box edit1= {250,247,13,0xffffff,videlenie,0xD3DDEB,0xffffff,0,248,#edit_path,#mouse_dd,64,6,6}; -edit_box edit2= {250,213,80,0xFFFFCC,videlenie,0xFFFFCC,0xffffff,0,248,#file_name,#mouse_dd,64,6,6}; +edit_box edit1= {250,247,13,0xffffff,0x94AECE,0xD3DDEB,0xffffff,0,248,#edit_path,#mouse_dd,64,6,6}; +edit_box edit2= {250,213,80,0xFFFFCC,0x94AECE,0xFFFFCC,0xffffff,0,248,#file_name,#mouse_dd,64,6,6}; proc_info Form; dword buf, off; //для текста и буфера -dword devbuf, dev_num; -#include "include\about_dialog.h--" -#include "include\some_code.h--" -#include "include\sorting.h--" -#include "include\icons_f.h--" -#include "include\ini.h--" +#include "include\about_dialog.h" +#include "include\some_code.h" +#include "include\sorting.h" +#include "include\icons_f.h" +#include "include\ini.h" +#include "include\devices.h" -void Devices() -{ - byte dev_icon; - dword drive_name[30]; - char dev_name[4]; - - DrawBar(2,41,190,15,0x00699C); //синий прямоугольник - сверху - DrawBar(2,56,15,onTop(21,41),0x00699C); //синий прямоугольник - слева - DrawBar(177,56,15,onTop(21,41),0x00699C); //синий прямоугольник - справа - //список дисков - Tip(56, "Goto:", 0, ""); - for (i=0;i0) copystr(#dev_name,#drive_name+strlen(#drive_name)); - copystr("/",#drive_name+strlen(#drive_name)); - // - WriteText(45,i*16+79,0x80,0,#drive_name,0); - PutImage(dev_icon*14*13*3+#devices,14,13,21,i*16+76); - } -} - void main() word key, id; mouse m; int pressed_y; { - GetIni(1); // load_editbox_lib(); - devbuf= malloc(3112); //буфер где-то на 10 девайсов в левой панели - ReadDir(10, devbuf, "/"); - dev_num=EBX; - // - //curbtn=za_kadrom=0; + GetSystemDiscs(); + GetIni(1); + + edit1.shift_color=videlenie; + edit2.shift_color=videlenie; + HistoryPath(add_new_path); IF (param[0]<>'') //был ли запуск с параметром { copystr(#param, #path); IF (strcmp(#path+strlen(#path)-1,"/")<>0) copystr("/",#path+strlen(#path)); //если нет, + "/" } + else copystr("/rd/1/", #path); Open_Dir(#path,ONLY_OPEN); loop() { @@ -167,7 +137,8 @@ int pressed_y; IF (scroll_size/2+57>m.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); + za_kadrom = m.y -j -57 * count; + za_kadrom /= onTop(22,57); IF (but_num+za_kadrom>count) za_kadrom=count-but_num; IF (id<>za_kadrom) List_ReDraw(); //чтоб лишний раз не перерисовывать m.get(); @@ -229,22 +200,21 @@ int pressed_y; break; case 100...120: DEVICE_MARK: - copystr(id-100*304+ devbuf+72, #path); - IF (path[0]=='r') copystr("/rd/1",#file_path); - ELSE { - copystr("/", #file_path); - copystr(#path, #file_path+strlen(#file_path)); - } - GOTO OPEN_DEV; + //copystr(#disk_list[id-100].Item, #file_path); + //GOTO OPEN_DEV; + copystr(#disk_list[id-100].Item, #path); + za_kadrom=curbtn=0; + Open_Dir(#path,1); + 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,"..")==0) Dir_Up(); ELSE + if (!isdir) GetIni(0); else + if (strcmp(#file_name,"..")==0) Dir_Up(); else { OPEN_DEV: copystr(#file_path, #path); - copystr("/", #path+strlen(#path)); + IF (strcmp(#path+strlen(#path)-1,"/")<>0) copystr("/",#path+strlen(#path)); //если нет, + "/" za_kadrom=curbtn=0; Open_Dir(#path,1); } @@ -275,7 +245,7 @@ int pressed_y; { case 209...217: id=key-110; - IF (id-100>=dev_num) break; + IF (id-100>=disc_num) break; GOTO DEVICE_MARK; case 8: //Назад GoBack(); @@ -375,7 +345,7 @@ int pressed_y; inline fastcall void draw_window() -{ +{ DefineAndDrawWindow(98,90,582,482,0x73,0x10E4DFE1,0,0,title); Form.GetInfo(#Form, SelfInfo); IF (Form.status_window==4) return; //ничего не делать если окно схлопнуто в заголовок @@ -396,8 +366,8 @@ inline fastcall void draw_window() //прямоугольники внутри DrawRegion_3D(1,40,Form.width-12,onTop(46,0),0x94AECE,0x94AECE); //синий ободок DrawRegion_3D(0,39,Form.width-10,onTop(44,0),0xE4DFE1,0xE4DFE1); //фон - Devices(); //панель слева на синем фоне - Actions(); //функции файлов и папок + DrawSystemDiscs(); + Actions(); //SortButtons DrawFlatButton(192,40,onLeft(192,168),16,31,0xE4DFE1,"File"); DrawFlatButton(onLeft(168,0),40,73,16,32,0xE4DFE1,"Type"); @@ -408,6 +378,7 @@ inline fastcall void draw_window() DrawBar(onLeft(27,0),57,1,onTop(22,57),0x94AECE); //линия слева от прокрутки DrawFlatButton(onLeft(27,0),40,16,16,0,0xE4DFE1,"\x18"); //прокрутка вверх DrawFlatButton(onLeft(27,0),onTop(22,0),16,16,0,0xE4DFE1,"\x19");//прокрутка вниз + if (del_active==1) Del_Form(); } @@ -453,13 +424,6 @@ void FileList_ReDraw(int curbtn_) } else //вниз { - /*if (count-za_kadrom-but_num==1) //это заглушка - { - za_kadrom=count-but_num; - curbtn=but_num-1; - List_ReDraw(); - }*/ - IF (za_kadrom==count-but_num) && (curbtn==but_num-1) return; IF (but_num-curbtn>curbtn_) { @@ -470,7 +434,6 @@ void FileList_ReDraw(int curbtn_) } else { - //IF(za_kadrom+but_num+curbtn_>=count) //а тут кажись был баг IF(za_kadrom+curbtn+curbtn_>=count) { za_kadrom=count-but_num; @@ -513,7 +476,7 @@ void List_ReDraw() //puticon+icon_fairing!!! void Line_ReDraw(dword color, filenum){ dword text_col=0, temp_int, - /* + /* //это я пытался сделать вид крупными значками dword text_col=0, temp_int, x, max_x=onLeft(28,192)/BUTTON_HEIGHT, y=filenum/max_x*BUTTON_HEIGHT+57; //положение текста по Y @@ -525,26 +488,27 @@ void Line_ReDraw(dword color, filenum){ IF (rename_active==1) ReName(false); //да, я не спорю что изврат, но перерисовка зато маленькая DefineButton(192,y,onLeft(28,192),BUTTON_HEIGHT,201+filenum+BT_HIDE+BT_NOFRAME,color); //кнопа - DrawBar(192,y,3,BUTTON_HEIGHT,color); DrawBar(195,y,16,2,color); + DrawBar(192,y,3,BUTTON_HEIGHT,color); DrawBar(192+19,y,onLeft(46,192),BUTTON_HEIGHT,color); DrawBar(195,y+17,16,1,color); if (BUTTON_HEIGHT>18) DrawBar(195,y+18,16,BUTTON_HEIGHT-18,color); + if (BUTTON_HEIGHT>15) DrawBar(195,y,16,BUTTON_HEIGHT-15,color); // off=file_mas[filenum+za_kadrom]*304 + buf+72; if (TestBit(ESDWORD[off-40],1)) || (TestBit(ESDWORD[off-40],2)) text_col=0xA6A6B7; if (!TestBit(ESDWORD[off-40],4)) { copystr(off,#temp); - temp_int = Put_icon(#temp+find_symbol(#temp,'.'), BUTTON_HEIGHT-14/2+y); + temp_int = Put_icon(#temp+find_symbol(#temp,'.'), BUTTON_HEIGHT/2-7+y); WriteText(7-strlen(ConvertSize(ESDWORD[off-8]))*6+onLeft(75,0),BUTTON_HEIGHT-6/2+y,0x80,0,ConvertSize(ESDWORD[off-8]),0); //size } ELSE - IF (!strcmp("..",off)) temp_int=Put_icon("..", y+2); + IF (!strcmp("..",off)) temp_int=Put_icon("..", BUTTON_HEIGHT/2-7+y); ELSE - temp_int=Put_icon("", y+2); + temp_int=Put_icon("", BUTTON_HEIGHT/2-7+y); if (color==videlenie) { isdir=TestBit(ESDWORD[off-40], 4); - IconFairing(temp_int, y+2); //закрашиваем иконку + IconFairing(temp_int, BUTTON_HEIGHT/2-7+y); //закрашиваем иконку copystr(off,#file_name); copystr(#path,#file_path); copystr(#file_name,#file_path+strlen(#file_path)); //полный путь к файлу @@ -607,12 +571,24 @@ void Open_Dir(dword temp_, redraw){ inline Sorting() { dword k=0, l=1; - IF (!strcmp(#path,"/")) {FOR(k=1;k=0; j--, off-=304;) //папки вверх, файлы вниз { ChangeCase(off+40); - IF (TestBit(ESDWORD[off],4)) {file_mas[k]=j; k++;} - ELSE {file_mas[count-l]=j; l++;} + if (TestBit(ESDWORD[off],4)) //папка? + { + file_mas[k]=j; + k++; + } + else + { + file_mas[count-l]=j; + l++; + } } //Собственно сортировка: вначале папки, потом файлы Sort_by_Name(0,k-1); @@ -747,15 +723,16 @@ void ReName(byte rename) void Actions() { - int actions_y=dev_num*16; + int actions_y=disc_num*16; DrawBar(17,actions_y+75,160,15,0x00699C); //синий прямоугольник - под девайсами + DrawBar(17,show_actions*51+actions_y+108,160,onTop(show_actions*51+actions_y+108,6),0x00699C); //синее в конце if (show_actions==1) { - Tip(actions_y+90, "Actions", 77, "\x19"); + Tip(actions_y+90, "Actions", 77, "\x19"); //заголовок DrawBar(17,actions_y+108,160,51,0xFFFFFF); //белое - PutImage(#factions,16,44,21,actions_y+113); //пиктограмки + PutImage(#factions,16,44,21,actions_y+113); //иконки //rename file - DefineButton(22,actions_y+108,159,16,80+BT_HIDE,0xE4DFE1); + DefineButton(17,actions_y+108,159,16,80+BT_HIDE,0xE4DFE1); WriteText(42,actions_y+113,0x80,0,"Rename file ",0); //delete file DefineButton(17,actions_y+125,159,16,81+BT_HIDE,0xE4DFE1); @@ -764,12 +741,13 @@ void Actions() DefineButton(17,actions_y+142,159,16,82+BT_HIDE,0xE4DFE1); WriteText(42,actions_y+147,0x80,0,"Create folder ",0); } - ELSE + else { - DeleteButton(80); DeleteButton(81); DeleteButton(82); + DeleteButton(80); + DeleteButton(81); + DeleteButton(82); Tip(actions_y+90, "Actions", 77, "\x18"); } - DrawBar(17,show_actions*51+actions_y+108,160,onTop(show_actions*51+actions_y+108,6),0x00699C); //синее в конце } @@ -789,13 +767,8 @@ void SelectFile(dword that_file) za_kadrom=curbtn=0; //вверх списка Open_Dir(#path,ONLY_OPEN); ChangeCase(that_file); - FOR (i=count-1; i>=0; i--;) IF(strcmp(file_mas[i]*304+buf+72,that_file)==0) BREAK; - /*IF (i>but_num-1) && (i>count-but_num) //всё это по-идее можно сделать через FileList_ReDraw(i) или я неправ? - { - za_kadrom=count-but_num; - curbtn=i-count+but_num; - } - ELSE FileList_ReDraw(i);*/ + for (i=count-1; i>=0; i--;) + if (strcmp(file_mas[i]*304+buf+72,that_file)==0) break; FileList_ReDraw(i); List_ReDraw(); } diff --git a/programs/fs/Eolite/trunk/History.txt b/programs/fs/Eolite/trunk/History.txt index 5c5ce1823e..4ade5e5ba2 100644 --- a/programs/fs/Eolite/trunk/History.txt +++ b/programs/fs/Eolite/trunk/History.txt @@ -1,6 +1,19 @@ +05.04.12 -- v1.1 --16,2 Кб +- отображение списка дисков, а не устройств в панели слева; +- уменьшен размер программы и потребляемой памяти; +- возможность задать цвет выделения и высоту пункта в списке файлов; +- после перерисовки окна пропадал диалог удаления файла +- другие мелкие исправления. + 26.03.12 -- v1.0 --16,2 Кб Мелкие исправления. + + + + + + 27.08.11 -- v0.99.8 RC3 -- 16.2 Кб - исправления в скроллбаре, баг со времён первых версий; - в 90% случаев не выделяло переименованый файл; diff --git a/programs/fs/Eolite/trunk/ReadMe_en.txt b/programs/fs/Eolite/trunk/ReadMe_en.txt index 2b21130796..07dc8733fb 100644 --- a/programs/fs/Eolite/trunk/ReadMe_en.txt +++ b/programs/fs/Eolite/trunk/ReadMe_en.txt @@ -29,6 +29,7 @@ Rock_maniak_forever turbanoff Sorcerer Gluk +lev KolibriOS Forever! \ No newline at end of file diff --git a/programs/fs/Eolite/trunk/ReadMe_ru.txt b/programs/fs/Eolite/trunk/ReadMe_ru.txt index 55c0d418e3..e9c8de4e70 100644 --- a/programs/fs/Eolite/trunk/ReadMe_ru.txt +++ b/programs/fs/Eolite/trunk/ReadMe_ru.txt @@ -27,6 +27,7 @@ Nable - Mario79 - советы. S1n - за реализацию работы с lib_ini (увы не используемую). Rock_maniak_forever, turbanoff, Sorcerer, Gluk, Albom - за найденые баги. +lev - за алгоритм работы с массивами строк. У нас будет свой Менует с блекджеком! И шлюхами! KolibriOS Forever! \ No newline at end of file diff --git a/programs/fs/Eolite/trunk/compile.bat b/programs/fs/Eolite/trunk/compile.bat index 601230f8e6..5bb4d73d95 100644 --- a/programs/fs/Eolite/trunk/compile.bat +++ b/programs/fs/Eolite/trunk/compile.bat @@ -1,5 +1,5 @@ @..\C--\c-- Eolite.c-- del Eolite rename Eolite.com Eolite -@..\C--\kpack Eolite +rem @..\C--\kpack Eolite pause \ No newline at end of file diff --git a/programs/fs/Eolite/trunk/include/about_dialog.h-- b/programs/fs/Eolite/trunk/include/about_dialog.h similarity index 93% rename from programs/fs/Eolite/trunk/include/about_dialog.h-- rename to programs/fs/Eolite/trunk/include/about_dialog.h index dcdc209417..29749da808 100644 --- a/programs/fs/Eolite/trunk/include/about_dialog.h-- +++ b/programs/fs/Eolite/trunk/include/about_dialog.h @@ -37,7 +37,7 @@ void authors() DefineAndDrawWindow(600,150,181,256,0x34,0x10EFEBEF,0,0,"About Eolite"); DrawBar(0,0,172,50,0x8494C4); //голубое сзади PutPaletteImage(#logo,85,85,43,7,#logo_pal); - WriteText(54,100,0x80,0xBF40BF,"Eolite v1.0",0); + WriteText(54,100,0x80,0xBF40BF,"Eolite v1.1",0); WriteText(55,120,0x80,0,"Developers:",0); WriteText(39,130,0x80,0,"Leency & Veliant",0); WriteText(30,140,0x80,0,"Diamond, Lrz, Nable",0); diff --git a/programs/fs/Eolite/trunk/include/devices.h b/programs/fs/Eolite/trunk/include/devices.h new file mode 100644 index 0000000000..54f32af61f --- /dev/null +++ b/programs/fs/Eolite/trunk/include/devices.h @@ -0,0 +1,70 @@ +//03.04.2012 + +struct string { +char Item[4096]; +}; + +string disk_list[20]; +int disc_num; + + +void GetSystemDiscs() +{ + char dev_name[10], sys_discs[10]; + int i1, j1, dev_num, dev_disc_num; + dword devbuf; + + devbuf= malloc(3112); //буфер где-то на 10 девайсов в левой панели + ReadDir(10, devbuf, "/"); + dev_num = EBX; + for (i1=0; i10); + IF(DSBYTE[EDI]=='-') -EAX; +} + +dword StrToCol(char* htmlcolor) +{ + dword j, color=0; + char ch=0x00; + + FOR (j=0; j<6; j++) + { + ch=ESBYTE[htmlcolor+j]; + IF ((ch>='0') && (ch<='9')) ch -= '0'; + IF ((ch>='A') && (ch<='F')) ch -= 'A'-10; + IF ((ch>='a') && (ch<='f')) ch -= 'a'-10; + color = color*0x10 + ch; + } + + return color; +} + inline fastcall int strcmp(ESI, EDI) { loop() diff --git a/programs/fs/Eolite/trunk/lib/memory.h-- b/programs/fs/Eolite/trunk/lib/memory.h similarity index 100% rename from programs/fs/Eolite/trunk/lib/memory.h-- rename to programs/fs/Eolite/trunk/lib/memory.h