Subversion Repositories Kolibri OS

Rev

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

Rev 7989 Rev 7991
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=0;
46
} SystemDiscs=0;
47
 
47
 
48
#define DEV_H 17
48
#define DEV_H 17
49
#define DEV_H_HOR 21
49
#define DEV_H_HOR 21
50
 
50
 
51
void GetDiskIconAndName(char disk_first_letter, dword dev_icon, disc_name)
51
void GetDiskIconAndName(char disk_first_letter, dword dev_icon, disc_name)
52
{
52
{
53
	switch(disk_first_letter)
53
	switch(disk_first_letter)
54
	{
54
	{
55
		case 'r':
55
		case 'r':
56
			ESBYTE[dev_icon]=0;
56
			ESBYTE[dev_icon]=0;
57
			strcpy(disc_name, T_SYS);
57
			strcpy(disc_name, T_SYS);
58
			break;
58
			break;
59
		case 'k':
59
		case 'k':
60
			ESBYTE[dev_icon]=1;
60
			ESBYTE[dev_icon]=1;
61
			strcpy(disc_name, T_PROG);
61
			strcpy(disc_name, T_PROG);
62
			break;
62
			break;
63
		case 'f':
63
		case 'f':
64
			ESBYTE[dev_icon]=2;
64
			ESBYTE[dev_icon]=2;
65
			strcpy(disc_name, T_FD);
65
			strcpy(disc_name, T_FD);
66
			break;
66
			break;
67
		case 'c':
67
		case 'c':
68
			ESBYTE[dev_icon]=3;
68
			ESBYTE[dev_icon]=3;
69
			strcpy(disc_name, T_CD);
69
			strcpy(disc_name, T_CD);
70
			break;
70
			break;
71
		case 'h':
71
		case 'h':
72
		case 'b':
72
		case 'b':
73
			ESBYTE[dev_icon]=4;
73
			ESBYTE[dev_icon]=4;
74
			strcpy(disc_name, T_HD);
74
			strcpy(disc_name, T_HD);
75
			break;
75
			break;
76
		case 's':
76
		case 's':
77
			ESBYTE[dev_icon]=4;
77
			ESBYTE[dev_icon]=4;
78
			strcpy(disc_name, T_SATA);
78
			strcpy(disc_name, T_SATA);
79
			break;
79
			break;
80
		case 't':
80
		case 't':
81
			ESBYTE[dev_icon]=5;
81
			ESBYTE[dev_icon]=5;
82
			strcpy(disc_name, T_RAM);
82
			strcpy(disc_name, T_RAM);
83
			break;
83
			break;
84
		case 'u':
84
		case 'u':
85
			ESBYTE[dev_icon]=6;
85
			ESBYTE[dev_icon]=6;
86
			strcpy(disc_name, T_USB);
86
			strcpy(disc_name, T_USB);
87
			break;
87
			break;
88
		default:
88
		default:
89
			ESBYTE[dev_icon]=5;
89
			ESBYTE[dev_icon]=5;
90
	}
90
	}
91
}
91
}
92
 
92
 
