Subversion Repositories Kolibri OS

Rev

Rev 4057 | Rev 4225 | 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);
4076 leency 42
	WriteText(25,y+5,0x80,sc.work_text,caption);
3444 leency 43
	IF (id<>0) DefineButton(159,y+1,16,16,id+BT_HIDE+BT_NOFRAME,0); //кнопа для стрелки
4076 leency 44
	WriteText(165,y+5,0x80,sc.work_text,arrow); //стрелка вниз
45
	DrawBar(17,y+17,160,1,sc.work_graph);		//подчёркивание
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/");
4057 leency 83
			kolibrios_drive = true;
3956 leency 84
			disc_num++;
4057 leency 85
		} else kolibrios_drive = false;
3363 leency 86
	}
87
}
88
 
89
 
3434 leency 90
void SystemDiscsDraw()
3363 leency 91
{
3956 leency 92
	char dev_name[15], disc_name[100];
3363 leency 93
	int i, dev_icon;
94
 
3848 punk_joker 95
	Tip(56, T_DEVICES, 55, "=");
3363 leency 96
	for (i=0; i<20; i++) DeleteButton(100+i);
97
	for (i=0;i
98
	{
3434 leency 99
		DrawBar(17,i*16+74,160,17,0xFFFFFF);
100
		DefineButton(17,i*16+74,159,16,100+i+BT_HIDE,0xFFFFFF);
3363 leency 101
		strcpy(#dev_name, #disk_list[i].Item);
102
		dev_name[strlen(#dev_name)-1]=NULL;
103
		switch(dev_name[1])
104
		{
3956 leency 105
			case 'k':
106
				dev_icon=0;
107
				strcpy(#disc_name, "Programs ");
108
				break;
3363 leency 109
			case 'r':
110
				dev_icon=0;
3956 leency 111
				strcpy(#disc_name, "System ");
3363 leency 112
				break;
113
			case 'c':
114
				dev_icon=1;
115
				strcpy(#disc_name, "CD-ROM ");
116
				break;
117
			case 'f':
118
				dev_icon=2;
119
				strcpy(#disc_name, "Floppy disk ");
120
				break;
121
			case 'h':
122
			case 'b':
123
				dev_icon=3;
124
				strcpy(#disc_name, "Hard disk ");
125
				break;
3399 leency 126
			case 's':
127
				dev_icon=3;
128
				strcpy(#disc_name, "SATA disk ");
129
				break;
3363 leency 130
			case 'u':
131
				dev_icon=5;
132
				strcpy(#disc_name, "USB flash ");
133
				break;
134
			case 't':
135
				dev_icon=4;
136
				strcpy(#disc_name, "RAM disk ");
137
				DefineButton(17+143,i*16+74,16,16,i+130+BT_HIDE+BT_NOFRAME,0xFFFFFF);
138
				WriteText(45+121,i*16+79,0x80,0xD63535,"-");
139
				WriteText(45+121,i*16+79+1,0x80,0xBC2424,"-");
140
				break;
141
			default:
142
				dev_icon=3; //по-умолчанию устройство выглядит как жестяк но это неправильно
143
				strcpy(#disc_name, "Unknown ");
144
		}
145
		strcat(#disc_name, #dev_name);
146
		if (show_dev_name) WriteText(45,i*16+79,0x80,0,#disc_name);
147
			else WriteText(45,i*16+79,0x80,0,#dev_name);
148
		_PutImage(21,i*16+76, 14,13, dev_icon*14*13*3+#devices);
149
	}
150
}
151
 
3434 leency 152
void ActionsDraw()
3363 leency 153
{
3434 leency 154
	int actions_y=disc_num*16+108, lineh=16;
3848 punk_joker 155
	Tip(actions_y-18, T_ACTIONS, 77, ""); //заголовок
3434 leency 156
	for (i=0; actions[i*3]!=0; i++, actions_y+=lineh)
3363 leency 157
	{
3434 leency 158
		DrawBar(17,actions_y,160,lineh,0xFFFFFF); //белое
159
		DefineButton(17,actions_y,159,lineh,actions[i*3]+BT_HIDE,0xE4DFE1);
160
		WriteText(45,actions_y+4,0x80,0,actions[i*3+1]);
161
		WriteText(-strlen(actions[i*3+2])*6+170,actions_y+4,0x80,0x999999,actions[i*3+2]);
162
		_PutImage(21,actions_y+2, 14,13, i*14*13*3+#factions);
3363 leency 163
	}
164
}
165
 
166
 
3434 leency 167
void LeftPanelBgDraw()
3363 leency 168
{
169
	int actions_y=disc_num*16;
3434 leency 170
	int start_y = actions_y+156;
3363 leency 171
	DrawBar(2,41,190,15,col_lpanel);		      //синий прямоугольник - над девайсами
172
	DrawBar(17,actions_y+75,160,15,col_lpanel); //синий прямоугольник - под девайсами
3877 leency 173
	PutShadow(17,actions_y+75,160,1,1,3);
3434 leency 174
	PutShadow(18,actions_y+75+1,158,1,1,1);
3363 leency 175
	DrawBar(2,56,15,actions_y+103,col_lpanel);	          //синий прямоугольник - слева
176
	DrawBar(177,56,15,actions_y+103,col_lpanel);            //синий прямоугольник - справа
177
	if (onTop(start_y, 6) < 268)
178
		PutPaletteImage(#blue_hl, 190, onTop(start_y, 6), 2, start_y, 8, #blue_hl_pal);
179
	else
180
	{
181
		DrawBar(2,start_y,190,onTop(start_y,6+268),col_lpanel);
182
		PutPaletteImage(#blue_hl, 190, 268, 2, onTop(268,6), 8, #blue_hl_pal);
183
	}
3877 leency 184
	PutShadow(17,start_y,160,1,1,3);
3434 leency 185
	PutShadow(18,start_y+1,158,1,1,1);
3363 leency 186
}
187
 
188
 
189
void DrawLeftPanel()
190
{
3434 leency 191
	SystemDiscsDraw();
192
	ActionsDraw();
193
	LeftPanelBgDraw();
3363 leency 194
}
195