Subversion Repositories Kolibri OS

Rev

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

Rev 8946 Rev 8949
Line 1... Line -...
1
#ifdef LANG_RUS
-
 
2
	?define T_DEVICES "“áâனá⢠"
-
 
3
	?define T_ACTIONS "„¥©á⢨ï"
-
 
4
	char *actions[] = {
-
 
5
		59, "®¢ë© ä ©«", "F9",
-
 
6
		57, "®¢ ï ¯ ¯ª ", "F7",
-
 
7
		60, " áâனª¨", "F10",
-
 
8
		0,0,0
-
 
9
	};
-
 
10
	?define T_PROG "à®£à ¬¬ë "
-
 
11
	?define T_SYS  "‘¨á⥬  "
-
 
12
	?define T_UNC  "¥¨§¢¥áâ­® "
-
 
13
	?define T_CD   "CD-ROM "
-
 
14
	?define T_FD   "„¨áª¥â  "
-
 
15
	?define T_HD   "†¥á⪨© ¤¨áª "
-
 
16
	?define T_SATA "SATA ¤¨áª "
-
 
17
	?define T_USB  "USB ¤¨áª "
-
 
18
	?define T_RAM  "RAM ¤¨áª "
-
 
19
#else
-
 
20
	?define T_DEVICES "Devices"
-
 
21
	?define T_ACTIONS "Actions"
-
 
22
	char *actions[] = {
-
 
23
		59, "New file", "F9",
-
 
24
		57, "New folder", "F7",
-
 
25
		60, "Settings", "F10",
-
 
26
		0,0,0
-
 
27
	};
-
 
28
	?define T_PROG "Programs "
-
 
29
	?define T_SYS  "System "
-
 
30
	?define T_UNC  "Unknown "
-
 
31
	?define T_CD   "CD-ROM "
-
 
32
	?define T_FD   "Floppy disk "
-
 
33
	?define T_HD   "Hard disk "
-
 
34
	?define T_SATA "SATA disk "
-
 
35
	?define T_USB  "USB disk "
-
 
36
	?define T_RAM  "RAM disk "
-
 
37
#endif
-
 
38
 
-
 
39
struct _SystemDiscs
1
struct _SystemDiscs
40
{
2
{
41
	collection list;
3
	collection list;
42
	int dev_num;
4
	int dev_num;
43
	void Get();
5
	void Get();
Line 46... Line 8...
46
	void DrawOptions();
8
	void DrawOptions();
47
	void Click();
9
	void Click();
48
} SystemDiscs=0;
10
} SystemDiscs=0;
49
 
11
 
Line 50... Line -...
50
#define DEV_H 17
-
 
51
#define DEV_H_HOR 20
-
 
52
 
-
 
53
void GetDiskIconAndName(char disk_first_letter, dword dev_icon, disc_name)
-
 
54
{
-
 
55
	switch(disk_first_letter)
-
 
56
	{
-
 
57
		case 'r':
-
 
58
			ESBYTE[dev_icon]=0;
-
 
59
			strcpy(disc_name, T_SYS);
-
 
60
			break;
-
 
61
		case 'k':
-
 
62
			ESBYTE[dev_icon]=1;
-
 
63
			strcpy(disc_name, T_PROG);
-
 
64
			break;
-
 
65
		case 'f':
-
 
66
			ESBYTE[dev_icon]=2;
-
 
67
			strcpy(disc_name, T_FD);
-
 
68
			break;
-
 
69
		case 'c':
-
 
70
			ESBYTE[dev_icon]=3;
-
 
71
			strcpy(disc_name, T_CD);
-
 
72
			break;
-
 
73
		case 'h':
-
 
74
		case 'b':
-
 
75
			ESBYTE[dev_icon]=4;
-
 
76
			strcpy(disc_name, T_HD);
-
 
77
			break;
-
 
78
		case 's':
-
 
79
			ESBYTE[dev_icon]=4;
-
 
80
			strcpy(disc_name, T_SATA);
-
 
81
			break;
-
 
82
		case 't':
-
 
83
			ESBYTE[dev_icon]=5;
-
 
84
			strcpy(disc_name, T_RAM);
-
 
85
			break;
-
 
86
		case 'u':
-
 
87
			ESBYTE[dev_icon]=6;
-
 
88
			strcpy(disc_name, T_USB);
-
 
89
			break;
-
 
90
		default:
-
 
91
			ESBYTE[dev_icon]=5;
-
 
92
	}
-
 
93
}
-
 
94
 
-
 
