2017-10-05 23:38:09 +02:00
|
|
|
_ini icons = { "/sys/File managers/icons.ini", "icons16" };
|
2013-03-11 19:16:24 +01:00
|
|
|
|
2016-11-25 15:15:30 +01:00
|
|
|
void DrawIconByExtension(dword file_path, extension, xx, yy, fairing_color)
|
2013-11-14 01:22:55 +01:00
|
|
|
{
|
2016-11-25 15:15:30 +01:00
|
|
|
char BYTE_HEAD_FILE[4];
|
2017-10-05 23:38:09 +02:00
|
|
|
char ext[512];
|
2015-08-20 12:06:51 +02:00
|
|
|
int i;
|
2018-02-18 16:32:11 +01:00
|
|
|
dword icon_n=2; // set default icon
|
2017-10-05 23:38:09 +02:00
|
|
|
|
|
|
|
if (extension)
|
2013-11-14 01:22:55 +01:00
|
|
|
{
|
2017-10-05 23:38:09 +02:00
|
|
|
strcpy(#ext, extension);
|
|
|
|
strlwr(#ext);
|
|
|
|
icon_n = icons.GetInt(#ext, 2);
|
2016-11-25 15:15:30 +01:00
|
|
|
}
|
|
|
|
else if (file_path)
|
|
|
|
{
|
|
|
|
ReadFile(0,4,#BYTE_HEAD_FILE,file_path);
|
2017-10-05 23:38:09 +02:00
|
|
|
IF(DSDWORD[#BYTE_HEAD_FILE]=='KCPK')||(DSDWORD[#BYTE_HEAD_FILE]=='UNEM') icon_n = icons.GetInt("kex", 2);
|
|
|
|
}
|
|
|
|
if (fairing_color==col_selec)
|
|
|
|
{
|
2018-03-20 18:03:14 +01:00
|
|
|
img_draw stdcall(icons16_selected.image, xx, yy, icon_size, icon_size, 0, icon_n*icon_size);
|
2017-10-05 23:38:09 +02:00
|
|
|
IconFairing(icon_n, xx, yy, fairing_color);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-03-20 18:03:14 +01:00
|
|
|
img_draw stdcall(icons16_default.image, xx, yy, icon_size, icon_size, 0, icon_n*icon_size);
|
2013-11-14 01:22:55 +01:00
|
|
|
}
|
2013-03-11 19:16:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-10-16 01:30:35 +02:00
|
|
|
void IconFairing(dword filenum, x,y, color)
|
2013-03-11 19:16:24 +01:00
|
|
|
{
|
2018-02-07 16:43:26 +01:00
|
|
|
//0 = folder
|
|
|
|
//22 = forder with up arrow
|
|
|
|
if (filenum == 0) || (filenum == 22)
|
2013-03-11 19:16:24 +01:00
|
|
|
{
|
2018-02-07 16:43:26 +01:00
|
|
|
DrawBar(x+7,y+1,8,2,color);
|
|
|
|
DrawBar(x,y+14,15,2,color);
|
|
|
|
PutPixel(x,y+1,color);
|
|
|
|
PutPixel(x+6,y+1,color);
|
|
|
|
PutPixel(x+14,y+3,color);
|
|
|
|
PutPixel(x,y+13,color);
|
|
|
|
PutPixel(x+14,y+13,color);
|
2013-03-11 19:16:24 +01:00
|
|
|
}
|
2018-02-07 16:43:26 +01:00
|
|
|
if (filenum == 22) PutPixel(x+10,y+2,0x1A7B17); //green arrow part
|
2013-03-11 19:16:24 +01:00
|
|
|
}
|