Subversion Repositories Kolibri OS

Rev

Rev 9277 | Rev 9356 | 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 (volume_label = GetVolumeLabel(dev_name))
59
			{
60
				//show label only for hard disk drives
61
				if (ESBYTE[icon]==4) {
62
					strncpy(disc_name, volume_label, 15);
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
				if (dev_name[1]=='t') {
9349 leency 102
					chrcat(#disc_name, dev_name[4]);
103
				} else if (dev_name[1]=='f') {
104
					//
105
				} else {
106
					strcat(#disc_name, #dev_name);
107
				}
108
				if (is_active) WriteText(draw_x+30,draw_y+5,0x80,0x555555,#disc_name);
6034 leency 109
				WriteText(draw_x+29,draw_y+5,0x80,0,#disc_name);
7806 leency 110
				//if (is_active) kfont.bold = true;
8854 leency 111
				//kfont.WriteIntoWindow(draw_x + 29, draw_y+2, 0xFFFfff, 0x000000, kfont.size.pt, #disc_name);
112
				//kfont.bold = false;
113
			} else {
7806 leency 114
				if (is_active) WriteText(draw_x+30,draw_y+5,0x80,0x555555,#dev_name);
6034 leency 115
				WriteText(draw_x+29,draw_y+5,0x80,0,#dev_name);
116
			}
5698 leency 117
			_PutImage(draw_x+6,draw_y, 18,17, is_active*7+dev_icon*17*18*3+#devices);
7989 leency 118
			draw_y += DEV_H;
8854 leency 119
		}
5633 leency 120
		DrawBar(draw_x+6, draw_y, 18, 1, 0xFFFfff);
7989 leency 121
		ActionsDraw(list.count*DEV_H+108);
8952 leency 122
		DrawLeftPanelBg(list.count*DEV_H);
123
	}
5703 leency 124
}
3363 leency 125
126
 
8949 leency 127
{
8854 leency 128
	char dev_name[15], disc_name[100], i, dev_icon;
8949 leency 129
130
 
131
		strcpy(#dev_name, "/root");
8854 leency 132
		dev_icon = 0;
133
	} else if (chrnum(_path, '/')==1) {
8949 leency 134
		strcpy(#dev_name, _path);
135
		GetDiskIconAndName(#dev_name, #dev_icon, #disc_name);
8981 leency 136
	} else for (i=0;i
8854 leency 137
		strcpy(#dev_name, list.get(i));
138
		GetDiskIconAndName(#dev_name, #dev_icon, #disc_name);
8981 leency 139
		if (strstr(_path, #dev_name)-_path==0) break;
8949 leency 140
	}
8854 leency 141
	DrawRectangle(draw_x-1, SELECTY-1, DDW+2-KFM2_DEVH, KFM2_DEVH+1, sc.work_graph);
8949 leency 142
	DrawBar(draw_x, SELECTY, DDW+1-KFM2_DEVH, KFM2_DEVH, 0xFFFFFF);
143
	_PutImage(draw_x + 5, SELECTY+2, 18,17, dev_icon*17*18*3+#devices);
144
	kfont.WriteIntoWindow(draw_x + 24, math.max(KFM2_DEVH-kfont.height/2+SELECTY,0), 0xFFFfff, 0x000000, kfont.size.pt, #dev_name+1);
145
	DefineHiddenButton(draw_x, SELECTY, DDW-1, KFM2_DEVH-1, btid);
8953 leency 146
	DrawFlatButtonSmall(draw_x+DDW-KFM2_DEVH+1, SELECTY-1, KFM2_DEVH-1, KFM2_DEVH+1, NULL, "\x19");
147
}
8854 leency 148
149
 
8949 leency 150
{
8854 leency 151
	int optionsy = SELECTY+KFM2_DEVH+1;
8949 leency 152
	char dev_name[15], disc_name[100], volume_label[64], label_file_name[100];
9277 leency 153
	char i, dev_icon, is_active=0;
154
8854 leency 155
 
8996 leency 156
8854 leency 157
 
8949 leency 158
8854 leency 159
 
160
		strcpy(#dev_name, list.get(i));
161
		GetDiskIconAndName(#dev_name, #dev_icon, #disc_name);
8981 leency 162
		if (strstr(path, #dev_name)!=0) is_active=true; else is_active=false;
8949 leency 163
8854 leency 164
 
8949 leency 165
		DefineButton(draw_x, optionsy, DDW, KFM2_DEVH-1, 100+i+BT_HIDE,0xFFFFFF);
166
		_PutImage(draw_x + 5, optionsy+2, 18,17, is_active*7+dev_icon*17*18*3+#devices);
167
		if (is_active) kfont.bold = true;
8854 leency 168
		//strncpy(#volume_label, GetVolumeLabel(#dev_name), sizeof(volume_label));
9277 leency 169
		strcpy(#label_file_name, #dev_name);
170
		//if (dev_name[1]!='k') && (dev_name[2]!='y') {
171
		//	if (volume_label) sprintf(#label_file_name, "%s [%s]", #dev_name, #volume_label);
172
		//}
173
		kfont.WriteIntoWindow(draw_x + 24, optionsy+2, 0xFFFfff, 0x000000, kfont.size.pt, #label_file_name+1);
174
		kfont.bold = false;
8854 leency 175
		optionsy += KFM2_DEVH;
8949 leency 176
	}
8854 leency 177
}
178