Subversion Repositories Kolibri OS

Rev

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