Subversion Repositories Kolibri OS

Rev

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

Rev 7611 Rev 7634
1
#ifdef LANG_RUS
1
#ifdef LANG_RUS
2
	?define T_DEVICES "“áâனá⢠"
2
	?define T_DEVICES "“áâனá⢠"
3
	?define T_ACTIONS "„¥©á⢨ï"
3
	?define T_ACTIONS "„¥©á⢨ï"
4
	char *actions[] = {
4
	char *actions[] = {
5
		57, "®¢ë© ä ©«", "F7",
5
		57, "®¢ë© ä ©«", "F7",
6
		56, "®¢ ï ¯ ¯ª ", "F6",
6
		56, "®¢ ï ¯ ¯ª ", "F6",
7
		60, " áâனª¨", "F10",
7
		60, " áâனª¨", "F10",
8
		0,0,0
8
		0,0,0
9
	};
9
	};
10
	?define T_PROG "à®£à ¬¬ë "
10
	?define T_PROG "à®£à ¬¬ë "
11
	?define T_SYS  "‘¨á⥬  "
11
	?define T_SYS  "‘¨á⥬  "
12
	?define T_UNC  "¥¨§¢¥áâ­® "
12
	?define T_UNC  "¥¨§¢¥áâ­® "
13
	?define T_CD   "CD-ROM "
13
	?define T_CD   "CD-ROM "
14
	?define T_FD   "„¨áª¥â  "
14
	?define T_FD   "„¨áª¥â  "
15
	?define T_HD   "†¥á⪨© ¤¨áª "
15
	?define T_HD   "†¥á⪨© ¤¨áª "
16
	?define T_SATA "SATA ¤¨áª "
16
	?define T_SATA "SATA ¤¨áª "
17
	?define T_USB  "USB ¤¨áª "
17
	?define T_USB  "USB ¤¨áª "
18
	?define T_RAM  "RAM ¤¨áª "
18
	?define T_RAM  "RAM ¤¨áª "
19
#else
19
#else
20
	?define T_DEVICES "Devices"
20
	?define T_DEVICES "Devices"
21
	?define T_ACTIONS "Actions"
21
	?define T_ACTIONS "Actions"
22
	char *actions[] = {
22
	char *actions[] = {
23
		57, "New file", "F7",
23
		57, "New file", "F7",
24
		56, "New folder", "F6",
24
		56, "New folder", "F6",
25
		60, "Settings", "F10",
25
		60, "Settings", "F10",
26
		0,0,0
26
		0,0,0
27
	};
27
	};
28
	?define T_PROG "Programs "
28
	?define T_PROG "Programs "
29
	?define T_SYS  "System "
29
	?define T_SYS  "System "
30
	?define T_UNC  "Unknown "
30
	?define T_UNC  "Unknown "
31
	?define T_CD   "CD-ROM "
31
	?define T_CD   "CD-ROM "
32
	?define T_FD   "Floppy disk "
32
	?define T_FD   "Floppy disk "
33
	?define T_HD   "Hard disk "
33
	?define T_HD   "Hard disk "
34
	?define T_SATA "SATA disk "
34
	?define T_SATA "SATA disk "
35
	?define T_USB  "USB disk "
35
	?define T_USB  "USB disk "
36
	?define T_RAM  "RAM disk "
36
	?define T_RAM  "RAM disk "
37
#endif
37
#endif
38
 
38
 
39
struct _SystemDiscs
39
struct _SystemDiscs
40
{
40
{
41
	collection list;
41
	collection list;
42
	int dev_num;
42
	int dev_num;
43
	void Get();
43
	void Get();
44
	void Draw();
44
	void Draw();
45
	void Click();
45
	void Click();
46
} SystemDiscs;
46
} SystemDiscs;
47
 
47
 
48
 
48
 
