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
This commit is contained in:
Kirill Lipatov (Leency) 2011-08-18 13:32:06 +00:00
parent 03699fe762
commit feeaab087e
3 changed files with 99 additions and 74 deletions

View File

@ -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;i<dev_num;i++)
{
DrawBar(17,i*16+74,160,17,0xFFFFFF); //áåëîå
DefineButton(17,i*16+74,159,16,100+i+BT_HIDE,0xFFFFFF); //ñîçäà¸ì êíîïêè, à ïîòîì âûâîäèì íàçâàíèÿ äèñêîâ
copystr("Unknown drive",#drive_name); //èçíà÷àëüíî íåèçâåñíûé íîñèòåëü
dev_icon=3; //ïî-óìîë÷àíèþ óñòðîéñòâî âûãëÿäèò êàê æåñòÿê
copystr(i*304+ devbuf+72, #dev_name);
IF (dev_name[0]=='r') { dev_icon=0; copystr("RAM-disk /rd/1",#drive_name); }
IF (dev_name[0]=='c') { dev_icon=1; copystr("CD-drive /",#drive_name); }
IF (dev_name[0]=='f') { dev_icon=2; copystr("Floppy disk /",#drive_name); }
IF (dev_name[0]=='h') copystr("Hard disk drive /",#drive_name);
IF (dev_name[0]=='b') copystr("SATA disk drive /",#drive_name);
//
IF (dev_icon<>0) 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;
}
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;i<dev_num;i++)
{
DrawBar(17,i*16+74,160,17,0xFFFFFF); //áåëîå
DefineButton(17,i*16+74,159,16,100+i+BT_HIDE,0xFFFFFF); //ñîçäà¸ì êíîïêè, à ïîòîì âûâîäèì íàçâàíèÿ äèñêîâ
copystr("Unknown drive",#drive_name); //èçíà÷àëüíî íåèçâåñíûé íîñèòåëü
dev_icon=3; //ïî-óìîë÷àíèþ óñòðîéñòâî âûãëÿäèò êàê æåñòÿê
copystr(i*304+ devbuf+72, #dev_name);
IF (dev_name[0]=='r') { dev_icon=0; copystr("RAM-disk /rd/1",#drive_name); }
IF (dev_name[0]=='c') { dev_icon=1; copystr("CD-drive /",#drive_name); }
IF (dev_name[0]=='f') { dev_icon=2; copystr("Floppy disk /",#drive_name); }
IF (dev_name[0]=='h') copystr("Hard disk drive /",#drive_name);
IF (dev_name[0]=='b') copystr("SATA disk drive /",#drive_name);
//
IF (dev_icon<>0) 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; //ïðîâåðêà íå â ýòîé ëè ìû ïàïêå

View File

@ -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");
}
}

View File

@ -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<='<27>')DSBYTE[EDX]=AL|0x20; // 
IF (AL>=144) && (AL<=159) DSBYTE[EDX] = AL + 80; //à-ï
}while(AL!=0);