Subversion Repositories Kolibri OS

Compare Revisions

No changes between revisions

Regard whitespace Rev 3362 → Rev 3363

/programs/cmm/eolite/include/about_dialog.h
0,0 → 1,40
//Leency - 2008-2013
 
#define EDITOR_PATH "/sys/tinypad"
#define BROWSER_PATH "/sys/htmlv"
#define BROWSER_LINK "http://kolibri-n.org/index.php"
 
 
void about_dialog()
{
byte id;
loop() switch(WaitEvent())
{
case evButton:
id=GetButtonID();
IF (id==1) || (id==10) ExitProcess();
IF (id==23) RunProgram(BROWSER_PATH, BROWSER_LINK);
IF (id==33) RunProgram(EDITOR_PATH, #program_path);
break;
case evKey:
IF (GetKey()==27) ExitProcess();
break;
case evReDraw:
DefineAndDrawWindow(600,150,181,232+GetSkinHeight(),0x34,col_work,"About Eolite");
DrawBar(0,0,172,50,0x8494C4);
PutPaletteImage(#logo,85,85,43,7,8,#logo_pal);
WriteTextB(46,100,0x90,0xBF40BF,"Eolite v1.62");
WriteText(55,120,0x80,0,"Developers:");
WriteText(39,130,0x80,0,"Leency & Veliant");
WriteText(45,140,0x80,0,"KolibriOS Team");
WriteText(61,150,0x80,0,"2008-2013");
WriteText(29,170,0x80,0,"Visit");
DrawLink(66,170,0x80,23, "kolibri-n.org");
DrawFlatButton(85,190,70,22,10,0xE4DFE1, "Close");
DefineButton(20-1,195-1, 16+1,15+1, 33+BT_HIDE, 0);
PutPaletteImage(8*16*15+#ficons,16,15,20,195,8,#ficons_pal);
DrawFilledBar(0, 216, 172, 12);
}
}
/programs/cmm/eolite/include/history.h
0,0 → 1,57
//06.04.2012
 
path_string history_list[40];
int history_num;
int history_current;
 
#define ADD_NEW_PATH 1
#define GO_BACK 2
#define GO_FORWARD 3
 
dword GetCurrentFolder()
{
char cur_fol[4096];
strcpy(#cur_fol, #path);
cur_fol[strlen(#cur_fol)-1]=0x00; //îáðåçàåì ïîñëåäíèé /
strcpy(#cur_fol, #cur_fol+strrchr(#cur_fol,'/'));
return #cur_fol;
}
 
int HistoryPath(byte action)
{
int MAX_HISTORY_NUM;
if (action==ADD_NEW_PATH)
{
if (history_num>0) && (!strcmp(#path,#history_list[history_current].Item)) return;
MAX_HISTORY_NUM = sizeof(history_list)/sizeof(path_string);
if (history_current>=MAX_HISTORY_NUM-1)
{
history_current/=2;
for (i=0; i<history_current; i++;)
{
strcpy(#history_list[i].Item, #history_list[MAX_HISTORY_NUM-i].Item);
}
}
history_current++;
strcpy(#history_list[history_current].Item, #path);
history_num=history_current;
}
if (action==GO_BACK)
{
if (history_current<=2) return 0;
history_current--;
strcpy(#path, #history_list[history_current].Item);
return 1;
}
 
if (action==GO_FORWARD)
{
if (history_current==history_num) return 0;
history_current++;
strcpy(#path, #history_list[history_current].Item);
return 1;
}
}
/programs/cmm/eolite/include/icons_f.h
0,0 → 1,301
char *ext[]={
"..", 17,
"<DIR>",16,
"txt", 1,
"doc", 1,
"rtf", 1,
"odt", 1,
"log", 1,
"docx",1,
"htm", 2,
"html",2,
"mht", 2,
"ini", 3,
"js", 3,
"conf",3,
"inf", 3,
"xlt", 4,
"xls", 4,
"ods", 4,
"xlsx",4,
"cmd", 5,
"bat", 5,
"py", 5,
"sh", 5,
"ksh", 5,
"com", 5,
"kex", 6,
"lua", 6,
"exe", 7,
"msi", 7,
"sys", 8,
"ocx", 8,
"drv", 8,
"so", 8,
"inc", 9,
"chr", 10,
"mt", 10,
"ttf", 10,
"fon", 10,
"asm", 11,
"skn", 13,
"djvu",15,
"pdf", 15,
"fb2", 15,
"nes", 18,
"smc", 18,
"img", 21,
"ima", 21,
"dll", 22,
"obj", 22,
"dict",22,
"iso", 24,
"cue", 24,
"nrg", 24,
"mdf", 24,
"gif", 19,
"bmp", 19,
"tga", 19,
"pcx", 19,
"png", 19,
"pnm", 19,
"jpg", 19,
"xcf", 19,
"ai", 19,
"jpeg",19,
"raw", 19,
"psd", 19,
"wbmp",19,
"tiff",19,
"tif", 19,
"3ds", 20,
"ico", 20,
"cur", 20,
"ani", 20,
"vox", 20,
"rar", 23,
"zip", 23,
"cab", 23,
"tar", 23,
"ajr", 23,
"jar", 23,
"7z", 23,
"gz", 23,
"mp3", 12,
"wav", 12,
"mid", 12,
"midi",12,
"ogg", 12,
"wma", 12,
"flac",12,
"avi", 14,
"flv", 14,
"mpg", 14,
"wmv", 14,
"mov", 14,
"mkv", 14,
"mp4", 14,
"vob", 14,
"grf", 25,
0,0};
 
 
#include "imgs\icons.txt"
 
 
void Put_icon(dword extension, yy, fairing_color)
{
int icon_n=0, i;
 
for (i=0; ext[i]<>0; i+=2;)
if (!strcmp(extension, ext[i]))
{
icon_n = ext[i+1];
break;
}
 
PutPaletteImage(icon_n*16*15+#ficons,16,15,195,yy,8,#ficons_pal);
if (icon_n<>17) && (strlen(extension)<9) WriteText(-strlen(extension)*3+onLeft(168,0)+36,yy+4,0x80,0,extension);
if (fairing_color<>0xFFFfff) IconFairing(icon_n, yy, fairing_color); //çàêðàøèâàåì èêîíêó
}
 
 
 
void IconFairing(dword filenum, y, color)
{
switch(filenum)
{
case 0...1: //ôàéëèê
DrawBar(195,y,2,15,color);
RIGHT_PAINT:
DrawBar(209,y,2,15,color);
DrawBar(205,y,4,1,color);
DrawBar(206,y+1,3,1,color);
DrawBar(207,y+2,2,1,color);
PutPixel(208,y+3,color);
return;
case 2: //html
DrawBar(195,y,1,7,color);
DrawBar(196,y,1,6,color);
DrawBar(195,y+10,1,5,color);
DrawBar(196,y+11,1,4,color);
GOTO RIGHT_PAINT;
case 3: //íàñòðîéêè
DrawBar(195,y,2,7,color);
DrawBar(195,y+7,1,2,color);
DrawBar(195,y+12,1,3,color);
PutPixel(196,y+14,color);
GOTO RIGHT_PAINT;
case 9: //inc
DrawBar(195,y,1,12,color);
DrawBar(196,y,1,11,color);
DrawBar(197,y,1,10,color);
DrawBar(198,y,1,5,color);
DrawBar(199,y,1,4,color);
DrawBar(200,y,1,3,color);
DrawBar(201,y,1,2,color);
DrawBar(202,y,1,3,color);
DrawBar(203,y,1,2,color);
PutPixel(204,y,color);
PutPixel(205,y+4,color);
PutPixel(206,y+3,color);
PutPixel(207,y,color);
PutPixel(207,y+2,color);
DrawBar(208,y,1,3,color);
DrawBar(209,y,2,4,color);
DrawBar(210,y,1,15,color);
PutPixel(198,y+14,color);
DrawBar(199,y+13,1,2,color);
DrawBar(200,y+12,10,3,color);
PutPixel(205,y+11,color);
DrawBar(206,y+10,1,2,color);
DrawBar(207,y+9,1,3,color);
PutPixel(207,y+7,color);
DrawBar(208,y+6,2,7,color);
PutPixel(209,y+5,color);
return;
case 10: //font
DrawRectangle3D(195,y,15,14,color,color);
DrawBar(196,y+1,1,13,color);
DrawBar(197,y+1,1,11,color);
DrawBar(198,y+1,1,10,color);
DrawBar(199,y+1,1,9,color);
DrawBar(200,y+1,1,7,color);
DrawBar(201,y+1,1,5,color);
DrawBar(202,y+1,1,4,color);
DrawBar(203,y+1,1,2,color);
DrawBar(209,y+1,1,13,color);
DrawBar(208,y+1,1,11,color);
PutPixel(204,y+6,color);
DrawBar(203,y+10,2,1,color);
DrawBar(202,y+11,2,3,color);
return;
case 11: //asm
DrawBar(195,y,1,15,color);
return;
case 12: //audio
DrawBar(195,y,16,1,color);
DrawBar(195,y,1,15,color);
DrawBar(196,y+1,4,8,color);
DrawBar(196,y+9,1,2,color);
PutPixel(197,y+9,color);
PutPixel(196,y+14,color);
DrawBar(210,y+1,1,14,color);
DrawBar(202,y+4,6,4,color);
DrawBar(202,y+8,4,1,color);
DrawBar(202,y+9,3,1,color);
DrawBar(202,y+10,2,3,color);
DrawBar(201,y+13,4,1,color);
DrawBar(200,y+14,14,1,color);
DrawBar(209,y+12,1,2,color);
PutPixel(208,y+13,color);
return;
case 13: //skin
PutPixel(210,y,color);
return;
case 14...15: //video, book
DrawBar(195,y,1,15,color);
DrawBar(210,y,1,15,color);
return;
case 16...17: //ïàïêà
DrawBar(195,y,1,15,color);
DrawBar(203,y,8,2,color);
IF (filenum==17) PutPixel(206,y+1,0x1A7B17); //çåë¸íàÿ òî÷êà ñòðåëêè
DrawBar(196,y+13,15,2,color);
PutPixel(196,y,color); //.òî÷êè
PutPixel(202,y,color);
PutPixel(210,y+2,color);
PutPixel(196,y+12,color);
PutPixel(210,y+12,color);
return;
case 18: //êàðòðèäæ
DrawBar(195,y,16,2,color);
DrawBar(195,y+11,1,2,color);
DrawBar(210,y+11,1,2,color);
DrawBar(195,y+13,16,2,color);
return;
case 19: //èçîáðàæåíèå
case 20: //èçîáðàæåíèå
DrawBar(195,y+14,16,1,color);
return;
case 21: //äèñêåòà
PutPixel(195,y,color);
PutPixel(210,y,color);
return;
case 22: //áèáëèîòåêà
DrawBar(195,y,16,1,color); //ñâåðõó ñëåâà
DrawBar(195,y+1,3,1,color);
DrawBar(195,y+2,2,1,color);
PutPixel(195,y+3,color);
PutPixel(210,y+11,color); //ñïðàâà ñïðàâà
DrawBar(209,y+12,2,1,color);
DrawBar(208,y+13,3,1,color);
DrawBar(207,y+14,4,1,color);
return;
case 23: //àðõèâ
PutPixel(195,y+3,color);
PutPixel(195,y+11,color);
PutPixel(210,y+3,color);
PutPixel(210,y+11,color);
 
DrawBar(195,y,7,1,color);
DrawBar(204,y,7,1,color);
DrawBar(195,y+14,7,1,color);
DrawBar(204,y+14,7,1,color);
 
DrawBar(195,y+1,5,1,color);
DrawBar(206,y+1,5,1,color);
DrawBar(195,y+13,5,1,color);
DrawBar(206,y+13,5,1,color);
 
DrawBar(195,y+2,3,1,color);
DrawBar(208,y+2,3,1,color);
DrawBar(195,y+12,3,1,color);
DrawBar(208,y+12,3,1,color);
return;
case 24: //îáðàç
DrawBar(195,y,6,1,color);
DrawBar(195,y+1,4,1,color);
DrawBar(195,y+2,3,1,color);
DrawBar(195,y+3,2,2,color);
DrawBar(195,y+5,1,5,color);
DrawBar(195,y+10,2,2,color);
DrawBar(195,y+12,3,1,color);
DrawBar(195,y+13,4,1,color);
DrawBar(195,y+14,6,1,color);
 
DrawBar(195+11,y,5,1,color);
DrawBar(195+13,y+1,3,1,color);
DrawBar(195+14,y+2,2,1,color);
DrawBar(195+15,y+3,1,2,color);
DrawBar(195+15,y+10,1,2,color);
DrawBar(195+14,y+12,2,1,color);
DrawBar(195+13,y+13,3,1,color);
DrawBar(195+11,y+14,5,1,color);
 
return;
}
}
/programs/cmm/eolite/include/ini.h
0,0 → 1,134
//INI parser in C--, GPL licence.
//Leency - 2012
 
#define COMMENT 0
#define SECTION 1
#define PARAM 2
#define OPTION 3
 
unsigned char *ERROR_TEXT[]={
"Code #0 - No error",
"Error #1 - Base or partition of a hard disk is not defined",
"Error #2 - Function isn't supported for this file system",
"Error #3 - Unknown file system",
"Error #4 - Reserved, is never returned",
"Error #5 - File or folder not found",
"Error #6 - End of file, EOF",
"Error #7 - Pointer lies outside of application memory",
"Error #8 - FAT table is destroyed",
"Error #9 - FAT table is destroyed",
"Error #10 - Access denied",
"Error #11 - Device error",
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
"Error #30 - Not enough memory",
"Error #31 - File is not executable",
"Error #32 - Too many processes",
0};
 
void GetIni(byte onload)
{
byte section[32], parametr[32], option[256], InfType=0;
char bukva[2];
int errornum, tj;
static dword buff, fsize;
//÷èòàåì ôàéë
if (onload==1)
{
free(buff);
buff = malloc(12000);
program_path[strrchr(#program_path, '/')] = NULL;
strcat(#program_path, "Eolite.ini");
ReadFile(0, 12000, buff, #program_path);
fsize=EBX;
IF (EAX<>6) ReadFile(0, 12000, buff, "/sys/File managers/Eolite.ini");
IF (EAX<>6) notify("Eolite.ini not found. Defaults will be used.");
}
//ïàðñèì åãî
for (tj=0; tj<fsize; tj++;)
{
bukva = ESBYTE[buff+tj];
switch (bukva)
{
case ';':
InfType=COMMENT;
break;
case '[':
InfType=SECTION;
section=NULL;
break;
case ']':
InfType=PARAM;
break;
case '=':
InfType=OPTION;
break;
case 0x0a:
case 0x0d:
InfType=PARAM;
IF (!strcmp(#parametr,"SelectionColor")) edit2.shift_color=col_selec=StrToCol(#option);
IF (!strcmp(#parametr,"LineHeight")) BUTTON_HEIGHT=atoi(#option);
IF (!strcmp(#parametr,"ShowDeviceName")) show_dev_name=atoi(#option);
/*if (!strcmp(#section,"UserDirectories")) && (parametr) && (onload)
{
copystr(#parametr, #disk_list[disc_num].Item);
disc_num++;
}*/
IF (parametr) && (!strcmp(#file_name+strrchr(#file_name,'.'),#parametr)) && (!onload)
{
errornum=RunProgram(#option,#file_path);
IF (errornum<0) Write_Error(errornum); //åñëè îøèáî÷êà âûøëà ïðè çàïóñêå
return;
}
parametr=option=NULL;
break;
default:
IF (InfType==SECTION) chrcat(#section, bukva);
IF (InfType==PARAM) chrcat(#parametr, bukva);
IF (InfType==OPTION) chrcat(#option, bukva);
}
}
if (file_path) && (!onload)
{
errornum=RunProgram(#file_path,NULL);
if (errornum<0) Write_Error(errornum); //åñëè îøèáî÷êà âûøëà ïðè çàïóñêå
}
}
 
 
void Write_Error(int error_number)
{
char error[256];
 
if (error_number<0) error_number=-1*error_number;
if (error_number<33)
strcpy(#error, ERROR_TEXT[error_number]);
else
{
strcpy(#error, itoa(error_number));
strcat(#error, " - Unknown error number O_o");
}
if (curbtn>=0) Line_ReDraw(0xFF0000, curbtn);
pause(5);
notify(#error);
}
 
 
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;
}
/programs/cmm/eolite/include/left_panel.h
0,0 → 1,192
void Tip(int y, dword caption, id, arrow)
{
int i;
DrawBar(17,y,160,1,0xEFEDEE);
DrawFilledBar(17, y+1, 160, 16);
WriteText(25,y+5,0x80,0,caption);
IF (id<>0) DefineButton(159,y+1,16,16,id+BT_HIDE+BT_NOFRAME,0xE4DFE1); //êíîïà äëÿ ñòðåëêè
WriteText(165,y+5,0x80,0,arrow); //ñòðåëêà âíèç
DrawBar(17,y+17,160,1,0x94AECE); //ïîä÷¸ðêèâàíèå
}
 
 
path_string disk_list[20];
int disc_num;
dword devbuf;
 
void GetSystemDiscs()
{
unsigned char dev_name[10], sys_discs[10];
unsigned int i1, j1, dev_num, dev_disc_num;
disc_num=0;
if (devbuf) free(devbuf);
devbuf = malloc(3112); //áóôåð ãäå-òî íà 10 äåâàéñîâ â ëåâîé ïàíåëè
ReadDir(19, devbuf, "/");
dev_num = EBX;
for (i1=0; i1<dev_num; i1++)
{
strcpy(#dev_name, "/"); // /
strcat(#dev_name, i1*304+ devbuf+72); // /rd
strcat(#dev_name, "/"); // /rd/
Open_Dir(#dev_name, ONLY_OPEN);
dev_disc_num = count;
//if (count<=0) copystr(#dev_name,#disk_list[disc_num].Item); else
for (j1=0; j1<dev_disc_num; j1++;)
{
strcpy(#sys_discs, #dev_name); // /rd/
strcat(#sys_discs, j1*304+ buf+72); // /rd/1
strcat(#sys_discs, "/"); // /rd/1/
strcpy(#disk_list[disc_num].Item, #sys_discs);
disc_num++;
}
}
}
 
 
void DrawSystemDiscs()
{
byte disc_icon;
char dev_name[10];
char disc_name[100];
int i, dev_icon;
for (i=0; i<20; i++) DeleteButton(100+i);
//ñïèñîê äèñêîâ
Tip(56, "Devices", 78, "=");
for (i=0;i<disc_num;i++)
{
DrawBar(17,i*16+74,160,17,0xFFFFFF); //ôîí
DefineButton(17,i*16+74,159,16,100+i+BT_HIDE,0xFFFFFF); //ñîçäà¸ì êíîïêè, à ïîòîì âûâîäèì íàçâàíèÿ äèñêîâ
strcpy(#dev_name, #disk_list[i].Item);
dev_name[strlen(#dev_name)-1]=NULL;
switch(dev_name[1])
{
case 'r':
dev_icon=0;
strcpy(#disc_name, "RAM disk ");
break;
case 'c':
dev_icon=1;
strcpy(#disc_name, "CD-ROM ");
break;
case 'f':
dev_icon=2;
strcpy(#disc_name, "Floppy disk ");
break;
case 'h':
case 'b':
dev_icon=3;
strcpy(#disc_name, "Hard disk ");
break;
case 'u':
dev_icon=5;
strcpy(#disc_name, "USB flash ");
break;
case 't':
dev_icon=4;
strcpy(#disc_name, "RAM disk ");
DefineButton(17+143,i*16+74,16,16,i+130+BT_HIDE+BT_NOFRAME,0xFFFFFF);
WriteText(45+121,i*16+79,0x80,0xD63535,"-");
WriteText(45+121,i*16+79+1,0x80,0xBC2424,"-");
break;
default:
dev_icon=3; //ïî-óìîë÷àíèþ óñòðîéñòâî âûãëÿäèò êàê æåñòÿê íî ýòî íåïðàâèëüíî
strcpy(#disc_name, "Unknown ");
}
strcat(#disc_name, #dev_name);
if (show_dev_name) WriteText(45,i*16+79,0x80,0,#disc_name);
else WriteText(45,i*16+79,0x80,0,#dev_name);
_PutImage(21,i*16+76, 14,13, dev_icon*14*13*3+#devices);
}
}
 
void FileMenu()
{
word id, key;
loop() switch(WaitEvent())
{
case evButton:
id=GetButtonID();
ExitProcess();
break;
case evKey:
IF (GetKey()==27) ExitProcess();
break;
case evReDraw:
DefineAndDrawWindow(m.x+1+Form.left,m.y+Form.top,159,90,0x01,0xEEEeee,0x01fffFFF);
DrawBar(1,18,160,51,0xFFFFFF); //áåëîå
_PutImage(1,23, 16,44, #factions); //èêîíêè
//rename file
DefineButton(1,18,159,16,80+BT_HIDE,0xE4DFE1);
WriteText(26,23,0x80,0,"Rename file");
WriteText(134,23,0x80,0x999999,"[F2]");
//delete file
DefineButton(1,35,159,16,81+BT_HIDE,0xE4DFE1);
WriteText(26,40,0x80,0,"Delete file");
WriteText(144,40,0x80,0x999999,"[Del]");
//create folder
DefineButton(1,52,159,16,82+BT_HIDE,0xE4DFE1);
WriteText(26,57,0x80,0,"Create folder");
WriteText(134,57,0x80,0x999999,"[F6]");
}
}
 
void Actions()
{
int actions_y=disc_num*16;
DeleteButton(80);
DeleteButton(81);
DeleteButton(82);
if (!show_actions)
Tip(actions_y+90, "Actions", 77, "\x18");
else
{
Tip(actions_y+90, "Actions", 77, "\x19"); //çàãîëîâîê
DrawBar(17,actions_y+108,160,51,0xFFFFFF); //áåëîå
_PutImage(21,actions_y+113, 16,44, #factions); //èêîíêè
//rename file
DefineButton(17,actions_y+108,159,16,80+BT_HIDE,0xE4DFE1);
WriteText(42,actions_y+113,0x80,0,"Rename file");
WriteText(150,actions_y+113,0x80,0x999999,"[F2]");
//delete file
DefineButton(17,actions_y+125,159,16,81+BT_HIDE,0xE4DFE1);
WriteText(42,actions_y+130,0x80,0,"Delete file");
WriteText(144,actions_y+130,0x80,0x999999,"[Del]");
//create folder
DefineButton(17,actions_y+142,159,16,82+BT_HIDE,0xE4DFE1);
WriteText(42,actions_y+147,0x80,0,"Create folder");
WriteText(150,actions_y+147,0x80,0x999999,"[F6]");
}
}
 
 
void LeftPanelBackground()
{
int actions_y=disc_num*16;
int start_y = show_actions*51+actions_y+108;
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, 8, #blue_hl_pal);
else
{
DrawBar(2,start_y,190,onTop(start_y,6+268),col_lpanel);
PutPaletteImage(#blue_hl, 190, 268, 2, onTop(268,6), 8, #blue_hl_pal);
}
}
 
 
void DrawLeftPanel()
{
DrawSystemDiscs();
Actions();
LeftPanelBackground();
}
 
/programs/cmm/eolite/include/some_code.h
0,0 → 1,69
//Leency - 2012
 
dword onLeft(dword right,left) {EAX=Form.width-right-left;}
dword onTop(dword down,up) {EAX=Form.height-GetSkinHeight()-down-up;}
 
 
void ShowMessage(dword message)
{
DrawFlatButton(Form.width/2-13,160,200,80,0,0xFFB6B5, message);
pause(150);
List_ReDraw();
}
 
 
dword ConvertSize(dword bytes)
{
unsigned char size_prefix[8], size_nm[4];
if (bytes>=1073741824) strcpy(#size_nm, " Gb");
else if (bytes>=1048576) strcpy(#size_nm, " Mb");
else if (bytes>=1024) strcpy(#size_nm, " Kb");
else strcpy(#size_nm, " b ");
while (bytes>1023) bytes/=1024;
strcpy(#size_prefix, itoa(bytes));
strcat(#size_prefix, #size_nm);
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, 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,-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;
DrawRectangle(x,y,width,height,col_border);
DrawRectangle3D(x+1,y+1,width-2,height-2,0xFEFEFE,col_padding);
PutPixel(x+width-1, y+1, col_work);
if (color!=-1) 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);
}
 
void DrawFilledBar(dword x, y, w, h)
{
int i, fill_h;
if (h <= 14) fill_h = h; else fill_h = 14;
for (i=0; i<fill_h; i++) DrawBar(x, y+i, w, 1, col_palette[14-i]);
DrawBar(x, y+i, w, h-fill_h, col_palette[14-i]);
}
/programs/cmm/eolite/include/sorting.h
0,0 → 1,51
//Áûñòðàÿ ñîðòèðîâêà. Leency 2008.
 
void Sort_by_Size(int a, b) // äëÿ ïåðâîãî âûçîâà: a = 0, b = <ýëåìåíòîâ â ìàññèâå> - 1
{
int iss = a;
IF (a >= b) return;
FOR (j = a; j <= b; j++)
IF (ESDWORD[file_mas[j]*304 + buf+64] <= ESDWORD[file_mas[b]*304 + buf+64]) { file_mas[iss] >< file_mas[j]; iss++;}
Sort_by_Size (a, iss-2);
Sort_by_Size (iss, b);
}
 
 
void Sort_by_Name(int a, b) // äëÿ ïåðâîãî âûçîâà: a = 0, b = <ýëåìåíòîâ â ìàññèâå> - 1
{
int isn = a;
IF (a >= b) return;
FOR (j = a; j <= b; j++)
IF (strcmp(file_mas[j]*304 + buf+72, file_mas[b]*304 + buf+72)<=0) { file_mas[isn] >< file_mas[j]; isn++;}
Sort_by_Name(a, isn-2);
Sort_by_Name(isn, b);
}
 
void Sort_by_Type(int a, b) // äëÿ ïåðâîãî âûçîâà: a = 0, b = <ýëåìåíòîâ â ìàññèâå> - 1
{
dword filename1, filename2, ext1, ext2;
int n, isn = a;
IF (a >= b) return;
for (j = a; j <= b; j++)
{
filename1 = file_mas[j]*304 + buf+72;
filename2 = file_mas[b]*304 + buf+72;
 
n=strlen(filename1)-1;
WHILE (n>0) && (ESBYTE[filename1+n]<>'.') n--;
IF (n) ext1 = filename1+n+1; else ext1=0;
n=strlen(filename2)-1;
WHILE (n>0) && (ESBYTE[filename2+n]<>'.') n--;
IF (n) ext2 = filename2+n+1; else ext2=0;
 
n=strcmp(ext1, ext2);
IF (n<0) { file_mas[isn] >< file_mas[j]; isn++;}
IF (n==0) && (strcmp(filename1, filename2)<=0) { file_mas[isn] >< file_mas[j]; isn++;}
}
Sort_by_Type(a, isn-2);
Sort_by_Type(isn, b);
}
 
 
 
/programs/cmm/eolite/include/.
Property changes:
Added: tsvn:logminsize
+5
\ No newline at end of property