49
void GetDiskIconAndName(char disk_first_letter, dword dev_icon, disc_name)
49
void GetDiskIconAndName(char disk_first_letter, dword dev_icon, disc_name)
50
{
50
{
51
	switch(disk_first_letter)
51
	switch(disk_first_letter)
52
	{
52
	{
53
		case 'k':
53
		case 'k':
54
			ESBYTE[dev_icon]=0;
54
			ESBYTE[dev_icon]=0;
55
			strcpy(disc_name, T_PROG);
55
			strcpy(disc_name, T_PROG);
56
			break;
56
			break;
57
		case 'r':
57
		case 'r':
58
			ESBYTE[dev_icon]=0;
58
			ESBYTE[dev_icon]=0;
59
			strcpy(disc_name, T_SYS);
59
			strcpy(disc_name, T_SYS);
60
			break;
60
			break;
61
		case 'c':
61
		case 'c':
62
			ESBYTE[dev_icon]=1;
62
			ESBYTE[dev_icon]=1;
63
			strcpy(disc_name, T_CD);
63
			strcpy(disc_name, T_CD);
64
			break;
64
			break;
65
		case 'f':
65
		case 'f':
66
			ESBYTE[dev_icon]=2;
66
			ESBYTE[dev_icon]=2;
67
			strcpy(disc_name, T_FD);
67
			strcpy(disc_name, T_FD);
68
			break;
68
			break;
69
		case 'h':
69
		case 'h':
70
		case 'b':
70
		case 'b':
71
			ESBYTE[dev_icon]=3;
71
			ESBYTE[dev_icon]=3;
72
			strcpy(disc_name, T_HD);
72
			strcpy(disc_name, T_HD);
73
			break;
73
			break;
74
		case 's':
74
		case 's':
75
			ESBYTE[dev_icon]=3;
75
			ESBYTE[dev_icon]=3;
76
			strcpy(disc_name, T_SATA);
76
			strcpy(disc_name, T_SATA);
77
			break;
77
			break;
78
		case 'u':
78
		case 'u':
79
			ESBYTE[dev_icon]=5;
79
			ESBYTE[dev_icon]=5;
80
			strcpy(disc_name, T_USB);
80
			strcpy(disc_name, T_USB);
81
			break;
81
			break;
82
		case 't':
82
		case 't':
83
			ESBYTE[dev_icon]=4;
83
			ESBYTE[dev_icon]=4;
84
			strcpy(disc_name, T_RAM);
84
			strcpy(disc_name, T_RAM);
85
			break;
85
			break;
86
		default:
86
		default:
87
			ESBYTE[dev_icon]=3;
87
			ESBYTE[dev_icon]=3;
88
			strcpy(disc_name, T_UNC);				
88
			strcpy(disc_name, T_UNC);				
89
	}
89
	}
90
}
90
}
91
 
91
 
