Subversion Repositories Kolibri OS

Rev

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

Rev 5526 Rev 5532
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); //arrow button
40
	WriteText(165,y+5,0x80,sc.work_text,arrow); //ñòðåëêà âíèç
40
	WriteText(165,y+5,0x80,sc.work_text,arrow); //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 GetSystemDiscs()
50
void GetSystemDiscs()
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
 
86
 
87
 
87
 
88
void DrawSystemDiscs()
88
void DrawSystemDiscs()
89
{    
89
{    
90
	char dev_name[15], disc_name[100];
90
	char dev_name[15], disc_name[100];
91
	int i, dev_icon;
91
	int i, dev_icon;
92
	
92
	
93
	Tip(56, T_DEVICES, 55, "=");
93
	Tip(56, T_DEVICES, 55, "=");
94
	for (i=0; i<20; i++) DeleteButton(100+i);
94
	for (i=0; i<20; i++) DeleteButton(100+i);
95
	for (i=0;i
95
	for (i=0;i
96
	{
96
	{
97
		DrawBar(17,i*16+74,160,17,0xFFFFFF);
97
		DrawBar(17,i*16+74,160,17,0xFFFFFF);
98
		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);
99
		strcpy(#dev_name, #disk_list[i].Item);
99
		strcpy(#dev_name, #disk_list[i].Item);
100
		dev_name[strlen(#dev_name)-1]=NULL;
100
		dev_name[strlen(#dev_name)-1]=NULL;
101
		switch(dev_name[1])
101
		switch(dev_name[1])
102
		{
102
		{
103
			case 'k':
103
			case 'k':
104
				dev_icon=0;
104
				dev_icon=0;
105
				strcpy(#disc_name, "Programs ");
105
				strcpy(#disc_name, "Programs ");
106
				break;
106
				break;
107
			case 'r':
107
			case 'r':
108
				dev_icon=0;
108
				dev_icon=0;
109
				strcpy(#disc_name, "System ");
109
				strcpy(#disc_name, "System ");
110
				break;
110
				break;
111
			case 'c':
111
			case 'c':
112
				dev_icon=1;
112
				dev_icon=1;
113
				strcpy(#disc_name, "CD-ROM ");
113
				strcpy(#disc_name, "CD-ROM ");
114
				break;
114
				break;
115
			case 'f':
115
			case 'f':
116
				dev_icon=2;
116
				dev_icon=2;
117
				strcpy(#disc_name, "Floppy disk ");
117
				strcpy(#disc_name, "Floppy disk ");
118
				break;
118
				break;
119
			case 'h':
119
			case 'h':
120
			case 'b':
120
			case 'b':
121
				dev_icon=3;
121
				dev_icon=3;
122
				strcpy(#disc_name, "Hard disk ");
122
				strcpy(#disc_name, "Hard disk ");
123
				break;
123
				break;
124
			case 's':
124
			case 's':
125
				dev_icon=3;
125
				dev_icon=3;
126
				strcpy(#disc_name, "SATA disk ");
126
				strcpy(#disc_name, "SATA disk ");
127
				break;
127
				break;
128
			case 'u':
128
			case 'u':
129
				dev_icon=5;
129
				dev_icon=5;
130
				strcpy(#disc_name, "USB flash ");
130
				strcpy(#disc_name, "USB flash ");
131
				break;
131
				break;
132
			case 't':
132
			case 't':
133
				dev_icon=4;
133
				dev_icon=4;
134
				strcpy(#disc_name, "RAM disk ");
134
				strcpy(#disc_name, "RAM disk ");
135
				break;
135
				break;
136
			default:
136
			default:
137
				dev_icon=3; //ïî-óìîë÷àíèþ óñòðîéñòâî âûãëÿäèò êàê æåñòÿê íî ýòî íåïðàâèëüíî
137
				dev_icon=3; //ïî-óìîë÷àíèþ óñòðîéñòâî âûãëÿäèò êàê æåñòÿê íî ýòî íåïðàâèëüíî
138
				strcpy(#disc_name, "Unknown ");				
138
				strcpy(#disc_name, "Unknown ");				
139
		}
139
		}
140
		strcat(#disc_name, #dev_name);
140
		strcat(#disc_name, #dev_name);
141
		if (show_dev_name) WriteText(45,i*16+79,0x80,0,#disc_name); else WriteText(45,i*16+79,0x80,0,#dev_name);
141
		if (show_dev_name) WriteText(45,i*16+79,0x80,0,#disc_name); else WriteText(45,i*16+79,0x80,0,#dev_name);
142
		_PutImage(23,i*16+76, 14,13, dev_icon*14*13*3+#devices);
142
		_PutImage(23,i*16+76, 14,13, dev_icon*14*13*3+#devices);
143
	}
143
	}
144
}
144
}
145
 
145
 
146
void ActionsDraw()
146
void ActionsDraw()
147
{
147
{
148
	int actions_y=disc_num*16+108, lineh=16;
148
	int actions_y=disc_num*16+108, lineh=16;
149
	Tip(actions_y-18, T_ACTIONS, 77, ""); //çàãîëîâîê
149
	Tip(actions_y-18, T_ACTIONS, 77, ""); //çàãîëîâîê
150
	for (i=0; actions[i*3]!=0; i++, actions_y+=lineh)
150
	for (i=0; actions[i*3]!=0; i++, actions_y+=lineh)
151
	{
151
	{
152
		DrawBar(17,actions_y,160,lineh,0xFFFFFF); //áåëîå
152
		DrawBar(17,actions_y,160,lineh,0xFFFFFF); //áåëîå
153
		DefineButton(17,actions_y,159,lineh,actions[i*3]+BT_HIDE,0xE4DFE1);
153
		DefineButton(17,actions_y,159,lineh,actions[i*3]+BT_HIDE,0xE4DFE1);
154
		WriteText(45,actions_y+4,0x80,0,actions[i*3+1]);
154
		WriteText(45,actions_y+4,0x80,0,actions[i*3+1]);
155
		WriteText(-strlen(actions[i*3+2])*6+170,actions_y+4,0x80,0x999999,actions[i*3+2]);
155
		WriteText(-strlen(actions[i*3+2])*6+170,actions_y+4,0x80,0x999999,actions[i*3+2]);
156
		_PutImage(23,actions_y+2, 14,13, i*14*13*3+#factions);
156
		_PutImage(23,actions_y+2, 14,13, i*14*13*3+#factions);
157
	}
157
	}
158
}
158
}
159
 
159
 
160
 
160
 
161
void DrawLeftPanelBg()
161
void DrawLeftPanelBg()
162
{
162
{
163
	int actions_y=disc_num*16;
163
	int actions_y=disc_num*16;
164
	int start_y = actions_y+156;
164
	int start_y = actions_y+156;
165
	DrawBar(2,41,190,15,col_lpanel);		      //ñèíèé ïðÿìîóãîëüíèê - íàä äåâàéñàìè
165
	DrawBar(2,41,190,15,col_lpanel);		      //ñèíèé ïðÿìîóãîëüíèê - íàä äåâàéñàìè
166
	DrawBar(17,actions_y+75,160,15,col_lpanel); //ñèíèé ïðÿìîóãîëüíèê - ïîä äåâàéñàìè
166
	DrawBar(17,actions_y+75,160,15,col_lpanel); //ñèíèé ïðÿìîóãîëüíèê - ïîä äåâàéñàìè
167
	PutShadow(17,actions_y+75,160,1,1,3);
167
	PutShadow(17,actions_y+75,160,1,1,3);
168
	PutShadow(18,actions_y+75+1,158,1,1,1);
168
	PutShadow(18,actions_y+75+1,158,1,1,1);
169
	DrawBar(2,56,15,actions_y+103,col_lpanel);	          //ñèíèé ïðÿìîóãîëüíèê - ñëåâà       
169
	DrawBar(2,56,15,actions_y+103,col_lpanel);	          //ñèíèé ïðÿìîóãîëüíèê - ñëåâà       
170
	DrawBar(177,56,15,actions_y+103,col_lpanel);            //ñèíèé ïðÿìîóãîëüíèê - ñïðàâà
170
	DrawBar(177,56,15,actions_y+103,col_lpanel);            //ñèíèé ïðÿìîóãîëüíèê - ñïðàâà
171
	if (onTop(start_y, 6) < 268)
171
	if (onTop(start_y, 6) < 268)
172
		PutPaletteImage(#blue_hl, 190, onTop(start_y, 6), 2, start_y, 8, #blue_hl_pal);
172
		PutPaletteImage(#blue_hl, 190, onTop(start_y, 6), 2, start_y, 8, #blue_hl_pal);
173
	else
173
	else
174
	{
174
	{
175
		DrawBar(2,start_y,190,onTop(start_y,6+268),col_lpanel);
175
		DrawBar(2,start_y,190,onTop(start_y,6+268),col_lpanel);
176
		PutPaletteImage(#blue_hl, 190, 268, 2, onTop(268,6), 8, #blue_hl_pal);
176
		PutPaletteImage(#blue_hl, 190, 268, 2, onTop(268,6), 8, #blue_hl_pal);
177
	}
177
	}
178
	PutShadow(17,start_y,160,1,1,3);
178
	PutShadow(17,start_y,160,1,1,3);
179
	PutShadow(18,start_y+1,158,1,1,1);
179
	PutShadow(18,start_y+1,158,1,1,1);
180
}
180
}
181
 
181
 
182
 
182
 
183
void DrawLeftPanel()
183
void DrawLeftPanel()
184
{
184
{
185
	DrawSystemDiscs();
185
	DrawSystemDiscs();
186
	ActionsDraw();
186
	ActionsDraw();
187
	DrawLeftPanelBg();
187
	DrawLeftPanelBg();
188
}
188
}
189
>
189
>