Subversion Repositories Kolibri OS

Rev

Rev 5753 | Rev 5834 | 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
4225 punk_joker 4
	?define T_DEVICES "“бва®©бвў "
5
	?define T_ACTIONS "„Ґ©бвўЁп"
6
	char *actions[] = {
7
		57, "Ќ®ўл© д ©«", "F7",
8
		56, "Ќ®ў п Ї ЇЄ ", "F6",
9
		60, "Ќ бва®©ЄЁ", "F10",
10
		0,0,0
11
	};
5576 pavelyakov 12
	?define T_PROG "Џа®Ја ¬¬л "
13
	?define T_SYS  "‘Ёб⥬  "
14
	?define T_UNC  "ЌҐЁ§ўҐбв­® "
15
	?define T_CD   "CD-ROM "
16
	?define T_FD   "„ЁбЄҐв  "
17
	?define T_HD   "†ҐбвЄЁ© ¤ЁбЄ "
18
	?define T_SATA "SATA ¤ЁбЄ "
19
	?define T_USB  "USB ¤ЁбЄ "
20
	?define T_RAM  "RAM ¤ЁбЄ "
3933 kaitz 21
#elif LANG_EST
4225 punk_joker 22
	?define T_DEVICES "Seadmed"
23
	?define T_ACTIONS "Toimingud"
24
	char *actions[] = {
25
		57, "Uus fail", "F7",
26
		56, "Uus kataloog", "F6",
27
		60, "Seaded", "F10",
28
		0,0,0
29
	};
5576 pavelyakov 30
	?define T_PROG "Programs "
31
	?define T_SYS  "System "
32
	?define T_UNC  "Unknown "
33
	?define T_CD   "CD-ROM "
34
	?define T_FD   "Floppy disk "
35
	?define T_HD   "Hard disk "
36
	?define T_SATA "SATA disk"
37
	?define T_USB  "USB disk"
38
	?define T_RAM  "RAM disk"
3848 punk_joker 39
#else
4225 punk_joker 40
	?define T_DEVICES "Devices"
41
	?define T_ACTIONS "Actions"
42
	char *actions[] = {
43
		57, "New file", "F7",
44
		56, "New folder", "F6",
5428 leency 45
		60, "Settings", "F10",
4225 punk_joker 46
		0,0,0
47
	};
5576 pavelyakov 48
	?define T_PROG "Programs "
49
	?define T_SYS  "System "
50
	?define T_UNC  "Unknown "
51
	?define T_CD   "CD-ROM "
52
	?define T_FD   "Floppy disk "
53
	?define T_HD   "Hard disk "
54
	?define T_SATA "SATA disk"
55
	?define T_USB  "USB disk"
56
	?define T_RAM  "RAM disk"
3848 punk_joker 57
#endif
58
 
59
 
3363 leency 60
void Tip(int y, dword caption, id, arrow)
61
{
62
	int i;
63
	DrawBar(17,y,160,1,0xEFEDEE);
64
	DrawFilledBar(17, y+1, 160, 16);
5674 pavelyakov 65
	WriteText(25,y+5,0x80,system.color.work_text,caption);
5631 pavelyakov 66
	if (id) DefineButton(159,y+1,16,16,id+BT_HIDE+BT_NOFRAME,0); //arrow button
5674 pavelyakov 67
	WriteText(165,y+5,0x80,system.color.work_text,arrow); //arrow
68
	DrawBar(17,y+17,160,1,system.color.work_graph);
3363 leency 69
}
70
 
71
 
3399 leency 72
path_string disk_list[30];
3363 leency 73
int disc_num;
74
dword devbuf;
75
 
3956 leency 76
 