92
void _SystemDiscs::Get()
92
void _SystemDiscs::Get()
93
{
93
{
94
	bool kolibrios_exists=false;
94
	bool kolibrios_exists=false;
95
	char dev_name[10], sys_discs[10];
95
	char dev_name[10], sys_discs[10];
96
	int i1, j1, dev_num_i, dev_disc_num;
96
	int i1, j1, dev_num_i, dev_disc_num;
97
	dword devbuf;
97
	dword devbuf;
98
 
98
 
99
	list.drop();
99
	list.drop();
100
	devbuf = malloc(10000);
100
	devbuf = malloc(10000);
101
	ReadDir(19, devbuf, "/");
101
	ReadDir(19, devbuf, "/");
102
	dev_num = dev_num_i = EBX;
102
	dev_num = dev_num_i = EBX;
103
	for (i1=0; i1
103
	for (i1=0; i1
104
	{
104
	{
105
		sprintf(#dev_name,"/%s",i1*304+ devbuf+72);
105
		sprintf(#dev_name,"/%s",i1*304+ devbuf+72);
106
		Open_Dir(#dev_name, ONLY_OPEN);
106
		Open_Dir(#dev_name, ONLY_OPEN);
107
		dev_disc_num = files.count;
107
		dev_disc_num = files.count;
108
		for (j1=0; j1
108
		for (j1=0; j1
109
		{
109
		{
110
			sprintf(#sys_discs,"%s/%s",#dev_name,j1*304+ buf+72);
110
			sprintf(#sys_discs,"%s/%s",#dev_name,j1*304+ buf+72);
111
			list.add(#sys_discs);
111
			list.add(#sys_discs);
112
		}
112
		}
113
		if (!strcmp(#sys_discs, "/rd/1")) 
113
		if (!strcmp(#sys_discs, "/rd/1")) 
114
		{
114
		{
115
			if (dir_exists("/kolibrios")) && (!kolibrios_exists) {
115
			if (dir_exists("/kolibrios")) && (!kolibrios_exists) {
116
				kolibrios_exists=true;
116
				kolibrios_exists=true;
117
				list.add("/kolibrios");
117
				list.add("/kolibrios");
118
				dev_num++;
118
				dev_num++;
119
			}
119
			}
120
		}
120
		}
121
	}
121
	}
122
	free(devbuf);
122
	free(devbuf);
123
}
123
}
124
 
124
 
125
void _SystemDiscs::Draw()
125
void _SystemDiscs::Draw()
126
{    
126
{    
127
	char dev_name[15], disc_name[100], i, dev_icon, is_active, name_len;
127
	char dev_name[15], disc_name[100], i, dev_icon, is_active, name_len;
128
	int draw_y, draw_x, draw_h;
128
	int draw_y, draw_x, draw_h;
129
	
129
	
130
	for (i=0; i<30; i++) DeleteButton(100+i);
130
	for (i=0; i<30; i++) DeleteButton(100+i);
131
 
131
 
132
	if ( two_panels.checked) { draw_y = 41; draw_x =  2; draw_h = 21; }
132
	if ( two_panels.checked) { draw_y = 41; draw_x =  2; draw_h = 21; }
133
	if (!two_panels.checked) { draw_y = 74; draw_x = 17; draw_h = 16; }
133
	if (!two_panels.checked) { draw_y = 74; draw_x = 17; draw_h = 16; }
134
 
134
 
135
	for (i=0;i
135
	for (i=0;i
136
	{
136
	{
137
		strcpy(#dev_name, list.get(i));
137
		strcpy(#dev_name, list.get(i));
138
		GetDiskIconAndName(dev_name[1], #dev_icon, #disc_name);
138
		GetDiskIconAndName(dev_name[1], #dev_icon, #disc_name);
139
		if (strstr(#path, #dev_name)-#path==0) is_active=true; else is_active=false;
139
		if (strstr(#path, #dev_name)-#path==0) is_active=true; else is_active=false;
140
		if (two_panels.checked)
140
		if (two_panels.checked)
141
		{
141
		{
142
			name_len = strlen(#dev_name)-1*8;
142
			name_len = strlen(#dev_name)-1*8;
143
			DrawBar(draw_x, draw_y, name_len + 31, draw_h, 0xFFFFFF);
143
			DrawBar(draw_x, draw_y, name_len + 31, draw_h, 0xFFFFFF);
144
			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);
145
			_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);
146
			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);
147
			draw_x += name_len + 31;
147
			draw_x += name_len + 31;
148
			if (draw_x>=Form.cwidth-100) && (Form.cwidth) {
148
			if (draw_x>=Form.cwidth-100) && (Form.cwidth) {
149
				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);
150
				draw_x = 2;
150
				draw_x = 2;
151
				draw_y += draw_h;
151
				draw_y += draw_h;
152
			}
152
			}
153
		}
153
		}
154
		else
154
		else
155
		{
155
		{
156
			DrawBar(draw_x,draw_y,6,draw_h+1,0xFFFFFF);
156
			DrawBar(draw_x,draw_y,6,draw_h+1,0xFFFFFF);
157
			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);
158
			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);
159
			if (show_dev_name.checked)
159
			if (show_dev_name.checked)
160
			{
160
			{
161
				strcat(#disc_name, #dev_name);
161
				strcat(#disc_name, #dev_name);
162
				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);
163
				WriteText(draw_x+29,draw_y+5,0x80,0,#disc_name);			}
163
				WriteText(draw_x+29,draw_y+5,0x80,0,#disc_name);			}
164
			else
164
			else
165
			{
165
			{
166
				if (is_active) WriteText(draw_x+30,draw_y+5,0x80,0x555555,#dev_name);
166
				if (is_active) WriteText(draw_x+30,draw_y+5,0x80,0x555555,#dev_name);
167
				WriteText(draw_x+29,draw_y+5,0x80,0,#dev_name);
167
				WriteText(draw_x+29,draw_y+5,0x80,0,#dev_name);
168
			}
168
			}
169
			_PutImage(draw_x+6,draw_y, 18,17, is_active*6+dev_icon*17*18*3+#devices);
169
			_PutImage(draw_x+6,draw_y, 18,17, is_active*6+dev_icon*17*18*3+#devices);
170
			draw_y += draw_h;
170
			draw_y += draw_h;
171
		}
171
		}
172
	}
172
	}
173
	if (two_panels.checked)
173
	if (two_panels.checked)
174
	{
174
	{
175
		DrawBar(draw_x, draw_y, Form.cwidth - draw_x - 2, draw_h, 0xFFFFFF);
175
		DrawBar(draw_x, draw_y, Form.cwidth - draw_x - 2, draw_h, 0xFFFFFF);
176
		DefineButton(Form.cwidth - 23, draw_y+2, 17,16, 60+BT_HIDE, 0xCCCccc);
176
		DefineButton(Form.cwidth - 23, draw_y+2, 17,16, 60+BT_HIDE, 0xCCCccc);
177
		_PutImage(Form.cwidth - 21, draw_y+4, 14,13, 2*14*13*3+#factions);
177
		_PutImage(Form.cwidth - 21, draw_y+4, 14,13, 2*14*13*3+#factions);
178
		files.y = draw_y + draw_h + 17;
178
		files.y = draw_y + draw_h + 17;
179
	}
179
	}
180
}
180
}
181
 
181
 
182
void _SystemDiscs::Click(int n)
182
void _SystemDiscs::Click(int n)
183
{
183
{
184
	strcpy(#path, list.get(n));
184
	strcpy(#path, list.get(n));
185
	files.KeyHome();
185
	files.KeyHome();
186
	Open_Dir(#path,WITH_REDRAW);	
186
	Open_Dir(#path,WITH_REDRAW);	
187
}
187
}
188
 
188
 
189
 
189
 
190
 
190
 
191
void DrawDeviceAndActionsLeftPanel()
191
void DrawDeviceAndActionsLeftPanel()
192
{
192
{
193
	Tip(56, T_DEVICES, 55, "=");
193
	Tip(56, T_DEVICES, 55, "=");
194
	SystemDiscs.Draw();
194
	SystemDiscs.Draw();
195
	ActionsDraw();
195
	ActionsDraw();
196
	DrawLeftPanelBg();
196
	DrawLeftPanelBg();
197
}
197
}
198
 
198
 
199
dword col_palette_inner[14] = {0xD2D3D3,0xD4D4D4,0xD6D5D6,0xD8D7D8,0xDAD8D9,0xDCDADB,
199
dword col_palette_inner[14] = {0xD2D3D3,0xD4D4D4,0xD6D5D6,0xD8D7D8,0xDAD8D9,0xDCDADB,
200
	0xDFDCDD,0xE1DDDE,0xE2DEE0,0xE4DFE1,0xE3DFE1,0xE3DFE1,0xE3DFE1,0xE3DFE1,0xE3DFE1};
200
	0xDFDCDD,0xE1DDDE,0xE2DEE0,0xE4DFE1,0xE3DFE1,0xE3DFE1,0xE3DFE1,0xE3DFE1,0xE3DFE1};
201
void DrawFilledBarInner(dword x, y, w, h)
201
void DrawFilledBarInner(dword x, y, w, h)
202
{
202
{
203
	int i, fill_h;
203
	int i, fill_h;
204
	if (h <= 14) fill_h = h; else fill_h = 14;
204
	if (h <= 14) fill_h = h; else fill_h = 14;
205
	for (i=0; i
205
	for (i=0; i
206
	DrawBar(x, y+i, w, h-fill_h, col_palette_inner[14-i]);
206
	DrawBar(x, y+i, w, h-fill_h, col_palette_inner[14-i]);
207
}
207
}
208
 
208
 
209
void Tip(int y, dword caption, id, arrow)
209
void Tip(int y, dword caption, id, arrow)
210
{
210
{
211
	DrawBar(17,y,160,1,0xEFEDEE);
211
	DrawBar(17,y,160,1,0xEFEDEE);
212
	DrawFilledBarInner(17, y+1, 160, 16);
212
	DrawFilledBarInner(17, y+1, 160, 16);
213
	WriteText(25,y+5,0x80,0x000000,caption);
213
	WriteText(25,y+5,0x80,0x000000,caption);
214
	if (id) DefineButton(159,y+1,16,16,id+BT_HIDE+BT_NOFRAME,0); //arrow button
214
	if (id) DefineButton(159,y+1,16,16,id+BT_HIDE+BT_NOFRAME,0); //arrow button
215
	WriteText(165,y+5,0x80,0x000000,arrow); //arrow
215
	WriteText(165,y+5,0x80,0x000000,arrow); //arrow
216
	DrawBar(17,y+17,160,1,0x7E87A3);
216
	DrawBar(17,y+17,160,1,0x7E87A3);
217
}
217
}
218
 
218
 
219
void ActionsDraw()
219
void ActionsDraw()
220
{
220
{
221
	int i;
221
	int i;
222
	int actions_y= SystemDiscs.list.count*16+108, lineh=16;
222
	int actions_y= SystemDiscs.list.count*16+108, lineh=16;
223
	Tip(actions_y-18, T_ACTIONS, 77, ""); //çàãîëîâîê
223
	Tip(actions_y-18, T_ACTIONS, 77, ""); //çàãîëîâîê
224
	for (i=0; actions[i*3]!=0; i++, actions_y+=lineh)
224
	for (i=0; actions[i*3]!=0; i++, actions_y+=lineh)
225
	{
225
	{
226
		DrawBar(17,actions_y,160,lineh,0xFFFFFF); //áåëîå
226
		DrawBar(17,actions_y,160,lineh,0xFFFFFF); //áåëîå
227
		DefineButton(17,actions_y,159,lineh,actions[i*3]+BT_HIDE,0xE4DFE1);
227
		DefineButton(17,actions_y,159,lineh,actions[i*3]+BT_HIDE,0xE4DFE1);
228
		WriteText(45,actions_y+4,0x80,0,actions[i*3+1]);
228
		WriteText(45,actions_y+4,0x80,0,actions[i*3+1]);
229
		WriteText(-strlen(actions[i*3+2])*6+170,actions_y+4,0x80,0x999999,actions[i*3+2]);
229
		WriteText(-strlen(actions[i*3+2])*6+170,actions_y+4,0x80,0x999999,actions[i*3+2]);
230
		_PutImage(23,actions_y+2, 14,13, i*14*13*3+#factions);
230
		_PutImage(23,actions_y+2, 14,13, i*14*13*3+#factions);
231
	}
231
	}
232
}
232
}
233
 
233
 
234
void DrawLeftPanelBg()
234
void DrawLeftPanelBg()
235
{
235
{
236
	int actions_y = SystemDiscs.list.count*16;
236
	int actions_y = SystemDiscs.list.count*16;
237
	int start_y = actions_y+156;
237
	int start_y = actions_y+156;
238
	int area_h;
238
	int area_h;
239
	DrawBar(2,41,190,15,col_lpanel);		      //ñèíèé ïðÿìîóãîëüíèê - íàä äåâàéñàìè
239
	DrawBar(2,41,190,15,col.lpanel);		      //ñèíèé ïðÿìîóãîëüíèê - íàä äåâàéñàìè
240
	DrawBar(17,actions_y+75,160,15,col_lpanel); //ñèíèé ïðÿìîóãîëüíèê - ïîä äåâàéñàìè
240
	DrawBar(17,actions_y+75,160,15,col.lpanel); //ñèíèé ïðÿìîóãîëüíèê - ïîä äåâàéñàìè
241
	PutShadow(17,actions_y+75,160,1,1,3);
241
	PutShadow(17,actions_y+75,160,1,1,3);
242
	PutShadow(18,actions_y+75+1,158,1,1,1);
242
	PutShadow(18,actions_y+75+1,158,1,1,1);
243
	DrawBar(2,56,15,actions_y+103,col_lpanel);	          //ñèíèé ïðÿìîóãîëüíèê - ñëåâà       
243
	DrawBar(2,56,15,actions_y+103,col.lpanel);	          //ñèíèé ïðÿìîóãîëüíèê - ñëåâà       
244
	DrawBar(177,56,15,actions_y+103,col_lpanel);            //ñèíèé ïðÿìîóãîëüíèê - ñïðàâà
244
	DrawBar(177,56,15,actions_y+103,col.lpanel);            //ñèíèé ïðÿìîóãîëüíèê - ñïðàâà
245
	area_h = Form.cheight-start_y-2 - status_bar_h;
245
	area_h = Form.cheight-start_y-2 - status_bar_h;
246
	if (area_h < 268)
246
	if (col.lpanel == 0x00699C) 
247
	{
247
	{
248
		PutPaletteImage(#blue_hl, 190, area_h, 2, start_y, 8, #blue_hl_pal);
248
		if (area_h < 268){
-
 
249
			PutPaletteImage(#blue_hl, 190, area_h, 2, start_y, 8, #blue_hl_pal);
249
	}
250
		} else {
250
	else
-
 
251
	{
251
			DrawBar(2,start_y,190, area_h-268, col.lpanel);
252
		DrawBar(2,start_y,190, area_h-268, col_lpanel);
-
 
253
		PutPaletteImage(#blue_hl, 190, 268, 2, Form.cheight-270-status_bar_h, 8, #blue_hl_pal);
252
			PutPaletteImage(#blue_hl, 190, 268, 2, Form.cheight-270-status_bar_h, 8, #blue_hl_pal);
254
	}
253
		}
255
	PutShadow(17,start_y,160,1,1,3);
254
	}
-
 
255
	else {
-
 
256
		DrawBar(2,start_y,190, area_h, col.lpanel);
-
 
257
	}
-
 
258
	PutShadow(17,start_y,160,1,1,3);
256
	PutShadow(18,start_y+1,158,1,1,1);
259
	PutShadow(18,start_y+1,158,1,1,1);
257
}
260
}
258
>
261
>