Subversion Repositories Kolibri OS

Rev

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

Rev 7628 Rev 7774
Line 9... Line 9...
9
?define T_ADD_DISK " „®¡ ¢¨âì ¤¨áª [Ins]"	
9
?define T_ADD_DISK " „®¡ ¢¨âì ¤¨áª [Ins]"	
10
?define T_DELETE_DISK " “¤ «¨âì ¤¨áª [Del]"
10
?define T_DELETE_DISK " “¤ «¨âì ¤¨áª [Del]"
11
?define INTRO_TEXT_1 "‡¤¥áì ¡ã¤¥â ®â®¡à ¦ âìáï ᯨ᮪"
11
?define INTRO_TEXT_1 "‡¤¥áì ¡ã¤¥â ®â®¡à ¦ âìáï ᯨ᮪"
12
?define INTRO_TEXT_2 "¢¨àâã «ì­ëå ¤¨áª®¢ ¢ á¨á⥬¥."
12
?define INTRO_TEXT_2 "¢¨àâã «ì­ëå ¤¨áª®¢ ¢ á¨á⥬¥."
13
?define INTRO_TEXT_3 "®¯à®¡ã©â¥ ¤®¡ ¢¨âì ®¤¨­..."
13
?define INTRO_TEXT_3 "®¯à®¡ã©â¥ ¤®¡ ¢¨âì ®¤¨­..."
14
?define SIZE_TEXT " §¬¥à:"
14
?define SIZE_TEXT " §¬¥à ­®¢®£® ¤¨áª  ¢ Œ:"
15
?define NOTIFY_TEXT_NO_DISK    "'„«ï ­ ç «  ¤®¡ ¢ì⥠å®âï ¡ë ®¤¨­ ¤¨áª' -W"
15
?define NOTIFY_TEXT_NO_DISK    "'„«ï ­ ç «  ¤®¡ ¢ì⥠å®âï ¡ë ®¤¨­ ¤¨áª' -W"
16
?define NOTIFY_SYSTEM_DISK0    "'„¨áª á ­®¬¥à®¬ 0 ï¥âáï á¨á⥬­ë¬ ¨ 㤠«ïâì ¥£® ­¥ ४®¬¥­¤ã¥âáï. 
16
?define NOTIFY_SYSTEM_DISK0    "'„¨áª á ­®¬¥à®¬ 0 ï¥âáï á¨á⥬­ë¬ ¨ 㤠«ïâì ¥£® ­¥ ४®¬¥­¤ã¥âáï. 
17
‚ á«ãç ¥, ¥á«¨ ¢ë â®ç­® §­ ¥â¥, çâ® ¤¥« ¥â¥, 㤠«¨âì ¥£® ¬®¦­® á § ¦ â®© ª« ¢¨è¥© SHIFT.' -W"
17
‚ á«ãç ¥, ¥á«¨ ¢ë â®ç­® §­ ¥â¥, çâ® ¤¥« ¥â¥, 㤠«¨âì ¥£® ¬®¦­® á § ¦ â®© ª« ¢¨è¥© SHIFT.' -W"
18
?define NOTIFY_TEXT_DISK_LIMIT "'„®á⨣­ã⠯।¥« ª®«¨ç¥á⢠ ¢¨àâã «ì­ëå ¤¨áª®¢' -W"
18
?define NOTIFY_TEXT_DISK_LIMIT "'„®á⨣­ã⠯।¥« ª®«¨ç¥á⢠ ¢¨àâã «ì­ëå ¤¨áª®¢' -W"
19
?define FREE_RAM_TEXT " §¬¥à ᢮¡®¤­®© ®¯¥à â¨¢­®© ¯ ¬ïâ¨: "
19
?define FREE_RAM_TEXT " §¬¥à ᢮¡®¤­®© ®¯¥à â¨¢­®© ¯ ¬ïâ¨: %i Mb"
Line 20... Line 20...
20
	
20
	
21
#else
21
#else
22
?define T_ADD_DISK " Add disk [Ins]"
22
?define T_ADD_DISK " Add disk [Ins]"
23
?define T_DELETE_DISK " Delete disk [Del]"
23
?define T_DELETE_DISK " Delete disk [Del]"
24
?define INTRO_TEXT_1 " There will be list of mounted"
24
?define INTRO_TEXT_1 " There will be list of mounted"
25
?define INTRO_TEXT_2 " virtual disks."
25
?define INTRO_TEXT_2 " virtual disks."
26
?define INTRO_TEXT_3 " Try to add one..."
26
?define INTRO_TEXT_3 " Try to add one..."
27
?define SIZE_TEXT "Size:"
27
?define SIZE_TEXT "New Disk size in MB:"
28
?define NOTIFY_TEXT_NO_DISK    "'You need to have at least one disk' -W"
28
?define NOTIFY_TEXT_NO_DISK    "'You need to have at least one disk' -W"
29
?define NOTIFY_SYSTEM_DISK0    "'Disc number 0 is a system disk. It is not recommended to delete it.
29
?define NOTIFY_SYSTEM_DISK0    "'Disc number 0 is a system disk. It is not recommended to delete it.
30
In case when you know what you are doing you can delete it with the SHIFT key pressed.' -W"
30
In case when you know what you are doing you can delete it with the SHIFT key pressed.' -W"
31
?define NOTIFY_TEXT_DISK_LIMIT "'Reached the limit of the number of virtual disks' -W"
31
?define NOTIFY_TEXT_DISK_LIMIT "'Reached the limit of the number of virtual disks' -W"
32
?define FREE_RAM_TEXT "Free RAM size: "
32
?define FREE_RAM_TEXT "Free RAM size: %i MB"
Line 33... Line 33...
33
#endif
33
#endif
34
 
