Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
3399 leency 1
 
6034 leency 2
{
3
	collection list;
4
	int dev_num;
7422 leency 5
	void Get();
6
	void Draw();
6034 leency 7
	void DrawSelect();
8854 leency 8
	void DrawOptions();
9
} SystemDiscs=0;
7972 leency 10
3848 punk_joker 11
 
7422 leency 12
{
3363 leency 13
	char dev_name[10], sys_discs[10];
5150 leency 14
	int i1, j1, dev_disc_num, real_dev_num;
8981 leency 15
	dword devbuf, diskbuf;
8872 leency 16
5734 leency 17
 
6034 leency 18
	devbuf = malloc(10000);
5960 leency 19
	ReadDir(19, devbuf, "/");
3363 leency 20
	dev_num = real_dev_num = EBX;
8981 leency 21
22
 
23
	dev_num++;
24
25
 
26
		//need to check that /sys != /kolibrios
27
		list.add("/kolibrios");
28
		dev_num++;
29
	}
30
31
 
32
	{
7310 pavelyakov 33
		sprintf(#dev_name,"/%s",i1*304+ devbuf+72);
6635 leency 34
		GetDir(#diskbuf, #dev_disc_num, #dev_name, DIRS_NOROOT);
8872 leency 35
		if (!EAX) for (j1=0; j1
9044 leency 36
		{
3363 leency 37
			sprintf(#sys_discs,"%s/%s",#dev_name,j1*304+ diskbuf+72);
8872 leency 38
			if (sys_discs[1]=='r') {
8981 leency 39
				dev_num--;
40
				continue;
41
			}
7422 leency 42
			if (sys_discs[1]=='c') || (sys_discs[1]=='f') || (dir_exists(#sys_discs)) {
8981 leency 43
				list.add(#sys_discs);
44
			}
45
		}
4225 punk_joker 46
	}
3363 leency 47
	free(devbuf);
5960 leency 48
	free(diskbuf);
8872 leency 49
}
3363 leency 50
51
 
9349 leency 52
{
8949 leency 53
	int i;
54
	dword volume_label;
9349 leency 55
	for (i=0; devinfo[i]!=0; i+=3) {
8949 leency 56
		if (!strncmp(dev_name+1, devinfo[i], 2)) {
8981 leency 57
			ESBYTE[icon] = devinfo[i+1];
9349 leency 58
			if (ESBYTE[icon]==4)
9356 leency 59
			{
9349 leency 60
				//show label only for hard disk drives
61
				volume_label = GetVolumeLabel(dev_name);
9525 leency 62
				if (ESBYTE[volume_label]) {
63
					strncpy(disc_name, volume_label, 15);
9349 leency 64
					chrcat(disc_name, ' ');
65
					return;
66
				}
67
			}
68
			strcpy(disc_name, devinfo[i+2]);
8949 leency 69
			return;
70
		}
71
	}
72
	ESBYTE[icon]=4;
9349 leency 73
	strcpy(disc_name, T_UNC);
8949 leency 74
}
75
76
 
6034 leency 77
{
3363 leency 78
	char dev_name[15], disc_name[100], i, dev_icon;
8949 leency 79
	bool is_active=0;
80
	int draw_y, draw_x;
7989 leency 81
3363 leency 82
 
8854 leency 83
		DrawSelect(2, KFM_DEV_DROPDOWN_1, location[0]);
8952 leency 84
		DrawSelect(Form.cwidth/2, KFM_DEV_DROPDOWN_2, location[sizeof(dword)]);
85
		files.y = 40 + 17;
8854 leency 86
	} else {
87
		Tip(56, T_DEVICES, 55, "=");
8951 leency 88
		for (i=0; i<30; i++) DeleteButton(100+i);
89
90
 
8854 leency 91
		draw_x = 17;
92
		for (i=0;i
93
			strcpy(#dev_name, list.get(i));
94
			GetDiskIconAndName(#dev_name, #dev_icon, #disc_name);
8981 leency 95
			if (strstr(path, #dev_name)==path) is_active=true; else is_active=false;
8949 leency 96
6034 leency 97
 
7989 leency 98
			DrawBar(draw_x+6+18,draw_y,160-6-18,DEV_H+1,0xFFFFFF);
99
			DefineHiddenButton(draw_x,draw_y,159,16,100+i);
8949 leency 100
			if (show_dev_name.checked)
7244 leency 101
			{
5698 leency 102
				strcat(#disc_name, #dev_name);
9361 leency 103
				if (is_active) WriteText(draw_x+30,draw_y+5,0x80,0x555555,#disc_name);
6034 leency 104
				WriteText(draw_x+29,draw_y+5,0x80,0,#disc_name);
7806 leency 105
				//if (is_active) kfont.bold = true;
8854 leency 106
				//kfont.WriteIntoWindow(draw_x + 29, draw_y+2, 0xFFFfff, 0x000000, kfont.size.pt, #disc_name);
107
				//kfont.bold = false;
108
			} else {
7806 leency 109
				if (is_active) WriteText(draw_x+30,draw_y+5,0x80,0x555555,#dev_name);
6034 leency 110
				WriteText(draw_x+29,draw_y+5,0x80,0,#dev_name);
111
			}
5698 leency 112
			PutImage(draw_x+6,draw_y, 18,17, is_active*7+dev_icon*17*18*3+#devices);
9602 leency 113
			draw_y += DEV_H;
8854 leency 114
		}
5633 leency 115
		DrawBar(draw_x+6, draw_y, 18, 1, 0xFFFfff);
7989 leency 116
		ActionsDraw(list.count*DEV_H+108);
8952 leency 117
		DrawLeftPanelBg(list.count*DEV_H);
118
	}
5703 leency 119
}
3363 leency 120
121
 
8949 leency 122
{
8854 leency 123
	char dev_name[15], disc_name[100], i, dev_icon;
8949 leency 124
125
 
126
		strcpy(#dev_name, "/root");
8854 leency 127
		dev_icon = 0;
128
	} else if (chrnum(_path, '/')==1) {
8949 leency 129
		strcpy(#dev_name, _path);
130
		GetDiskIconAndName(#dev_name, #dev_icon, #disc_name);
8981 leency 131
	} else for (i=0;i
8854 leency 132
		strcpy(#dev_name, list.get(i));
133
		GetDiskIconAndName(#dev_name, #dev_icon, #disc_name);
8981 leency 134
		if (strstr(_path, #dev_name)-_path==0) break;
8949 leency 135
	}
8854 leency 136
	DrawRectangle(draw_x-1, SELECTY-1, DDW+2-KFM2_DEVH, KFM2_DEVH+1, sc.line);
9602 leency 137
	DrawBar(draw_x, SELECTY, DDW+1-KFM2_DEVH, KFM2_DEVH, 0xFFFFFF);
8949 leency 138
	PutImage(draw_x + 5, SELECTY+2, 18,17, dev_icon*17*18*3+#devices);
9602 leency 139
	kfont.WriteIntoWindow(draw_x + 24, math.max(KFM2_DEVH-kfont.height/2+SELECTY,0), 0xFFFfff, 0x000000, kfont.size.pt, #dev_name+1);
8949 leency 140
	DefineHiddenButton(draw_x, SELECTY, DDW-1, KFM2_DEVH-1, btid);
8953 leency 141
	DrawFlatButtonSmall(draw_x+DDW-KFM2_DEVH+1, SELECTY-1, KFM2_DEVH-1, KFM2_DEVH+1, NULL, "\x19");
142
}
8854 leency 143
144
 
8949 leency 145
{
8854 leency 146
	int optionsy = SELECTY+KFM2_DEVH+1;
8949 leency 147
	char dev_name[15], disc_name[100], volume_label[64], label_file_name[100];
9277 leency 148
	char i, dev_icon, is_active=0;
149
8854 leency 150
 
8996 leency 151
8854 leency 152
 
9602 leency 153
8854 leency 154
 
155
		strcpy(#dev_name, list.get(i));
156
		GetDiskIconAndName(#dev_name, #dev_icon, #disc_name);
8981 leency 157
		if (strstr(path, #dev_name)!=0) is_active=true; else is_active=false;
8949 leency 158
8854 leency 159
 
8949 leency 160
		DefineButton(draw_x, optionsy, DDW, KFM2_DEVH-1, 100+i+BT_HIDE,0xFFFFFF);
161
		PutImage(draw_x + 5, optionsy+2, 18,17, is_active*7+dev_icon*17*18*3+#devices);
9602 leency 162
		if (is_active) kfont.bold = true;
8854 leency 163
		//strncpy(#volume_label, GetVolumeLabel(#dev_name), sizeof(volume_label));
9277 leency 164
		strcpy(#label_file_name, #dev_name);
165
		//if (dev_name[1]!='k') && (dev_name[2]!='y') {
166
		//	if (volume_label) sprintf(#label_file_name, "%s [%s]", #dev_name, #volume_label);
167
		//}
168
		kfont.WriteIntoWindow(draw_x + 24, optionsy+2, 0xFFFfff, 0x000000, kfont.size.pt, #label_file_name+1);
169
		kfont.bold = false;
8854 leency 170
		optionsy += KFM2_DEVH;
8949 leency 171
	}
8854 leency 172
}
173