Subversion Repositories Kolibri OS

Rev

Rev 5965 | Rev 6049 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5965 Rev 6034
Line 16... Line 16...
16
	?define T_FD   "„¨áª¥â  "
16
	?define T_FD   "„¨áª¥â  "
17
	?define T_HD   "†¥á⪨© ¤¨áª "
17
	?define T_HD   "†¥á⪨© ¤¨áª "
18
	?define T_SATA "SATA ¤¨áª "
18
	?define T_SATA "SATA ¤¨áª "
19
	?define T_USB  "USB ¤¨áª "
19
	?define T_USB  "USB ¤¨áª "
20
	?define T_RAM  "RAM ¤¨áª "
20
	?define T_RAM  "RAM ¤¨áª "
21
#elif LANG_EST
-
 
22
	?define T_DEVICES "Seadmed"
-
 
23
	?define T_ACTIONS "Toimingud"
-
 
24
	char *actions[] = {
-
 
25
		57, "Uus fail", "F7",
-
 
26
		56, "Uus kataloog", "F6",
-
 
27
		60, "Seaded", "F10",
-
 
28
		0,0,0
-
 
29
	};
-
 
30
	?define T_PROG "Programs "
-
 
31
	?define T_SYS  "System "
-
 
32
	?define T_UNC  "Unknown "
-
 
33
	?define T_CD   "CD-ROM "
-
 
34
	?define T_FD   "Floppy disk "
-
 
35
	?define T_HD   "Hard disk "
-
 
36
	?define T_SATA "SATA disk"
-
 
37
	?define T_USB  "USB disk"
-
 
38
	?define T_RAM  "RAM disk"
-
 
39
#else
21
#else
40
	?define T_DEVICES "Devices"
22
	?define T_DEVICES "Devices"
41
	?define T_ACTIONS "Actions"
23
	?define T_ACTIONS "Actions"