34
 
Line 39... Line 39...
39
char disk_num;
39
char disk_num;
40
char selected;
40
char selected;
Line 41... Line 41...
41
 
41
 
Line 42... Line 42...
42
proc_info Form;
42
proc_info Form;
-
 
43
 
43
 
44
unsigned char icons_btn[] = FROM "img/btn.raw";
44
unsigned char icons[] = FROM "icons.raw";
45
unsigned char disk_icon[] = FROM "img/disk.raw";
Line 45... Line 46...
45
#define TOPPANELH 68
46
#define TOPPANELH 68
46
#define BOTPANELH 26
47
#define BOTPANELH 26
Line 54... Line 55...
54
	word id;
55
	word id;
55
	int x;
56
	int x;
Line 56... Line 57...
56
 
57
 
57
	load_dll(boxlib, #box_lib_init,0);
58
	load_dll(boxlib, #box_lib_init,0);
58
	GetNewSizeDisk();
59
	GetNewSizeDisk();
59
	edit_disk_size.left = strlen(SIZE_TEXT)*9 + 10;
60
	edit_disk_size.left = strlen(SIZE_TEXT)*8 + 13;
60
	SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER);
61
	SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER);
61
	loop()
62
	loop()
62
	{
63
	{
63
		switch(WaitEvent()) 
64
		switch(WaitEvent()) 
Line 139... Line 140...
139
					break;
140
					break;
140
			}
141
			}
141
			break;
142
			break;
142
         case evReDraw:			
143
         case evReDraw:			
143
			system.color.get();
144
			system.color.get();
144
			DefineAndDrawWindow(170,150,405,290,0x74,system.color.work,"Virtual Disk Manager 0.68",0);
145
			DefineAndDrawWindow(170,150,405,290,0x74,system.color.work,"Virtual Disk Manager 0.69",0);
