Subversion Repositories Kolibri OS

Rev

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