Subversion Repositories Kolibri OS

Rev

Rev 7054 | Rev 7149 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
7054 leency 1
_ini icons = { "/sys/File managers/icons.ini", "icons16" };
4042 leency 2
 
6757 leency 3
void DrawIconByExtension(dword file_path, extension, xx, yy, fairing_color)
4225 punk_joker 4
{
6757 leency 5
	char BYTE_HEAD_FILE[4];
7054 leency 6
	char ext[512];
5751 leency 7
	int i;
6278 leency 8
	dword icon_n=0;
7054 leency 9
 
10
	if (extension)
4225 punk_joker 11
	{
7054 leency 12
		strcpy(#ext, extension);
13
		strlwr(#ext);
14
		icon_n = icons.GetInt(#ext, 2);
6757 leency 15
	}
16
	else if (file_path)
17
	{
18
			ReadFile(0,4,#BYTE_HEAD_FILE,file_path);
7054 leency 19
			IF(DSDWORD[#BYTE_HEAD_FILE]=='KCPK')||(DSDWORD[#BYTE_HEAD_FILE]=='UNEM') icon_n = icons.GetInt("kex", 2);
4225 punk_joker 20
	}
7054 leency 21
	if (fairing_color==col_selec)
22
	{
23
		img_draw stdcall(icons16_selected.image, xx, yy, 16, 16, 0, icon_n*16);
24
		IconFairing(icon_n, xx, yy, fairing_color);
25
	}
26
	else
27
	{
28
		img_draw stdcall(icons16_default.image, xx, yy, 16, 16, 0, icon_n*16);
29
	}
4042 leency 30
}
31
 
32
 
33
void IconFairing(dword filenum, x,y, color)
34
{
35
	switch(filenum)
36
	{
7054 leency 37
		case 0: //folder
38
		case 22: //
7096 leency 39
			DrawBar(x+7,y+1,8,2,color);
40
			IF (filenum==22) PutPixel(x+10,y+2,0x1A7B17); //green arrow part
41
			DrawBar(x,y+14,15,2,color);
42
			PutPixel(x,y+1,color);
43
			PutPixel(x+6,y+1,color);
44
			PutPixel(x+14,y+3,color);
45
			PutPixel(x,y+13,color);
46
			PutPixel(x+14,y+13,color);
4042 leency 47
			return;
48
	}
49
}