Subversion Repositories Kolibri OS

Rev

Rev 7266 | Rev 7634 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7266 Rev 7278
1
_ini icons_ini = { "/sys/File managers/icons.ini", NULL };
1
_ini icons_ini = { "/sys/File managers/icons.ini", NULL };
2
 
2
 
3
void DrawIconByExtension(dword file_path, extension, xx, yy, fairing_color)
3
void DrawIconByExtension(dword file_path, extension, xx, yy, fairing_color)
4
{
4
{
5
	char BYTE_HEAD_FILE[4];
5
	char BYTE_HEAD_FILE[4];
6
	char ext[512];
6
	char ext[512];
7
	int i;
7
	int i;
8
	dword icon_n;
8
	dword icon_n = 2;
9
	dword selected_image;
9
	dword selected_image;
10
	dword default_image;
10
	dword default_image;
11
	dword default_icon;
11
	dword default_icon;
12
 
12
 
13
	if (big_icons.checked) {
13
	if (big_icons.checked) {
14
		icons_ini.section = "icons32";
14
		icons_ini.section = "icons32";
15
		selected_image = icons32_selected.image;
15
		selected_image = icons32_selected.image;
16
		default_image = icons32_default.image;
16
		default_image = icons32_default.image;
17
		default_icon=95;
17
		default_icon=95;
18
	}
18
	}
19
	else {
19
	else {
20
		icons_ini.section = "icons16";
20
		icons_ini.section = "icons16";
21
		selected_image = icons16_selected.image;
21
		selected_image = icons16_selected.image;
22
		default_image = icons16_default.image;
22
		default_image = icons16_default.image;
23
		default_icon=2;
23
		default_icon=2;
24
	}
24
	}
25
 
25
 
26
	if (extension)
26
	if (extension)
27
	{
27
	{
28
		strcpy(#ext, extension);
28
		strcpy(#ext, extension);
29
		strlwr(#ext);
29
		strlwr(#ext);
30
		icon_n = icons_ini.GetInt(#ext, default_icon);
30
		icon_n = icons_ini.GetInt(#ext, default_icon);
31
	} 
31
	} 
32
	else if (file_path)
32
	else if (file_path)
33
	{
33
	{
34
			ReadFile(0,4,#BYTE_HEAD_FILE,file_path);
34
			ReadFile(0,4,#BYTE_HEAD_FILE,file_path);
35
			IF(DSDWORD[#BYTE_HEAD_FILE]=='KCPK')||(DSDWORD[#BYTE_HEAD_FILE]=='UNEM') 
35
			IF(DSDWORD[#BYTE_HEAD_FILE]=='KCPK')||(DSDWORD[#BYTE_HEAD_FILE]=='UNEM') 
36
				icon_n = icons_ini.GetInt("kex", 2);
36
				icon_n = icons_ini.GetInt("kex", 2);
37
	}
37
	}
38
	if (fairing_color==col_selec)
38
	if (fairing_color==col_selec)
39
	{
39
	{
40
		img_draw stdcall(selected_image, xx, yy, icon_size, icon_size, 0, icon_n*icon_size);
40
		img_draw stdcall(selected_image, xx, yy, icon_size, icon_size, 0, icon_n*icon_size);
41
	}
41
	}
42
	else 
42
	else 
43
	{
43
	{
44
		img_draw stdcall(default_image, xx, yy, icon_size, icon_size, 0, icon_n*icon_size);
44
		img_draw stdcall(default_image, xx, yy, icon_size, icon_size, 0, icon_n*icon_size);
45
	}
45
	}
46
}
46
}