93
void _SystemDiscs::Get()
93
void _SystemDiscs::Get()
94
{
94
{
95
	bool kolibrios_exists=false;
95
	bool kolibrios_exists=false;
96
	char dev_name[10], sys_discs[10];
96
	char dev_name[10], sys_discs[10];
97
	int i1, j1, dev_num_i, dev_disc_num;
97
	int i1, j1, dev_num_i, dev_disc_num;
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 = dev_num_i = EBX;
103
	dev_num = dev_num_i = 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
			if (dir_exists(#sys_discs)) list.add(#sys_discs);
113
		}
113
		}
114
		if (!strcmp(#sys_discs, "/rd/1")) 
114
		if (!strcmp(#sys_discs, "/rd/1")) 
115
		{
115
		{
116
			if (dir_exists("/kolibrios")) && (!kolibrios_exists) {
116
			if (dir_exists("/kolibrios")) && (!kolibrios_exists) {
117
				kolibrios_exists=true;
117
				kolibrios_exists=true;
118
				list.add("/kolibrios");
118
				list.add("/kolibrios");
119
				dev_num++;
119
				dev_num++;
120
			}
120
			}
121
		}
121
		}
122
	}
122
	}
123
	free(devbuf);
123
	free(devbuf);
124
}
124
}
125
 
125
 
126
void _SystemDiscs::Draw()
126
void _SystemDiscs::Draw()
127
{    
127
{    
128
	char dev_name[15], disc_name[100], i, dev_icon, is_active, name_len;
128
	char dev_name[15], disc_name[100], i, dev_icon, is_active, name_len;
129
	int draw_y, draw_x;
129
	int draw_y, draw_x;
130
	
130
	
131
	for (i=0; i<30; i++) DeleteButton(100+i);
131
	for (i=0; i<30; i++) DeleteButton(100+i);
132
 
132
 
133
	if ( two_panels.checked) { draw_y = 41; draw_x =  2; }
133
	if ( two_panels.checked) { draw_y = 41; draw_x =  2; }
134
	if (!two_panels.checked) { draw_y = 74; draw_x = 17; }
134
	if (!two_panels.checked) { draw_y = 74; draw_x = 17; }
135
 
135
 
136
	for (i=0;i
136
	for (i=0;i
137
	{
137
	{
138
		strcpy(#dev_name, list.get(i));
138
		strcpy(#dev_name, list.get(i));
139
		GetDiskIconAndName(dev_name[1], #dev_icon, #disc_name);
139
		GetDiskIconAndName(dev_name[1], #dev_icon, #disc_name);
140
		if (strstr(#path, #dev_name)-#path==0) is_active=true; else is_active=false;
140
		if (strstr(#path, #dev_name)-#path==0) is_active=true; else is_active=false;
141
		if (two_panels.checked)
141
		if (two_panels.checked)
142
		{
142
		{
143
			name_len = strlen(#dev_name)-1*8;
143
			name_len = strlen(#dev_name)-1*8;
144
			DrawBar(draw_x, draw_y, name_len + 31, DEV_H_HOR, 0xFFFFFF);
144
			DrawBar(draw_x, draw_y, name_len + 31, DEV_H_HOR, 0xFFFFFF);
145
			DefineButton(draw_x+2, draw_y, name_len + 27, DEV_H_HOR-1, 100+i+BT_HIDE,0xFFFFFF);
145
			DefineButton(draw_x+2, draw_y, name_len + 27, DEV_H_HOR-1, 100+i+BT_HIDE,0xFFFFFF);
146
			_PutImage(draw_x + 5, draw_y+2, 18,17, is_active*7+dev_icon*17*18*3+#devices);
146
			_PutImage(draw_x + 5, draw_y+2, 18,17, is_active*7+dev_icon*17*18*3+#devices);
147
			WriteText(draw_x + 24, draw_y+3, 10110000b, 0, #dev_name+1);
147
			WriteText(draw_x + 24, draw_y+3, 10110000b, 0, #dev_name+1);
148
			draw_x += name_len + 31;
148
			draw_x += name_len + 31;
149
			if (draw_x>=Form.cwidth-100) && (Form.cwidth) {
149
			if (draw_x>=Form.cwidth-100) && (Form.cwidth) {
150
				DrawBar(draw_x, draw_y, Form.cwidth - draw_x - 2, DEV_H_HOR, 0xFFFFFF);
150
				DrawBar(draw_x, draw_y, Form.cwidth - draw_x - 2, DEV_H_HOR, 0xFFFFFF);
151
				draw_x = 2;
151
				draw_x = 2;
152
				draw_y += DEV_H_HOR;
152
				draw_y += DEV_H_HOR;
153
			}
153
			}
154
		}
154
		}
155
		else
155
		else
156
		{
156
		{
157
			DrawBar(draw_x,draw_y,6,DEV_H+1,0xFFFFFF);
157
			DrawBar(draw_x,draw_y,6,DEV_H+1,0xFFFFFF);
158
			DrawBar(draw_x+6+18,draw_y,160-6-18,DEV_H+1,0xFFFFFF);
158
			DrawBar(draw_x+6+18,draw_y,160-6-18,DEV_H+1,0xFFFFFF);
159
			DefineButton(draw_x,draw_y,159,16,100+i+BT_HIDE,0xFFFFFF);
159
			DefineButton(draw_x,draw_y,159,16,100+i+BT_HIDE,0xFFFFFF);
160
			if (show_dev_name.checked)
160
			if (show_dev_name.checked)
161
			{
161
			{
162
				strcat(#disc_name, #dev_name);
162
				strcat(#disc_name, #dev_name);
163
				if (is_active) WriteText(draw_x+30,draw_y+5,0x80,0x555555,#disc_name);
163
				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);
164
				WriteText(draw_x+29,draw_y+5,0x80,0,#disc_name);
165
			} else {
165
			} else {
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*7+dev_icon*17*18*3+#devices);
169
			_PutImage(draw_x+6,draw_y, 18,17, is_active*7+dev_icon*17*18*3+#devices);
170
			draw_y += DEV_H;
170
			draw_y += DEV_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, DEV_H_HOR, 0xFFFFFF);
175
		DrawBar(draw_x, draw_y, Form.cwidth - draw_x - 2, DEV_H_HOR, 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 + DEV_H_HOR + 17;
178
		files.y = draw_y + DEV_H_HOR + 17;
179
	} else {
179
	} else {
180
		DrawBar(draw_x+6, draw_y, 18, 1, 0xFFFfff);
180
		DrawBar(draw_x+6, draw_y, 18, 1, 0xFFFfff);
181
	}
181
	}
182
}
182
}
183
 
183
 
184
void _SystemDiscs::Click(int n)
184
void _SystemDiscs::Click(int n)
185
{
185
{
186
	strcpy(#path, list.get(n));
186
	strcpy(#path, list.get(n));
187
	files.KeyHome();
187
	files.KeyHome();
188
	Open_Dir(#path,WITH_REDRAW);	
188
	Open_Dir(#path,WITH_REDRAW);	
189
}
189
}
190
 
190
 
191
 
191
 
192
 
192
 
193
void DrawDeviceAndActionsLeftPanel()
193
void DrawDeviceAndActionsLeftPanel()
194
{
194
{
195
	Tip(56, T_DEVICES, 55, "=");
195
	Tip(56, T_DEVICES, 55, "=");
196
	SystemDiscs.Draw();
196
	SystemDiscs.Draw();
197
	ActionsDraw();
197
	ActionsDraw();
198
	DrawLeftPanelBg();
198
	DrawLeftPanelBg();
199
}
199
}
200
 
200
 
201
dword col_palette_inner[14] = {0xD2D3D3,0xD4D4D4,0xD6D5D6,0xD8D7D8,0xDAD8D9,0xDCDADB,
201
dword col_palette_inner[14] = {0xD2D3D3,0xD4D4D4,0xD6D5D6,0xD8D7D8,0xDAD8D9,0xDCDADB,
202
	0xDFDCDD,0xE1DDDE,0xE2DEE0,0xE4DFE1,0xE3DFE1,0xE3DFE1,0xE3DFE1,0xE3DFE1,0xE3DFE1};
202
	0xDFDCDD,0xE1DDDE,0xE2DEE0,0xE4DFE1,0xE3DFE1,0xE3DFE1,0xE3DFE1,0xE3DFE1,0xE3DFE1};
203
void DrawFilledBarInner(dword x, y, w, h)
203
void DrawFilledBarInner(dword x, y, w, h)
204
{
204
{
205
	int i, fill_h;
205
	int i, fill_h;
206
	if (h <= 14) fill_h = h; else fill_h = 14;
206
	if (h <= 14) fill_h = h; else fill_h = 14;
207
	for (i=0; i
207
	for (i=0; i
208
	DrawBar(x, y+i, w, h-fill_h, col_palette_inner[14-i]);
208
	DrawBar(x, y+i, w, h-fill_h, col_palette_inner[14-i]);
209
}
209
}
210
 
210
 
211
void Tip(int y, dword caption, id, arrow)
211
void Tip(int y, dword caption, id, arrow)
212
{
212
{
213
	if (col.def) {
213
	if (col.def) {
214
		DrawBar(17,y,160,1,0xEFEDEE);
214
		DrawBar(17,y,160,1,0xEFEDEE);
215
		DrawFilledBarInner(17, y+1, 160, 16);
215
		DrawFilledBarInner(17, y+1, 160, 16);
216
		DrawBar(17,y+17,160,1,0x7E87A3);
216
		DrawBar(17,y+17,160,1,0x7E87A3);
217
	} else {
217
	} else {
218
		DrawBar(17,y,160,1,sc.work_graph);
218
		DrawBar(17,y,160,1,sc.work_graph);
219
		DrawBar(17,y+1,160,16,col.list_bg);
219
		DrawBar(17,y+1,160,16,col.list_bg);
220
		DrawBar(17,y+17,160,1,sc.work_graph);
220
		DrawBar(17,y+17,160,1,sc.work_graph);
221
	}
221
	}
222
	WriteText(25,y+5,0x80,col.list_gb_text,caption);
222
	WriteText(25,y+5,0x80,col.list_gb_text,caption);
223
	if (id) DefineButton(159,y+1,16,16,id+BT_HIDE+BT_NOFRAME,0); //arrow button
223
	if (id) DefineButton(159,y+1,16,16,id+BT_HIDE+BT_NOFRAME,0); //arrow button
224
	WriteText(165,y+5,0x80,col.list_gb_text,arrow); //arrow
224
	WriteText(165,y+5,0x80,col.list_gb_text,arrow); //arrow
225
}
225
}
226
 
226
 
227
void ActionsDraw()
227
void ActionsDraw()
228
{
228
{
229
	int i;
229
	int i;
230
	int actions_y= SystemDiscs.list.count*DEV_H+108;
230
	int actions_y= SystemDiscs.list.count*DEV_H+108;
231
	Tip(actions_y-18, T_ACTIONS, 77, ""); //çàãîëîâîê
231
	Tip(actions_y-18, T_ACTIONS, 77, ""); //çàãîëîâîê
232
	for (i=0; actions[i*3]!=0; i++, actions_y+=DEV_H)
232
	for (i=0; actions[i*3]!=0; i++, actions_y+=DEV_H)
233
	{
233
	{
234
		DrawBar(17,actions_y,160,DEV_H,0xFFFFFF); //áåëîå
234
		DrawBar(17,actions_y,160,DEV_H,0xFFFFFF); //áåëîå
235
		DefineButton(17,actions_y,159,DEV_H,actions[i*3]+BT_HIDE,0xE4DFE1);
235
		DefineButton(17,actions_y,159,DEV_H,actions[i*3]+BT_HIDE,0xE4DFE1);
236
		WriteText(45,actions_y+4,0x80,0,actions[i*3+1]);
236
		WriteText(45,actions_y+4,0x80,0,actions[i*3+1]);
237
		WriteText(-strlen(actions[i*3+2])*6+170,actions_y+4,0x80,0x999999,actions[i*3+2]);
237
		WriteText(-strlen(actions[i*3+2])*6+170,actions_y+4,0x80,0x999999,actions[i*3+2]);
238
		_PutImage(23,actions_y+2, 14,13, i*14*13*3+#factions);
238
		_PutImage(23,actions_y+2, 14,13, i*14*13*3+#factions);
239
	}
239
	}
240
}
240
}
241
 
241
 
242
void DrawLeftPanelBg()
242
void DrawLeftPanelBg()
243
{
243
{
244
	int actions_y = SystemDiscs.list.count*DEV_H;
244
	int actions_y = SystemDiscs.list.count*DEV_H;
245
	int start_y = actions_y+159;
245
	int start_y = actions_y+159;
246
	int area_h;
246
	int area_h;
247
	DrawBar(2,41,190,15,col.lpanel);		      //ñèíèé ïðÿìîóãîëüíèê - íàä äåâàéñàìè
247
	DrawBar(2,41,190,15,col.lpanel);		      //ñèíèé ïðÿìîóãîëüíèê - íàä äåâàéñàìè
248
	DrawBar(17,actions_y+75,160,15,col.lpanel); //ñèíèé ïðÿìîóãîëüíèê - ïîä äåâàéñàìè
248
	DrawBar(17,actions_y+75,160,15,col.lpanel); //ñèíèé ïðÿìîóãîëüíèê - ïîä äåâàéñàìè
249
	PutShadow(17,actions_y+75,160,1,1,3);
249
	PutShadow(17,actions_y+75,160,1,1,3);
250
	PutShadow(18,actions_y+75+1,158,1,1,1);
250
	PutShadow(18,actions_y+75+1,158,1,1,1);
251
	DrawBar(2,56,15,actions_y+103,col.lpanel);	          //ñèíèé ïðÿìîóãîëüíèê - ñëåâà       
251
	DrawBar(2,56,15,actions_y+103,col.lpanel);	          //ñèíèé ïðÿìîóãîëüíèê - ñëåâà       
252
	DrawBar(177,56,15,actions_y+103,col.lpanel);            //ñèíèé ïðÿìîóãîëüíèê - ñïðàâà
252
	DrawBar(177,56,15,actions_y+103,col.lpanel);            //ñèíèé ïðÿìîóãîëüíèê - ñïðàâà
253
	area_h = Form.cheight-start_y-2 - status_bar_h;
253
	area_h = Form.cheight-start_y-2 - status_bar_h;
254
	if (col.def) 
254
	if (col.def) 
255
	{
255
	{
256
		if (area_h < 268){
256
		if (area_h < 268){
257
			PutPaletteImage(#blue_hl, 190, area_h, 2, start_y, 8, #blue_hl_pal);
257
			PutPaletteImage(#blue_hl, 190, area_h, 2, start_y, 8, #blue_hl_pal);
258
		} else {
258
		} else {
259
			DrawBar(2,start_y,190, area_h-268, col.lpanel);
259
			DrawBar(2,start_y,190, area_h-268, col.lpanel);
260
			PutPaletteImage(#blue_hl, 190, 268, 2, Form.cheight-270-status_bar_h, 8, #blue_hl_pal);
260
			PutPaletteImage(#blue_hl, 190, 268, 2, Form.cheight-270-status_bar_h, 8, #blue_hl_pal);
261
		}
261
		}
262
	}
262
	}
263
	else {
263
	else {
264
		DrawBar(2,start_y,190, area_h, col.lpanel);
264
		DrawBar(2,start_y,190, area_h, col.lpanel);
265
	}
265
	}
266
	PutShadow(17,start_y,160,1,1,3);
266
	PutShadow(17,start_y,160,1,1,3);
267
	PutShadow(18,start_y+1,158,1,1,1);
267
	PutShadow(18,start_y+1,158,1,1,1);
268
}
268
}
269
>
269
>