Subversion Repositories Kolibri OS

Rev

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

Rev 5674 Rev 5698
1
//Leency 2008-2013
1
//Leency 2008-2013
2
 
2
 
3
#ifdef LANG_RUS
3
#ifdef LANG_RUS
4
	?define T_DEVICES "“áâனá⢠"
4
	?define T_DEVICES "“áâனá⢠"
5
	?define T_ACTIONS "„¥©á⢨ï"
5
	?define T_ACTIONS "„¥©á⢨ï"
6
	char *actions[] = {
6
	char *actions[] = {
7
		57, "®¢ë© ä ©«", "F7",
7
		57, "®¢ë© ä ©«", "F7",
8
		56, "®¢ ï ¯ ¯ª ", "F6",
8
		56, "®¢ ï ¯ ¯ª ", "F6",
9
		60, " áâனª¨", "F10",
9
		60, " áâனª¨", "F10",
10
		0,0,0
10
		0,0,0
11
	};
11
	};
12
	?define T_PROG "à®£à ¬¬ë "
12
	?define T_PROG "à®£à ¬¬ë "
13
	?define T_SYS  "‘¨á⥬  "
13
	?define T_SYS  "‘¨á⥬  "
14
	?define T_UNC  "¥¨§¢¥áâ­® "
14
	?define T_UNC  "¥¨§¢¥áâ­® "
15
	?define T_CD   "CD-ROM "
15
	?define T_CD   "CD-ROM "
16
	?define T_FD   "„¨áª¥â  "
16
	?define T_FD   "„¨áª¥â  "
17
	?define T_HD   "†¥á⪨© ¤¨áª "
17
	?define T_HD   "†¥á⪨© ¤¨áª "
18
	?define T_SATA "SATA ¤¨áª "
18
	?define T_SATA "SATA ¤¨áª "
19
	?define T_USB  "USB ¤¨áª "
19
	?define T_USB  "USB ¤¨áª "
20
	?define T_RAM  "RAM ¤¨áª "
20
	?define T_RAM  "RAM ¤¨áª "
21
#elif LANG_EST
21
#elif LANG_EST
22
	?define T_DEVICES "Seadmed"
22
	?define T_DEVICES "Seadmed"
23
	?define T_ACTIONS "Toimingud"
23
	?define T_ACTIONS "Toimingud"
24
	char *actions[] = {
24
	char *actions[] = {
25
		57, "Uus fail", "F7",
25
		57, "Uus fail", "F7",
26
		56, "Uus kataloog", "F6",
26
		56, "Uus kataloog", "F6",
27
		60, "Seaded", "F10",
27
		60, "Seaded", "F10",
28
		0,0,0
28
		0,0,0
29
	};
29
	};
30
	?define T_PROG "Programs "
30
	?define T_PROG "Programs "
31
	?define T_SYS  "System "
31
	?define T_SYS  "System "
32
	?define T_UNC  "Unknown "
32
	?define T_UNC  "Unknown "
33
	?define T_CD   "CD-ROM "
33
	?define T_CD   "CD-ROM "
34
	?define T_FD   "Floppy disk "
34
	?define T_FD   "Floppy disk "
35
	?define T_HD   "Hard disk "
35
	?define T_HD   "Hard disk "
36
	?define T_SATA "SATA disk"
36
	?define T_SATA "SATA disk"
37
	?define T_USB  "USB disk"
37
	?define T_USB  "USB disk"
38
	?define T_RAM  "RAM disk"
38
	?define T_RAM  "RAM disk"
39
#else
39
#else
40
	?define T_DEVICES "Devices"
40
	?define T_DEVICES "Devices"
41
	?define T_ACTIONS "Actions"
41
	?define T_ACTIONS "Actions"
42
	char *actions[] = {
42
	char *actions[] = {
43
		57, "New file", "F7",
43
		57, "New file", "F7",
44
		56, "New folder", "F6",
44
		56, "New folder", "F6",
45
		60, "Settings", "F10",
45
		60, "Settings", "F10",
46
		0,0,0
46
		0,0,0
47
	};
47
	};
48
	?define T_PROG "Programs "
48
	?define T_PROG "Programs "
49
	?define T_SYS  "System "
49
	?define T_SYS  "System "
