Subversion Repositories Kolibri OS

Rev

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

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