Subversion Repositories Kolibri OS

Rev

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

Rev 6034 Rev 6049
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
#else
21
#else
22
	?define T_DEVICES "Devices"
22
	?define T_DEVICES "Devices"
23
	?define T_ACTIONS "Actions"
23
	?define T_ACTIONS "Actions"
24
	char *actions[] = {
24
	char *actions[] = {
25
		57, "New file", "F7",
25
		57, "New file", "F7",
26
		56, "New folder", "F6",
26
		56, "New folder", "F6",
27
		60, "Settings", "F10",
27
		60, "Settings", "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
#endif
39
#endif
40
 
40
 
41
struct _SystemDiscs
41
struct _SystemDiscs
42
{
42
{
43
	collection list;
43
	collection list;
44
	void Get();
44
	void Get();
45
	void Draw();
45
	void Draw();
46
	void Click();
46
	void Click();
47
} SystemDiscs;
47
} SystemDiscs;
48
 
48
 
49
 
49
 
50
void GetDiskIconAndName(char disk_first_letter, dword dev_icon, disc_name)
50
void GetDiskIconAndName(char disk_first_letter, dword dev_icon, disc_name)
51
{
51
{
52
	switch(disk_first_letter)
52
	switch(disk_first_letter)
53
	{
53
	{
54
		case 'k':
54
		case 'k':
55
			ESBYTE[dev_icon]=0;
55
			ESBYTE[dev_icon]=0;
56
			strcpy(disc_name, T_PROG);
56
			strcpy(disc_name, T_PROG);
57
			break;
57
			break;
58
		case 'r':
58
		case 'r':
59
			ESBYTE[dev_icon]=0;
59
			ESBYTE[dev_icon]=0;
60
			strcpy(disc_name, T_SYS);
60
			strcpy(disc_name, T_SYS);
61
			break;
61
			break;
62
		case 'c':
62
		case 'c':
63
			ESBYTE[dev_icon]=1;
63
			ESBYTE[dev_icon]=1;
64
			strcpy(disc_name, T_CD);
64
			strcpy(disc_name, T_CD);
65
			break;
65
			break;
66
		case 'f':
66
		case 'f':
67
			ESBYTE[dev_icon]=2;
67
			ESBYTE[dev_icon]=2;
68
			strcpy(disc_name, T_FD);
68
			strcpy(disc_name, T_FD);
69
			break;
69
			break;
70
		case 'h':
70
		case 'h':
71
		case 'b':
71
		case 'b':
72
			ESBYTE[dev_icon]=3;
72
			ESBYTE[dev_icon]=3;
73
			strcpy(disc_name, T_HD);
73
			strcpy(disc_name, T_HD);
74
			break;
74
			break;
75
		case 's':
75
		case 's':
76
			ESBYTE[dev_icon]=3;
76
			ESBYTE[dev_icon]=3;
77
			strcpy(disc_name, T_SATA);
77
			strcpy(disc_name, T_SATA);
78
			break;
78
			break;
79
		case 'u':
79
		case 'u':
80
			ESBYTE[dev_icon]=5;
80
			ESBYTE[dev_icon]=5;
81
			strcpy(disc_name, T_USB);
81
			strcpy(disc_name, T_USB);
82
			break;
82
			break;
83
		case 't':
83
		case 't':
84
			ESBYTE[dev_icon]=4;
84
			ESBYTE[dev_icon]=4;
85
			strcpy(disc_name, T_RAM);
85
			strcpy(disc_name, T_RAM);
86
			break;
86
			break;
87
		default:
87
		default:
88
			ESBYTE[dev_icon]=3;
88
			ESBYTE[dev_icon]=3;
89
			strcpy(disc_name, T_UNC);				
89
			strcpy(disc_name, T_UNC);				
90
	}
90
	}
91
}
91
}
92
 
92
 
93
void _SystemDiscs::Get()
93
void _SystemDiscs::Get()
94
{
94
{
95
	char dev_name[10], sys_discs[10];
95
	char dev_name[10], sys_discs[10];
96
	int i1, j1, dev_num, dev_disc_num;
96
	int i1, j1, dev_num, dev_disc_num;
97
	dword temp_file_count, tempbuf;
97
	dword temp_file_count, tempbuf;
98
	dword devbuf;
98
	dword devbuf;
99
 
99
 
100
	list.drop();
100
	list.drop();
101
	devbuf = malloc(10000);
101
	devbuf = malloc(10000);
102
	ReadDir(19, devbuf, "/");
102
	ReadDir(19, devbuf, "/");
103
	dev_num = EBX;
103
	dev_num = EBX;
104
	for (i1=0; i1
104
	for (i1=0; i1
105
	{
105
	{
106
		sprintf(#dev_name,"/%s/",i1*304+ devbuf+72);
106
		sprintf(#dev_name,"/%s/",i1*304+ devbuf+72);
107
		Open_Dir(#dev_name, ONLY_OPEN);
107
		Open_Dir(#dev_name, ONLY_OPEN);
108
		dev_disc_num = files.count;
108
		dev_disc_num = files.count;
109
		for (j1=0; j1
109
		for (j1=0; j1
110
		{
110
		{
111
			sprintf(#sys_discs,"%s%s/",#dev_name,j1*304+ buf+72);
111
			sprintf(#sys_discs,"%s%s/",#dev_name,j1*304+ buf+72);
112
			list.add(#sys_discs);
112
			list.add(#sys_discs);
113
		}
113
		}
114
		if (!strcmp(#sys_discs, "/rd/1/")) 
114
		if (!strcmp(#sys_discs, "/rd/1/")) 
115
		{
115
		{
116
			GetDir(#tempbuf, #temp_file_count, "/kolibrios/", DIRS_ONLYREAL);
116
			GetDir(#tempbuf, #temp_file_count, "/kolibrios/", DIRS_ONLYREAL);
117
			if (temp_file_count) list.add("/kolibrios/");
117
			if (temp_file_count) list.add("/kolibrios/");
118
			free(tempbuf);
118
			free(tempbuf);
119
		}
119
		}
120
		else if (!strcmp(#sys_discs, "/fd/1/")) CMD_ENABLE_SAVE_IMG = true;
-
 
121
	}
120
	}
122
	free(devbuf);
121
	free(devbuf);
123
}
122
}
124
 
123
 
125
void _SystemDiscs::Draw()
124
void _SystemDiscs::Draw()
126
{    
125
{    
127
	char dev_name[15], disc_name[100], i, dev_icon, is_active, name_len;
126
	char dev_name[15], disc_name[100], i, dev_icon, is_active, name_len;
128
	int draw_y, draw_x, draw_h;
127
	int draw_y, draw_x, draw_h;
129
	
128
	
130
	for (i=0; i<30; i++) DeleteButton(100+i);
129
	for (i=0; i<30; i++) DeleteButton(100+i);
131
 
130
 
132
	if ( two_panels) { draw_y = 41; draw_x =  2; draw_h = 21; }
131
	if ( two_panels) { draw_y = 41; draw_x =  2; draw_h = 21; }
133
	if (!two_panels) { draw_y = 74; draw_x = 17; draw_h = 16; }
132
	if (!two_panels) { draw_y = 74; draw_x = 17; draw_h = 16; }
134
 
133
 
135
	for (i=0;i
134
	for (i=0;i
136
	{
135
	{
137
		strcpy(#dev_name, list.get(i));
136
		strcpy(#dev_name, list.get(i));
138
		dev_name[strlen(#dev_name)-1]=NULL;
137
		dev_name[strlen(#dev_name)-1]=NULL;
139
		GetDiskIconAndName(dev_name[1], #dev_icon, #disc_name);
138
		GetDiskIconAndName(dev_name[1], #dev_icon, #disc_name);
140
		if (strstr(#path, #dev_name)) is_active=true; else is_active=false;
139
		if (strstr(#path, #dev_name)) is_active=true; else is_active=false;
141
		if (two_panels)
140
		if (two_panels)
142
		{
141
		{
143
			name_len = strlen(#dev_name)-1*8;
142
			name_len = strlen(#dev_name)-1*8;
144
			DrawBar(draw_x, draw_y, name_len + 31, draw_h, 0xFFFFFF);
143
			DrawBar(draw_x, draw_y, name_len + 31, draw_h, 0xFFFFFF);
145
			DefineButton(draw_x+2, draw_y, name_len + 27, draw_h-1, 100+i+BT_HIDE,0xFFFFFF);
144
			DefineButton(draw_x+2, draw_y, name_len + 27, draw_h-1, 100+i+BT_HIDE,0xFFFFFF);
146
			_PutImage(draw_x + 5, draw_y+2, 18,17, is_active*6+dev_icon*17*18*3+#devices);
145
			_PutImage(draw_x + 5, draw_y+2, 18,17, is_active*6+dev_icon*17*18*3+#devices);
147
			WriteText(draw_x + 24, draw_y+3, 10110000b, 0, #dev_name+1);
146
			WriteText(draw_x + 24, draw_y+3, 10110000b, 0, #dev_name+1);
148
			draw_x += name_len + 31;
147
			draw_x += name_len + 31;
149
			if (draw_x>=Form.width-35) && (Form.width) {
148
			if (draw_x>=Form.width-35) && (Form.width) {
150
				DrawBar(draw_x, draw_y, Form.cwidth - draw_x - 2, draw_h, 0xFFFFFF);
149
				DrawBar(draw_x, draw_y, Form.cwidth - draw_x - 2, draw_h, 0xFFFFFF);
151
				draw_x = 2;
150
				draw_x = 2;
152
				draw_y += draw_h;
151
				draw_y += draw_h;
153
			}
152
			}
154
		}
153
		}
155
		else
154
		else
156
		{
155
		{
157
			DrawBar(draw_x,draw_y,6,draw_h+1,0xFFFFFF);
156
			DrawBar(draw_x,draw_y,6,draw_h+1,0xFFFFFF);
158
			DrawBar(draw_x+6+18,draw_y,160-6-18,draw_h+1,0xFFFFFF);
157
			DrawBar(draw_x+6+18,draw_y,160-6-18,draw_h+1,0xFFFFFF);
159
			DefineButton(draw_x,draw_y,159,16,100+i+BT_HIDE,0xFFFFFF);
158
			DefineButton(draw_x,draw_y,159,16,100+i+BT_HIDE,0xFFFFFF);
160
			if (show_dev_name)
159
			if (show_dev_name)
161
			{
160
			{
162
				strcat(#disc_name, #dev_name);
161
				strcat(#disc_name, #dev_name);
163
				if (is_active) WriteText(draw_x+30,draw_y+5,0x80,0x555555,#disc_name);
162
				if (is_active) WriteText(draw_x+30,draw_y+5,0x80,0x555555,#disc_name);
164
				WriteText(draw_x+29,draw_y+5,0x80,0,#disc_name);
163
				WriteText(draw_x+29,draw_y+5,0x80,0,#disc_name);
165
			}
164
			}
166
			else
165
			else
167
			{
166
			{
168
				if (is_active) WriteText(draw_x+30,draw_y+5,0x80,0x555555,#dev_name);
167
				if (is_active) WriteText(draw_x+30,draw_y+5,0x80,0x555555,#dev_name);
169
				WriteText(draw_x+29,draw_y+5,0x80,0,#dev_name);
168
				WriteText(draw_x+29,draw_y+5,0x80,0,#dev_name);
170
			}
169
			}
171
			_PutImage(draw_x+6,draw_y, 18,17, is_active*6+dev_icon*17*18*3+#devices);
170
			_PutImage(draw_x+6,draw_y, 18,17, is_active*6+dev_icon*17*18*3+#devices);
172
			draw_y += draw_h;
171
			draw_y += draw_h;
173
		}
172
		}
174
	}
173
	}
175
	if (two_panels)
174
	if (two_panels)
176
	{
175
	{
177
		DrawBar(draw_x, draw_y, Form.cwidth - draw_x - 2, draw_h, 0xFFFFFF);
176
		DrawBar(draw_x, draw_y, Form.cwidth - draw_x - 2, draw_h, 0xFFFFFF);
178
		DefineButton(Form.cwidth - 23, draw_y+2, 17,16, 60+BT_HIDE, 0xCCCccc);
177
		DefineButton(Form.cwidth - 23, draw_y+2, 17,16, 60+BT_HIDE, 0xCCCccc);
179
		_PutImage(Form.cwidth - 21, draw_y+4, 14,13, 2*14*13*3+#factions);
178
		_PutImage(Form.cwidth - 21, draw_y+4, 14,13, 2*14*13*3+#factions);
180
		files.y = draw_y + draw_h + 17;
179
		files.y = draw_y + draw_h + 17;
181
	}
180
	}
182
}
181
}
183
 
182
 
184
void _SystemDiscs::Click(int n)
183
void _SystemDiscs::Click(int n)
185
{
184
{
186
	strcpy(#path, list.get(n));
185
	strcpy(#path, list.get(n));
187
	files.KeyHome();
186
	files.KeyHome();
188
	Open_Dir(#path,WITH_REDRAW);	
187
	Open_Dir(#path,WITH_REDRAW);	
189
}
188
}
190
 
189
 
191
 
190
 
192
 
191
 
193
void DrawDeviceAndActionsLeftPanel()
192
void DrawDeviceAndActionsLeftPanel()
194
{
193
{
195
	Tip(56, T_DEVICES, 55, "=");
194
	Tip(56, T_DEVICES, 55, "=");
196
	SystemDiscs.Draw();
195
	SystemDiscs.Draw();
197
	ActionsDraw();
196
	ActionsDraw();
198
	DrawLeftPanelBg();
197
	DrawLeftPanelBg();
199
}
198
}
200
 
199
 
201
void Tip(int y, dword caption, id, arrow)
200
void Tip(int y, dword caption, id, arrow)
202
{
201
{
203
	DrawBar(17,y,160,1,0xEFEDEE);
202
	DrawBar(17,y,160,1,0xEFEDEE);
204
	DrawFilledBar(17, y+1, 160, 16);
203
	DrawFilledBar(17, y+1, 160, 16);
205
	WriteText(25,y+5,0x80,system.color.work_text,caption);
204
	WriteText(25,y+5,0x80,system.color.work_text,caption);
206
	if (id) DefineButton(159,y+1,16,16,id+BT_HIDE+BT_NOFRAME,0); //arrow button
205
	if (id) DefineButton(159,y+1,16,16,id+BT_HIDE+BT_NOFRAME,0); //arrow button
207
	WriteText(165,y+5,0x80,system.color.work_text,arrow); //arrow
206
	WriteText(165,y+5,0x80,system.color.work_text,arrow); //arrow
208
	DrawBar(17,y+17,160,1,system.color.work_graph);
207
	DrawBar(17,y+17,160,1,system.color.work_graph);
209
}
208
}
210
 
209
 
211
void ActionsDraw()
210
void ActionsDraw()
212
{
211
{
213
	int actions_y= SystemDiscs.list.count*16+108, lineh=16;
212
	int actions_y= SystemDiscs.list.count*16+108, lineh=16;
214
	Tip(actions_y-18, T_ACTIONS, 77, ""); //çàãîëîâîê
213
	Tip(actions_y-18, T_ACTIONS, 77, ""); //çàãîëîâîê
215
	for (i=0; actions[i*3]!=0; i++, actions_y+=lineh)
214
	for (i=0; actions[i*3]!=0; i++, actions_y+=lineh)
216
	{
215
	{
217
		DrawBar(17,actions_y,160,lineh,0xFFFFFF); //áåëîå
216
		DrawBar(17,actions_y,160,lineh,0xFFFFFF); //áåëîå
218
		DefineButton(17,actions_y,159,lineh,actions[i*3]+BT_HIDE,0xE4DFE1);
217
		DefineButton(17,actions_y,159,lineh,actions[i*3]+BT_HIDE,0xE4DFE1);
219
		WriteText(45,actions_y+4,0x80,0,actions[i*3+1]);
218
		WriteText(45,actions_y+4,0x80,0,actions[i*3+1]);
220
		WriteText(-strlen(actions[i*3+2])*6+170,actions_y+4,0x80,0x999999,actions[i*3+2]);
219
		WriteText(-strlen(actions[i*3+2])*6+170,actions_y+4,0x80,0x999999,actions[i*3+2]);
221
		_PutImage(23,actions_y+2, 14,13, i*14*13*3+#factions);
220
		_PutImage(23,actions_y+2, 14,13, i*14*13*3+#factions);
222
	}
221
	}
223
}
222
}
224
 
223
 
225
void DrawLeftPanelBg()
224
void DrawLeftPanelBg()
226
{
225
{
227
	int actions_y = SystemDiscs.list.count*16;
226
	int actions_y = SystemDiscs.list.count*16;
228
	int start_y = actions_y+156;
227
	int start_y = actions_y+156;
229
	int onTop1;
228
	int onTop1;
230
	DrawBar(2,41,190,15,col_lpanel);		      //ñèíèé ïðÿìîóãîëüíèê - íàä äåâàéñàìè
229
	DrawBar(2,41,190,15,col_lpanel);		      //ñèíèé ïðÿìîóãîëüíèê - íàä äåâàéñàìè
231
	DrawBar(17,actions_y+75,160,15,col_lpanel); //ñèíèé ïðÿìîóãîëüíèê - ïîä äåâàéñàìè
230
	DrawBar(17,actions_y+75,160,15,col_lpanel); //ñèíèé ïðÿìîóãîëüíèê - ïîä äåâàéñàìè
232
	PutShadow(17,actions_y+75,160,1,1,3);
231
	PutShadow(17,actions_y+75,160,1,1,3);
233
	PutShadow(18,actions_y+75+1,158,1,1,1);
232
	PutShadow(18,actions_y+75+1,158,1,1,1);
234
	DrawBar(2,56,15,actions_y+103,col_lpanel);	          //ñèíèé ïðÿìîóãîëüíèê - ñëåâà       
233
	DrawBar(2,56,15,actions_y+103,col_lpanel);	          //ñèíèé ïðÿìîóãîëüíèê - ñëåâà       
235
	DrawBar(177,56,15,actions_y+103,col_lpanel);            //ñèíèé ïðÿìîóãîëüíèê - ñïðàâà
234
	DrawBar(177,56,15,actions_y+103,col_lpanel);            //ñèíèé ïðÿìîóãîëüíèê - ñïðàâà
236
	onTop1 = Form.cheight-start_y-2;
235
	onTop1 = Form.cheight-start_y-2;
237
	if (onTop1 < 268)
236
	if (onTop1 < 268)
238
	{
237
	{
239
		PutPaletteImage(#blue_hl, 190, onTop1, 2, start_y, 8, #blue_hl_pal);
238
		PutPaletteImage(#blue_hl, 190, onTop1, 2, start_y, 8, #blue_hl_pal);
240
	}
239
	}
241
	else
240
	else
242
	{
241
	{
243
		DrawBar(2,start_y,190, onTop1-268, col_lpanel);
242
		DrawBar(2,start_y,190, onTop1-268, col_lpanel);
244
		PutPaletteImage(#blue_hl, 190, 268, 2, Form.cheight-270, 8, #blue_hl_pal);
243
		PutPaletteImage(#blue_hl, 190, 268, 2, Form.cheight-270, 8, #blue_hl_pal);
245
	}
244
	}
246
	PutShadow(17,start_y,160,1,1,3);
245
	PutShadow(17,start_y,160,1,1,3);
247
	PutShadow(18,start_y+1,158,1,1,1);
246
	PutShadow(18,start_y+1,158,1,1,1);
248
}
247
}
249
>
248
>