From feeaab087ee4e3e26ba54694a3bce54354d995cd Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Thu, 18 Aug 2011 13:32:06 +0000 Subject: [PATCH] Eolite 0.98.9b, Eolite.ini gets from programs folder or then from /rd/1/File managers/ git-svn-id: svn://kolibrios.org@2054 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/fs/Eolite/trunk/Eolite.c-- | 127 +++++++++++++---------- programs/fs/Eolite/trunk/include/ini.h-- | 38 ++++--- programs/fs/Eolite/trunk/lib/kolibri.h-- | 8 +- 3 files changed, 99 insertions(+), 74 deletions(-) diff --git a/programs/fs/Eolite/trunk/Eolite.c-- b/programs/fs/Eolite/trunk/Eolite.c-- index 14e5984597..cb12aded0a 100644 --- a/programs/fs/Eolite/trunk/Eolite.c-- +++ b/programs/fs/Eolite/trunk/Eolite.c-- @@ -13,10 +13,6 @@ #include "imgs\toolbar.txt" #include "imgs\left_p.txt" -// -#define NOTIFY_PATH "@notify" -#define INI_PATH "/sys/File managers/Eolite.ini" - //переменные #define title "Eolite File Manager v0.98.9" @@ -59,16 +55,54 @@ dword devbuf, dev_num; #include "include\ini.h--" +void Devices() +{ + //on load + /*devbuf= malloc(3112); //буфер где-то на 10 девайсов в левой панели + ReadDir(10, devbuf, "/"); + dev_num=EBX; + */ + + 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); + } + Actions(); //функции файлов и папок +} + 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; + // IF (param[0]<>'') { copystr(#param,#edit_path); @@ -236,10 +270,14 @@ int pressed_y; FileList_ReDraw(1); break; case 180: //home - FileList_ReDraw(-za_kadrom-curbtn); + za_kadrom=0; + curbtn=0; + List_ReDraw(); break; case 181: //end - FileList_ReDraw(count-za_kadrom-curbtn+but_num-1); + za_kadrom=count-but_num; + curbtn=but_num-1; + List_ReDraw(); break; case 183: //Page Down FileList_ReDraw(but_num-1); @@ -277,7 +315,11 @@ int pressed_y; copystr(file_mas[i]*304+buf+72,#temp); AL=DSBYTE[#temp]; IF(AL>='A')&&(AL<='Z')DSBYTE[#temp]=AL|0x20; - IF (temp[0]==key) {FileList_ReDraw(i-curbtn-za_kadrom); break;} + IF (temp[0]==key) + { + FileList_ReDraw(i-curbtn-za_kadrom); + break; + } } } BREAK; @@ -291,7 +333,7 @@ int pressed_y; inline fastcall void draw_window() { WindowRedrawStatus(1); - DefineAndDrawWindow(100,100,600,410,0x73,0x10E4DFE1,0,0,title); + DefineAndDrawWindow(98,90,560,481,0x73,0x10E4DFE1,0,0,title); WindowRedrawStatus(2); Form.GetInfo(SelfInfo); IF (Form.height==GetSkinWidth()+3) return; //ничего не делать если окно схлопнуто в заголовок @@ -375,23 +417,38 @@ void FileList_ReDraw(int curbtn_) Line_ReDraw(videlenie, curbtn); //выделение return; } - //WriteDebug(IntToStr(curbtn)); =0 - //WriteDebug(IntToStr(za_kadrom)); =0 - //WriteDebug(IntToStr(count)); =41 - ELSE + else { IF(but_num+za_kadrom+curbtn_>=count) //18+0+33>=41 { - za_kadrom=count-but_num; //41-18=23 - //curbtn=but_num+curbtn_-count; //11=33-18 + //WriteDebug("1"); + za_kadrom=count-but_num; + curbtn=curbtn_-za_kadrom+curbtn; } ELSE { + //WriteDebug("2"); za_kadrom+=curbtn_+curbtn-but_num+1; //curbtn=but_num-1; + curbtn=but_num-1; + } + IF (curbtn<0) || (curbtn>but_num) + { + //ShowMessage("Bug found! Tell it Leency!"); + curbtn=but_num-1; } - curbtn=but_num-1; List_ReDraw(); + //WriteDebug(IntToStr(curbtn)); //=0 + //WriteDebug(IntToStr(za_kadrom)); //=0 + //WriteDebug(IntToStr(but_num)); //=41 + //WriteDebug(IntToStr(count)); //=41 + + /*WriteDebug(""); + WriteDebug(#path); + WriteDebug("Number of files:"); WriteDebug(IntToStr(count)); + WriteDebug("but_num:"); WriteDebug(IntToStr(but_num)); + WriteDebug("curbtn"); WriteDebug(IntToStr(curbtn)); + WriteDebug("ra_kadrom:"); WriteDebug(IntToStr(za_kadrom));*/ } } } @@ -622,37 +679,6 @@ void ReName(byte rename) } -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); - } - Actions(); //функции файлов и папок -} - - void Actions() { int actions_y=dev_num*16; @@ -682,15 +708,6 @@ void Actions() - /*WriteDebug(""); - WriteDebug(#path); - WriteDebug("Number of files:"); WriteDebug(IntToStr(count)); - WriteDebug("but_num:"); WriteDebug(IntToStr(but_num)); - WriteDebug("curbtn"); WriteDebug(IntToStr(curbtn)); - WriteDebug("ra_kadrom:"); WriteDebug(IntToStr(za_kadrom));*/ - - - void Goto_edit_path() { IF (strcmp(#path,#edit_path)==0) return; //проверка не в этой ли мы папке diff --git a/programs/fs/Eolite/trunk/include/ini.h-- b/programs/fs/Eolite/trunk/include/ini.h-- index 64848267ea..a88ee0a809 100644 --- a/programs/fs/Eolite/trunk/include/ini.h-- +++ b/programs/fs/Eolite/trunk/include/ini.h-- @@ -6,6 +6,9 @@ #define PARAM 2 #define OPTION 3 +char NOTIFY_PATH[7]="@notify"; + + void GetIni(byte onload) { byte section[32]='', parametr[32]='', option[256]='', InfType=0; @@ -14,10 +17,13 @@ void GetIni(byte onload) dword buff, fsize, tj; //читаем файл buff = malloc(1048576); - ReadFile(0, 1048576, buff, INI_PATH); - IF (EAX<>6) //если файл с настройками не найден + IF (onload==1) copystr(".ini", #program_path+strlen(#program_path)); //facepalm + ReadFile(0, 1048576, buff, #program_path); + IF (EAX<>6) //если файла с настройками нет в папке с программой смотрим в папке по-умолчанию + ReadFile(0, 1048576, buff, "/sys/File managers/Eolite.ini"); + IF (EAX<>6) //если файла с настройками тупо нет печалька { - IF (onload==1) RunProgram(NOTIFY_PATH, "Eolite.ini not found. Defaults will be used."); + IF (onload==1) RunProgram(#NOTIFY_PATH, "Eolite.ini not found. Defaults will be used."); IF (onload==0) goto RUN_AS_PROGRAM; } fsize=EBX; @@ -80,30 +86,30 @@ void Write_Debug_Error(int error_number){ IF (error_number<0) error_number=-1*error_number; switch (error_number) //извесная ошибка - пишем какая и уходим { - CASE 2: RunProgram(NOTIFY_PATH, "Eolite: error 2 - Function is not supported for the given file system"); + CASE 2: RunProgram(#NOTIFY_PATH, "Eolite: error 2 - Function is not supported for the given file system"); return; - CASE 3: RunProgram(NOTIFY_PATH, "Eolite: error 3 - Unknown file system"); + CASE 3: RunProgram(#NOTIFY_PATH, "Eolite: error 3 - Unknown file system"); return; - CASE 5: RunProgram(NOTIFY_PATH, "Eolite: error 5 - File or folder not found"); + CASE 5: RunProgram(#NOTIFY_PATH, "Eolite: error 5 - File or folder not found"); return; - CASE 6: RunProgram(NOTIFY_PATH, "Eolite: error 6 - End of file, EOF"); + CASE 6: RunProgram(#NOTIFY_PATH, "Eolite: error 6 - End of file, EOF"); return; - CASE 7: RunProgram(NOTIFY_PATH, "Eolite: error 7 - Pointer lies outside of application memory"); + CASE 7: RunProgram(#NOTIFY_PATH, "Eolite: error 7 - Pointer lies outside of application memory"); return; - case 8: RunProgram(NOTIFY_PATH, "Eolite: error 8 - FAT table is destroyed"); + case 8: RunProgram(#NOTIFY_PATH, "Eolite: error 8 - FAT table is destroyed"); return; - case 9: RunProgram(NOTIFY_PATH, "Eolite: error 9 - FAT table is destroyed"); + case 9: RunProgram(#NOTIFY_PATH, "Eolite: error 9 - FAT table is destroyed"); RETURN; - case 10:RunProgram(NOTIFY_PATH, "Eolite: error 10 - Access denied"); + case 10:RunProgram(#NOTIFY_PATH, "Eolite: error 10 - Access denied"); RETURN; - case 11:RunProgram(NOTIFY_PATH, "Eolite: error 11 - Device error"); + case 11:RunProgram(#NOTIFY_PATH, "Eolite: error 11 - Device error"); RETURN; - case 30:RunProgram(NOTIFY_PATH, "Eolite: error 30 - Not enough memory"); + case 30:RunProgram(#NOTIFY_PATH, "Eolite: error 30 - Not enough memory"); RETURN; - case 31:RunProgram(NOTIFY_PATH, "Eolite: error 31 - File is not executable"); + case 31:RunProgram(#NOTIFY_PATH, "Eolite: error 31 - File is not executable"); RETURN; - case 32:RunProgram(NOTIFY_PATH, "Eolite: error 32 - Too many processes"); + case 32:RunProgram(#NOTIFY_PATH, "Eolite: error 32 - Too many processes"); RETURN; - default:RunProgram(NOTIFY_PATH, "Unknown error number O_o"); + default:RunProgram(#NOTIFY_PATH, "Unknown error number O_o"); } } diff --git a/programs/fs/Eolite/trunk/lib/kolibri.h-- b/programs/fs/Eolite/trunk/lib/kolibri.h-- index ae1775c8d3..945755c237 100644 --- a/programs/fs/Eolite/trunk/lib/kolibri.h-- +++ b/programs/fs/Eolite/trunk/lib/kolibri.h-- @@ -10,8 +10,10 @@ dword final_addr = #stop+32; dword alloc_mem = 0x00100000; dword x86esp_reg = 0x00100000; // 0x0007fff0; dword I_Param = #param; -dword I_Icon = 0x0; -char param[256]=""; +dword I_Path = #program_path; +char param[4096]=""; +char program_path[4096]=""; + //Events #define evMouse 6 @@ -272,7 +274,7 @@ inline fastcall ChangeCase(dword EDX) do{ EDX++; AL=DSBYTE[EDX]; - IF(AL>='A')&&(AL<='Z'){DSBYTE[EDX]=AL|0x20; continue;} + IF(AL>='A')&&(AL<='Z'){DSBYTE[EDX]=AL|0x20; CONTINUE;} IF(AL>='Ђ')&&(AL<='Џ')DSBYTE[EDX]=AL|0x20; // -Ї IF (AL>=144) && (AL<=159) DSBYTE[EDX] = AL + 80; //а-п }while(AL!=0);