95
void _SystemDiscs::Get()
12
void _SystemDiscs::Get()
96
{
13
{
97
	bool kolibrios_exists=false;
14
	bool kolibrios_exists=false;
98
	char dev_name[10], sys_discs[10];
15
	char dev_name[10], sys_discs[10];
99
	int i1, j1, dev_num_i, dev_disc_num;
16
	int i1, j1, dev_num_i, dev_disc_num;
Line 124... Line 41...
124
	free(devbuf);
41
	free(devbuf);
125
	free(diskbuf);
42
	free(diskbuf);
126
}
43
}
127
 
44
 
Line -... Line 45...
-
 
45
void GetDiskIconAndName(char disk_first_letter, dword dev_icon, dword disc_name)
-
 
46
{
-
 
47
	int i;
-
 
48
	for (i=0; devinfo[i]!=0; i+=3) {
-
 
49
		if (disk_first_letter == ESBYTE[devinfo[i]]) {
-
 
50
			ESBYTE[dev_icon] = devinfo[i+1];
-
 
51
			strcpy(disc_name, devinfo[i+2]);
-
 
52
			return;
-
 
53
		}
-
 
54
	}
-
 
55
	ESBYTE[dev_icon]=5;
-
 
56
	strcpy(disc_name, T_UNC);
-
 
57
}
-
 
58
 
-
 
59
#define DEV_H 17
128
#define DDW 120
60
#define DDW 120
-
 
61
#define KFM2_DEVH 20
Line 129... Line 62...
129
 
62
 
