Subversion Repositories Kolibri OS

Rev

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

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