Subversion Repositories Kolibri OS

Rev

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

Rev 4399 Rev 5149
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
#elif LANG_EST
12
#elif LANG_EST
13
	?define T_DEVICES "Seadmed"
13
	?define T_DEVICES "Seadmed"
14
	?define T_ACTIONS "Toimingud"
14
	?define T_ACTIONS "Toimingud"
15
	char *actions[] = {
15
	char *actions[] = {
16
		57, "Uus fail", "F7",
16
		57, "Uus fail", "F7",
17
		56, "Uus kataloog", "F6",
17
		56, "Uus kataloog", "F6",
18
		60, "Seaded", "F10",
18
		60, "Seaded", "F10",
19
		0,0,0
19
		0,0,0
20
	};
20
	};
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, "Options", "F10",
27
		60, "Options", "F10",
28
		0,0,0
28
		0,0,0
29
	};
29
	};
30
#endif
30
#endif
31
 
31
 
32
 
32
 
33
void Tip(int y, dword caption, id, arrow)
33
void Tip(int y, dword caption, id, arrow)
34
{
34
{
35
	int i;
35
	int i;
36
	DrawBar(17,y,160,1,0xEFEDEE);
36
	DrawBar(17,y,160,1,0xEFEDEE);
37
	DrawFilledBar(17, y+1, 160, 16);
37
	DrawFilledBar(17, y+1, 160, 16);
38
	WriteText(25,y+5,0x80,sc.work_text,caption);
38
	WriteText(25,y+5,0x80,sc.work_text,caption);
39
	IF (id<>0) DefineButton(159,y+1,16,16,id+BT_HIDE+BT_NOFRAME,0); //êíîïà äëÿ ñòðåëêè
39
	IF (id<>0) DefineButton(159,y+1,16,16,id+BT_HIDE+BT_NOFRAME,0); //êíîïà äëÿ ñòðåëêè
40
	WriteText(165,y+5,0x80,sc.work_text,arrow); //ñòðåëêà âíèç
40
	WriteText(165,y+5,0x80,sc.work_text,arrow); //ñòðåëêà âíèç
41
	DrawBar(17,y+17,160,1,sc.work_graph);		//ïîä÷¸ðêèâàíèå
41
	DrawBar(17,y+17,160,1,sc.work_graph);		//ïîä÷¸ðêèâàíèå
42
}
42
}
43
 
43
 
44
 
44
 
45
path_string disk_list[30];
45
path_string disk_list[30];
46
int disc_num;
46
int disc_num;
47
dword devbuf;
47
dword devbuf;
48
 
48
 
49
 
49
 