5441 leency 77
void GetSystemDiscs()
3363 leency 78
{
5150 leency 79
	char dev_name[10], sys_discs[10];
5576 pavelyakov 80
	int i1, j1, dev_num, dev_disc_num,l;
5734 leency 81
	dword temp_file_count, tempbuf;
82
 
3363 leency 83
	disc_num=0;
84
	if (devbuf) free(devbuf);
3399 leency 85
	devbuf = malloc(10000); //буфер где-то на 10 девайсов в левой панели
3363 leency 86
	ReadDir(19, devbuf, "/");
87
	dev_num = EBX;
88
	for (i1=0; i1
89
	{
5576 pavelyakov 90
		sprintf(#dev_name,"/%s/",i1*304+ devbuf+72);
3363 leency 91
		Open_Dir(#dev_name, ONLY_OPEN);
3434 leency 92
		dev_disc_num = files.count;
93
		//if (files.count<=0) copystr(#dev_name,#disk_list[disc_num].Item); else
3363 leency 94
		for (j1=0; j1
95
		{
5576 pavelyakov 96
			l=sprintf(#sys_discs,"%s%s/",#dev_name,j1*304+ buf+72);
5803 leency 97
			strlcpy(#disk_list[disc_num].Item, #sys_discs,l);
3363 leency 98
			disc_num++;
99
		}
5598 pavelyakov 100
		if (!strncmp(#sys_discs, "/rd/1/",6))
3956 leency 101
		{
5734 leency 102
			GetDir(#tempbuf, #temp_file_count, "/kolibrios/", DIRS_ONLYREAL);
103
			if (temp_file_count)
4225 punk_joker 104
			{
5803 leency 105
				strlcpy(#disk_list[disc_num].Item, "/kolibrios/",11);
4225 punk_joker 106
				kolibrios_drive = true;
107
				disc_num++;
5576 pavelyakov 108
			}
109
			else kolibrios_drive = false;
5734 leency 110
			free(tempbuf);
4225 punk_joker 111
		}
3363 leency 112
	}
113
}
114
 
115
 
5441 leency 116
void DrawSystemDiscs()
3363 leency 117
{
5753 leency 118
	char dev_name[15], disc_name[100], i, dev_icon, is_active, name_len;
5703 leency 119
	int pos_y, pos_x=2;
3363 leency 120
 
5633 leency 121
	for (i=disc_num; i<30; i++) DeleteButton(100+i);
3363 leency 122
	for (i=0;i
123
	{
124
		strcpy(#dev_name, #disk_list[i].Item);
125
		dev_name[strlen(#dev_name)-1]=NULL;
126
		switch(dev_name[1])
127
		{
3956 leency 128
			case 'k':
129
				dev_icon=0;
5576 pavelyakov 130
				strcpy(#disc_name, T_PROG);
3956 leency 131
				break;
3363 leency 132
			case 'r':
133
				dev_icon=0;
5576 pavelyakov 134
				strcpy(#disc_name, T_SYS);
3363 leency 135
				break;
136
			case 'c':
137
				dev_icon=1;
5576 pavelyakov 138
				strcpy(#disc_name, T_CD);
3363 leency 139
				break;
140
			case 'f':
141
				dev_icon=2;
5576 pavelyakov 142
				strcpy(#disc_name, T_FD);
3363 leency 143
				break;
144
			case 'h':
145
			case 'b':
146
				dev_icon=3;
5576 pavelyakov 147
				strcpy(#disc_name, T_HD);
3363 leency 148
				break;
3399 leency 149
			case 's':
150
				dev_icon=3;
5576 pavelyakov 151
				strcpy(#disc_name, T_SATA);
3399 leency 152
				break;
3363 leency 153
			case 'u':
154
				dev_icon=5;
5576 pavelyakov 155
				strcpy(#disc_name, T_USB);
3363 leency 156
				break;
157
			case 't':
158
				dev_icon=4;
5576 pavelyakov 159
				strcpy(#disc_name, T_RAM);
3363 leency 160
				break;
161
			default:
5698 leency 162
				dev_icon=3;
5576 pavelyakov 163
				strcpy(#disc_name, T_UNC);
3363 leency 164
		}
5634 leency 165
		if (strstr(#path, #dev_name)) is_active=true; else is_active=false;
5698 leency 166
		if (!two_panels)
5633 leency 167
		{
5698 leency 168
			pos_y = i*16+74;
169
			DrawBar(17,pos_y,6,17,0xFFFFFF);
170
			DrawBar(17+6+18,pos_y,160-6-18,17,0xFFFFFF);
171
			DefineButton(17,pos_y,159,16,100+i+BT_HIDE,0xFFFFFF);
172
			if (show_dev_name)
173
			{
174
				strcat(#disc_name, #dev_name);
175
				if (is_active) WriteText(46+1,pos_y+5,0x80,0x555555,#disc_name);
176
				WriteText(46,pos_y+5,0x80,0,#disc_name);
177
			}
178
			else
179
			{
180
				if (is_active) WriteText(46+1,pos_y+5,0x80,0x555555,#dev_name);
181
				WriteText(46,pos_y+5,0x80,0,#dev_name);
182
			}
183
			_PutImage(23,pos_y, 18,17, is_active*6+dev_icon*17*18*3+#devices);
5633 leency 184
		}
185
		else
186
		{
5703 leency 187
			pos_y = 43;
5753 leency 188
			name_len = strlen(#dev_name)-1*8;
189
			DrawBar(pos_x, pos_y, name_len + 31, 17, 0xFFFFFF);
190
			DefineButton(pos_x+2, pos_y, name_len + 27, 16, 100+i+BT_HIDE,0xFFFFFF);
5698 leency 191
			_PutImage(pos_x + 5, pos_y, 18,17, is_active*6+dev_icon*17*18*3+#devices);
5753 leency 192
			WriteText(pos_x + 24, pos_y+1, 10110000b, 0, #dev_name+1);
193
			pos_x += name_len + 31;
5633 leency 194
		}
3363 leency 195
	}
5703 leency 196
	if (two_panels)
197
	{
198
		DrawBar(pos_x, pos_y, Form.cwidth - pos_x - 2, 17, 0xFFFFFF);
199
		DrawBar(2, pos_y-2, Form.cwidth - 4, 2, 0xFFFFFF);
200
		DrawBar(2, pos_y+17, Form.cwidth - 4, 2, 0xFFFFFF);
5723 leency 201
		DefineButton(Form.cwidth - 23, pos_y, 17,16, 60+BT_HIDE, 0xCCCccc);
202
		_PutImage(Form.cwidth - 21, pos_y+2, 14,13, 2*14*13*3+#factions);
5703 leency 203
	}
3363 leency 204
}
205
 
5698 leency 206
 
3434 leency 207
void ActionsDraw()
3363 leency 208
{
3434 leency 209
	int actions_y=disc_num*16+108, lineh=16;
3848 punk_joker 210
	Tip(actions_y-18, T_ACTIONS, 77, ""); //заголовок
3434 leency 211
	for (i=0; actions[i*3]!=0; i++, actions_y+=lineh)
3363 leency 212
	{
3434 leency 213
		DrawBar(17,actions_y,160,lineh,0xFFFFFF); //белое
214
		DefineButton(17,actions_y,159,lineh,actions[i*3]+BT_HIDE,0xE4DFE1);
215
		WriteText(45,actions_y+4,0x80,0,actions[i*3+1]);
216
		WriteText(-strlen(actions[i*3+2])*6+170,actions_y+4,0x80,0x999999,actions[i*3+2]);
5149 leency 217
		_PutImage(23,actions_y+2, 14,13, i*14*13*3+#factions);
3363 leency 218
	}
219
}
220
 
221
 
5441 leency 222
void DrawLeftPanelBg()
3363 leency 223
{
224
	int actions_y=disc_num*16;
3434 leency 225
	int start_y = actions_y+156;
5743 leency 226
	int onTop1;
3363 leency 227
	DrawBar(2,41,190,15,col_lpanel);		      //синий прямоугольник - над девайсами
228
	DrawBar(17,actions_y+75,160,15,col_lpanel); //синий прямоугольник - под девайсами
3877 leency 229
	PutShadow(17,actions_y+75,160,1,1,3);
3434 leency 230
	PutShadow(18,actions_y+75+1,158,1,1,1);
3363 leency 231
	DrawBar(2,56,15,actions_y+103,col_lpanel);	          //синий прямоугольник - слева
232
	DrawBar(177,56,15,actions_y+103,col_lpanel);            //синий прямоугольник - справа
5743 leency 233
	onTop1 = Form.cheight-start_y-2;
234
	if (onTop1 < 268)
235
	{
236
		PutPaletteImage(#blue_hl, 190, onTop1, 2, start_y, 8, #blue_hl_pal);
237
	}
3363 leency 238
	else
239
	{
5743 leency 240
		DrawBar(2,start_y,190, onTop1-268, col_lpanel);
241
		PutPaletteImage(#blue_hl, 190, 268, 2, Form.cheight-270, 8, #blue_hl_pal);
3363 leency 242
	}
3877 leency 243
	PutShadow(17,start_y,160,1,1,3);
3434 leency 244
	PutShadow(18,start_y+1,158,1,1,1);
3363 leency 245
}
246
 
247
 
5723 leency 248
void DrawDeviceAndActionsLeftPanel()
3363 leency 249
{
5633 leency 250
	Tip(56, T_DEVICES, 55, "=");
5441 leency 251
	DrawSystemDiscs();
3434 leency 252
	ActionsDraw();
5441 leency 253
	DrawLeftPanelBg();
3363 leency 254
}
5698 leency 255
 
256
 
257
void ClickOnDisk(char diskN)
258
{
259
	strcpy(#path, #disk_list[diskN].Item);
260
	files.KeyHome();
261
	Open_Dir(#path,WITH_REDRAW);
262
}