Subversion Repositories Kolibri OS

Rev

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

Rev 8839 Rev 8868
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 icon_n = 2;
7
	int icon_n = 2;
8
	dword selected_image;
8
	dword selected_image;
9
	dword default_image;
9
	dword default_image;
10
	dword default_icon;
10
	dword default_icon;
11
 
11
 
12
	if (big_icons.checked) {
12
	if (big_icons.checked) {
13
		icons_ini.section = "icons32";
13
		icons_ini.section = "icons32";
14
		selected_image = icons32_selected.image;
14
		selected_image = icons32_selected.image;
15
		default_image = icons32_default.image;
15
		default_image = icons32_default.image;
16
		default_icon=95;
16
		default_icon=95;
17
	} else {
17
	} else {
18
		icons_ini.section = "icons16";
18
		icons_ini.section = "icons16";
19
		selected_image = icons16_selected.image;
19
		selected_image = icons16_selected.image;
20
		default_image = icons16_default.image;
20
		default_image = icons16_default.image;
21
		default_icon=2;
21
		default_icon=2;
22
	}
22
	}
23
 
23
 
24
	if (ESBYTE[file_path+1]!='k') && (chrnum(file_path, '/')==2) {
24
	if (ESBYTE[file_path+1]!='k') && (ESBYTE[file_path+1]!='s') && (chrnum(file_path, '/')==2) {
25
		if (ESBYTE[file_path+1]=='/') ext[0] = ESBYTE[file_path+2];
25
		if (ESBYTE[file_path+1]=='/') ext[0] = ESBYTE[file_path+2];
26
			else ext[0] = ESBYTE[file_path+1];
26
			else ext[0] = ESBYTE[file_path+1];
27
		ext[1] = '\0';
27
		ext[1] = '\0';
28
		if (big_icons.checked) {
28
		if (big_icons.checked) {
29
			icons_ini.section = "drives32";
29
			icons_ini.section = "drives32";
30
			icon_n = icons_ini.GetInt(#ext, 50);
30
			icon_n = icons_ini.GetInt(#ext, 50);
31
		} else {
31
		} else {
32
			icons_ini.section = "drives16";
32
			icons_ini.section = "drives16";
33
			icon_n = icons_ini.GetInt(#ext, 50);
33
			icon_n = icons_ini.GetInt(#ext, 50);
34
		}
34
		}
35
	} else if (extension) {
35
	} else if (extension) {
36
		strcpy(#ext, extension);
36
		strcpy(#ext, extension);
37
		strlwr(#ext);
37
		strlwr(#ext);
38
		icon_n = icons_ini.GetInt(#ext, default_icon);
38
		icon_n = icons_ini.GetInt(#ext, default_icon);
39
	} else if (file_path) {
39
	} else if (file_path) {
40
		ReadFile(0,4,#BYTE_HEAD_FILE,file_path);
40
		ReadFile(0,4,#BYTE_HEAD_FILE,file_path);
41
		IF(DSDWORD[#BYTE_HEAD_FILE]=='KCPK')||(DSDWORD[#BYTE_HEAD_FILE]=='UNEM') 
41
		IF(DSDWORD[#BYTE_HEAD_FILE]=='KCPK')||(DSDWORD[#BYTE_HEAD_FILE]=='UNEM') 
42
			icon_n = icons_ini.GetInt("kex", 2);
42
			icon_n = icons_ini.GetInt("kex", 2);
43
	}
43
	}
44
 
44
 
45
	if (fairing_color==col.selec) {
45
	if (fairing_color==col.selec) {
46
		img_draw stdcall(selected_image, xx, yy, icon_size, icon_size, 0, icon_n*icon_size);
46
		img_draw stdcall(selected_image, xx, yy, icon_size, icon_size, 0, icon_n*icon_size);
47
	} else {
47
	} else {
48
		img_draw stdcall(default_image, xx, yy, icon_size, icon_size, 0, icon_n*icon_size);
48
		img_draw stdcall(default_image, xx, yy, icon_size, icon_size, 0, icon_n*icon_size);
49
	}
49
	}
50
}
50
}