Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
3399 leency 1
//Leency 2008-2013
2
 
3363 leency 3
void Tip(int y, dword caption, id, arrow)
4
{
5
	int i;
6
	DrawBar(17,y,160,1,0xEFEDEE);
7
	DrawFilledBar(17, y+1, 160, 16);
8
	WriteText(25,y+5,0x80,0,caption);
3444 leency 9
	IF (id<>0) DefineButton(159,y+1,16,16,id+BT_HIDE+BT_NOFRAME,0); //кнопа для стрелки
3363 leency 10
	WriteText(165,y+5,0x80,0,arrow); //стрелка вниз
3444 leency 11
	DrawBar(17,y+17,160,1,col_border);		//подчёркивание
3363 leency 12
}
13
 
14
 
3399 leency 15
path_string disk_list[30];
3363 leency 16
int disc_num;
17
dword devbuf;
18
 
3434 leency 19
void SystemDiscsGet()
3363 leency 20
{
21
	unsigned char dev_name[10], sys_discs[10];
22
	unsigned int i1, j1, dev_num, dev_disc_num;
23
 
24
	disc_num=0;
25
	if (devbuf) free(devbuf);
3399 leency 26
	devbuf = malloc(10000); //буфер где-то на 10 девайсов в левой панели
3363 leency 27
	ReadDir(19, devbuf, "/");
28
	dev_num = EBX;
29
	for (i1=0; i1
30
	{
31
		strcpy(#dev_name, "/");                                 // /
32
		strcat(#dev_name, i1*304+ devbuf+72); // /rd
33
		strcat(#dev_name, "/");               // /rd/
34
		Open_Dir(#dev_name, ONLY_OPEN);
3434 leency 35
		dev_disc_num = files.count;
36
		//if (files.count<=0) copystr(#dev_name,#disk_list[disc_num].Item); else
3363 leency 37
		for (j1=0; j1
38
		{
39
			strcpy(#sys_discs, #dev_name);                              // /rd/
40
			strcat(#sys_discs, j1*304+ buf+72);      // /rd/1
41
			strcat(#sys_discs, "/");                 // /rd/1/
42
			strcpy(#disk_list[disc_num].Item, #sys_discs);
43
			disc_num++;
44
		}
45
	}
46
}
47
 
48
 
3434 leency 49
void SystemDiscsDraw()
3363 leency 50
{
3434 leency 51
	char dev_name[10], disc_name[100];
3363 leency 52
	int i, dev_icon;
53
 
3440 leency 54
	Tip(56, "Devices", 55, "=");
3363 leency 55
	for (i=0; i<20; i++) DeleteButton(100+i);
56
	for (i=0;i
57
	{
3434 leency 58
		DrawBar(17,i*16+74,160,17,0xFFFFFF);
59
		DefineButton(17,i*16+74,159,16,100+i+BT_HIDE,0xFFFFFF);
3363 leency 60
		strcpy(#dev_name, #disk_list[i].Item);
61
		dev_name[strlen(#dev_name)-1]=NULL;
62
		switch(dev_name[1])
63
		{
64
			case 'r':
65
				dev_icon=0;
3399 leency 66
				strcpy(#disc_name, "SYS disk ");
3363 leency 67
				break;
68
			case 'c':
69
				dev_icon=1;
70
				strcpy(#disc_name, "CD-ROM ");
71
				break;
72
			case 'f':
73
				dev_icon=2;
74
				strcpy(#disc_name, "Floppy disk ");
75
				break;
76
			case 'h':
77
			case 'b':
78
				dev_icon=3;
79
				strcpy(#disc_name, "Hard disk ");
80
				break;
3399 leency 81
			case 's':
82
				dev_icon=3;
83
				strcpy(#disc_name, "SATA disk ");
84
				break;
3363 leency 85
			case 'u':
86
				dev_icon=5;
87
				strcpy(#disc_name, "USB flash ");
88
				break;
89
			case 't':
90
				dev_icon=4;
91
				strcpy(#disc_name, "RAM disk ");
92
				DefineButton(17+143,i*16+74,16,16,i+130+BT_HIDE+BT_NOFRAME,0xFFFFFF);
93
				WriteText(45+121,i*16+79,0x80,0xD63535,"-");
94
				WriteText(45+121,i*16+79+1,0x80,0xBC2424,"-");
95
				break;
96
			default:
97
				dev_icon=3; //по-умолчанию устройство выглядит как жестяк но это неправильно
98
				strcpy(#disc_name, "Unknown ");
99
		}
100
		strcat(#disc_name, #dev_name);
101
		if (show_dev_name) WriteText(45,i*16+79,0x80,0,#disc_name);
102
			else WriteText(45,i*16+79,0x80,0,#dev_name);
103
		_PutImage(21,i*16+76, 14,13, dev_icon*14*13*3+#devices);
104
	}
105
}
106
 
107
 
3434 leency 108
char *actions[] = {
109
	57, "New file", "F7",
110
	56, "New folder", "F6",
111
	60, "Options", "F10",
112
	0,0,0
113
};
114
void ActionsDraw()
3363 leency 115
{
3434 leency 116
	int actions_y=disc_num*16+108, lineh=16;
117
	Tip(actions_y-18, "Actions", 77, ""); //заголовок
118
	for (i=0; actions[i*3]!=0; i++, actions_y+=lineh)
3363 leency 119
	{
3434 leency 120
		DrawBar(17,actions_y,160,lineh,0xFFFFFF); //белое
121
		DefineButton(17,actions_y,159,lineh,actions[i*3]+BT_HIDE,0xE4DFE1);
122
		WriteText(45,actions_y+4,0x80,0,actions[i*3+1]);
123
		WriteText(-strlen(actions[i*3+2])*6+170,actions_y+4,0x80,0x999999,actions[i*3+2]);
124
		_PutImage(21,actions_y+2, 14,13, i*14*13*3+#factions);
3363 leency 125
	}
126
}
127
 
128
 
3434 leency 129
void LeftPanelBgDraw()
3363 leency 130
{
131
	int actions_y=disc_num*16;
3434 leency 132
	int start_y = actions_y+156;
3363 leency 133
	DrawBar(2,41,190,15,col_lpanel);		      //синий прямоугольник - над девайсами
134
	DrawBar(17,actions_y+75,160,15,col_lpanel); //синий прямоугольник - под девайсами
3444 leency 135
	PutShadow(17,actions_y+75,160,1,1,4);
3434 leency 136
	PutShadow(18,actions_y+75+1,158,1,1,1);
3363 leency 137
	DrawBar(2,56,15,actions_y+103,col_lpanel);	          //синий прямоугольник - слева
138
	DrawBar(177,56,15,actions_y+103,col_lpanel);            //синий прямоугольник - справа
139
	if (onTop(start_y, 6) < 268)
140
		PutPaletteImage(#blue_hl, 190, onTop(start_y, 6), 2, start_y, 8, #blue_hl_pal);
141
	else
142
	{
143
		DrawBar(2,start_y,190,onTop(start_y,6+268),col_lpanel);
144
		PutPaletteImage(#blue_hl, 190, 268, 2, onTop(268,6), 8, #blue_hl_pal);
145
	}
3444 leency 146
	PutShadow(17,start_y,160,1,1,4);
3434 leency 147
	PutShadow(18,start_y+1,158,1,1,1);
3363 leency 148
}
149
 
150
 
151
void DrawLeftPanel()
152
{
3434 leency 153
	SystemDiscsDraw();
154
	ActionsDraw();
155
	LeftPanelBgDraw();
3363 leency 156
}
157