42
	char *actions[] = {
24
	char *actions[] = {
43
		57, "New file", "F7",
25
		57, "New file", "F7",
Line 54... Line 36...
54
	?define T_SATA "SATA disk"
36
	?define T_SATA "SATA disk"
55
	?define T_USB  "USB disk"
37
	?define T_USB  "USB disk"
56
	?define T_RAM  "RAM disk"
38
	?define T_RAM  "RAM disk"
57
#endif
39
#endif
Line 58... Line -...
58
 
-
 
59
 
40
 
60
void Tip(int y, dword caption, id, arrow)
41
struct _SystemDiscs
61
{
42
{
62
	int i;
43
	collection list;
63
	DrawBar(17,y,160,1,0xEFEDEE);
44
	void Get();
64
	DrawFilledBar(17, y+1, 160, 16);
45
	void Draw();
65
	WriteText(25,y+5,0x80,system.color.work_text,caption);
-
 
66
	if (id) DefineButton(159,y+1,16,16,id+BT_HIDE+BT_NOFRAME,0); //arrow button
-
 
67
	WriteText(165,y+5,0x80,system.color.work_text,arrow); //arrow
46
	void Click();
68
	DrawBar(17,y+17,160,1,system.color.work_graph);
-
 
Line -... Line 47...
-
 
47
} SystemDiscs;
-
 
48
 
69
}
49
 
-
 
50
void GetDiskIconAndName(char disk_first_letter, dword dev_icon, disc_name)
-
 
51
{
-
 
52
	switch(disk_first_letter)
-
 
53
	{
-
 
54
		case 'k':
-
 
55
			ESBYTE[dev_icon]=0;
-
 
56
			strcpy(disc_name, T_PROG);
-
 
57
			break;
-
 
58
		case 'r':
-
 
59
			ESBYTE[dev_icon]=0;
-
 
60
			strcpy(disc_name, T_SYS);
-
 
61
			break;
-
 
62
		case 'c':
-
 
63
			ESBYTE[dev_icon]=1;
-
 
64
			strcpy(disc_name, T_CD);
-
 
65
			break;
-
 
66
		case 'f':
-
 
67
			ESBYTE[dev_icon]=2;
-
 
68
			strcpy(disc_name, T_FD);
-
 
69
			break;
-
 
70
		case 'h':
-
 
71
		case 'b':
-
 
72
			ESBYTE[dev_icon]=3;
-
 
73
			strcpy(disc_name, T_HD);
-
 
74
			break;
-
 
75
		case 's':
-
 
76
			ESBYTE[dev_icon]=3;
-
 
77
			strcpy(disc_name, T_SATA);
-
 
78
			break;
-
 
79
		case 'u':
-
 
80
			ESBYTE[dev_icon]=5;
-
 
81
			strcpy(disc_name, T_USB);
-
 
82
			break;
-
 
83
		case 't':
-
 
84
			ESBYTE[dev_icon]=4;
-
 
85
			strcpy(disc_name, T_RAM);
-
 
86
			break;
-
 
87
		default:
-
 
88
			ESBYTE[dev_icon]=3;
Line 70... Line 89...
70
 
89
			strcpy(disc_name, T_UNC);				
71
 
90
	}
72
collection disk_list;
91
}
73
 
92
 
74
void GetSystemDiscs()
93
void _SystemDiscs::Get()
75
{
94
{
Line 76... Line 95...
76
	char dev_name[10], sys_discs[10];
95
	char dev_name[10], sys_discs[10];
77
	int i1, j1, dev_num, dev_disc_num;
96
	int i1, j1, dev_num, dev_disc_num;
78
	dword temp_file_count, tempbuf;
97
	dword temp_file_count, tempbuf;
79
	dword devbuf;
98
	dword devbuf;
80
 
99
 
81
	disk_list.drop();
100
	list.drop();
Line 88... Line 107...
88
		Open_Dir(#dev_name, ONLY_OPEN);
107
		Open_Dir(#dev_name, ONLY_OPEN);
89
		dev_disc_num = files.count;
108
		dev_disc_num = files.count;
90
		for (j1=0; j1
109
		for (j1=0; j1
91
		{
110
		{
92
			sprintf(#sys_discs,"%s%s/",#dev_name,j1*304+ buf+72);
111
			sprintf(#sys_discs,"%s%s/",#dev_name,j1*304+ buf+72);
93
			disk_list.add(#sys_discs);
112
			list.add(#sys_discs);
94
		}
113
		}
95
		if (!strcmp(#sys_discs, "/rd/1/")) 
114
		if (!strcmp(#sys_discs, "/rd/1/")) 
96
		{
115
		{
97
			GetDir(#tempbuf, #temp_file_count, "/kolibrios/", DIRS_ONLYREAL);
116
			GetDir(#tempbuf, #temp_file_count, "/kolibrios/", DIRS_ONLYREAL);
98
			if (temp_file_count) disk_list.add("/kolibrios/");
117
			if (temp_file_count) list.add("/kolibrios/");
99
			free(tempbuf);
118
			free(tempbuf);
100
		}
119
		}
101
		else if (!strcmp(#sys_discs, "/fd/1/")) CMD_ENABLE_SAVE_IMG = true;
120
		else if (!strcmp(#sys_discs, "/fd/1/")) CMD_ENABLE_SAVE_IMG = true;
102
	}
121
	}
103
	free(devbuf);
122
	free(devbuf);
104
}
123
}
Line 105... Line -...
105
 
-
 
106
 
124
 
107
void DrawSystemDiscs()
125
void _SystemDiscs::Draw()
108
{    
126
{    
109
	char dev_name[15], disc_name[100], i, dev_icon, is_active, name_len;
127
	char dev_name[15], disc_name[100], i, dev_icon, is_active, name_len;
Line 110... Line 128...
110
	int pos_y, pos_x=2;
128
	int draw_y, draw_x, draw_h;
-
 
129
	
-
 
130
	for (i=0; i<30; i++) DeleteButton(100+i);
-
 
131
 
-
 
132
	if ( two_panels) { draw_y = 41; draw_x =  2; draw_h = 21; }
111
	
133
	if (!two_panels) { draw_y = 74; draw_x = 17; draw_h = 16; }
112
	for (i=0; i<30; i++) DeleteButton(100+i);
134
 
113
	for (i=0;i
135
	for (i=0;i
114
	{
136
	{
-
 
137
		strcpy(#dev_name, list.get(i));
-
 
138
		dev_name[strlen(#dev_name)-1]=NULL;
115
		strcpy(#dev_name, disk_list.get(i));
139
		GetDiskIconAndName(dev_name[1], #dev_icon, #disc_name);
116
		dev_name[strlen(#dev_name)-1]=NULL;
140
		if (strstr(#path, #dev_name)) is_active=true; else is_active=false;
117
		switch(dev_name[1])
-
 
118
		{
-
 
119
			case 'k':
141
		if (two_panels)
120
				dev_icon=0;
-
 
121
				strcpy(#disc_name, T_PROG);
-
 
122
				break;
-
 
123
			case 'r':
142
		{
124
				dev_icon=0;
-
 
125
				strcpy(#disc_name, T_SYS);
-
 
126
				break;
-
 
127
			case 'c':
143
			name_len = strlen(#dev_name)-1*8;
128
				dev_icon=1;
-
 
129
				strcpy(#disc_name, T_CD);
-
 
130
				break;
-
 
131
			case 'f':
144
			DrawBar(draw_x, draw_y, name_len + 31, draw_h, 0xFFFFFF);
132
				dev_icon=2;
-
 
133
				strcpy(#disc_name, T_FD);
-
 
134
				break;
-
 
135
			case 'h':
-
 
136
			case 'b':
145
			DefineButton(draw_x+2, draw_y, name_len + 27, draw_h-1, 100+i+BT_HIDE,0xFFFFFF);
137
				dev_icon=3;
-
 
138
				strcpy(#disc_name, T_HD);
-
 
139
				break;
-
 
140
			case 's':
146
			_PutImage(draw_x + 5, draw_y+2, 18,17, is_active*6+dev_icon*17*18*3+#devices);
141
				dev_icon=3;
-
 
142
				strcpy(#disc_name, T_SATA);
-
 
143
				break;
-
 
144
			case 'u':
147
			WriteText(draw_x + 24, draw_y+3, 10110000b, 0, #dev_name+1);
145
				dev_icon=5;
-
 
146
				strcpy(#disc_name, T_USB);
-
 
147
				break;
-
 
148
			case 't':
148
			draw_x += name_len + 31;
149
				dev_icon=4;
149
			if (draw_x>=Form.width-35) && (Form.width) {
150
				strcpy(#disc_name, T_RAM);
-
 
151
				break;
150
				DrawBar(draw_x, draw_y, Form.cwidth - draw_x - 2, draw_h, 0xFFFFFF);
152
			default:
-
 
153
				dev_icon=3;
151
				draw_x = 2;
154
				strcpy(#disc_name, T_UNC);				
-
 
-
 
152
				draw_y += draw_h;
155
		}
153
			}
156
		if (strstr(#path, #dev_name)) is_active=true; else is_active=false;
154
		}
157
		if (!two_panels)
-
 
158
		{
155
		else
159
			pos_y = i*16+74;
156
		{
160
			DrawBar(17,pos_y,6,17,0xFFFFFF);
157
			DrawBar(draw_x,draw_y,6,draw_h+1,0xFFFFFF);
161
			DrawBar(17+6+18,pos_y,160-6-18,17,0xFFFFFF);
158
			DrawBar(draw_x+6+18,draw_y,160-6-18,draw_h+1,0xFFFFFF);
162
			DefineButton(17,pos_y,159,16,100+i+BT_HIDE,0xFFFFFF);
159
			DefineButton(draw_x,draw_y,159,16,100+i+BT_HIDE,0xFFFFFF);
163
			if (show_dev_name)
160
			if (show_dev_name)
164
			{
161
			{
165
				strcat(#disc_name, #dev_name);
162
				strcat(#disc_name, #dev_name);
166
				if (is_active) WriteText(46+1,pos_y+5,0x80,0x555555,#disc_name);
163
				if (is_active) WriteText(draw_x+30,draw_y+5,0x80,0x555555,#disc_name);
167
				WriteText(46,pos_y+5,0x80,0,#disc_name);
164
				WriteText(draw_x+29,draw_y+5,0x80,0,#disc_name);
168
			}
165
			}
169
			else
166
			else
170
			{
167
			{
171
				if (is_active) WriteText(46+1,pos_y+5,0x80,0x555555,#dev_name);
168
				if (is_active) WriteText(draw_x+30,draw_y+5,0x80,0x555555,#dev_name);
172
				WriteText(46,pos_y+5,0x80,0,#dev_name);
169
				WriteText(draw_x+29,draw_y+5,0x80,0,#dev_name);
-
 
170
			}
173
			}
171
			_PutImage(draw_x+6,draw_y, 18,17, is_active*6+dev_icon*17*18*3+#devices);
174
			_PutImage(23,pos_y, 18,17, is_active*6+dev_icon*17*18*3+#devices);
172
			draw_y += draw_h;
-
 
173
		}
175
		}
174
	}
176
		else
-
 
177
		{
-
 
178
			pos_y = 43;
175
	if (two_panels)
179
			name_len = strlen(#dev_name)-1*8;
176
	{
180
			DrawBar(pos_x, pos_y, name_len + 31, 17, 0xFFFFFF);
177
		DrawBar(draw_x, draw_y, Form.cwidth - draw_x - 2, draw_h, 0xFFFFFF);
181
			DefineButton(pos_x+2, pos_y, name_len + 27, 16, 100+i+BT_HIDE,0xFFFFFF);
-
 
182
			_PutImage(pos_x + 5, pos_y, 18,17, is_active*6+dev_icon*17*18*3+#devices);
178
		DefineButton(Form.cwidth - 23, draw_y+2, 17,16, 60+BT_HIDE, 0xCCCccc);
183
			WriteText(pos_x + 24, pos_y+1, 10110000b, 0, #dev_name+1);
179
		_PutImage(Form.cwidth - 21, draw_y+4, 14,13, 2*14*13*3+#factions);
184
			pos_x += name_len + 31;
180
		files.y = draw_y + draw_h + 17;
-
 
181
	}
185
		}
182
}
186
	}
183
 
187
	if (two_panels)
-
 
188
	{
184
void _SystemDiscs::Click(int n)
189
		DrawBar(pos_x, pos_y, Form.cwidth - pos_x - 2, 17, 0xFFFFFF);
185
{
190
		DrawBar(2, pos_y-2, Form.cwidth - 4, 2, 0xFFFFFF);
186
	strcpy(#path, list.get(n));
191
		DrawBar(2, pos_y+17, Form.cwidth - 4, 2, 0xFFFFFF);
-
 
192
		DefineButton(Form.cwidth - 23, pos_y, 17,16, 60+BT_HIDE, 0xCCCccc);
187
	files.KeyHome();
-
 
188
	Open_Dir(#path,WITH_REDRAW);	
-
 
189
}
-
 
190
 
-
 
191
 
-
 
192
 
-
 
193
void DrawDeviceAndActionsLeftPanel()
-
 
194
{
-
 
195
	Tip(56, T_DEVICES, 55, "=");
-
 
196
	SystemDiscs.Draw();
193
		_PutImage(Form.cwidth - 21, pos_y+2, 14,13, 2*14*13*3+#factions);
197
	ActionsDraw();
Line -... Line 198...
-
 
198
	DrawLeftPanelBg();
-
 
199
}
-
 
200
 
-
 
201
void Tip(int y, dword caption, id, arrow)
-
 
202
{
-
 
203
	DrawBar(17,y,160,1,0xEFEDEE);
-
 
204
	DrawFilledBar(17, y+1, 160, 16);
-
 
205
	WriteText(25,y+5,0x80,system.color.work_text,caption);
-
 
206
	if (id) DefineButton(159,y+1,16,16,id+BT_HIDE+BT_NOFRAME,0); //arrow button
Line 194... Line 207...
194
	}
207
	WriteText(165,y+5,0x80,system.color.work_text,arrow); //arrow
195
}
208
	DrawBar(17,y+17,160,1,system.color.work_graph);
196
 
209
}
197
 
210
 
198
void ActionsDraw()
211
void ActionsDraw()
199
{
212
{
200
	int actions_y=disk_list.count*16+108, lineh=16;
213
	int actions_y= SystemDiscs.list.count*16+108, lineh=16;
201
	Tip(actions_y-18, T_ACTIONS, 77, ""); //çàãîëîâîê
214
	Tip(actions_y-18, T_ACTIONS, 77, ""); //çàãîëîâîê
Line 207... Line 220...
207
		WriteText(-strlen(actions[i*3+2])*6+170,actions_y+4,0x80,0x999999,actions[i*3+2]);
220
		WriteText(-strlen(actions[i*3+2])*6+170,actions_y+4,0x80,0x999999,actions[i*3+2]);
208
		_PutImage(23,actions_y+2, 14,13, i*14*13*3+#factions);
221
		_PutImage(23,actions_y+2, 14,13, i*14*13*3+#factions);
209
	}
222
	}
210
}
223
}
Line 211... Line -...
211
 
-
 
212
 
224
 
213
void DrawLeftPanelBg()
225
void DrawLeftPanelBg()
214
{
226
{
215
	int actions_y=disk_list.count*16;
227
	int actions_y = SystemDiscs.list.count*16;
216
	int start_y = actions_y+156;
228
	int start_y = actions_y+156;
217
	int onTop1;
229
	int onTop1;
218
	DrawBar(2,41,190,15,col_lpanel);		      //ñèíèé ïðÿìîóãîëüíèê - íàä äåâàéñàìè
230
	DrawBar(2,41,190,15,col_lpanel);		      //ñèíèé ïðÿìîóãîëüíèê - íàä äåâàéñàìè
219
	DrawBar(17,actions_y+75,160,15,col_lpanel); //ñèíèé ïðÿìîóãîëüíèê - ïîä äåâàéñàìè
231
	DrawBar(17,actions_y+75,160,15,col_lpanel); //ñèíèé ïðÿìîóãîëüíèê - ïîä äåâàéñàìè
Line 232... Line 244...
232
		PutPaletteImage(#blue_hl, 190, 268, 2, Form.cheight-270, 8, #blue_hl_pal);
244
		PutPaletteImage(#blue_hl, 190, 268, 2, Form.cheight-270, 8, #blue_hl_pal);
233
	}
245
	}
234
	PutShadow(17,start_y,160,1,1,3);
246
	PutShadow(17,start_y,160,1,1,3);
235
	PutShadow(18,start_y+1,158,1,1,1);
247
	PutShadow(18,start_y+1,158,1,1,1);
236
}
248
}
237
 
-
 
238
 
-
 
239
void DrawDeviceAndActionsLeftPanel()
-
 
240
{
-
 
241
	Tip(56, T_DEVICES, 55, "=");
-
 
242
	DrawSystemDiscs();
-
 
243
	ActionsDraw();
-
 
244
	DrawLeftPanelBg();
-
 
245
}
-
 
246
 
-
 
247
 
-
 
248
void ClickOnDisk(int n)
-
 
249
{
-
 
250
	strcpy(#path, disk_list.get(n));
-
 
251
	files.KeyHome();
-
 
252
	Open_Dir(#path,WITH_REDRAW);	
-
 
253
}
-
 
254
>
249
>