50
	?define T_UNC  "Unknown "
50
	?define T_UNC  "Unknown "
51
	?define T_CD   "CD-ROM "
51
	?define T_CD   "CD-ROM "
52
	?define T_FD   "Floppy disk "
52
	?define T_FD   "Floppy disk "
53
	?define T_HD   "Hard disk "
53
	?define T_HD   "Hard disk "
54
	?define T_SATA "SATA disk"
54
	?define T_SATA "SATA disk"
55
	?define T_USB  "USB disk"
55
	?define T_USB  "USB disk"
56
	?define T_RAM  "RAM disk"
56
	?define T_RAM  "RAM disk"
57
#endif
57
#endif
58
 
58
 
59
 
59
 
60
void Tip(int y, dword caption, id, arrow)
60
void Tip(int y, dword caption, id, arrow)
61
{
61
{
62
	int i;
62
	int i;
63
	DrawBar(17,y,160,1,0xEFEDEE);
63
	DrawBar(17,y,160,1,0xEFEDEE);
64
	DrawFilledBar(17, y+1, 160, 16);
64
	DrawFilledBar(17, y+1, 160, 16);
65
	WriteText(25,y+5,0x80,system.color.work_text,caption);
65
	WriteText(25,y+5,0x80,system.color.work_text,caption);
66
	if (id) DefineButton(159,y+1,16,16,id+BT_HIDE+BT_NOFRAME,0); //arrow button
66
	if (id) DefineButton(159,y+1,16,16,id+BT_HIDE+BT_NOFRAME,0); //arrow button
67
	WriteText(165,y+5,0x80,system.color.work_text,arrow); //arrow
67
	WriteText(165,y+5,0x80,system.color.work_text,arrow); //arrow
68
	DrawBar(17,y+17,160,1,system.color.work_graph);
68
	DrawBar(17,y+17,160,1,system.color.work_graph);
69
}
69
}
70
 
70
 
71
 
71
 
72
path_string disk_list[30];
72
path_string disk_list[30];
73
int disc_num;
73
int disc_num;
74
dword devbuf;
74
dword devbuf;
75
 
75
 
76
 
76
 