145
			GetProcessInfo(#Form, SelfInfo);
146
			GetProcessInfo(#Form, SelfInfo);
146
			if (Form.status_window>2) break;
147
			if (Form.status_window>2) break;
Line 147... Line 148...
147
 
148
 
148
			DrawBar(0,0,  Form.cwidth,TOPPANELH, system.color.work);
149
			DrawBar(0,0,  Form.cwidth,TOPPANELH, system.color.work);
149
			DrawBar(0,TOPPANELH, Form.cwidth,1,  system.color.work_graph);
150
			DrawBar(0,TOPPANELH, Form.cwidth,1,  system.color.work_graph);
150
			WriteText(6, 9, 0x90, system.color.work_text, SIZE_TEXT);
151
			WriteText(6, 9, 0x90, system.color.work_text, SIZE_TEXT);
151
			WriteText(edit_disk_size.left + edit_disk_size.width + 12, 9, 0x90, system.color.work_text, "MB.");
152
			DrawRectangle(edit_disk_size.left-1, edit_disk_size.top-1, edit_disk_size.width+2, 23,system.color.work_graph);
152
			DrawEditBox(#edit_disk_size);
153
			edit_box_draw stdcall (#edit_disk_size);
153
			x = 6 + DrawStandartCaptButton(6, 36, 10, T_ADD_DISK);
154
			x = 6 + DrawStandartCaptButton(6, 36, 10, T_ADD_DISK);
154
			DrawStandartCaptButton(x, 36, 11, T_DELETE_DISK);
155
			DrawStandartCaptButton(x, 36, 11, T_DELETE_DISK);
155
			_PutImage(6+6, 42,  14,14,   #icons);
156
			_PutImage(6+6, 42,  14,14, #icons_btn);
156
			_PutImage(x+6, 42,  14,14,   1*14*14*3+#icons);		
157
			_PutImage(x+6, 42,  14,14, 14*14*3+#icons_btn);		
157
			GetDisks();
158
			GetDisks();
158
			DrawTmpDisks();
159
			DrawTmpDisks();
159
		}
160
		}
160
	}
161
	}
Line 209... Line 210...
209
 
210
 
210
dword GetDiskSize(dword disk_n)
211
dword GetDiskSize(dword disk_n)
211
{
212
{
212
	BDVK bdvk;
213
	BDVK bdvk;
213
	char tmp_path[8];
214
	char tmp_path[8];
214
	strcpy(#tmp_path, "/tmp0/1");
215
	strcpy(#tmp_path, "/tmp#/1");
215
	tmp_path[4] = disk_n + '0';
216
	tmp_path[4] = disk_n + '0';
216
	GetFileInfo(#tmp_path, #bdvk);		
217
	GetFileInfo(#tmp_path, #bdvk);		
217
	return bdvk.sizelo;
218
	return bdvk.sizelo;
Line 224... Line 225...
224
{
225
{
225
	#define SELECTION_ACTIVE 0x0080FF;
226
	#define SELECTION_ACTIVE 0x0080FF;
226
	#define SELECTION_INACTIVE 0x757489;
227
	#define SELECTION_INACTIVE 0x757489;
227
	dword selection_color;
228
	dword selection_color;
228
	char free_ram_text[60];
229
	char free_ram_text[60];
229
	byte i, real_id;
230
	byte i;
230
	int FreeRAM=GetFreeRAM()/1024;
-
 
Line 231... Line 231...
231
 
231
 
232
	DrawBar(0,TOPPANELH+1, Form.cwidth,Form.cheight-TOPPANELH-BOTPANELH-2, 0xFFFFFF);
232
	DrawBar(0,TOPPANELH+1, Form.cwidth,Form.cheight-TOPPANELH-BOTPANELH-2, 0xFFFFFF);
233
	DrawBar(0,Form.cheight-BOTPANELH-1, Form.cwidth,1, system.color.work_graph);
233
	DrawBar(0,Form.cheight-BOTPANELH-1, Form.cwidth,1, system.color.work_graph);
234
	DrawBar(0,Form.cheight-BOTPANELH, Form.cwidth,BOTPANELH, system.color.work);
234
	DrawBar(0,Form.cheight-BOTPANELH, Form.cwidth,BOTPANELH, system.color.work);
235
	sprintf(#free_ram_text, "%s%i MB", FREE_RAM_TEXT, FreeRAM);
235
	sprintf(#free_ram_text, FREE_RAM_TEXT, GetFreeRAM()/1024);
236
	WriteText(10, Form.cheight-20, 0x90, system.color.work_text, #free_ram_text);
236
	WriteText(10, Form.cheight-20, 0x90, system.color.work_text, #free_ram_text);
237
	if (disk_num==0)
237
	if (disk_num==0)
238
	{
238
	{
239
		WriteText(17,TOPPANELH+15,    0x90, 0x777777, INTRO_TEXT_1);
239
		WriteText(17,TOPPANELH+15,    0x90, 0x777777, INTRO_TEXT_1);
240
		WriteText(17,TOPPANELH+15+15, 0x90, 0x777777, INTRO_TEXT_2);
240
		WriteText(17,TOPPANELH+15+15, 0x90, 0x777777, INTRO_TEXT_2);
241
		WriteText(17,TOPPANELH+15+42, 0x90, 0x777777, INTRO_TEXT_3);
241
		WriteText(17,TOPPANELH+15+42, 0x90, 0x777777, INTRO_TEXT_3);
242
		return;
242
		return;
243
	};
243
	};
244
	if (selected>=disk_num) selected=disk_num-1; //restore selected
-
 
245
	for (i=0; i<10; i++) DeleteButton(20+i);
244
	if (selected>=disk_num) selected=disk_num-1; //restore selected
246
	for (i=0; i
245
	for (i=0; i<10; i++)
-
 
246
	{
-
 
247
		DeleteButton(20+i);
247
	{
248
		if (i>=disk_num) continue;
248
		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);
249
		WriteText(disk_pos_x[i]+26,disk_pos_y[i]+6,  10110000b, 0x222222, #disk_list[i].Item);
250
		WriteText(disk_pos_x[i]+29,disk_pos_y[i]+6,  0x90, 0x222222, #disk_list[i].Item);
250
		real_id = disk_list[i].Item[3] - '0';
251
		WriteText(disk_pos_x[i]+30,disk_pos_y[i]+24, 0x80, 0x555555, 
251
		WriteText(disk_pos_x[i]+27,disk_pos_y[i]+24, 0x80, 0x555555, ConvertSize(GetDiskSize(real_id)));
252
			ConvertSize(GetDiskSize(disk_list[i].Item[3] - '0')));
252
		_PutImage(disk_pos_x[i]+6,disk_pos_y[i]+6, 14,14, 2*14*14*3+#icons);
253
		_PutImage(disk_pos_x[i]+9,disk_pos_y[i]+10, 15,9, #disk_icon);
253
		if (selected==i) {
254
		if (selected==i) {
254
			if ( edit_disk_size.flags & ed_focus) 
255
			if ( edit_disk_size.flags & ed_focus) 
255
				selection_color = SELECTION_INACTIVE; 
256
				selection_color = SELECTION_INACTIVE; 
256
			else 
257
			else