Subversion Repositories Kolibri OS

Rev

Rev 8872 | Rev 8946 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
3399 leency 1
 
3848 punk_joker 2
	?define T_DEVICES "Устройства"
4225 punk_joker 3
	?define T_ACTIONS "Действия"
4
	char *actions[] = {
5
		59, "Новый файл", "F9",
8833 leency 6
		57, "Новая папка", "F7",
7
		60, "Настройки", "F10",
4225 punk_joker 8
		0,0,0
9
	};
10
	?define T_PROG "Программы "
5576 pavelyakov 11
	?define T_SYS  "Система "
12
	?define T_UNC  "Неизвестно "
13
	?define T_CD   "CD-ROM "
14
	?define T_FD   "Дискета "
15
	?define T_HD   "Жесткий диск "
16
	?define T_SATA "SATA диск "
17
	?define T_USB  "USB диск "
18
	?define T_RAM  "RAM диск "
19
#else
3848 punk_joker 20
	?define T_DEVICES "Devices"
4225 punk_joker 21
	?define T_ACTIONS "Actions"
22
	char *actions[] = {
23
		59, "New file", "F9",
8833 leency 24
		57, "New folder", "F7",
25
		60, "Settings", "F10",
5428 leency 26
		0,0,0
4225 punk_joker 27
	};
28
	?define T_PROG "Programs "
5576 pavelyakov 29
	?define T_SYS  "System "
30
	?define T_UNC  "Unknown "
31
	?define T_CD   "CD-ROM "
32
	?define T_FD   "Floppy disk "
33
	?define T_HD   "Hard disk "
34
	?define T_SATA "SATA disk "
7210 leency 35
	?define T_USB  "USB disk "
36
	?define T_RAM  "RAM disk "
37
#endif
3848 punk_joker 38
39
 
6034 leency 40
{
41
	collection list;
42
	int dev_num;
7422 leency 43
	void Get();
44
	void Draw();
6034 leency 45
	void DrawSelect();
8854 leency 46
	void DrawOptions();
47
	void Click();
6034 leency 48
} SystemDiscs=0;
7972 leency 49
3848 punk_joker 50
 
7989 leency 51
#define DEV_H_HOR 20
8854 leency 52
6034 leency 53
 
54
{
3363 leency 55
	switch(disk_first_letter)
6034 leency 56
	{
57
		case 'r':
58
			ESBYTE[dev_icon]=0;
59
			strcpy(disc_name, T_SYS);
60
			break;
61
		case 'k':
7989 leency 62
			ESBYTE[dev_icon]=1;
6034 leency 63
			strcpy(disc_name, T_PROG);
7989 leency 64
			break;
6034 leency 65
		case 'f':
66
			ESBYTE[dev_icon]=2;
67
			strcpy(disc_name, T_FD);
68
			break;
69
		case 'c':
7989 leency 70
			ESBYTE[dev_icon]=3;
71
			strcpy(disc_name, T_CD);
72
			break;
73
		case 'h':
6034 leency 74
		case 'b':
75
			ESBYTE[dev_icon]=4;
7989 leency 76
			strcpy(disc_name, T_HD);
6034 leency 77
			break;
78
		case 's':
79
			ESBYTE[dev_icon]=4;
7989 leency 80
			strcpy(disc_name, T_SATA);
6034 leency 81
			break;
82
		case 't':
7989 leency 83
			ESBYTE[dev_icon]=5;
84
			strcpy(disc_name, T_RAM);
85
			break;
86
		case 'u':
6034 leency 87
			ESBYTE[dev_icon]=6;
7989 leency 88
			strcpy(disc_name, T_USB);
6034 leency 89
			break;
90
		default:
91
			ESBYTE[dev_icon]=5;
7989 leency 92
	}
6034 leency 93
}
3363 leency 94
7422 leency 95
 
