Subversion Repositories Kolibri OS

Rev

Rev 3933 | Rev 4057 | 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
 
3956 leency 53
 
3434 leency 54
void SystemDiscsGet()
3363 leency 55
{
56
	unsigned char dev_name[10], sys_discs[10];
57
	unsigned int i1, j1, dev_num, dev_disc_num;
3956 leency 58
	unsigned int nullbuf;
3363 leency 59
	disc_num=0;
60
	if (devbuf) free(devbuf);
3399 leency 61
	devbuf = malloc(10000); //буфер где-то на 10 девайсов в левой панели
3363 leency 62
	ReadDir(19, devbuf, "/");
63
	dev_num = EBX;
64
	for (i1=0; i1
65
	{
66
		strcpy(#dev_name, "/");                                 // /
67
		strcat(#dev_name, i1*304+ devbuf+72); // /rd
68
		strcat(#dev_name, "/");               // /rd/
69
		Open_Dir(#dev_name, ONLY_OPEN);
3434 leency 70
		dev_disc_num = files.count;
71
		//if (files.count<=0) copystr(#dev_name,#disk_list[disc_num].Item); else
3363 leency 72
		for (j1=0; j1
73
		{
74
			strcpy(#sys_discs, #dev_name);                              // /rd/
75
			strcat(#sys_discs, j1*304+ buf+72);      // /rd/1
76
			strcat(#sys_discs, "/");                 // /rd/1/
77
			strcpy(#disk_list[disc_num].Item, #sys_discs);
78
			disc_num++;
79
		}
3956 leency 80
		if (strcmp(#disk_list[disc_num-1].Item, "/rd/1/")==0) if (GetDir(nullbuf, nullbuf, "/kolibrios/", DIRS_ALL)==0)
81
		{
82
			strcpy(#disk_list[disc_num].Item, "/kolibrios/");
83
			disc_num++;
84
		}
3363 leency 85
	}
86
}
87
 
88
 
3434 leency 89
void SystemDiscsDraw()
3363 leency 90
{
3956 leency 91
	char dev_name[15], disc_name[100];
3363 leency 92
	int i, dev_icon;
93
 
3848 punk_joker 94
	Tip(56, T_DEVICES, 55, "=");
3363 leency 95
	for (i=0; i<20; i++) DeleteButton(100+i);
96
	for (i=0;i
97
	{
3434 leency 98
		DrawBar(17,i*16+74,160,17,0xFFFFFF);
99
		DefineButton(17,i*16+74,159,16,100+i+BT_HIDE,0xFFFFFF);
3363 leency 100
		strcpy(#dev_name, #disk_list[i].Item);
101
		dev_name[strlen(#dev_name)-1]=NULL;
102
		switch(dev_name[1])
103
		{
3956 leency 104
			case 'k':
105
				dev_icon=0;
106
				strcpy(#disc_name, "Programs ");
107
				break;
3363 leency 108
			case 'r':
109
				dev_icon=0;
3956 leency 110
				strcpy(#disc_name, "System ");
3363 leency 111
				break;
112
			case 'c':
113
				dev_icon=1;
114
				strcpy(#disc_name, "CD-ROM ");
115
				break;
116
			case 'f':
117
				dev_icon=2;
118
				strcpy(#disc_name, "Floppy disk ");
119
				break;
120
			case 'h':
121
			case 'b':
122
				dev_icon=3;
123
				strcpy(#disc_name, "Hard disk ");
124
				break;
3399 leency 125
			case 's':
126
				dev_icon=3;
127
				strcpy(#disc_name, "SATA disk ");
128
				break;
3363 leency 129
			case 'u':
130
				dev_icon=5;
131
				strcpy(#disc_name, "USB flash ");
132
				break;
133
			case 't':
134
				dev_icon=4;
135
				strcpy(#disc_name, "RAM disk ");
136
				DefineButton(17+143,i*16+74,16,16,i+130+BT_HIDE+BT_NOFRAME,0xFFFFFF);
137
				WriteText(45+121,i*16+79,0x80,0xD63535,"-");
138
				WriteText(45+121,i*16+79+1,0x80,0xBC2424,"-");
139
				break;
140
			default:
141
				dev_icon=3; //по-умолчанию устройство выглядит как жестяк но это неправильно
142
				strcpy(#disc_name, "Unknown ");
143
		}
144
		strcat(#disc_name, #dev_name);
145
		if (show_dev_name) WriteText(45,i*16+79,0x80,0,#disc_name);
146
			else WriteText(45,i*16+79,0x80,0,#dev_name);
147
		_PutImage(21,i*16+76, 14,13, dev_icon*14*13*3+#devices);
148
	}
149
}
150
 
3434 leency 151
void ActionsDraw()
3363 leency 152
{
3434 leency 153
	int actions_y=disc_num*16+108, lineh=16;
3848 punk_joker 154
	Tip(actions_y-18, T_ACTIONS, 77, ""); //заголовок
3434 leency 155
	for (i=0; actions[i*3]!=0; i++, actions_y+=lineh)
3363 leency 156
	{
3434 leency 157
		DrawBar(17,actions_y,160,lineh,0xFFFFFF); //белое
158
		DefineButton(17,actions_y,159,lineh,actions[i*3]+BT_HIDE,0xE4DFE1);
159
		WriteText(45,actions_y+4,0x80,0,actions[i*3+1]);
160
		WriteText(-strlen(actions[i*3+2])*6+170,actions_y+4,0x80,0x999999,actions[i*3+2]);
161
		_PutImage(21,actions_y+2, 14,13, i*14*13*3+#factions);
3363 leency 162
	}
163
}
164
 
165
 
3434 leency 166
void LeftPanelBgDraw()
3363 leency 167
{
168
	int actions_y=disc_num*16;
3434 leency 169
	int start_y = actions_y+156;
3363 leency 170
	DrawBar(2,41,190,15,col_lpanel);		      //синий прямоугольник - над девайсами
171
	DrawBar(17,actions_y+75,160,15,col_lpanel); //синий прямоугольник - под девайсами
3877 leency 172
	PutShadow(17,actions_y+75,160,1,1,3);
3434 leency 173
	PutShadow(18,actions_y+75+1,158,1,1,1);
3363 leency 174
	DrawBar(2,56,15,actions_y+103,col_lpanel);	          //синий прямоугольник - слева
175
	DrawBar(177,56,15,actions_y+103,col_lpanel);            //синий прямоугольник - справа
176
	if (onTop(start_y, 6) < 268)
177
		PutPaletteImage(#blue_hl, 190, onTop(start_y, 6), 2, start_y, 8, #blue_hl_pal);
178
	else
179
	{
180
		DrawBar(2,start_y,190,onTop(start_y,6+268),col_lpanel);
181
		PutPaletteImage(#blue_hl, 190, 268, 2, onTop(268,6), 8, #blue_hl_pal);
182
	}
3877 leency 183
	PutShadow(17,start_y,160,1,1,3);
3434 leency 184
	PutShadow(18,start_y+1,158,1,1,1);
3363 leency 185
}
186
 
187
 
188
void DrawLeftPanel()
189
{
3434 leency 190
	SystemDiscsDraw();
191
	ActionsDraw();
192
	LeftPanelBgDraw();
3363 leency 193
}
194