Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
7242 leency 1
_ini icons_ini = { "/sys/File managers/icons.ini", NULL };
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;
7242 leency 8
	dword icon_n;
9
	dword selected_image;
10
	dword default_image;
7054 leency 11
 
7244 leency 12
	if (big_icons.checked) {
7242 leency 13
		icons_ini.section = "icons32";
14
		selected_image = icons32_selected.image;
15
		default_image = icons32_default.image;
16
	}
17
	else {
18
		icons_ini.section = "icons16";
19
		selected_image = icons16_selected.image;
20
		default_image = icons16_default.image;
21
	}
22
 
7054 leency 23
	if (extension)
4225 punk_joker 24
	{
7054 leency 25
		strcpy(#ext, extension);
26
		strlwr(#ext);
7242 leency 27
		icon_n = icons_ini.GetInt(#ext, 2);
6757 leency 28
	}
29
	else if (file_path)
30
	{
31
			ReadFile(0,4,#BYTE_HEAD_FILE,file_path);
7242 leency 32
			IF(DSDWORD[#BYTE_HEAD_FILE]=='KCPK')||(DSDWORD[#BYTE_HEAD_FILE]=='UNEM')
33
				icon_n = icons_ini.GetInt("kex", 2);
4225 punk_joker 34
	}
7054 leency 35
	if (fairing_color==col_selec)
36
	{
7242 leency 37
		img_draw stdcall(selected_image, xx, yy, icon_size, icon_size, 0, icon_n*icon_size);
7244 leency 38
		if (big_icons.checked==false) IconFairing(icon_n, xx, yy, fairing_color);
7054 leency 39
	}
40
	else
41
	{
7242 leency 42
		img_draw stdcall(default_image, xx, yy, icon_size, icon_size, 0, icon_n*icon_size);
7054 leency 43
	}
4042 leency 44
}
45
 
46
 
47
void IconFairing(dword filenum, x,y, color)
48
{
7149 leency 49
	//0 = folder
50
	//22 = forder with up arrow
51
	if (filenum == 0) || (filenum == 22)
4042 leency 52
	{
7149 leency 53
		DrawBar(x+7,y+1,8,2,color);
54
		DrawBar(x,y+14,15,2,color);
55
		PutPixel(x,y+1,color);
56
		PutPixel(x+6,y+1,color);
57
		PutPixel(x+14,y+3,color);
58
		PutPixel(x,y+13,color);
59
		PutPixel(x+14,y+13,color);
4042 leency 60
	}
7149 leency 61
	if (filenum == 22) PutPixel(x+10,y+2,0x1A7B17); //green arrow part
4042 leency 62
}