96
{
3363 leency 97
	bool kolibrios_exists=false;
7428 leency 98
	char dev_name[10], sys_discs[10];
5150 leency 99
	int i1, j1, dev_num_i, dev_disc_num;
7422 leency 100
	dword devbuf, diskbuf;
8872 leency 101
5734 leency 102
 
6034 leency 103
	devbuf = malloc(10000);
5960 leency 104
	ReadDir(19, devbuf, "/");
3363 leency 105
	dev_num = dev_num_i = EBX;
7422 leency 106
	for (i1=0; i1
107
	{
7310 pavelyakov 108
		sprintf(#dev_name,"/%s",i1*304+ devbuf+72);
6635 leency 109
		GetDir(#diskbuf, #dev_disc_num, #dev_name, DIRS_NOROOT);
8872 leency 110
		for (j1=0; j1
3363 leency 111
		{
112
			sprintf(#sys_discs,"%s/%s",#dev_name,j1*304+ diskbuf+72);
8872 leency 113
			if (sys_discs[1]=='c') || (dir_exists(#sys_discs)) list.add(#sys_discs);
7992 leency 114
		}
3363 leency 115
		if (!strcmp(#sys_discs, "/rd/1"))
6635 leency 116
		{
3956 leency 117
			if (dir_exists("/kolibrios")) && (!kolibrios_exists) {
7428 leency 118
				kolibrios_exists=true;
119
				list.add("/kolibrios");
7422 leency 120
				dev_num++;
121
			}
122
		}
4225 punk_joker 123
	}
3363 leency 124
	free(devbuf);
5960 leency 125
	free(diskbuf);
8872 leency 126
}
3363 leency 127
128
 
8854 leency 129
130
 
6034 leency 131
{
3363 leency 132
	char dev_name[15], disc_name[100], i, dev_icon, is_active=0;
8868 leency 133
	int draw_y, draw_x;
7989 leency 134
3363 leency 135
 
5960 leency 136
6034 leency 137
 
8854 leency 138
		if (active_panel==1) {
139
			DrawSelect(Form.cwidth/2-DDW, 10, #path, KFM_DEV_DROPDOWN_1);
140
			DrawSelect(Form.cwidth-DDW-2, 10, #inactive_path, KFM_DEV_DROPDOWN_2);
141
		} else {
142
			DrawSelect(Form.cwidth/2-DDW, 10, #inactive_path, KFM_DEV_DROPDOWN_1);
143
			DrawSelect(Form.cwidth-DDW-2, 10, #path, KFM_DEV_DROPDOWN_2);
144
		}
145
		files.y = 40 + 17;
146
	} else {
147
		draw_y = 74;
148
		draw_x = 17;
149
		for (i=0;i
150
			strcpy(#dev_name, list.get(i));
151
			GetDiskIconAndName(dev_name[1], #dev_icon, #disc_name);
152
			if (strstr(#path, #dev_name)==#path) is_active=true; else is_active=false;
8917 leency 153
6034 leency 154
 
7989 leency 155
			DrawBar(draw_x+6+18,draw_y,160-6-18,DEV_H+1,0xFFFFFF);
156
			DefineButton(draw_x,draw_y,159,16,100+i+BT_HIDE,0xFFFFFF);
6034 leency 157
			if (show_dev_name.checked)
7244 leency 158
			{
5698 leency 159
				strcat(#disc_name, #dev_name);
160
				if (is_active) WriteText(draw_x+30,draw_y+5,0x80,0x555555,#disc_name);
6034 leency 161
				WriteText(draw_x+29,draw_y+5,0x80,0,#disc_name);
7806 leency 162
				//if (is_active) kfont.bold = true;
8854 leency 163
				//kfont.WriteIntoWindow(draw_x + 29, draw_y+2, 0xFFFfff, 0x000000, kfont.size.pt, #disc_name);
164
				//kfont.bold = false;
165
			} else {
7806 leency 166
				if (is_active) WriteText(draw_x+30,draw_y+5,0x80,0x555555,#dev_name);
6034 leency 167
				WriteText(draw_x+29,draw_y+5,0x80,0,#dev_name);
168
			}
5698 leency 169
			_PutImage(draw_x+6,draw_y, 18,17, is_active*7+dev_icon*17*18*3+#devices);
7989 leency 170
			draw_y += DEV_H;
8854 leency 171
		}
5633 leency 172
		DrawBar(draw_x+6, draw_y, 18, 1, 0xFFFfff);
7989 leency 173
	}
5703 leency 174
}
3363 leency 175
176
 
8854 leency 177
{
178
	char dev_name[15], disc_name[100], i, dev_icon, is_active=0;
179
	if (ESBYTE[path1+1]=='\0') {
180
		strcpy(#dev_name, "/root");
181
		dev_icon = 0;
182
	} else if (chrnum(path1, '/')==1) {
183
		strcpy(#dev_name, path1);
184
		GetDiskIconAndName(dev_name[1], #dev_icon, #disc_name);
185
	} else for (i=0;i
186
		strcpy(#dev_name, list.get(i));
187
		GetDiskIconAndName(dev_name[1], #dev_icon, #disc_name);
188
		if (strstr(path1, #dev_name)-path1==0) break;
189
	}
190
	DrawRectangle(draw_x-1, draw_y-1, DDW+2-DEV_H_HOR, DEV_H_HOR+1, sc.work_graph);
191
	DrawBar(draw_x, draw_y, DDW+1-DEV_H_HOR, DEV_H_HOR, 0xFFFFFF);
192
	_PutImage(draw_x + 5, draw_y+2, 18,17, is_active*7+dev_icon*17*18*3+#devices);
193
	kfont.WriteIntoWindow(draw_x + 24, draw_y+2, 0xFFFfff, 0x000000, kfont.size.pt, #dev_name+1);
194
	DefineButton(draw_x, draw_y, DDW-1, DEV_H_HOR-1, btid+1+BT_HIDE,0xFFFFFF);
8868 leency 195
	DrawFlatButtonSmall(draw_x+DDW-DEV_H_HOR+1, draw_y-1, DEV_H_HOR-1, DEV_H_HOR+1, btid, "\x19");
8854 leency 196
197
 
198
	//DrawBar(draw_x, draw_y, Form.cwidth - draw_x - 2, DEV_H_HOR, sc.work);
199
}
200
201
 
202
{
203
	char dev_name[15], disc_name[100], i, dev_icon, is_active=0;
204
205
 
206
207
 
208
209
 
210
		strcpy(#dev_name, list.get(i));
211
		GetDiskIconAndName(dev_name[1], #dev_icon, #disc_name);
212
		if (strstr(#path, #dev_name)!=0) is_active=true; else is_active=false;
213
214
 
215
		DefineButton(draw_x, draw_y, DDW, DEV_H_HOR-1, 100+i+BT_HIDE,0xFFFFFF);
216
		_PutImage(draw_x + 5, draw_y+2, 18,17, is_active*7+dev_icon*17*18*3+#devices);
217
		if (is_active) kfont.bold = true;
218
		kfont.WriteIntoWindow(draw_x + 24, draw_y+2, 0xFFFfff, 0x000000, kfont.size.pt, #dev_name+1);
219
		kfont.bold = false;
220
		draw_y += DEV_H_HOR;
221
	}
222
}
223
224
 
6034 leency 225
{
226
	strcpy(#path, list.get(n));
227
	files.KeyHome();
228
	Open_Dir(#path,WITH_REDRAW);
229
}
230
5698 leency 231
 
6034 leency 232
 
233
 
234
{
235
	Tip(56, T_DEVICES, 55, "=");
236
	SystemDiscs.Draw();
237
	ActionsDraw();
238
	DrawLeftPanelBg();
239
}
240
241
 
7462 leency 242
	0xDFDCDD,0xE1DDDE,0xE2DEE0,0xE4DFE1,0xE3DFE1,0xE3DFE1,0xE3DFE1,0xE3DFE1,0xE3DFE1};
243
void DrawFilledBarInner(dword x, y, w, h)
244
{
245
	int i, fill_h;
246
	if (h <= 14) fill_h = h; else fill_h = 14;
247
	for (i=0; i
248
	DrawBar(x, y+i, w, h-fill_h, col_palette_inner[14-i]);
249
}
250
251
 
6034 leency 252
{
253
	if (col.def) {
7647 leency 254
		DrawBar(17,y,160,1,0xEFEDEE);
255
		DrawFilledBarInner(17, y+1, 160, 16);
256
		DrawBar(17,y+17,160,1,0x7E87A3);
257
	} else {
258
		DrawBar(17,y,160,1,sc.work_graph);
7806 leency 259
		DrawBar(17,y+1,160,16,col.list_bg);
7647 leency 260
		DrawBar(17,y+17,160,1,sc.work_graph);
7806 leency 261
	}
7647 leency 262
	WriteText(25,y+5,0x80,col.list_gb_text,caption);
263
	if (id) DefineButton(159,y+1,16,16,id+BT_HIDE+BT_NOFRAME,0); //arrow button
6034 leency 264
	WriteText(165,y+5,0x80,col.list_gb_text,arrow); //arrow
7647 leency 265
}
6034 leency 266
267
 
3434 leency 268
{
3363 leency 269
	int i;
7422 leency 270
	int actions_y= SystemDiscs.list.count*DEV_H+108;
7989 leency 271
	Tip(actions_y-18, T_ACTIONS, 77, "");
8240 leency 272
	for (i=0; actions[i*3]!=0; i++, actions_y+=DEV_H)
7989 leency 273
	{
3363 leency 274
		DrawBar(17,actions_y,160,DEV_H,0xFFFFFF); //схыюх
7989 leency 275
		DefineButton(17,actions_y,159,DEV_H,actions[i*3]+BT_HIDE,0xE4DFE1);
276
		WriteText(45,actions_y+4,0x80,0,actions[i*3+1]);
3434 leency 277
		WriteText(-strlen(actions[i*3+2])*6+170,actions_y+4,0x80,0x999999,actions[i*3+2]);
278
		_PutImage(23,actions_y+2, 14,13, i*14*13*3+#factions);
5149 leency 279
	}
3363 leency 280
}
281
282
 
5441 leency 283
{
3363 leency 284
	int actions_y = SystemDiscs.list.count*DEV_H;
7989 leency 285
	int start_y = actions_y+159;
286
	int area_h;
6987 leency 287
	DrawBar(2,41,190,15,waves_pal[0]);		      //above devices block
8240 leency 288
	DrawBar(17,actions_y+75,160,15,waves_pal[0]); //below devices block
289
	PutShadow(17,actions_y+75,160,1,1,3);
3877 leency 290
	PutShadow(18,actions_y+75+1,158,1,1,1);
3434 leency 291
	DrawBar(2,56,15,actions_y+103,waves_pal[0]);	          //on the left
8240 leency 292
	DrawBar(177,56,15,actions_y+103,waves_pal[0]);            //on the right
293
	area_h = Form.cheight-start_y-2 - status_bar_h;
6987 leency 294
	if (area_h < 268){
8240 leency 295
		PutPaletteImage(#blue_hl, 190, area_h, 2, start_y, 8, #waves_pal);
296
	} else {
297
		DrawBar(2,start_y,190, area_h-268, waves_pal[0]);
298
		PutPaletteImage(#blue_hl, 190, 268, 2, Form.cheight-270-status_bar_h, 8, #waves_pal);
299
	}
5743 leency 300
	PutShadow(17,start_y,160,1,1,3);
3877 leency 301
	PutShadow(18,start_y+1,158,1,1,1);
3434 leency 302
}
5698 leency 303