Subversion Repositories Kolibri OS

Rev

Rev 3363 | Rev 3434 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3363 Rev 3399
-
 
1
//Leency 2008-2013
-
 
2
 
1
void Tip(int y, dword caption, id, arrow)
3
void Tip(int y, dword caption, id, arrow)
2
{
4
{
3
	int i;
5
	int i;
4
	DrawBar(17,y,160,1,0xEFEDEE);
6
	DrawBar(17,y,160,1,0xEFEDEE);
5
	DrawFilledBar(17, y+1, 160, 16);
7
	DrawFilledBar(17, y+1, 160, 16);
6
	WriteText(25,y+5,0x80,0,caption);
8
	WriteText(25,y+5,0x80,0,caption);
7
	IF (id<>0) DefineButton(159,y+1,16,16,id+BT_HIDE+BT_NOFRAME,0xE4DFE1); //êíîïà äëÿ ñòðåëêè
9
	IF (id<>0) DefineButton(159,y+1,16,16,id+BT_HIDE+BT_NOFRAME,0xE4DFE1); //êíîïà äëÿ ñòðåëêè
8
	WriteText(165,y+5,0x80,0,arrow); //ñòðåëêà âíèç
10
	WriteText(165,y+5,0x80,0,arrow); //ñòðåëêà âíèç
9
	DrawBar(17,y+17,160,1,0x94AECE);		//ïîä÷¸ðêèâàíèå
11
	DrawBar(17,y+17,160,1,0x94AECE);		//ïîä÷¸ðêèâàíèå
10
}
12
}
11
 
13
 
12
 
14
 
13
path_string disk_list[20];
15
path_string disk_list[30];
14
int disc_num;
16
int disc_num;
15
dword devbuf;
17
dword devbuf;
16
 
18
 