130
void _SystemDiscs::Draw()
63
void _SystemDiscs::Draw()
131
{    
64
{    
-
 
65
	char dev_name[15], disc_name[100], i, dev_icon;
132
	char dev_name[15], disc_name[100], i, dev_icon, is_active=0;
66
	bool is_active=0;
Line 133... Line 67...
133
	int draw_y, draw_x;
67
	int draw_y, draw_x;
Line 134... Line 68...
134
	
68
	
135
	for (i=0; i<30; i++) DeleteButton(100+i);
-
 
136
 
69
	for (i=0; i<30; i++) DeleteButton(100+i);
137
	if (efm) { 
-
 
138
		if (active_panel==0) {
-
 
139
			DrawSelect(Form.cwidth/2-DDW, 10, #path, KFM_DEV_DROPDOWN_1);
-
 
140
			DrawSelect(Form.cwidth-DDW-2, 10, #inactive_path, KFM_DEV_DROPDOWN_2);
70
 
141
		} else {
-
 
142
			DrawSelect(Form.cwidth/2-DDW, 10, #inactive_path, KFM_DEV_DROPDOWN_1);
71
	if (efm) { 
143
			DrawSelect(Form.cwidth-DDW-2, 10, #path, KFM_DEV_DROPDOWN_2);		
72
		DrawSelect(Form.cwidth/2-DDW, KFM_DEV_DROPDOWN_1, location[0]);
144
		}
73
		DrawSelect(Form.cwidth-DDW-2, KFM_DEV_DROPDOWN_2, location[sizeof(dword)]);
145
		files.y = 40 + 17;
74
		files.y = 40 + 17;
146
	} else { 
75
	} else { 
147
		draw_y = 74; 
76
		draw_y = 74; 
148
		draw_x = 17; 
77
		draw_x = 17; 
149
		for (i=0;i
78
		for (i=0;i
Line 150... Line 79...
150
			strcpy(#dev_name, list.get(i));
79
			strcpy(#dev_name, list.get(i));
151
			GetDiskIconAndName(dev_name[1], #dev_icon, #disc_name);
80
			GetDiskIconAndName(dev_name[1], #dev_icon, #disc_name);
152
			if (strstr(#path, #dev_name)==#path) is_active=true; else is_active=false;
81
			if (strstr(path, #dev_name)==path) is_active=true; else is_active=false;
153
 
82
 
154
			DrawBar(draw_x,draw_y,6,DEV_H+1,0xFFFFFF);
83
			DrawBar(draw_x,draw_y,6,DEV_H+1,0xFFFFFF);
155
			DrawBar(draw_x+6+18,draw_y,160-6-18,DEV_H+1,0xFFFFFF);
84
			DrawBar(draw_x+6+18,draw_y,160-6-18,DEV_H+1,0xFFFFFF);
156
			DefineButton(draw_x,draw_y,159,16,100+i+BT_HIDE,0xFFFFFF);
85
			DefineHiddenButton(draw_x,draw_y,159,16,100+i);
157
			if (show_dev_name.checked)
86
			if (show_dev_name.checked)
Line 172... Line 101...
172
		DrawBar(draw_x+6, draw_y, 18, 1, 0xFFFfff);
101
		DrawBar(draw_x+6, draw_y, 18, 1, 0xFFFfff);
173
	}
102
	}
174
}
103
}
175
 
104
 
Line 176... Line 105...
176
void _SystemDiscs::DrawSelect(int draw_x, draw_y, path1, btid)
105
void _SystemDiscs::DrawSelect(int draw_x, btid, dword _path)
177
{
106
{
-
 
107
	#define SELECTY 10
178
	char dev_name[15], disc_name[100], i, dev_icon, is_active=0;
108
	char dev_name[15], disc_name[100], i, dev_icon;
-
 
109
 
179
	if (ESBYTE[path1+1]=='\0') {
110
	if (ESBYTE[_path+1]=='\0') {
180
		strcpy(#dev_name, "/root");
111
		strcpy(#dev_name, "/root");
181
		dev_icon = 0;
112
		dev_icon = 0;
182
	} else if (chrnum(path1, '/')==1) {
113
	} else if (chrnum(_path, '/')==1) {
183
		strcpy(#dev_name, path1);
114
		strcpy(#dev_name, _path);
184
		GetDiskIconAndName(dev_name[1], #dev_icon, #disc_name);
115
		GetDiskIconAndName(dev_name[1], #dev_icon, #disc_name);
185
	} else for (i=0;i
116
	} else for (i=0;i
186
		strcpy(#dev_name, list.get(i));
117
		strcpy(#dev_name, list.get(i));
187
		GetDiskIconAndName(dev_name[1], #dev_icon, #disc_name);
118
		GetDiskIconAndName(dev_name[1], #dev_icon, #disc_name);
188
		if (strstr(path1, #dev_name)-path1==0) break;
119
		if (strstr(_path, #dev_name)-_path==0) break;
189
	}
120
	}
190
	DrawRectangle(draw_x-1, draw_y-1, DDW+2-DEV_H_HOR, DEV_H_HOR+1, sc.work_graph);
121
	DrawRectangle(draw_x-1, SELECTY-1, DDW+2-KFM2_DEVH, KFM2_DEVH+1, sc.work_graph);
191
	DrawBar(draw_x, draw_y, DDW+1-DEV_H_HOR, DEV_H_HOR, 0xFFFFFF);
122
	DrawBar(draw_x, SELECTY, DDW+1-KFM2_DEVH, KFM2_DEVH, 0xFFFFFF);
192
	_PutImage(draw_x + 5, draw_y+2, 18,17, is_active*7+dev_icon*17*18*3+#devices);
123
	_PutImage(draw_x + 5, SELECTY+2, 18,17, dev_icon*17*18*3+#devices);
193
	kfont.WriteIntoWindow(draw_x + 24, draw_y+2, 0xFFFfff, 0x000000, kfont.size.pt, #dev_name+1);
124
	kfont.WriteIntoWindow(draw_x + 24, math.max(KFM2_DEVH-kfont.height/2+SELECTY,0), 0xFFFfff, 0x000000, kfont.size.pt, #dev_name+1);
194
	DefineButton(draw_x, draw_y, DDW-1, DEV_H_HOR-1, btid+1+BT_HIDE,0xFFFFFF);
125
	DefineHiddenButton(draw_x, SELECTY, DDW-1, KFM2_DEVH-1, btid+1);
195
	DrawFlatButtonSmall(draw_x+DDW-DEV_H_HOR+1, draw_y-1, DEV_H_HOR-1, DEV_H_HOR+1, btid, "\x19");
126
	DrawFlatButtonSmall(draw_x+DDW-KFM2_DEVH+1, SELECTY-1, KFM2_DEVH-1, KFM2_DEVH+1, btid, "\x19");
196
 
-
 
197
	draw_x += DDW + 1;
-
 
198
	//DrawBar(draw_x, draw_y, Form.cwidth - draw_x - 2, DEV_H_HOR, sc.work);
-
 
199
}
127
}
Line 200... Line 128...
200
 
128
 
201
void _SystemDiscs::DrawOptions(int draw_x, draw_y)
129
void _SystemDiscs::DrawOptions(int draw_x)
-
 
130
{
202
{
131
	int optionsy = SELECTY+KFM2_DEVH+1;
Line 203... Line 132...
203
	char dev_name[15], disc_name[100], i, dev_icon, is_active=0;
132
	char dev_name[15], disc_name[100], i, dev_icon, is_active=0;
Line 204... Line 133...
204
		
133
		
Line 205... Line 134...
205
	for (i=0; i<30; i++) DeleteButton(100+i);
134
	for (i=0; i<30; i++) DeleteButton(100+i);
206
 
135
 
207
	DrawPopup(draw_x, draw_y, DDW, list.count*DEV_H_HOR, 1, -1, sc.work_graph);
136
	DrawPopup(draw_x, optionsy, DDW, list.count*KFM2_DEVH, 1, -1, sc.work_graph);
208
 
137
 
Line 209... Line 138...
209
	for (i=0;i
138
	for (i=0;i
210
		strcpy(#dev_name, list.get(i));
139
		strcpy(#dev_name, list.get(i));
211
		GetDiskIconAndName(dev_name[1], #dev_icon, #disc_name);
140
		GetDiskIconAndName(dev_name[1], #dev_icon, #disc_name);
212
		if (strstr(#path, #dev_name)!=0) is_active=true; else is_active=false;
141
		if (strstr(path, #dev_name)!=0) is_active=true; else is_active=false;
213
 
142
 
214
		DrawBar(draw_x, draw_y, DDW, DEV_H_HOR, 0xFFFFFF);
143
		DrawBar(draw_x, optionsy, DDW, KFM2_DEVH, 0xFFFFFF);
215
		DefineButton(draw_x, draw_y, DDW, DEV_H_HOR-1, 100+i+BT_HIDE,0xFFFFFF);
144
		DefineButton(draw_x, optionsy, DDW, KFM2_DEVH-1, 100+i+BT_HIDE,0xFFFFFF);
216
		_PutImage(draw_x + 5, draw_y+2, 18,17, is_active*7+dev_icon*17*18*3+#devices);
145
		_PutImage(draw_x + 5, optionsy+2, 18,17, is_active*7+dev_icon*17*18*3+#devices);
217
		if (is_active) kfont.bold = true;
146
		if (is_active) kfont.bold = true;
Line 218... Line 147...
218
		kfont.WriteIntoWindow(draw_x + 24, draw_y+2, 0xFFFfff, 0x000000, kfont.size.pt, #dev_name+1);
147
		kfont.WriteIntoWindow(draw_x + 24, optionsy+2, 0xFFFfff, 0x000000, kfont.size.pt, #dev_name+1);
219
		kfont.bold = false;
148
		kfont.bold = false;
220
		draw_y += DEV_H_HOR;
149
		optionsy += KFM2_DEVH;
221
	}
150
	}
222
}
151
}
223
 
152
 
Line 224... Line 153...
224
void _SystemDiscs::Click(int n)
153
void _SystemDiscs::Click(int n)
Line 284... Line 213...
284
	int actions_y = SystemDiscs.list.count*DEV_H;
213
	int actions_y = SystemDiscs.list.count*DEV_H;
285
	int start_y = actions_y+159;
214
	int start_y = actions_y+159;
286
	int area_h;
215
	int area_h;
287
	DrawBar(2,41,190,15,waves_pal[0]);		      //above devices block
216
	DrawBar(2,41,190,15,waves_pal[0]);             //above devices block
288
	DrawBar(17,actions_y+75,160,15,waves_pal[0]); //below devices block
217
	DrawBar(17,actions_y+75,160,15,EDX);  //below devices block
289
	PutShadow(17,actions_y+75,160,1,1,3);
218
	DrawBar(2,56,15,actions_y+103,EDX);   //on the left
290
	PutShadow(18,actions_y+75+1,158,1,1,1);
-
 
291
	DrawBar(2,56,15,actions_y+103,waves_pal[0]);	          //on the left
-
 
292
	DrawBar(177,56,15,actions_y+103,waves_pal[0]);            //on the right
219
	DrawBar(177,56,15,actions_y+103,EDX); //on the right
293
	area_h = Form.cheight-start_y-2 - status_bar_h;
220
	area_h = Form.cheight-start_y-2 - status_bar_h;
294
	if (area_h < 268){
221
	if (area_h < 268){
295
		PutPaletteImage(#blue_hl, 190, area_h, 2, start_y, 8, #waves_pal);
222
		PutPaletteImage(#blue_hl, 190, area_h, 2, start_y, 8, #waves_pal);
296
	} else {
223
	} else {
297
		DrawBar(2,start_y,190, area_h-268, waves_pal[0]);
224
		DrawBar(2,start_y,190, area_h-268, waves_pal[0]);
298
		PutPaletteImage(#blue_hl, 190, 268, 2, Form.cheight-270-status_bar_h, 8, #waves_pal);
225
		PutPaletteImage(#blue_hl, 190, 268, 2, Form.cheight-270-status_bar_h, 8, #waves_pal);
299
	}
226
	}
300
	PutShadow(17,start_y,160,1,1,3);
227
	PutShadow(17,actions_y+75,160,1,1,3);
-
 
228
	PutShadow(18,actions_y+75+1,158,1,1,1);
-
 
229
	PutShadow(17,start_y,160,1,1,3);
301
	PutShadow(18,start_y+1,158,1,1,1);
230
	PutShadow(18,start_y+1,158,1,1,1);
302
}
231
}
303
232
304
233