Subversion Repositories Kolibri OS

Rev

Rev 6757 | Rev 7096 | 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: //
39
			DrawBar(x+7,y,8,2,color);
40
			IF (filenum==22) PutPixel(x+10,y+1,0x1A7B17); //green arrow part
41
			DrawBar(x,y+13,15,2,color);
42
			PutPixel(x,y,color);
43
			PutPixel(x+6,y,color);
44
			PutPixel(x+14,y+2,color);
45
			PutPixel(x,y+12,color);
46
			PutPixel(x+14,y+12,color);
4042 leency 47
			return;
7054 leency 48
		case 13: //html
4049 leency 49
			DrawBar(x,y,1,7,color);
50
			DrawBar(x+1,y,1,6,color);
51
			DrawBar(x,y+10,1,5,color);
52
			DrawBar(x+1,y+11,1,4,color);
4042 leency 53
			return;
7054 leency 54
		case 12: //font
4049 leency 55
			DrawBar(x+1,y+1,1,13,color);
4057 leency 56
			DrawBar(x+2,y+1,1,11,color);
57
			DrawBar(x+3,y+1,1,10,color);
58
			DrawBar(x+4,y+1,1,9,color);
59
			DrawBar(x+5,y+1,1,7,color);
60
			DrawBar(x+6,y+1,1,5,color);
61
			DrawBar(x+7,y+1,1,4,color);
62
			DrawBar(x+8,y+1,1,2,color);
63
			DrawBar(x+14,y+1,1,13,color);
64
			DrawBar(x+13,y+1,1,11,color);
65
			PutPixel(x+9,y+6,color);
66
			DrawBar(x+8,y+10,2,1,color);
67
			DrawBar(x+7,y+11,2,3,color);
4042 leency 68
			return;
7054 leency 69
		case 23: //nes
4049 leency 70
			DrawBar(x,y+11,1,2,color);
4057 leency 71
			DrawBar(x+15,y+11,1,2,color);
4049 leency 72
			DrawBar(x,y+13,16,1,color);
4042 leency 73
			return;
74
	}
75
}