Subversion Repositories Kolibri OS

Rev

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

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