Subversion Repositories Kolibri OS

Rev

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

Rev 5743 Rev 5753
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
	dword temp_file_count, tempbuf;
81
	dword temp_file_count, tempbuf;
82
 
82
 
83
	disc_num=0;
83
	disc_num=0;
84
	if (devbuf) free(devbuf);
84
	if (devbuf) free(devbuf);
85
	devbuf = malloc(10000); //áóôåð ãäå-òî íà 10 äåâàéñîâ â ëåâîé ïàíåëè
85
	devbuf = malloc(10000); //áóôåð ãäå-òî íà 10 äåâàéñîâ â ëåâîé ïàíåëè
86
	ReadDir(19, devbuf, "/");
86
	ReadDir(19, devbuf, "/");
87
	dev_num = EBX;
87
	dev_num = EBX;
88
	for (i1=0; i1
88
	for (i1=0; i1
89
	{
89
	{
90
		sprintf(#dev_name,"/%s/",i1*304+ devbuf+72);
90
		sprintf(#dev_name,"/%s/",i1*304+ devbuf+72);
91
		Open_Dir(#dev_name, ONLY_OPEN);
91
		Open_Dir(#dev_name, ONLY_OPEN);
92
		dev_disc_num = files.count;
92
		dev_disc_num = files.count;
93
		//if (files.count<=0) copystr(#dev_name,#disk_list[disc_num].Item); else
93
		//if (files.count<=0) copystr(#dev_name,#disk_list[disc_num].Item); else
94
		for (j1=0; j1
94
		for (j1=0; j1
95
		{
95
		{
96
			l=sprintf(#sys_discs,"%s%s/",#dev_name,j1*304+ buf+72);
96
			l=sprintf(#sys_discs,"%s%s/",#dev_name,j1*304+ buf+72);
97
			strncpy(#disk_list[disc_num].Item, #sys_discs,l);
97
			strncpy(#disk_list[disc_num].Item, #sys_discs,l);
98
			disc_num++;
98
			disc_num++;
99
		}
99
		}
100
		if (!strncmp(#sys_discs, "/rd/1/",6)) 
100
		if (!strncmp(#sys_discs, "/rd/1/",6)) 
101
		{
101
		{
102
			GetDir(#tempbuf, #temp_file_count, "/kolibrios/", DIRS_ONLYREAL);
102
			GetDir(#tempbuf, #temp_file_count, "/kolibrios/", DIRS_ONLYREAL);
103
			if (temp_file_count)
103
			if (temp_file_count)
104
			{
104
			{
105
				strncpy(#disk_list[disc_num].Item, "/kolibrios/",11);
105
				strncpy(#disk_list[disc_num].Item, "/kolibrios/",11);
106
				kolibrios_drive = true;
106
				kolibrios_drive = true;
107
				disc_num++;	
107
				disc_num++;	
108
			}
108
			}
109
			else kolibrios_drive = false;
109
			else kolibrios_drive = false;
110
			free(tempbuf);
110
			free(tempbuf);
111
		}
111
		}
112
	}
112
	}
113
}
113
}
114
 
114
 
115
 
115
 
116
void DrawSystemDiscs()
116
void DrawSystemDiscs()
117
{    
117
{    
118
	char dev_name[15], disc_name[100], i, dev_icon, is_active;
118
	char dev_name[15], disc_name[100], i, dev_icon, is_active, name_len;
119
	int pos_y, pos_x=2;
119
	int pos_y, pos_x=2;
120
	
120
	
121
	for (i=disc_num; i<30; i++) DeleteButton(100+i);
121
	for (i=disc_num; i<30; i++) DeleteButton(100+i);
122
	for (i=0;i
122
	for (i=0;i
123
	{
123
	{
124
		strcpy(#dev_name, #disk_list[i].Item);
124
		strcpy(#dev_name, #disk_list[i].Item);
125
		dev_name[strlen(#dev_name)-1]=NULL;
125
		dev_name[strlen(#dev_name)-1]=NULL;
126
		switch(dev_name[1])
126
		switch(dev_name[1])
127
		{
127
		{
128
			case 'k':
128
			case 'k':
129
				dev_icon=0;
129
				dev_icon=0;
130
				strcpy(#disc_name, T_PROG);
130
				strcpy(#disc_name, T_PROG);
131
				break;
131
				break;
132
			case 'r':
132
			case 'r':
133
				dev_icon=0;
133
				dev_icon=0;
134
				strcpy(#disc_name, T_SYS);
134
				strcpy(#disc_name, T_SYS);
135
				break;
135
				break;
136
			case 'c':
136
			case 'c':
137
				dev_icon=1;
137
				dev_icon=1;
138
				strcpy(#disc_name, T_CD);
138
				strcpy(#disc_name, T_CD);
139
				break;
139
				break;
140
			case 'f':
140
			case 'f':
141
				dev_icon=2;
141
				dev_icon=2;
142
				strcpy(#disc_name, T_FD);
142
				strcpy(#disc_name, T_FD);
143
				break;
143
				break;
144
			case 'h':
144
			case 'h':
145
			case 'b':
145
			case 'b':
146
				dev_icon=3;
146
				dev_icon=3;
147
				strcpy(#disc_name, T_HD);
147
				strcpy(#disc_name, T_HD);
148
				break;
148
				break;
149
			case 's':
149
			case 's':
150
				dev_icon=3;
150
				dev_icon=3;
151
				strcpy(#disc_name, T_SATA);
151
				strcpy(#disc_name, T_SATA);
152
				break;
152
				break;
153
			case 'u':
153
			case 'u':
154
				dev_icon=5;
154
				dev_icon=5;
155
				strcpy(#disc_name, T_USB);
155
				strcpy(#disc_name, T_USB);
156
				break;
156
				break;
157
			case 't':
157
			case 't':
158
				dev_icon=4;
158
				dev_icon=4;
159
				strcpy(#disc_name, T_RAM);
159
				strcpy(#disc_name, T_RAM);
160
				break;
160
				break;
161
			default:
161
			default:
162
				dev_icon=3;
162
				dev_icon=3;
163
				strcpy(#disc_name, T_UNC);				
163
				strcpy(#disc_name, T_UNC);				
164
		}
164
		}
165
		if (strstr(#path, #dev_name)) is_active=true; else is_active=false;
165
		if (strstr(#path, #dev_name)) is_active=true; else is_active=false;
166
		if (!two_panels)
166
		if (!two_panels)
167
		{
167
		{
168
			pos_y = i*16+74;
168
			pos_y = i*16+74;
169
			DrawBar(17,pos_y,6,17,0xFFFFFF);
169
			DrawBar(17,pos_y,6,17,0xFFFFFF);
170
			DrawBar(17+6+18,pos_y,160-6-18,17,0xFFFFFF);
170
			DrawBar(17+6+18,pos_y,160-6-18,17,0xFFFFFF);
171
			DefineButton(17,pos_y,159,16,100+i+BT_HIDE,0xFFFFFF);
171
			DefineButton(17,pos_y,159,16,100+i+BT_HIDE,0xFFFFFF);
172
			if (show_dev_name)
172
			if (show_dev_name)
173
			{
173
			{
174
				strcat(#disc_name, #dev_name);
174
				strcat(#disc_name, #dev_name);
175
				if (is_active) WriteText(46+1,pos_y+5,0x80,0x555555,#disc_name);
175
				if (is_active) WriteText(46+1,pos_y+5,0x80,0x555555,#disc_name);
176
				WriteText(46,pos_y+5,0x80,0,#disc_name);
176
				WriteText(46,pos_y+5,0x80,0,#disc_name);
177
			}
177
			}
178
			else
178
			else
179
			{
179
			{
180
				if (is_active) WriteText(46+1,pos_y+5,0x80,0x555555,#dev_name);
180
				if (is_active) WriteText(46+1,pos_y+5,0x80,0x555555,#dev_name);
181
				WriteText(46,pos_y+5,0x80,0,#dev_name);
181
				WriteText(46,pos_y+5,0x80,0,#dev_name);
182
			}
182
			}
183
			_PutImage(23,pos_y, 18,17, is_active*6+dev_icon*17*18*3+#devices);
183
			_PutImage(23,pos_y, 18,17, is_active*6+dev_icon*17*18*3+#devices);
184
		}
184
		}
185
		else
185
		else
186
		{
186
		{
187
			pos_y = 43;
187
			pos_y = 43;
-
 
188
			name_len = strlen(#dev_name)-1*8;
188
			DrawBar(pos_x, pos_y, strlen(#dev_name)*6 + 29, 17, 0xFFFFFF);
189
			DrawBar(pos_x, pos_y, name_len + 31, 17, 0xFFFFFF);
189
			DefineButton(pos_x+2, pos_y, strlen(#dev_name)*6 + 25, 16, 100+i+BT_HIDE,0xFFFFFF);
190
			DefineButton(pos_x+2, pos_y, name_len + 27, 16, 100+i+BT_HIDE,0xFFFFFF);
190
			_PutImage(pos_x + 5, pos_y, 18,17, is_active*6+dev_icon*17*18*3+#devices);
191
			_PutImage(pos_x + 5, pos_y, 18,17, is_active*6+dev_icon*17*18*3+#devices);
191
			WriteText(pos_x + 24, pos_y+5, 0x80, 0, #dev_name);
192
			WriteText(pos_x + 24, pos_y+1, 10110000b, 0, #dev_name+1);
192
			pos_x += strlen(#dev_name)*6 + 29;
193
			pos_x += name_len + 31;
193
		}
194
		}
194
	}
195
	}
195
	if (two_panels)
196
	if (two_panels)
196
	{
197
	{
197
		DrawBar(pos_x, pos_y, Form.cwidth - pos_x - 2, 17, 0xFFFFFF);
198
		DrawBar(pos_x, pos_y, Form.cwidth - pos_x - 2, 17, 0xFFFFFF);
198
		DrawBar(2, pos_y-2, Form.cwidth - 4, 2, 0xFFFFFF);
199
		DrawBar(2, pos_y-2, Form.cwidth - 4, 2, 0xFFFFFF);
199
		DrawBar(2, pos_y+17, Form.cwidth - 4, 2, 0xFFFFFF);
200
		DrawBar(2, pos_y+17, Form.cwidth - 4, 2, 0xFFFFFF);
200
		DefineButton(Form.cwidth - 23, pos_y, 17,16, 60+BT_HIDE, 0xCCCccc);
201
		DefineButton(Form.cwidth - 23, pos_y, 17,16, 60+BT_HIDE, 0xCCCccc);
201
		_PutImage(Form.cwidth - 21, pos_y+2, 14,13, 2*14*13*3+#factions);
202
		_PutImage(Form.cwidth - 21, pos_y+2, 14,13, 2*14*13*3+#factions);
202
	}
203
	}
203
}
204
}
204
 
205
 
205
 
206
 
206
void ActionsDraw()
207
void ActionsDraw()
207
{
208
{
208
	int actions_y=disc_num*16+108, lineh=16;
209
	int actions_y=disc_num*16+108, lineh=16;
209
	Tip(actions_y-18, T_ACTIONS, 77, ""); //çàãîëîâîê
210
	Tip(actions_y-18, T_ACTIONS, 77, ""); //çàãîëîâîê
210
	for (i=0; actions[i*3]!=0; i++, actions_y+=lineh)
211
	for (i=0; actions[i*3]!=0; i++, actions_y+=lineh)
211
	{
212
	{
212
		DrawBar(17,actions_y,160,lineh,0xFFFFFF); //áåëîå
213
		DrawBar(17,actions_y,160,lineh,0xFFFFFF); //áåëîå
213
		DefineButton(17,actions_y,159,lineh,actions[i*3]+BT_HIDE,0xE4DFE1);
214
		DefineButton(17,actions_y,159,lineh,actions[i*3]+BT_HIDE,0xE4DFE1);
214
		WriteText(45,actions_y+4,0x80,0,actions[i*3+1]);
215
		WriteText(45,actions_y+4,0x80,0,actions[i*3+1]);
215
		WriteText(-strlen(actions[i*3+2])*6+170,actions_y+4,0x80,0x999999,actions[i*3+2]);
216
		WriteText(-strlen(actions[i*3+2])*6+170,actions_y+4,0x80,0x999999,actions[i*3+2]);
216
		_PutImage(23,actions_y+2, 14,13, i*14*13*3+#factions);
217
		_PutImage(23,actions_y+2, 14,13, i*14*13*3+#factions);
217
	}
218
	}
218
}
219
}
219
 
220
 
220
 
221
 
221
void DrawLeftPanelBg()
222
void DrawLeftPanelBg()
222
{
223
{
223
	int actions_y=disc_num*16;
224
	int actions_y=disc_num*16;
224
	int start_y = actions_y+156;
225
	int start_y = actions_y+156;
225
	int onTop1;
226
	int onTop1;
226
	DrawBar(2,41,190,15,col_lpanel);		      //ñèíèé ïðÿìîóãîëüíèê - íàä äåâàéñàìè
227
	DrawBar(2,41,190,15,col_lpanel);		      //ñèíèé ïðÿìîóãîëüíèê - íàä äåâàéñàìè
227
	DrawBar(17,actions_y+75,160,15,col_lpanel); //ñèíèé ïðÿìîóãîëüíèê - ïîä äåâàéñàìè
228
	DrawBar(17,actions_y+75,160,15,col_lpanel); //ñèíèé ïðÿìîóãîëüíèê - ïîä äåâàéñàìè
228
	PutShadow(17,actions_y+75,160,1,1,3);
229
	PutShadow(17,actions_y+75,160,1,1,3);
229
	PutShadow(18,actions_y+75+1,158,1,1,1);
230
	PutShadow(18,actions_y+75+1,158,1,1,1);
230
	DrawBar(2,56,15,actions_y+103,col_lpanel);	          //ñèíèé ïðÿìîóãîëüíèê - ñëåâà       
231
	DrawBar(2,56,15,actions_y+103,col_lpanel);	          //ñèíèé ïðÿìîóãîëüíèê - ñëåâà       
231
	DrawBar(177,56,15,actions_y+103,col_lpanel);            //ñèíèé ïðÿìîóãîëüíèê - ñïðàâà
232
	DrawBar(177,56,15,actions_y+103,col_lpanel);            //ñèíèé ïðÿìîóãîëüíèê - ñïðàâà
232
	onTop1 = Form.cheight-start_y-2;
233
	onTop1 = Form.cheight-start_y-2;
233
	if (onTop1 < 268)
234
	if (onTop1 < 268)
234
	{
235
	{
235
		PutPaletteImage(#blue_hl, 190, onTop1, 2, start_y, 8, #blue_hl_pal);
236
		PutPaletteImage(#blue_hl, 190, onTop1, 2, start_y, 8, #blue_hl_pal);
236
	}
237
	}
237
	else
238
	else
238
	{
239
	{
239
		DrawBar(2,start_y,190, onTop1-268, col_lpanel);
240
		DrawBar(2,start_y,190, onTop1-268, col_lpanel);
240
		PutPaletteImage(#blue_hl, 190, 268, 2, Form.cheight-270, 8, #blue_hl_pal);
241
		PutPaletteImage(#blue_hl, 190, 268, 2, Form.cheight-270, 8, #blue_hl_pal);
241
	}
242
	}
242
	PutShadow(17,start_y,160,1,1,3);
243
	PutShadow(17,start_y,160,1,1,3);
243
	PutShadow(18,start_y+1,158,1,1,1);
244
	PutShadow(18,start_y+1,158,1,1,1);
244
}
245
}
245
 
246
 
246
 
247
 
247
void DrawDeviceAndActionsLeftPanel()
248
void DrawDeviceAndActionsLeftPanel()
248
{
249
{
249
	Tip(56, T_DEVICES, 55, "=");
250
	Tip(56, T_DEVICES, 55, "=");
250
	DrawSystemDiscs();
251
	DrawSystemDiscs();
251
	ActionsDraw();
252
	ActionsDraw();
252
	DrawLeftPanelBg();
253
	DrawLeftPanelBg();
253
}
254
}
254
 
255
 
255
 
256
 
256
void ClickOnDisk(char diskN)
257
void ClickOnDisk(char diskN)
257
{
258
{
258
	strcpy(#path, #disk_list[diskN].Item);
259
	strcpy(#path, #disk_list[diskN].Item);
259
	files.KeyHome();
260
	files.KeyHome();
260
	Open_Dir(#path,WITH_REDRAW);	
261
	Open_Dir(#path,WITH_REDRAW);	
261
}
262
}
262
>
263
>