Subversion Repositories Kolibri OS

Rev

Rev 9356 | 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
				if (volume_label = GetVolumeLabel(dev_name)) {
9356 leency 62
					strncpy(disc_name, volume_label, 15);
9349 leency 63
					chrcat(disc_name, ' ');
64
					return;
65
				}
66
			}
67
			strcpy(disc_name, devinfo[i+2]);
8949 leency 68
			return;
69
		}
70
	}
71
	ESBYTE[icon]=4;
9349 leency 72
	strcpy(disc_name, T_UNC);
8949 leency 73
}
74
75
 
6034 leency 76
{
3363 leency 77
	char dev_name[15], disc_name[100], i, dev_icon;
8949 leency 78
	bool is_active=0;
79
	int draw_y, draw_x;
7989 leency 80
3363 leency 81
 
8854 leency 82
		DrawSelect(2, KFM_DEV_DROPDOWN_1, location[0]);
8952 leency 83
		DrawSelect(Form.cwidth/2, KFM_DEV_DROPDOWN_2, location[sizeof(dword)]);
84
		files.y = 40 + 17;
8854 leency 85
	} else {
86
		Tip(56, T_DEVICES, 55, "=");
8951 leency 87
		for (i=0; i<30; i++) DeleteButton(100+i);
88
89
 
8854 leency 90
		draw_x = 17;
91
		for (i=0;i
92
			strcpy(#dev_name, list.get(i));
93
			GetDiskIconAndName(#dev_name, #dev_icon, #disc_name);
8981 leency 94
			if (strstr(path, #dev_name)==path) is_active=true; else is_active=false;
8949 leency 95
6034 leency 96
 
7989 leency 97
			DrawBar(draw_x+6+18,draw_y,160-6-18,DEV_H+1,0xFFFFFF);
98
			DefineHiddenButton(draw_x,draw_y,159,16,100+i);
8949 leency 99
			if (show_dev_name.checked)
7244 leency 100
			{
5698 leency 101
				strcat(#disc_name, #dev_name);
9361 leency 102
				if (is_active) WriteText(draw_x+30,draw_y+5,0x80,0x555555,#disc_name);
6034 leency 103
				WriteText(draw_x+29,draw_y+5,0x80,0,#disc_name);
7806 leency 104
				//if (is_active) kfont.bold = true;
8854 leency 105
				//kfont.WriteIntoWindow(draw_x + 29, draw_y+2, 0xFFFfff, 0x000000, kfont.size.pt, #disc_name);
106
				//kfont.bold = false;
107
			} else {
7806 leency 108
				if (is_active) WriteText(draw_x+30,draw_y+5,0x80,0x555555,#dev_name);
6034 leency 109
				WriteText(draw_x+29,draw_y+5,0x80,0,#dev_name);
110
			}
5698 leency 111
			_PutImage(draw_x+6,draw_y, 18,17, is_active*7+dev_icon*17*18*3+#devices);
7989 leency 112
			draw_y += DEV_H;
8854 leency 113
		}
5633 leency 114
		DrawBar(draw_x+6, draw_y, 18, 1, 0xFFFfff);
7989 leency 115
		ActionsDraw(list.count*DEV_H+108);
8952 leency 116
		DrawLeftPanelBg(list.count*DEV_H);
117
	}
5703 leency 118
}
3363 leency 119
120
 
8949 leency 121
{
8854 leency 122
	char dev_name[15], disc_name[100], i, dev_icon;
8949 leency 123
124
 
125
		strcpy(#dev_name, "/root");
8854 leency 126
		dev_icon = 0;
127
	} else if (chrnum(_path, '/')==1) {
8949 leency 128
		strcpy(#dev_name, _path);
129
		GetDiskIconAndName(#dev_name, #dev_icon, #disc_name);
8981 leency 130
	} else for (i=0;i
8854 leency 131
		strcpy(#dev_name, list.get(i));
132
		GetDiskIconAndName(#dev_name, #dev_icon, #disc_name);
8981 leency 133
		if (strstr(_path, #dev_name)-_path==0) break;
8949 leency 134
	}
8854 leency 135
	DrawRectangle(draw_x-1, SELECTY-1, DDW+2-KFM2_DEVH, KFM2_DEVH+1, sc.work_graph);
8949 leency 136
	DrawBar(draw_x, SELECTY, DDW+1-KFM2_DEVH, KFM2_DEVH, 0xFFFFFF);
137
	_PutImage(draw_x + 5, SELECTY+2, 18,17, dev_icon*17*18*3+#devices);
138
	kfont.WriteIntoWindow(draw_x + 24, math.max(KFM2_DEVH-kfont.height/2+SELECTY,0), 0xFFFfff, 0x000000, kfont.size.pt, #dev_name+1);
139
	DefineHiddenButton(draw_x, SELECTY, DDW-1, KFM2_DEVH-1, btid);
8953 leency 140
	DrawFlatButtonSmall(draw_x+DDW-KFM2_DEVH+1, SELECTY-1, KFM2_DEVH-1, KFM2_DEVH+1, NULL, "\x19");
141
}
8854 leency 142
143
 
8949 leency 144
{
8854 leency 145
	int optionsy = SELECTY+KFM2_DEVH+1;
8949 leency 146
	char dev_name[15], disc_name[100], volume_label[64], label_file_name[100];
9277 leency 147
	char i, dev_icon, is_active=0;
148
8854 leency 149
 
8996 leency 150
8854 leency 151
 
8949 leency 152
8854 leency 153
 
154
		strcpy(#dev_name, list.get(i));
155
		GetDiskIconAndName(#dev_name, #dev_icon, #disc_name);
8981 leency 156
		if (strstr(path, #dev_name)!=0) is_active=true; else is_active=false;
8949 leency 157
8854 leency 158
 
8949 leency 159
		DefineButton(draw_x, optionsy, DDW, KFM2_DEVH-1, 100+i+BT_HIDE,0xFFFFFF);
160
		_PutImage(draw_x + 5, optionsy+2, 18,17, is_active*7+dev_icon*17*18*3+#devices);
161
		if (is_active) kfont.bold = true;
8854 leency 162
		//strncpy(#volume_label, GetVolumeLabel(#dev_name), sizeof(volume_label));
9277 leency 163
		strcpy(#label_file_name, #dev_name);
164
		//if (dev_name[1]!='k') && (dev_name[2]!='y') {
165
		//	if (volume_label) sprintf(#label_file_name, "%s [%s]", #dev_name, #volume_label);
166
		//}
167
		kfont.WriteIntoWindow(draw_x + 24, optionsy+2, 0xFFFfff, 0x000000, kfont.size.pt, #label_file_name+1);
168
		kfont.bold = false;
8854 leency 169
		optionsy += KFM2_DEVH;
8949 leency 170
	}
8854 leency 171
}
172