50
void SystemDiscsGet()
50
void SystemDiscsGet()
51
{
51
{
52
	unsigned char dev_name[10], sys_discs[10];
52
	unsigned char dev_name[10], sys_discs[10];
53
	unsigned int i1, j1, dev_num, dev_disc_num;
53
	unsigned int i1, j1, dev_num, dev_disc_num;
54
	unsigned int nullbuf;
54
	unsigned int nullbuf;
55
	disc_num=0;
55
	disc_num=0;
56
	if (devbuf) free(devbuf);
56
	if (devbuf) free(devbuf);
57
	devbuf = malloc(10000); //áóôåð ãäå-òî íà 10 äåâàéñîâ â ëåâîé ïàíåëè
57
	devbuf = malloc(10000); //áóôåð ãäå-òî íà 10 äåâàéñîâ â ëåâîé ïàíåëè
58
	ReadDir(19, devbuf, "/");
58
	ReadDir(19, devbuf, "/");
59
	dev_num = EBX;
59
	dev_num = EBX;
60
	for (i1=0; i1
60
	for (i1=0; i1
61
	{
61
	{
62
		strcpy(#dev_name, "/");                                 // /
62
		strcpy(#dev_name, "/");                                 // /
63
		strcat(#dev_name, i1*304+ devbuf+72); // /rd
63
		strcat(#dev_name, i1*304+ devbuf+72); // /rd
64
		strcat(#dev_name, "/");               // /rd/
64
		strcat(#dev_name, "/");               // /rd/
65
		Open_Dir(#dev_name, ONLY_OPEN);
65
		Open_Dir(#dev_name, ONLY_OPEN);
66
		dev_disc_num = files.count;
66
		dev_disc_num = files.count;
67
		//if (files.count<=0) copystr(#dev_name,#disk_list[disc_num].Item); else
67
		//if (files.count<=0) copystr(#dev_name,#disk_list[disc_num].Item); else
68
		for (j1=0; j1
68
		for (j1=0; j1
69
		{
69
		{
70
			strcpy(#sys_discs, #dev_name);                              // /rd/
70
			strcpy(#sys_discs, #dev_name);                              // /rd/
71
			strcat(#sys_discs, j1*304+ buf+72);      // /rd/1
71
			strcat(#sys_discs, j1*304+ buf+72);      // /rd/1
72
			strcat(#sys_discs, "/");                 // /rd/1/
72
			strcat(#sys_discs, "/");                 // /rd/1/
73
			strcpy(#disk_list[disc_num].Item, #sys_discs);
73
			strcpy(#disk_list[disc_num].Item, #sys_discs);
74
			disc_num++;
74
			disc_num++;
75
		}
75
		}
76
		if (strcmp(#disk_list[disc_num-1].Item, "/rd/1/")==0) 
76
		if (strcmp(#disk_list[disc_num-1].Item, "/rd/1/")==0) 
77
		{
77
		{
78
			if (GetDir(nullbuf, nullbuf, "/kolibrios/", DIRS_ALL)==0)
78
			if (GetDir(nullbuf, nullbuf, "/kolibrios/", DIRS_ALL)==0)
79
			{
79
			{
80
				strcpy(#disk_list[disc_num].Item, "/kolibrios/");
80
				strcpy(#disk_list[disc_num].Item, "/kolibrios/");
81
				kolibrios_drive = true;
81
				kolibrios_drive = true;
82
				disc_num++;	
82
				disc_num++;	
83
			} else kolibrios_drive = false;
83
			} else kolibrios_drive = false;
84
		}
84
		}
85
	}
85
	}
86
}
86
}
87
 
87
 
88
void DrawRamDiskSpace()
88
void DrawRamDiskSpace()
89
{
89
{
90
	int free_rd_space = GetFreeRamDiskClusters() * 49 / ALL_RD_CLUSTERS;
90
	int free_rd_space = GetFreeRamDiskClusters() * 49 / ALL_RD_CLUSTERS;
91
	DefineButton(120, 80, 49, 4, 27+BT_HIDE, 0);
91
	DefineButton(120, 80, 49, 4, 27+BT_HIDE, 0);
92
	if (!free_rd_space)
92
	if (!free_rd_space)
93
		DrawBar(121, 81, 49-free_rd_space, 3, 0xFF0000);
93
		DrawBar(121, 81, 49-free_rd_space, 3, 0xFF0000);
94
	else
94
	else
95
	{
95
	{
96
		DrawBar(121, 81, 49-free_rd_space, 3, 0x7A7F84);
96
		DrawBar(121, 81, 49-free_rd_space, 3, 0x7A7F84);
97
		DrawBar(121+49-free_rd_space, 81, free_rd_space, 3, 0xC4C4C4);
97
		DrawBar(121+49-free_rd_space, 81, free_rd_space, 3, 0xC4C4C4);
98
	}
98
	}
99
}
99
}
100
 
100
 
101
void SystemDiscsDraw()
101
void SystemDiscsDraw()
102
{    
102
{    
103
	char dev_name[15], disc_name[100];
103
	char dev_name[15], disc_name[100];
104
	int i, dev_icon;
104
	int i, dev_icon;
105
	
105
	
106
	Tip(56, T_DEVICES, 55, "=");
106
	Tip(56, T_DEVICES, 55, "=");
107
	for (i=0; i<20; i++) DeleteButton(100+i);
107
	for (i=0; i<20; i++) DeleteButton(100+i);
108
	for (i=0;i
108
	for (i=0;i
109
	{
109
	{
110
		DrawBar(17,i*16+74,160,17,0xFFFFFF);
110
		DrawBar(17,i*16+74,160,17,0xFFFFFF);
111
		DefineButton(17,i*16+74,159,16,100+i+BT_HIDE,0xFFFFFF);
111
		DefineButton(17,i*16+74,159,16,100+i+BT_HIDE,0xFFFFFF);
112
		strcpy(#dev_name, #disk_list[i].Item);
112
		strcpy(#dev_name, #disk_list[i].Item);
113
		dev_name[strlen(#dev_name)-1]=NULL;
113
		dev_name[strlen(#dev_name)-1]=NULL;
114
		switch(dev_name[1])
114
		switch(dev_name[1])
115
		{
115
		{
116
			case 'k':
116
			case 'k':
117
				dev_icon=0;
117
				dev_icon=0;
118
				strcpy(#disc_name, "Programs ");
118
				strcpy(#disc_name, "Programs ");
119
				break;
119
				break;
120
			case 'r':
120
			case 'r':
121
				dev_icon=0;
121
				dev_icon=0;
122
				strcpy(#disc_name, "System ");
122
				strcpy(#disc_name, "System ");
123
				if (drw_ram_disk_space)
123
				if (drw_ram_disk_space)
124
				  DrawRamDiskSpace();
124
				  DrawRamDiskSpace();
125
				break;
125
				break;
126
			case 'c':
126
			case 'c':
127
				dev_icon=1;
127
				dev_icon=1;
128
				strcpy(#disc_name, "CD-ROM ");
128
				strcpy(#disc_name, "CD-ROM ");
129
				break;
129
				break;
130
			case 'f':
130
			case 'f':
131
				dev_icon=2;
131
				dev_icon=2;
132
				strcpy(#disc_name, "Floppy disk ");
132
				strcpy(#disc_name, "Floppy disk ");
133
				break;
133
				break;
134
			case 'h':
134
			case 'h':
135
			case 'b':
135
			case 'b':
136
				dev_icon=3;
136
				dev_icon=3;
137
				strcpy(#disc_name, "Hard disk ");
137
				strcpy(#disc_name, "Hard disk ");
138
				break;
138
				break;
139
			case 's':
139
			case 's':
140
				dev_icon=3;
140
				dev_icon=3;
141
				strcpy(#disc_name, "SATA disk ");
141
				strcpy(#disc_name, "SATA disk ");
142
				break;
142
				break;
143
			case 'u':
143
			case 'u':
144
				dev_icon=5;
144
				dev_icon=5;
145
				strcpy(#disc_name, "USB flash ");
145
				strcpy(#disc_name, "USB flash ");
146
				break;
146
				break;
147
			case 't':
147
			case 't':
148
				dev_icon=4;
148
				dev_icon=4;
149
				strcpy(#disc_name, "RAM disk ");				
149
				strcpy(#disc_name, "RAM disk ");				
150
				DefineButton(17+143,i*16+74,16,16,i+130+BT_HIDE+BT_NOFRAME,0xFFFFFF);
150
				DefineButton(17+143,i*16+74,16,16,i+130+BT_HIDE+BT_NOFRAME,0xFFFFFF);
151
				WriteText(45+121,i*16+79,0x80,0xD63535,"-");
151
				WriteText(45+121,i*16+79,0x80,0xD63535,"-");
152
				WriteText(45+121,i*16+79+1,0x80,0xBC2424,"-");
152
				WriteText(45+121,i*16+79+1,0x80,0xBC2424,"-");
153
				break;
153
				break;
154
			default:
154
			default:
155
				dev_icon=3; //ïî-óìîë÷àíèþ óñòðîéñòâî âûãëÿäèò êàê æåñòÿê íî ýòî íåïðàâèëüíî
155
				dev_icon=3; //ïî-óìîë÷àíèþ óñòðîéñòâî âûãëÿäèò êàê æåñòÿê íî ýòî íåïðàâèëüíî
156
				strcpy(#disc_name, "Unknown ");				
156
				strcpy(#disc_name, "Unknown ");				
157
		}
157
		}
158
		strcat(#disc_name, #dev_name);
158
		strcat(#disc_name, #dev_name);
159
		if (show_dev_name) WriteText(45,i*16+79,0x80,0,#disc_name); else WriteText(45,i*16+79,0x80,0,#dev_name);
159
		if (show_dev_name) WriteText(45,i*16+79,0x80,0,#disc_name); else WriteText(45,i*16+79,0x80,0,#dev_name);
160
		_PutImage(21,i*16+76, 14,13, dev_icon*14*13*3+#devices);
160
		_PutImage(23,i*16+76, 14,13, dev_icon*14*13*3+#devices);
161
	}
161
	}
162
}
162
}
163
 
163
 
164
void ActionsDraw()
164
void ActionsDraw()
165
{
165
{
166
	int actions_y=disc_num*16+108, lineh=16;
166
	int actions_y=disc_num*16+108, lineh=16;
167
	Tip(actions_y-18, T_ACTIONS, 77, ""); //çàãîëîâîê
167
	Tip(actions_y-18, T_ACTIONS, 77, ""); //çàãîëîâîê
168
	for (i=0; actions[i*3]!=0; i++, actions_y+=lineh)
168
	for (i=0; actions[i*3]!=0; i++, actions_y+=lineh)
169
	{
169
	{
170
		DrawBar(17,actions_y,160,lineh,0xFFFFFF); //áåëîå
170
		DrawBar(17,actions_y,160,lineh,0xFFFFFF); //áåëîå
171
		DefineButton(17,actions_y,159,lineh,actions[i*3]+BT_HIDE,0xE4DFE1);
171
		DefineButton(17,actions_y,159,lineh,actions[i*3]+BT_HIDE,0xE4DFE1);
172
		WriteText(45,actions_y+4,0x80,0,actions[i*3+1]);
172
		WriteText(45,actions_y+4,0x80,0,actions[i*3+1]);
173
		WriteText(-strlen(actions[i*3+2])*6+170,actions_y+4,0x80,0x999999,actions[i*3+2]);
173
		WriteText(-strlen(actions[i*3+2])*6+170,actions_y+4,0x80,0x999999,actions[i*3+2]);
174
		_PutImage(21,actions_y+2, 14,13, i*14*13*3+#factions);
174
		_PutImage(23,actions_y+2, 14,13, i*14*13*3+#factions);
175
	}
175
	}
176
}
176
}
177
 
177
 
178
 
178
 
179
void LeftPanelBgDraw()
179
void LeftPanelBgDraw()
180
{
180
{
181
	int actions_y=disc_num*16;
181
	int actions_y=disc_num*16;
182
	int start_y = actions_y+156;
182
	int start_y = actions_y+156;
183
	DrawBar(2,41,190,15,col_lpanel);		      //ñèíèé ïðÿìîóãîëüíèê - íàä äåâàéñàìè
183
	DrawBar(2,41,190,15,col_lpanel);		      //ñèíèé ïðÿìîóãîëüíèê - íàä äåâàéñàìè
184
	DrawBar(17,actions_y+75,160,15,col_lpanel); //ñèíèé ïðÿìîóãîëüíèê - ïîä äåâàéñàìè
184
	DrawBar(17,actions_y+75,160,15,col_lpanel); //ñèíèé ïðÿìîóãîëüíèê - ïîä äåâàéñàìè
185
	PutShadow(17,actions_y+75,160,1,1,3);
185
	PutShadow(17,actions_y+75,160,1,1,3);
186
	PutShadow(18,actions_y+75+1,158,1,1,1);
186
	PutShadow(18,actions_y+75+1,158,1,1,1);
187
	DrawBar(2,56,15,actions_y+103,col_lpanel);	          //ñèíèé ïðÿìîóãîëüíèê - ñëåâà       
187
	DrawBar(2,56,15,actions_y+103,col_lpanel);	          //ñèíèé ïðÿìîóãîëüíèê - ñëåâà       
188
	DrawBar(177,56,15,actions_y+103,col_lpanel);            //ñèíèé ïðÿìîóãîëüíèê - ñïðàâà
188
	DrawBar(177,56,15,actions_y+103,col_lpanel);            //ñèíèé ïðÿìîóãîëüíèê - ñïðàâà
189
	if (onTop(start_y, 6) < 268)
189
	if (onTop(start_y, 6) < 268)
190
		PutPaletteImage(#blue_hl, 190, onTop(start_y, 6), 2, start_y, 8, #blue_hl_pal);
190
		PutPaletteImage(#blue_hl, 190, onTop(start_y, 6), 2, start_y, 8, #blue_hl_pal);
191
	else
191
	else
192
	{
192
	{
193
		DrawBar(2,start_y,190,onTop(start_y,6+268),col_lpanel);
193
		DrawBar(2,start_y,190,onTop(start_y,6+268),col_lpanel);
194
		PutPaletteImage(#blue_hl, 190, 268, 2, onTop(268,6), 8, #blue_hl_pal);
194
		PutPaletteImage(#blue_hl, 190, 268, 2, onTop(268,6), 8, #blue_hl_pal);
195
	}
195
	}
196
	PutShadow(17,start_y,160,1,1,3);
196
	PutShadow(17,start_y,160,1,1,3);
197
	PutShadow(18,start_y+1,158,1,1,1);
197
	PutShadow(18,start_y+1,158,1,1,1);
198
}
198
}
199
 
199
 
200
 
200
 
201
void DrawLeftPanel()
201
void DrawLeftPanel()
202
{
202
{
203
	SystemDiscsDraw();
203
	SystemDiscsDraw();
204
	ActionsDraw();
204
	ActionsDraw();
205
	LeftPanelBgDraw();
205
	LeftPanelBgDraw();
206
}
206
}
207
>
207
>