77
void GetSystemDiscs()
77
void GetSystemDiscs()
78
{
78
{
79
	char dev_name[10], sys_discs[10];
79
	char dev_name[10], sys_discs[10];
80
	int i1, j1, dev_num, dev_disc_num,l;
80
	int i1, j1, dev_num, dev_disc_num,l;
81
	disc_num=0;
81
	disc_num=0;
82
	if (devbuf) free(devbuf);
82
	if (devbuf) free(devbuf);
83
	devbuf = malloc(10000); //áóôåð ãäå-òî íà 10 äåâàéñîâ â ëåâîé ïàíåëè
83
	devbuf = malloc(10000); //áóôåð ãäå-òî íà 10 äåâàéñîâ â ëåâîé ïàíåëè
84
	ReadDir(19, devbuf, "/");
84
	ReadDir(19, devbuf, "/");
85
	dev_num = EBX;
85
	dev_num = EBX;
86
	for (i1=0; i1
86
	for (i1=0; i1
87
	{
87
	{
88
		sprintf(#dev_name,"/%s/",i1*304+ devbuf+72);
88
		sprintf(#dev_name,"/%s/",i1*304+ devbuf+72);
89
		Open_Dir(#dev_name, ONLY_OPEN);
89
		Open_Dir(#dev_name, ONLY_OPEN);
90
		dev_disc_num = files.count;
90
		dev_disc_num = files.count;
91
		//if (files.count<=0) copystr(#dev_name,#disk_list[disc_num].Item); else
91
		//if (files.count<=0) copystr(#dev_name,#disk_list[disc_num].Item); else
92
		for (j1=0; j1
92
		for (j1=0; j1
93
		{
93
		{
94
			l=sprintf(#sys_discs,"%s%s/",#dev_name,j1*304+ buf+72);
94
			l=sprintf(#sys_discs,"%s%s/",#dev_name,j1*304+ buf+72);
95
			strncpy(#disk_list[disc_num].Item, #sys_discs,l);
95
			strncpy(#disk_list[disc_num].Item, #sys_discs,l);
96
			disc_num++;
96
			disc_num++;
97
		}
97
		}
98
		if (!strncmp(#sys_discs, "/rd/1/",6)) 
98
		if (!strncmp(#sys_discs, "/rd/1/",6)) 
99
		{
99
		{
100
			if (isdir("/kolibrios"))
100
			if (isdir("/kolibrios"))
101
			{
101
			{
102
				strncpy(#disk_list[disc_num].Item, "/kolibrios/",11);
102
				strncpy(#disk_list[disc_num].Item, "/kolibrios/",11);
103
				kolibrios_drive = true;
103
				kolibrios_drive = true;
104
				disc_num++;	
104
				disc_num++;	
105
			}
105
			}
106
			else kolibrios_drive = false;
106
			else kolibrios_drive = false;
107
		}
107
		}
108
	}
108
	}
109
}
109
}
110
 
110
 
111
 
111
 
112
void DrawSystemDiscs()
112
void DrawSystemDiscs()
113
{    
113
{    
114
	char dev_name[15], disc_name[100], i, dev_icon, is_active;
114
	char dev_name[15], disc_name[100], i, dev_icon, is_active;
115
	int pos_y;
115
	int pos_y, pos_x;
116
	
116
	
117
	for (i=disc_num; i<30; i++) DeleteButton(100+i);
117
	for (i=disc_num; i<30; i++) DeleteButton(100+i);
118
	for (i=0;i
118
	for (i=0;i
119
	{
119
	{
120
		pos_y = i*16+74;
-
 
121
		DrawBar(17,pos_y,6,17,0xFFFFFF);
-
 
122
		DrawBar(17+6+18,pos_y,160-6-18,17,0xFFFFFF);
-
 
123
		DefineButton(17,pos_y,159,16,100+i+BT_HIDE,0xFFFFFF);
-
 
124
		strcpy(#dev_name, #disk_list[i].Item);
120
		strcpy(#dev_name, #disk_list[i].Item);
125
		dev_name[strlen(#dev_name)-1]=NULL;
121
		dev_name[strlen(#dev_name)-1]=NULL;
126
		switch(dev_name[1])
122
		switch(dev_name[1])
127
		{
123
		{
128
			case 'k':
124
			case 'k':
129
				dev_icon=0;
125
				dev_icon=0;
130
				strcpy(#disc_name, T_PROG);
126
				strcpy(#disc_name, T_PROG);
131
				break;
127
				break;
132
			case 'r':
128
			case 'r':
133
				dev_icon=0;
129
				dev_icon=0;
134
				strcpy(#disc_name, T_SYS);
130
				strcpy(#disc_name, T_SYS);
135
				break;
131
				break;
136
			case 'c':
132
			case 'c':
137
				dev_icon=1;
133
				dev_icon=1;
138
				strcpy(#disc_name, T_CD);
134
				strcpy(#disc_name, T_CD);
139
				break;
135
				break;
140
			case 'f':
136
			case 'f':
141
				dev_icon=2;
137
				dev_icon=2;
142
				strcpy(#disc_name, T_FD);
138
				strcpy(#disc_name, T_FD);
143
				break;
139
				break;
144
			case 'h':
140
			case 'h':
145
			case 'b':
141
			case 'b':
146
				dev_icon=3;
142
				dev_icon=3;
147
				strcpy(#disc_name, T_HD);
143
				strcpy(#disc_name, T_HD);
148
				break;
144
				break;
149
			case 's':
145
			case 's':
150
				dev_icon=3;
146
				dev_icon=3;
151
				strcpy(#disc_name, T_SATA);
147
				strcpy(#disc_name, T_SATA);
152
				break;
148
				break;
153
			case 'u':
149
			case 'u':
154
				dev_icon=5;
150
				dev_icon=5;
155
				strcpy(#disc_name, T_USB);
151
				strcpy(#disc_name, T_USB);
156
				break;
152
				break;
157
			case 't':
153
			case 't':
158
				dev_icon=4;
154
				dev_icon=4;
159
				strcpy(#disc_name, T_RAM);
155
				strcpy(#disc_name, T_RAM);
160
				break;
156
				break;
161
			default:
157
			default:
162
				dev_icon=3; //ïî-óìîë÷àíèþ óñòðîéñòâî âûãëÿäèò êàê æåñòÿê íî ýòî íåïðàâèëüíî
158
				dev_icon=3;
163
				strcpy(#disc_name, T_UNC);				
159
				strcpy(#disc_name, T_UNC);				
164
		}
160
		}
165
		if (strstr(#path, #dev_name)) is_active=true; else is_active=false;
161
		if (strstr(#path, #dev_name)) is_active=true; else is_active=false;
-
 
162
		if (!two_panels)
-
 
163
		{
-
 
164
			pos_y = i*16+74;
-
 
165
			DrawBar(17,pos_y,6,17,0xFFFFFF);
-
 
166
			DrawBar(17+6+18,pos_y,160-6-18,17,0xFFFFFF);
-
 
167
			DefineButton(17,pos_y,159,16,100+i+BT_HIDE,0xFFFFFF);
166
		if (show_dev_name)
168
			if (show_dev_name)
167
		{
169
			{
168
			strcat(#disc_name, #dev_name);
170
				strcat(#disc_name, #dev_name);
169
			if (is_active) WriteText(46+1,pos_y+5,0x80,0x555555,#disc_name);
171
				if (is_active) WriteText(46+1,pos_y+5,0x80,0x555555,#disc_name);
170
			WriteText(46,pos_y+5,0x80,0,#disc_name);
172
				WriteText(46,pos_y+5,0x80,0,#disc_name);
171
		}
173
			}
172
		else
174
			else
173
		{
175
			{
174
			if (is_active) WriteText(46+1,pos_y+5,0x80,0x555555,#dev_name);
176
				if (is_active) WriteText(46+1,pos_y+5,0x80,0x555555,#dev_name);
175
			WriteText(46,pos_y+5,0x80,0,#dev_name);
177
				WriteText(46,pos_y+5,0x80,0,#dev_name);
176
		}
178
			}
177
		_PutImage(23,pos_y, 18,17, is_active*6+dev_icon*17*18*3+#devices);
179
			_PutImage(23,pos_y, 18,17, is_active*6+dev_icon*17*18*3+#devices);
178
	}
180
		}
-
 
181
		else
-
 
182
		{
-
 
183
			pos_y = 41;
-
 
184
			pos_x = i*80 + files.x;
-
 
185
			DrawBar(pos_x, pos_y, 80, 17, 0xFFFFFF);
-
 
186
			DefineButton(pos_x, pos_y, 79, 16, 100+i+BT_HIDE,0xFFFFFF);
-
 
187
			_PutImage(pos_x + 5, pos_y, 18,17, is_active*6+dev_icon*17*18*3+#devices);
-
 
188
			WriteText(pos_x + 24, pos_y+5, 0x80, 0, #dev_name);
-
 
189
		}
179
}
190
	}
-
 
191
	if (two_panels) DrawBar(pos_x + 80, pos_y, files.x + files.w - pos_x - 80 + 17, 17, system.color.work);
-
 
192
}
-
 
193
 
180
 
194
 
181
void ActionsDraw()
195
void ActionsDraw()
182
{
196
{
183
	int actions_y=disc_num*16+108, lineh=16;
197
	int actions_y=disc_num*16+108, lineh=16;
184
	Tip(actions_y-18, T_ACTIONS, 77, ""); //çàãîëîâîê
198
	Tip(actions_y-18, T_ACTIONS, 77, ""); //çàãîëîâîê
185
	for (i=0; actions[i*3]!=0; i++, actions_y+=lineh)
199
	for (i=0; actions[i*3]!=0; i++, actions_y+=lineh)
186
	{
200
	{
187
		DrawBar(17,actions_y,160,lineh,0xFFFFFF); //áåëîå
201
		DrawBar(17,actions_y,160,lineh,0xFFFFFF); //áåëîå
188
		DefineButton(17,actions_y,159,lineh,actions[i*3]+BT_HIDE,0xE4DFE1);
202
		DefineButton(17,actions_y,159,lineh,actions[i*3]+BT_HIDE,0xE4DFE1);
189
		WriteText(45,actions_y+4,0x80,0,actions[i*3+1]);
203
		WriteText(45,actions_y+4,0x80,0,actions[i*3+1]);
190
		WriteText(-strlen(actions[i*3+2])*6+170,actions_y+4,0x80,0x999999,actions[i*3+2]);
204
		WriteText(-strlen(actions[i*3+2])*6+170,actions_y+4,0x80,0x999999,actions[i*3+2]);
191
		_PutImage(23,actions_y+2, 14,13, i*14*13*3+#factions);
205
		_PutImage(23,actions_y+2, 14,13, i*14*13*3+#factions);
192
	}
206
	}
193
}
207
}
194
 
208
 
195
 
209
 
196
void DrawLeftPanelBg()
210
void DrawLeftPanelBg()
197
{
211
{
198
	int actions_y=disc_num*16;
212
	int actions_y=disc_num*16;
199
	int start_y = actions_y+156;
213
	int start_y = actions_y+156;
200
	DrawBar(2,41,190,15,col_lpanel);		      //ñèíèé ïðÿìîóãîëüíèê - íàä äåâàéñàìè
214
	DrawBar(2,41,190,15,col_lpanel);		      //ñèíèé ïðÿìîóãîëüíèê - íàä äåâàéñàìè
201
	DrawBar(17,actions_y+75,160,15,col_lpanel); //ñèíèé ïðÿìîóãîëüíèê - ïîä äåâàéñàìè
215
	DrawBar(17,actions_y+75,160,15,col_lpanel); //ñèíèé ïðÿìîóãîëüíèê - ïîä äåâàéñàìè
202
	PutShadow(17,actions_y+75,160,1,1,3);
216
	PutShadow(17,actions_y+75,160,1,1,3);
203
	PutShadow(18,actions_y+75+1,158,1,1,1);
217
	PutShadow(18,actions_y+75+1,158,1,1,1);
204
	DrawBar(2,56,15,actions_y+103,col_lpanel);	          //ñèíèé ïðÿìîóãîëüíèê - ñëåâà       
218
	DrawBar(2,56,15,actions_y+103,col_lpanel);	          //ñèíèé ïðÿìîóãîëüíèê - ñëåâà       
205
	DrawBar(177,56,15,actions_y+103,col_lpanel);            //ñèíèé ïðÿìîóãîëüíèê - ñïðàâà
219
	DrawBar(177,56,15,actions_y+103,col_lpanel);            //ñèíèé ïðÿìîóãîëüíèê - ñïðàâà
206
	if (onTop(start_y, 6) < 268)
220
	if (onTop(start_y, 6) < 268)
207
		PutPaletteImage(#blue_hl, 190, onTop(start_y, 6), 2, start_y, 8, #blue_hl_pal);
221
		PutPaletteImage(#blue_hl, 190, onTop(start_y, 6), 2, start_y, 8, #blue_hl_pal);
208
	else
222
	else
209
	{
223
	{
210
		DrawBar(2,start_y,190,onTop(start_y,6+268),col_lpanel);
224
		DrawBar(2,start_y,190,onTop(start_y,6+268),col_lpanel);
211
		PutPaletteImage(#blue_hl, 190, 268, 2, onTop(268,6), 8, #blue_hl_pal);
225
		PutPaletteImage(#blue_hl, 190, 268, 2, onTop(268,6), 8, #blue_hl_pal);
212
	}
226
	}
213
	PutShadow(17,start_y,160,1,1,3);
227
	PutShadow(17,start_y,160,1,1,3);
214
	PutShadow(18,start_y+1,158,1,1,1);
228
	PutShadow(18,start_y+1,158,1,1,1);
215
}
229
}
216
 
230
 
217
 
231
 
218
void DrawLeftPanel()
232
void DrawLeftPanel()
219
{
233
{
220
	Tip(56, T_DEVICES, 55, "=");
234
	Tip(56, T_DEVICES, 55, "=");
221
	DrawSystemDiscs();
235
	DrawSystemDiscs();
222
	ActionsDraw();
236
	ActionsDraw();
223
	DrawLeftPanelBg();
237
	DrawLeftPanelBg();
224
}
238
}
-
 
239
 
-
 
240
 
-
 
241
void ClickOnDisk(char diskN)
-
 
242
{
-
 
243
	strcpy(#path, #disk_list[diskN].Item);
-
 
244
	files.KeyHome();
-
 
245
	Open_Dir(#path,WITH_REDRAW);	
-
 
246
}
225
>
247
>