17
void GetSystemDiscs()
19
void GetSystemDiscs()
18
{
20
{
19
	unsigned char dev_name[10], sys_discs[10];
21
	unsigned char dev_name[10], sys_discs[10];
20
	unsigned int i1, j1, dev_num, dev_disc_num;
22
	unsigned int i1, j1, dev_num, dev_disc_num;
21
	
23
	
22
	disc_num=0;
24
	disc_num=0;
23
	if (devbuf) free(devbuf);
25
	if (devbuf) free(devbuf);
24
	devbuf = malloc(3112); //áóôåð ãäå-òî íà 10 äåâàéñîâ â ëåâîé ïàíåëè
26
	devbuf = malloc(10000); //áóôåð ãäå-òî íà 10 äåâàéñîâ â ëåâîé ïàíåëè
25
	ReadDir(19, devbuf, "/");
27
	ReadDir(19, devbuf, "/");
26
	dev_num = EBX;
28
	dev_num = EBX;
27
	for (i1=0; i1
29
	for (i1=0; i1
28
	{
30
	{
29
		strcpy(#dev_name, "/");                                 // /
31
		strcpy(#dev_name, "/");                                 // /
30
		strcat(#dev_name, i1*304+ devbuf+72); // /rd
32
		strcat(#dev_name, i1*304+ devbuf+72); // /rd
31
		strcat(#dev_name, "/");               // /rd/
33
		strcat(#dev_name, "/");               // /rd/
32
		Open_Dir(#dev_name, ONLY_OPEN);
34
		Open_Dir(#dev_name, ONLY_OPEN);
33
		dev_disc_num = count;
35
		dev_disc_num = count;
34
		//if (count<=0) copystr(#dev_name,#disk_list[disc_num].Item); else
36
		//if (count<=0) copystr(#dev_name,#disk_list[disc_num].Item); else
35
		for (j1=0; j1
37
		for (j1=0; j1
36
		{
38
		{
37
			strcpy(#sys_discs, #dev_name);                              // /rd/
39
			strcpy(#sys_discs, #dev_name);                              // /rd/
38
			strcat(#sys_discs, j1*304+ buf+72);      // /rd/1
40
			strcat(#sys_discs, j1*304+ buf+72);      // /rd/1
39
			strcat(#sys_discs, "/");                 // /rd/1/
41
			strcat(#sys_discs, "/");                 // /rd/1/
40
			strcpy(#disk_list[disc_num].Item, #sys_discs);
42
			strcpy(#disk_list[disc_num].Item, #sys_discs);
41
			disc_num++;
43
			disc_num++;
42
		}
44
		}
43
	}
45
	}
44
}
46
}
45
 
47
 
46
 
48
 
47
void DrawSystemDiscs()
49
void DrawSystemDiscs()
48
{    
50
{    
49
	byte disc_icon;
51
	byte disc_icon;
50
	char dev_name[10];
52
	char dev_name[10];
51
	char disc_name[100];
53
	char disc_name[100];
52
	int i, dev_icon;
54
	int i, dev_icon;
53
	
55
	
54
	for (i=0; i<20; i++) DeleteButton(100+i);
56
	for (i=0; i<20; i++) DeleteButton(100+i);
55
	//ñïèñîê äèñêîâ
57
	//ñïèñîê äèñêîâ
56
	Tip(56, "Devices", 78, "=");
58
	Tip(56, "Devices", 78, "=");
57
	for (i=0;i
59
	for (i=0;i
58
	{
60
	{
59
		DrawBar(17,i*16+74,160,17,0xFFFFFF); //ôîí
61
		DrawBar(17,i*16+74,160,17,0xFFFFFF); //ôîí
60
		DefineButton(17,i*16+74,159,16,100+i+BT_HIDE,0xFFFFFF); //ñîçäà¸ì êíîïêè, à ïîòîì âûâîäèì íàçâàíèÿ äèñêîâ
62
		DefineButton(17,i*16+74,159,16,100+i+BT_HIDE,0xFFFFFF); //ñîçäà¸ì êíîïêè, à ïîòîì âûâîäèì íàçâàíèÿ äèñêîâ
61
		strcpy(#dev_name, #disk_list[i].Item);
63
		strcpy(#dev_name, #disk_list[i].Item);
62
		dev_name[strlen(#dev_name)-1]=NULL;
64
		dev_name[strlen(#dev_name)-1]=NULL;
63
		switch(dev_name[1])
65
		switch(dev_name[1])
64
		{
66
		{
65
			case 'r':
67
			case 'r':
66
				dev_icon=0;
68
				dev_icon=0;
67
				strcpy(#disc_name, "RAM disk ");
69
				strcpy(#disc_name, "SYS disk ");
68
				break;
70
				break;
69
			case 'c':
71
			case 'c':
70
				dev_icon=1;
72
				dev_icon=1;
71
				strcpy(#disc_name, "CD-ROM ");
73
				strcpy(#disc_name, "CD-ROM ");
72
				break;
74
				break;
73
			case 'f':
75
			case 'f':
74
				dev_icon=2;
76
				dev_icon=2;
75
				strcpy(#disc_name, "Floppy disk ");
77
				strcpy(#disc_name, "Floppy disk ");
76
				break;
78
				break;
77
			case 'h':
79
			case 'h':
78
			case 'b':
80
			case 'b':
79
				dev_icon=3;
81
				dev_icon=3;
80
				strcpy(#disc_name, "Hard disk ");
82
				strcpy(#disc_name, "Hard disk ");
81
				break;
83
				break;
-
 
84
			case 's':
-
 
85
				dev_icon=3;
-
 
86
				strcpy(#disc_name, "SATA disk ");
-
 
87
				break;
82
			case 'u':
88
			case 'u':
83
				dev_icon=5;
89
				dev_icon=5;
84
				strcpy(#disc_name, "USB flash ");
90
				strcpy(#disc_name, "USB flash ");
85
				break;
91
				break;
86
			case 't':
92
			case 't':
87
				dev_icon=4;
93
				dev_icon=4;
88
				strcpy(#disc_name, "RAM disk ");				
94
				strcpy(#disc_name, "RAM disk ");				
89
				DefineButton(17+143,i*16+74,16,16,i+130+BT_HIDE+BT_NOFRAME,0xFFFFFF);
95
				DefineButton(17+143,i*16+74,16,16,i+130+BT_HIDE+BT_NOFRAME,0xFFFFFF);
90
				WriteText(45+121,i*16+79,0x80,0xD63535,"-");
96
				WriteText(45+121,i*16+79,0x80,0xD63535,"-");
91
				WriteText(45+121,i*16+79+1,0x80,0xBC2424,"-");
97
				WriteText(45+121,i*16+79+1,0x80,0xBC2424,"-");
92
				break;
98
				break;
93
			default:
99
			default:
94
				dev_icon=3; //ïî-óìîë÷àíèþ óñòðîéñòâî âûãëÿäèò êàê æåñòÿê íî ýòî íåïðàâèëüíî
100
				dev_icon=3; //ïî-óìîë÷àíèþ óñòðîéñòâî âûãëÿäèò êàê æåñòÿê íî ýòî íåïðàâèëüíî
95
				strcpy(#disc_name, "Unknown ");				
101
				strcpy(#disc_name, "Unknown ");				
96
		}
102
		}
97
		strcat(#disc_name, #dev_name);
103
		strcat(#disc_name, #dev_name);
98
		if (show_dev_name) WriteText(45,i*16+79,0x80,0,#disc_name);
104
		if (show_dev_name) WriteText(45,i*16+79,0x80,0,#disc_name);
99
			else WriteText(45,i*16+79,0x80,0,#dev_name);
105
			else WriteText(45,i*16+79,0x80,0,#dev_name);
100
		_PutImage(21,i*16+76, 14,13, dev_icon*14*13*3+#devices);
106
		_PutImage(21,i*16+76, 14,13, dev_icon*14*13*3+#devices);
101
	}
107
	}
102
}
108
}
103
 
109
 
104
void FileMenu()
110
void FileMenu()
105
{
111
{
106
	word id, key;
112
	word id, key;
107
	loop() switch(WaitEvent())
113
	loop() switch(WaitEvent())
108
	{
114
	{
109
		case evButton: 
115
		case evButton: 
110
				id=GetButtonID();
116
				id=GetButtonID();
111
				ExitProcess();
117
				ExitProcess();
112
				break;
118
				break;
113
				
119
				
114
		case evKey:
120
		case evKey:
115
				IF (GetKey()==27) ExitProcess();
121
				IF (GetKey()==27) ExitProcess();
116
				break;
122
				break;
117
				
123
				
118
		case evReDraw:
124
		case evReDraw:
119
			DefineAndDrawWindow(m.x+1+Form.left,m.y+Form.top,159,90,0x01,0xEEEeee,0x01fffFFF);
125
			DefineAndDrawWindow(m.x+1+Form.left,m.y+Form.top,159,90,0x01,0xEEEeee,0x01fffFFF);
120
			DrawBar(1,18,160,51,0xFFFFFF); //áåëîå
126
			DrawBar(1,18,160,51,0xFFFFFF); //áåëîå
121
			_PutImage(1,23, 16,44, #factions); //èêîíêè
127
			_PutImage(1,23, 16,44, #factions); //èêîíêè
122
			//rename file 
128
			//rename file 
123
			DefineButton(1,18,159,16,80+BT_HIDE,0xE4DFE1);
129
			DefineButton(1,18,159,16,80+BT_HIDE,0xE4DFE1);
124
			WriteText(26,23,0x80,0,"Rename file");
130
			WriteText(26,23,0x80,0,"Rename file");
125
			WriteText(134,23,0x80,0x999999,"[F2]");
131
			WriteText(134,23,0x80,0x999999,"[F2]");
126
			//delete file
132
			//delete file
127
			DefineButton(1,35,159,16,81+BT_HIDE,0xE4DFE1);
133
			DefineButton(1,35,159,16,81+BT_HIDE,0xE4DFE1);
128
			WriteText(26,40,0x80,0,"Delete file");
134
			WriteText(26,40,0x80,0,"Delete file");
129
			WriteText(144,40,0x80,0x999999,"[Del]");
135
			WriteText(144,40,0x80,0x999999,"[Del]");
130
			//create folder
136
			//create folder
131
			DefineButton(1,52,159,16,82+BT_HIDE,0xE4DFE1);
137
			DefineButton(1,52,159,16,82+BT_HIDE,0xE4DFE1);
132
			WriteText(26,57,0x80,0,"Create folder");
138
			WriteText(26,57,0x80,0,"Create folder");
133
			WriteText(134,57,0x80,0x999999,"[F6]");
139
			WriteText(134,57,0x80,0x999999,"[F6]");
134
	}
140
	}
135
}
141
}
136
 
142
 
137
void Actions()
143
void Actions()
138
{
144
{
139
	int actions_y=disc_num*16;
145
	int actions_y=disc_num*16;
140
	
146
	
141
	DeleteButton(80);
147
	DeleteButton(80);
142
	DeleteButton(81);
148
	DeleteButton(81);
143
	DeleteButton(82);
149
	DeleteButton(82);
144
	
150
	
145
	if (!show_actions)
151
	if (!show_actions)
146
		Tip(actions_y+90, "Actions", 77, "\x18");
152
		Tip(actions_y+90, "Actions", 77, "\x18");
147
	else
153
	else
148
	{
154
	{
149
		Tip(actions_y+90, "Actions", 77, "\x19"); //çàãîëîâîê
155
		Tip(actions_y+90, "Actions", 77, "\x19"); //çàãîëîâîê
150
		DrawBar(17,actions_y+108,160,51,0xFFFFFF); //áåëîå
156
		DrawBar(17,actions_y+108,160,51,0xFFFFFF); //áåëîå
151
		_PutImage(21,actions_y+113, 16,44, #factions); //èêîíêè
157
		_PutImage(21,actions_y+113, 16,44, #factions); //èêîíêè
152
		//rename file 
158
		//rename file 
153
		DefineButton(17,actions_y+108,159,16,80+BT_HIDE,0xE4DFE1);
159
		DefineButton(17,actions_y+108,159,16,80+BT_HIDE,0xE4DFE1);
154
		WriteText(42,actions_y+113,0x80,0,"Rename file");
160
		WriteText(42,actions_y+113,0x80,0,"Rename file");
155
		WriteText(150,actions_y+113,0x80,0x999999,"[F2]");
161
		WriteText(150,actions_y+113,0x80,0x999999,"[F2]");
156
		//delete file
162
		//delete file
157
		DefineButton(17,actions_y+125,159,16,81+BT_HIDE,0xE4DFE1);
163
		DefineButton(17,actions_y+125,159,16,81+BT_HIDE,0xE4DFE1);
158
		WriteText(42,actions_y+130,0x80,0,"Delete file");
164
		WriteText(42,actions_y+130,0x80,0,"Delete file");
159
		WriteText(144,actions_y+130,0x80,0x999999,"[Del]");
165
		WriteText(144,actions_y+130,0x80,0x999999,"[Del]");
160
		//create folder
166
		//create folder
161
		DefineButton(17,actions_y+142,159,16,82+BT_HIDE,0xE4DFE1);
167
		DefineButton(17,actions_y+142,159,16,82+BT_HIDE,0xE4DFE1);
162
		WriteText(42,actions_y+147,0x80,0,"Create folder");
168
		WriteText(42,actions_y+147,0x80,0,"Create folder");
163
		WriteText(150,actions_y+147,0x80,0x999999,"[F6]");
169
		WriteText(150,actions_y+147,0x80,0x999999,"[F6]");
164
	}
170
	}
165
}
171
}
166
 
172
 
167
 
173
 
168
void LeftPanelBackground()
174
void LeftPanelBackground()
169
{
175
{
170
	int actions_y=disc_num*16;
176
	int actions_y=disc_num*16;
171
	int start_y = show_actions*51+actions_y+108;
177
	int start_y = show_actions*51+actions_y+108;
172
	DrawBar(2,41,190,15,col_lpanel);		      //ñèíèé ïðÿìîóãîëüíèê - íàä äåâàéñàìè
178
	DrawBar(2,41,190,15,col_lpanel);		      //ñèíèé ïðÿìîóãîëüíèê - íàä äåâàéñàìè
173
	DrawBar(17,actions_y+75,160,15,col_lpanel); //ñèíèé ïðÿìîóãîëüíèê - ïîä äåâàéñàìè
179
	DrawBar(17,actions_y+75,160,15,col_lpanel); //ñèíèé ïðÿìîóãîëüíèê - ïîä äåâàéñàìè
174
	DrawBar(2,56,15,actions_y+103,col_lpanel);	          //ñèíèé ïðÿìîóãîëüíèê - ñëåâà       
180
	DrawBar(2,56,15,actions_y+103,col_lpanel);	          //ñèíèé ïðÿìîóãîëüíèê - ñëåâà       
175
	DrawBar(177,56,15,actions_y+103,col_lpanel);            //ñèíèé ïðÿìîóãîëüíèê - ñïðàâà
181
	DrawBar(177,56,15,actions_y+103,col_lpanel);            //ñèíèé ïðÿìîóãîëüíèê - ñïðàâà
176
	if (onTop(start_y, 6) < 268)
182
	if (onTop(start_y, 6) < 268)
177
		PutPaletteImage(#blue_hl, 190, onTop(start_y, 6), 2, start_y, 8, #blue_hl_pal);
183
		PutPaletteImage(#blue_hl, 190, onTop(start_y, 6), 2, start_y, 8, #blue_hl_pal);
178
	else
184
	else
179
	{
185
	{
180
		DrawBar(2,start_y,190,onTop(start_y,6+268),col_lpanel);
186
		DrawBar(2,start_y,190,onTop(start_y,6+268),col_lpanel);
181
		PutPaletteImage(#blue_hl, 190, 268, 2, onTop(268,6), 8, #blue_hl_pal);
187
		PutPaletteImage(#blue_hl, 190, 268, 2, onTop(268,6), 8, #blue_hl_pal);
182
	}
188
	}
183
}
189
}
184
 
190
 
185
 
191
 
186
void DrawLeftPanel()
192
void DrawLeftPanel()
187
{
193
{
188
	DrawSystemDiscs();
194
	DrawSystemDiscs();
189
	Actions();
195
	Actions();
190
	LeftPanelBackground();
196
	LeftPanelBackground();
191
}
197
}
192
>
198
>