Subversion Repositories Kolibri OS

Rev

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

Rev 7507 Rev 7515
Line 53... Line 53...
53
{
53
{
54
	word id;
54
	word id;
55
	int x;
55
	int x;
Line 56... Line 56...
56
 
56
 
57
	load_dll(boxlib, #box_lib_init,0);
57
	load_dll(boxlib, #box_lib_init,0);
58
	GetSizeDisk();
58
	GetNewSizeDisk();
59
	edit_disk_size.left = strlen(SIZE_TEXT)*9 + 10;
59
	edit_disk_size.left = strlen(SIZE_TEXT)*9 + 10;
60
	SetEventMask(0x27);
60
	SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER);
61
	loop()
61
	loop()
62
	{
62
	{
63
		switch(WaitEvent()) 
63
		switch(WaitEvent()) 
64
		{
64
		{
Line 140... Line 140...
140
					break;
140
					break;
141
			}
141
			}
142
			break;
142
			break;
143
         case evReDraw:			
143
         case evReDraw:			
144
			system.color.get();
144
			system.color.get();
145
			DefineAndDrawWindow(170,150,405,290,0x74,system.color.work,"Virtual Disk Manager 0.67a",0);
145
			DefineAndDrawWindow(170,150,405,290,0x74,system.color.work,"Virtual Disk Manager 0.68",0);
146
			GetProcessInfo(#Form, SelfInfo);
146
			GetProcessInfo(#Form, SelfInfo);
147
			if (Form.status_window>2) break;
147
			if (Form.status_window>2) break;
Line 148... Line 148...
148
 
148
 
149
			DrawBar(0,0,  Form.cwidth,TOPPANELH, system.color.work);
149
			DrawBar(0,0,  Form.cwidth,TOPPANELH, system.color.work);
150
			DrawBar(0,TOPPANELH, Form.cwidth,1,  system.color.work_graph);
150
			DrawBar(0,TOPPANELH, Form.cwidth,1,  system.color.work_graph);
151
			WriteText(6, 9, 0x90, system.color.work_text, SIZE_TEXT);
151
			WriteText(6, 9, 0x90, system.color.work_text, SIZE_TEXT);
152
			WriteText(edit_disk_size.left + edit_disk_size.width + 12, 9, 0x90, system.color.work_text, "MB.");
152
			WriteText(edit_disk_size.left + edit_disk_size.width + 12, 9, 0x90, system.color.work_text, "MB.");
153
			DrawEditBox(#edit_disk_size);
-
 
154
			x = 6;
153
			DrawEditBox(#edit_disk_size);
155
			x = 6 + DrawStandartCaptButton(6, 36, 10, T_ADD_DISK);
154
			x = 6 + DrawStandartCaptButton(6, 36, 10, T_ADD_DISK);
156
			DrawStandartCaptButton(x, 36, 11, T_DELETE_DISK);
155
			DrawStandartCaptButton(x, 36, 11, T_DELETE_DISK);
157
			_PutImage(6+6, 42,  14,14,   #icons);
156
			_PutImage(6+6, 42,  14,14,   #icons);
158
			_PutImage(x+6, 42,  14,14,   1*14*14*3+#icons);		
157
			_PutImage(x+6, 42,  14,14,   1*14*14*3+#icons);		
Line 161... Line 160...
161
		}
160
		}
162
	}
161
	}
163
}
162
}
Line 164... Line 163...
164
 
163
 
165
 
164
 
166
void GetSizeDisk()
165
void GetNewSizeDisk()
167
{
166
{
168
	int fr;
167
	int fr;
169
	fr = GetFreeRAM() / 5 * 2;
168
	fr = GetFreeRAM() / 5 * 2;
Line 207... Line 206...
207
	}
206
	}
208
	if (disk_num>12) disk_num=12;
207
	if (disk_num>12) disk_num=12;
209
}
208
}
Line -... Line 209...
-
 
209
 
-
 
210
 
-
 
211
dword GetDiskSize(dword disk_n)
-
 
212
{
-
 
213
	BDVK bdvk;
-
 
214
	char tmp_path[8];
-
 
215
	strcpy(#tmp_path, "/tmp0/1");
-
 
216
	tmp_path[4] = disk_n + '0';
-
 
217
	GetFileInfo(#tmp_path, #bdvk);		
-
 
218
	return bdvk.sizelo;
210
 
219
}
211
 
220
 
Line 212... Line 221...
212
unsigned int disk_pos_x[]={13,13,13,102,102,102,191,191,191,279,279,279};
221
unsigned int disk_pos_x[]={13,13,13,102,102,102,191,191,191,279,279,279};
213
unsigned int disk_pos_y[]={79,127,175, 79,127,175, 79,127,175, 79,127,175};
222
unsigned int disk_pos_y[]={79,127,175, 79,127,175, 79,127,175, 79,127,175};
-
 
223
 
-
 
224
void DrawTmpDisks()
214
 
225
{
215
void DrawTmpDisks()
-
 
216
{
-
 
217
	dword selection_color;
226
	#define SELECTION_ACTIVE 0x0080FF;
218
	dword selection_active = 0x0080FF;
227
	#define SELECTION_INACTIVE 0x757489;
219
	dword selection_inactive = 0x757489;
228
	dword selection_color;
Line 220... Line 229...
220
	char free_ram_text[60];
229
	char free_ram_text[60];
Line 238... Line 247...
238
	for (i=0; i
247
	for (i=0; i
239
	{
248
	{
240
		DefineButton(disk_pos_x[i], disk_pos_y[i], 80, 40, 20+i, 0xFFFfff);
249
		DefineButton(disk_pos_x[i], disk_pos_y[i], 80, 40, 20+i, 0xFFFfff);
241
		WriteText(disk_pos_x[i]+26,disk_pos_y[i]+6,  10110000b, 0x222222, #disk_list[i].Item);
250
		WriteText(disk_pos_x[i]+26,disk_pos_y[i]+6,  10110000b, 0x222222, #disk_list[i].Item);
242
		real_id = disk_list[i].Item[3] - '0';
251
		real_id = disk_list[i].Item[3] - '0';
243
		WriteText(disk_pos_x[i]+27,disk_pos_y[i]+24, 0x80, 0x555555, ConvertSize(disk_sizes[real_id]));
252
		WriteText(disk_pos_x[i]+27,disk_pos_y[i]+24, 0x80, 0x555555, ConvertSize(GetDiskSize(real_id)));
244
		_PutImage(disk_pos_x[i]+6,disk_pos_y[i]+6, 14,14, 2*14*14*3+#icons);
253
		_PutImage(disk_pos_x[i]+6,disk_pos_y[i]+6, 14,14, 2*14*14*3+#icons);
245
		if (selected==i) {
254
		if (selected==i) {
246
			if ( edit_disk_size.flags & ed_focus) selection_color = selection_inactive; else selection_color = selection_active;
255
			if ( edit_disk_size.flags & ed_focus) 
-
 
256
				selection_color = SELECTION_INACTIVE; 
-
 
257
			else 
-
 
258
				selection_color = SELECTION_ACTIVE;
247
			DrawWideRectangle(disk_pos_x[i], disk_pos_y[i], 80, 40, 2, selection_color);
259
			DrawWideRectangle(disk_pos_x[i], disk_pos_y[i], 80, 40, 2, selection_color);
248
			PutPixel(disk_pos_x[i], disk_pos_y[i], 0xFFFfff);
260
			PutPixel(disk_pos_x[i], disk_pos_y[i], 0xFFFfff);
249
		}
261
		}
250
	}
262
	}
251
}
263
}
Line 277... Line 289...
277
	err = Console_Work();
289
	err = Console_Work();
278
	if ((err!=0) && (err<7)) notify(rezult_text[err]);
290
	if ((err!=0) && (err<7)) notify(rezult_text[err]);
279
	pause(5);
291
	pause(5);
280
	GetDisks();
292
	GetDisks();
281
	DrawTmpDisks();
293
	DrawTmpDisks();
282
	GetSizeDisk();
294
	GetNewSizeDisk();
283
}
295
}
Line 284... Line 296...
284
 
296
 
285
 
297