Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
3050 leency 1
void Tip(int y, dword caption, id, arrow)
2
{
3
	DrawBar(17,y,160,1,0xEFEDEE);
4
	DrawBar(17,y+1,160,16,0xE4DFE1); //серое сверху
5
	WriteText(25,y+5,0x80,0,caption,0);
6
	IF (id<>0) DefineButton(159,y+1,16,16,id+BT_HIDE+BT_NOFRAME,0xE4DFE1); //кнопа для стрелки
7
	WriteText(165,y+5,0x80,0,arrow,0); //стрелка вниз
8
	DrawBar(17,y+17,160,1,0x94AECE);		//подчёркивание
9
}
2568 leency 10
 
3050 leency 11
 
2814 leency 12
path_string disk_list[20];
13
int disc_num;
3043 leency 14
dword devbuf;
2814 leency 15
 
2568 leency 16
void GetSystemDiscs()
17
{
3043 leency 18
	unsigned char dev_name[10], sys_discs[10];
19
	unsigned int i1, j1, dev_num, dev_disc_num;
20
 
2814 leency 21
	disc_num=0;
3043 leency 22
	if (devbuf) free(devbuf);
2568 leency 23
	devbuf= malloc(3112); //буфер где-то на 10 девайсов в левой панели
3043 leency 24
	ReadDir(19, devbuf, "/");
2568 leency 25
	dev_num = EBX;
26
	for (i1=0; i1
27
	{
28
		copystr("/", #dev_name);                                 // /
29
		copystr(i1*304+ devbuf+72, #dev_name+strlen(#dev_name)); // /rd
30
		copystr("/", #dev_name+strlen(#dev_name));               // /rd/
31
 
32
		Open_Dir(#dev_name, ONLY_OPEN);
33
		dev_disc_num = count;
2587 leency 34
		//if (count<=0) copystr(#dev_name,#disk_list[disc_num].Item); else
2568 leency 35
		for (j1=0; j1
36
		{
37
			copystr(#dev_name, #sys_discs);                              // /rd/
38
			copystr(j1*304+ buf+72, #sys_discs+strlen(#sys_discs));      // /rd/1
39
			copystr("/", #sys_discs+strlen(#sys_discs));                 // /rd/1/
40
			copystr(#sys_discs,#disk_list[disc_num].Item);
41
			disc_num++;
42
		}
43
	}
44
}
45
 
46
 
47
void DrawSystemDiscs()
48
{
49
	byte disc_icon;
2587 leency 50
	char dev_name[10];
2568 leency 51
	char disc_name[100];
52
	int i, dev_icon;
53
 
3050 leency 54
	for (i=0; i<20; i++) DeleteButton(i);
2568 leency 55
	//список дисков
3043 leency 56
	Tip(56, "Devices", 78, "=");
2568 leency 57
	for (i=0;i
58
	{
3043 leency 59
		DrawBar(17,i*16+74,160,17,0xFFFFFF); //фон
2568 leency 60
		DefineButton(17,i*16+74,159,16,100+i+BT_HIDE,0xFFFFFF); //создаём кнопки, а потом выводим названия дисков
3043 leency 61
		strcpy(#dev_name, #disk_list[i].Item);
62
		dev_name[strlen(#dev_name)-1]=NULL;
63
		switch(dev_name[1])
64
		{
65
			case 'r':
66
				dev_icon=0;
67
				strcpy(#disc_name, "RAM disk ");
68
				break;
69
			case 'c':
70
				dev_icon=1;
71
				strcpy(#disc_name, "CD-ROM ");
72
				break;
73
			case 'f':
74
				dev_icon=2;
75
				strcpy(#disc_name, "Floppy disk ");
76
				break;
77
			case 'h':
78
			case 'b':
79
				dev_icon=3;
80
				strcpy(#disc_name, "Hard disk ");
81
				break;
82
			case 't':
83
				dev_icon=4;
84
				strcpy(#disc_name, "RAM disk ");
85
 
3050 leency 86
				DefineButton(17+143,i*16+74,16,16,i+130+BT_HIDE+BT_NOFRAME,0xFFFFFF);
87
				WriteText(45+121,i*16+79,0x80,0xD63535,"-",0);
88
				WriteText(45+121,i*16+79+1,0x80,0xBC2424,"-",0);
3043 leency 89
				break;
90
			default:
91
				dev_icon=3; //по-умолчанию устройство выглядит как жестяк но это неправильно
92
				strcpy(#disc_name, "Unknown ");
93
		}
94
		strcat(#disc_name, #dev_name);
2662 leency 95
		if (show_dev_name) WriteText(45,i*16+79,0x80,0,#disc_name,0);
96
			else WriteText(45,i*16+79,0x80,0,#dev_name,0);
2568 leency 97
		PutImage(dev_icon*14*13*3+#devices,14,13,21,i*16+76);
98
	}
3050 leency 99
}
100
 
101
 
102
void Actions()
103
{
104
	int actions_y=disc_num*16;
105
 
106
	DeleteButton(80);
107
	DeleteButton(81);
108
	DeleteButton(82);
109
 
110
	if (!show_actions)
111
		Tip(actions_y+90, "Actions", 77, "\x18");
112
	else
113
	{
114
		Tip(actions_y+90, "Actions", 77, "\x19"); //заголовок
115
		DrawBar(17,actions_y+108,160,51,0xFFFFFF); //белое
116
		PutImage(#factions,16,44,21,actions_y+113); //иконки
117
		//rename file
118
		DefineButton(17,actions_y+108,159,16,80+BT_HIDE,0xE4DFE1);
119
		WriteText(42,actions_y+113,0x80,0,"Rename file",0);
120
		WriteText(150,actions_y+113,0x80,0x999999,"[F2]",0);
121
		//delete file
122
		DefineButton(17,actions_y+125,159,16,81+BT_HIDE,0xE4DFE1);
123
		WriteText(42,actions_y+130,0x80,0,"Delete file",0);
124
		WriteText(144,actions_y+130,0x80,0x999999,"[Del]",0);
125
		//create folder
126
		DefineButton(17,actions_y+142,159,16,82+BT_HIDE,0xE4DFE1);
127
		WriteText(42,actions_y+147,0x80,0,"Create folder",0);
128
		WriteText(150,actions_y+147,0x80,0x999999,"[F6]",0);
129
	}
130
}
131
 
132
 
133
void LeftPanelBackground()
134
{
135
	int actions_y=disc_num*16;
136
	int start_y = show_actions*51+actions_y+108;
137
	DrawBar(2,41,190,15,lpanel_col);		      //синий прямоугольник - над девайсами
138
	DrawBar(17,actions_y+75,160,15,lpanel_col); //синий прямоугольник - под девайсами
139
	DrawBar(2,56,15,actions_y+103,lpanel_col);	          //синий прямоугольник - слева
140
	DrawBar(177,56,15,actions_y+103,lpanel_col);            //синий прямоугольник - справа
141
	if (onTop(start_y, 6) < 268)
142
		PutPaletteImage(#blue_hl, 190, onTop(start_y, 6), 2, start_y, #blue_hl_pal);
143
	else
144
	{
145
		DrawBar(2,start_y,190,onTop(start_y,6+268),lpanel_col);
146
		PutPaletteImage(#blue_hl, 190, 268, 2, onTop(268,6), #blue_hl_pal);
147
		if (onTop(268,6)>300) PutPaletteImage(#blue_hl, 190, 87, 2, start_y+100, #blue_hl_pal);
148
	}
149
}
150
 
151
 
152
void DrawLeftPanel()
153
{
154
	DrawSystemDiscs();
155
	Actions();
156
	LeftPanelBackground();
157
}
158