2015-08-04 17:36:07 +03:00
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
///////////////////////// GUI ////////////////////
|
2015-02-27 04:44:22 +03:00
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2015-03-05 23:55:28 +03:00
|
|
|
|
#include "..\lib\gui.h"
|
|
|
|
|
#include "..\lib\obj\box_lib.h"
|
2012-11-26 19:26:15 +04:00
|
|
|
|
|
|
|
|
|
#ifdef LANG_RUS
|
2018-10-01 19:41:14 +03:00
|
|
|
|
?define T_ADD_DISK " <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> [Ins]"
|
|
|
|
|
?define T_DELETE_DISK " <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> [Del]"
|
|
|
|
|
?define INTRO_TEXT_1 "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>㤥<EFBFBD> <20>⮡ࠦ<E2AEA1><E0A0A6><EFBFBD><EFBFBD><EFBFBD> ᯨ᮪"
|
|
|
|
|
?define INTRO_TEXT_2 "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>㠫<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20> <20><><EFBFBD>⥬<EFBFBD>."
|
|
|
|
|
?define INTRO_TEXT_3 "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>..."
|
2020-04-11 18:48:27 +03:00
|
|
|
|
?define SIZE_TEXT "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>᪠ <20> <20><>:"
|
2018-10-01 19:41:14 +03:00
|
|
|
|
?define NOTIFY_TEXT_NO_DISK "'<27><><EFBFBD> <20><>砫<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>' -W"
|
|
|
|
|
?define NOTIFY_SYSTEM_DISK0 "'<27><><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD> 0 <><EFA2AB><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>⥬<EFBFBD><E2A5AC><EFBFBD> <20> 㤠<><E3A4A0><EFBFBD><EFBFBD> <20><><EFBFBD> <20><> ४<><E0A5AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
|
|
|
|
<EFBFBD> <EFBFBD><EFBFBD><EFBFBD>砥, <EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD>筮 <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, 㤠<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>⮩ <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>襩 SHIFT.' -W"
|
|
|
|
|
?define NOTIFY_TEXT_DISK_LIMIT "'<27><><EFBFBD>⨣<EFBFBD><E2A8A3><EFBFBD> <20>।<EFBFBD><E0A5A4> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>⢠ <20><><EFBFBD><EFBFBD>㠫<EFBFBD><E3A0AB><EFBFBD><EFBFBD> <20><><EFBFBD>' -W"
|
2020-04-11 18:48:27 +03:00
|
|
|
|
?define FREE_RAM_TEXT "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <><E1A2AE><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>⨢<EFBFBD><E2A8A2><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: %i Mb"
|
2012-11-26 19:26:15 +04:00
|
|
|
|
|
|
|
|
|
#else
|
2018-10-01 19:41:14 +03:00
|
|
|
|
?define T_ADD_DISK " Add disk [Ins]"
|
|
|
|
|
?define T_DELETE_DISK " Delete disk [Del]"
|
|
|
|
|
?define INTRO_TEXT_1 " There will be list of mounted"
|
|
|
|
|
?define INTRO_TEXT_2 " virtual disks."
|
|
|
|
|
?define INTRO_TEXT_3 " Try to add one..."
|
2020-04-11 18:48:27 +03:00
|
|
|
|
?define SIZE_TEXT "New Disk size in MB:"
|
2018-10-01 19:41:14 +03:00
|
|
|
|
?define NOTIFY_TEXT_NO_DISK "'You need to have at least one disk' -W"
|
|
|
|
|
?define NOTIFY_SYSTEM_DISK0 "'Disc number 0 is a system disk. It is not recommended to delete it.
|
|
|
|
|
In case when you know what you are doing you can delete it with the SHIFT key pressed.' -W"
|
|
|
|
|
?define NOTIFY_TEXT_DISK_LIMIT "'Reached the limit of the number of virtual disks' -W"
|
2020-04-11 18:48:27 +03:00
|
|
|
|
?define FREE_RAM_TEXT "Free RAM size: %i MB"
|
2012-11-26 19:26:15 +04:00
|
|
|
|
#endif
|
|
|
|
|
|
2015-02-27 04:44:22 +03:00
|
|
|
|
struct path_string { unsigned char Item[10]; };
|
|
|
|
|
path_string disk_list[10];
|
2012-11-26 19:26:15 +04:00
|
|
|
|
|
|
|
|
|
dword devbuf;
|
2015-02-27 04:44:22 +03:00
|
|
|
|
char disk_num;
|
|
|
|
|
char selected;
|
2012-11-26 19:26:15 +04:00
|
|
|
|
|
|
|
|
|
proc_info Form;
|
|
|
|
|
|
2020-04-11 18:48:27 +03:00
|
|
|
|
unsigned char icons_btn[] = FROM "img/btn.raw";
|
|
|
|
|
unsigned char disk_icon[] = FROM "img/disk.raw";
|
2016-11-05 13:13:29 +03:00
|
|
|
|
#define TOPPANELH 68
|
|
|
|
|
#define BOTPANELH 26
|
2012-11-26 19:26:15 +04:00
|
|
|
|
|
2018-10-29 14:39:31 +03:00
|
|
|
|
char new_disk_size[7];
|
2018-04-21 15:28:00 +03:00
|
|
|
|
edit_box edit_disk_size= {50,0,7,0xffffff,0x94AECE,0xFFFfff,0xffffff,0x10000000,
|
2018-10-29 14:39:31 +03:00
|
|
|
|
sizeof(new_disk_size)-2,#new_disk_size,0, ed_focus+ed_figure_only};
|
2012-11-26 19:26:15 +04:00
|
|
|
|
|
|
|
|
|
void Main_Window()
|
|
|
|
|
{
|
2016-10-31 14:27:15 +03:00
|
|
|
|
word id;
|
2016-11-05 13:13:29 +03:00
|
|
|
|
int x;
|
|
|
|
|
|
2015-07-29 23:43:05 +03:00
|
|
|
|
load_dll(boxlib, #box_lib_init,0);
|
2018-10-31 19:50:25 +03:00
|
|
|
|
GetNewSizeDisk();
|
2020-04-11 18:48:27 +03:00
|
|
|
|
edit_disk_size.left = strlen(SIZE_TEXT)*8 + 13;
|
2018-10-31 19:50:25 +03:00
|
|
|
|
SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER);
|
2012-11-26 19:26:15 +04:00
|
|
|
|
loop()
|
|
|
|
|
{
|
|
|
|
|
switch(WaitEvent())
|
|
|
|
|
{
|
2013-08-10 21:47:40 +04:00
|
|
|
|
case evMouse:
|
|
|
|
|
edit_box_mouse stdcall (#edit_disk_size);
|
|
|
|
|
break;
|
|
|
|
|
|
2012-11-26 19:26:15 +04:00
|
|
|
|
case evButton:
|
2015-02-27 04:44:22 +03:00
|
|
|
|
id=GetButtonID();
|
|
|
|
|
if (id==1) return;
|
2012-11-26 19:26:15 +04:00
|
|
|
|
if (id==10) AddDisk();
|
2018-10-01 19:41:14 +03:00
|
|
|
|
if (id==11) {
|
|
|
|
|
GetKeys();
|
|
|
|
|
DelDisk();
|
|
|
|
|
}
|
2012-11-26 19:26:15 +04:00
|
|
|
|
if (id>=20)
|
|
|
|
|
{
|
|
|
|
|
if (selected==id-20) OpenTmpDisk();
|
|
|
|
|
selected=id-20;
|
|
|
|
|
DrawTmpDisks();
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case evKey:
|
2016-10-31 14:27:15 +03:00
|
|
|
|
GetKeys();
|
|
|
|
|
// PROCESS KEYS WHEN EDIT BOX INACTIVE
|
2018-10-29 21:16:01 +03:00
|
|
|
|
if ( ! edit_disk_size.flags&ed_focus) switch(key_scancode)
|
2012-11-26 19:26:15 +04:00
|
|
|
|
{
|
2016-10-31 14:27:15 +03:00
|
|
|
|
case SCAN_CODE_TAB:
|
2018-10-29 21:16:01 +03:00
|
|
|
|
edit_disk_size.flags = ed_figure_only + ed_focus;
|
2015-02-27 04:44:22 +03:00
|
|
|
|
edit_box_draw stdcall (#edit_disk_size);
|
2016-10-31 14:27:15 +03:00
|
|
|
|
DrawTmpDisks();
|
2015-02-27 04:44:22 +03:00
|
|
|
|
break;
|
2016-10-31 14:27:15 +03:00
|
|
|
|
case SCAN_CODE_UP:
|
2015-02-27 04:44:22 +03:00
|
|
|
|
if (selected==0) break;
|
|
|
|
|
selected--;
|
|
|
|
|
DrawTmpDisks();
|
|
|
|
|
break;
|
2016-10-31 14:27:15 +03:00
|
|
|
|
case SCAN_CODE_DOWN:
|
2015-02-27 04:44:22 +03:00
|
|
|
|
if (selected+2>disk_num) break;
|
|
|
|
|
selected++;
|
|
|
|
|
DrawTmpDisks();
|
|
|
|
|
break;
|
2016-10-31 14:27:15 +03:00
|
|
|
|
case SCAN_CODE_LEFT:
|
2015-02-27 04:44:22 +03:00
|
|
|
|
if (selected<3) break;
|
|
|
|
|
selected-=3;
|
|
|
|
|
DrawTmpDisks();
|
|
|
|
|
break;
|
2016-10-31 14:27:15 +03:00
|
|
|
|
case SCAN_CODE_RIGHT:
|
2015-02-27 04:44:22 +03:00
|
|
|
|
if (selected+4>disk_num) break;
|
|
|
|
|
selected+=3;
|
|
|
|
|
DrawTmpDisks();
|
2016-10-31 14:27:15 +03:00
|
|
|
|
break;
|
|
|
|
|
case SCAN_CODE_INS:
|
|
|
|
|
AddDisk();
|
|
|
|
|
break;
|
|
|
|
|
case SCAN_CODE_DEL:
|
2018-10-01 19:41:14 +03:00
|
|
|
|
DelDisk();
|
2016-10-31 14:27:15 +03:00
|
|
|
|
break;
|
|
|
|
|
case SCAN_CODE_ENTER:
|
|
|
|
|
OpenTmpDisk();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
// PROCESS KEYS WHEN EDIT BOX ACTIVE
|
|
|
|
|
else switch(key_scancode)
|
|
|
|
|
{
|
|
|
|
|
case SCAN_CODE_TAB:
|
2018-10-29 21:16:01 +03:00
|
|
|
|
edit_disk_size.flags = ed_figure_only;
|
2016-10-31 14:27:15 +03:00
|
|
|
|
edit_box_draw stdcall (#edit_disk_size);
|
|
|
|
|
DrawTmpDisks();
|
|
|
|
|
break;
|
|
|
|
|
case SCAN_CODE_ENTER:
|
|
|
|
|
case SCAN_CODE_INS:
|
|
|
|
|
AddDisk();
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
EAX = key_editbox;
|
|
|
|
|
edit_box_key stdcall(#edit_disk_size);
|
2015-02-27 04:44:22 +03:00
|
|
|
|
break;
|
2012-11-26 19:26:15 +04:00
|
|
|
|
}
|
|
|
|
|
break;
|
2013-03-01 17:00:21 +04:00
|
|
|
|
case evReDraw:
|
2020-04-18 02:52:24 +03:00
|
|
|
|
sc.get();
|
|
|
|
|
DefineAndDrawWindow(170,150,405,290,0x74,sc.work,"Virtual Disk Manager 0.69",0);
|
2013-03-01 17:00:21 +04:00
|
|
|
|
GetProcessInfo(#Form, SelfInfo);
|
2013-09-14 19:59:07 +04:00
|
|
|
|
if (Form.status_window>2) break;
|
2013-03-01 17:00:21 +04:00
|
|
|
|
|
2020-04-18 02:52:24 +03:00
|
|
|
|
DrawBar(0,0, Form.cwidth,TOPPANELH, sc.work);
|
|
|
|
|
DrawBar(0,TOPPANELH, Form.cwidth,1, sc.work_graph);
|
|
|
|
|
WriteText(6, 9, 0x90, sc.work_text, SIZE_TEXT);
|
|
|
|
|
DrawRectangle(edit_disk_size.left-1, edit_disk_size.top-1, edit_disk_size.width+2, 23,sc.work_graph);
|
2020-04-11 18:48:27 +03:00
|
|
|
|
edit_box_draw stdcall (#edit_disk_size);
|
2016-11-05 13:13:29 +03:00
|
|
|
|
x = 6 + DrawStandartCaptButton(6, 36, 10, T_ADD_DISK);
|
|
|
|
|
DrawStandartCaptButton(x, 36, 11, T_DELETE_DISK);
|
2020-04-11 18:48:27 +03:00
|
|
|
|
_PutImage(6+6, 42, 14,14, #icons_btn);
|
|
|
|
|
_PutImage(x+6, 42, 14,14, 14*14*3+#icons_btn);
|
2013-03-01 17:00:21 +04:00
|
|
|
|
GetDisks();
|
|
|
|
|
DrawTmpDisks();
|
2012-11-26 19:26:15 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-02-27 04:44:22 +03:00
|
|
|
|
|
2018-10-31 19:50:25 +03:00
|
|
|
|
void GetNewSizeDisk()
|
2013-10-17 02:56:46 +04:00
|
|
|
|
{
|
|
|
|
|
int fr;
|
2016-02-22 00:57:22 +03:00
|
|
|
|
fr = GetFreeRAM() / 5 * 2;
|
2013-10-17 02:56:46 +04:00
|
|
|
|
fr = itoa(fr / 2048);
|
2015-02-27 04:44:22 +03:00
|
|
|
|
strcpy(#new_disk_size, fr);
|
2018-10-29 14:39:31 +03:00
|
|
|
|
EditBox_UpdateText(#edit_disk_size, edit_disk_size.flags);
|
2013-10-17 02:56:46 +04:00
|
|
|
|
edit_box_draw stdcall (#edit_disk_size);
|
|
|
|
|
}
|
2012-11-26 19:26:15 +04:00
|
|
|
|
|
2015-02-27 04:44:22 +03:00
|
|
|
|
|
2012-11-26 19:26:15 +04:00
|
|
|
|
void OpenTmpDisk()
|
|
|
|
|
{
|
2015-02-27 04:44:22 +03:00
|
|
|
|
unsigned char eol_param[10];
|
2012-11-26 19:26:15 +04:00
|
|
|
|
if (!disk_num) return;
|
|
|
|
|
strcpy(#eol_param, "/tmp#/1/");
|
2015-02-27 04:44:22 +03:00
|
|
|
|
eol_param[4] = disk_list[selected].Item[3];
|
2012-11-26 19:26:15 +04:00
|
|
|
|
RunProgram("/sys/File managers/Eolite", #eol_param);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void GetDisks()
|
|
|
|
|
{
|
|
|
|
|
unsigned int j, fcount=30;
|
2015-02-27 04:44:22 +03:00
|
|
|
|
unsigned char disk_name[10];
|
2012-11-26 19:26:15 +04:00
|
|
|
|
|
|
|
|
|
mem_Free(devbuf);
|
|
|
|
|
devbuf= mem_Alloc(32);
|
|
|
|
|
ReadDir(0, devbuf, "/");
|
|
|
|
|
fcount=ESDWORD[devbuf+8];
|
|
|
|
|
mem_Free(devbuf);
|
|
|
|
|
devbuf = mem_Alloc(fcount+1*304+32);
|
|
|
|
|
ReadDir(fcount, devbuf, "/");
|
|
|
|
|
|
|
|
|
|
disk_num=0;
|
|
|
|
|
for (j=0; j<fcount; j++;)
|
|
|
|
|
{
|
|
|
|
|
strcpy(#disk_name, j*304+devbuf+72);
|
|
|
|
|
if (disk_name[0]!='t') continue;
|
|
|
|
|
strcpy(#disk_list[disk_num].Item, #disk_name);
|
|
|
|
|
disk_num++;
|
|
|
|
|
}
|
|
|
|
|
if (disk_num>12) disk_num=12;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2018-10-31 19:50:25 +03:00
|
|
|
|
dword GetDiskSize(dword disk_n)
|
|
|
|
|
{
|
|
|
|
|
BDVK bdvk;
|
|
|
|
|
char tmp_path[8];
|
2020-04-11 18:48:27 +03:00
|
|
|
|
strcpy(#tmp_path, "/tmp#/1");
|
2018-10-31 19:50:25 +03:00
|
|
|
|
tmp_path[4] = disk_n + '0';
|
|
|
|
|
GetFileInfo(#tmp_path, #bdvk);
|
|
|
|
|
return bdvk.sizelo;
|
|
|
|
|
}
|
|
|
|
|
|
2016-11-05 13:13:29 +03:00
|
|
|
|
unsigned int disk_pos_x[]={13,13,13,102,102,102,191,191,191,279,279,279};
|
|
|
|
|
unsigned int disk_pos_y[]={79,127,175, 79,127,175, 79,127,175, 79,127,175};
|
2012-11-26 19:26:15 +04:00
|
|
|
|
|
|
|
|
|
void DrawTmpDisks()
|
|
|
|
|
{
|
2018-10-31 19:50:25 +03:00
|
|
|
|
#define SELECTION_ACTIVE 0x0080FF;
|
|
|
|
|
#define SELECTION_INACTIVE 0x757489;
|
2016-10-31 14:27:15 +03:00
|
|
|
|
dword selection_color;
|
2013-10-05 02:02:44 +04:00
|
|
|
|
char free_ram_text[60];
|
2020-04-11 18:48:27 +03:00
|
|
|
|
byte i;
|
2015-02-27 04:44:22 +03:00
|
|
|
|
|
2016-02-11 05:22:34 +03:00
|
|
|
|
DrawBar(0,TOPPANELH+1, Form.cwidth,Form.cheight-TOPPANELH-BOTPANELH-2, 0xFFFFFF);
|
2020-04-18 02:52:24 +03:00
|
|
|
|
DrawBar(0,Form.cheight-BOTPANELH-1, Form.cwidth,1, sc.work_graph);
|
|
|
|
|
DrawBar(0,Form.cheight-BOTPANELH, Form.cwidth,BOTPANELH, sc.work);
|
2020-04-11 18:48:27 +03:00
|
|
|
|
sprintf(#free_ram_text, FREE_RAM_TEXT, GetFreeRAM()/1024);
|
2020-04-18 02:52:24 +03:00
|
|
|
|
WriteText(10, Form.cheight-20, 0x90, sc.work_text, #free_ram_text);
|
2012-11-26 19:26:15 +04:00
|
|
|
|
if (disk_num==0)
|
|
|
|
|
{
|
2016-11-05 13:13:29 +03:00
|
|
|
|
WriteText(17,TOPPANELH+15, 0x90, 0x777777, INTRO_TEXT_1);
|
|
|
|
|
WriteText(17,TOPPANELH+15+15, 0x90, 0x777777, INTRO_TEXT_2);
|
|
|
|
|
WriteText(17,TOPPANELH+15+42, 0x90, 0x777777, INTRO_TEXT_3);
|
2012-11-26 19:26:15 +04:00
|
|
|
|
return;
|
|
|
|
|
};
|
2013-03-01 17:00:21 +04:00
|
|
|
|
if (selected>=disk_num) selected=disk_num-1; //restore selected
|
2020-04-11 18:48:27 +03:00
|
|
|
|
for (i=0; i<10; i++)
|
2012-11-26 19:26:15 +04:00
|
|
|
|
{
|
2020-04-11 18:48:27 +03:00
|
|
|
|
DeleteButton(20+i);
|
|
|
|
|
if (i>=disk_num) continue;
|
2016-11-05 13:13:29 +03:00
|
|
|
|
DefineButton(disk_pos_x[i], disk_pos_y[i], 80, 40, 20+i, 0xFFFfff);
|
2020-04-11 18:48:27 +03:00
|
|
|
|
WriteText(disk_pos_x[i]+29,disk_pos_y[i]+6, 0x90, 0x222222, #disk_list[i].Item);
|
|
|
|
|
WriteText(disk_pos_x[i]+30,disk_pos_y[i]+24, 0x80, 0x555555,
|
|
|
|
|
ConvertSize(GetDiskSize(disk_list[i].Item[3] - '0')));
|
|
|
|
|
_PutImage(disk_pos_x[i]+9,disk_pos_y[i]+10, 15,9, #disk_icon);
|
2016-01-10 18:31:02 +03:00
|
|
|
|
if (selected==i) {
|
2018-10-31 19:50:25 +03:00
|
|
|
|
if ( edit_disk_size.flags & ed_focus)
|
|
|
|
|
selection_color = SELECTION_INACTIVE;
|
|
|
|
|
else
|
|
|
|
|
selection_color = SELECTION_ACTIVE;
|
2016-11-05 13:13:29 +03:00
|
|
|
|
DrawWideRectangle(disk_pos_x[i], disk_pos_y[i], 80, 40, 2, selection_color);
|
2016-01-10 18:31:02 +03:00
|
|
|
|
PutPixel(disk_pos_x[i], disk_pos_y[i], 0xFFFfff);
|
|
|
|
|
}
|
2012-11-26 19:26:15 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-02-27 04:44:22 +03:00
|
|
|
|
|
2012-11-26 19:26:15 +04:00
|
|
|
|
void AddDisk()
|
|
|
|
|
{
|
2015-02-27 04:44:22 +03:00
|
|
|
|
byte i, j, err;
|
2012-11-26 19:26:15 +04:00
|
|
|
|
if (disk_num>=10)
|
|
|
|
|
{
|
|
|
|
|
notify(NOTIFY_TEXT_DISK_LIMIT);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2013-08-10 21:47:40 +04:00
|
|
|
|
|
2012-11-26 19:26:15 +04:00
|
|
|
|
param[0]='a';
|
|
|
|
|
for (i=0; i<9; i++)
|
|
|
|
|
{
|
|
|
|
|
for (j=0; j<=disk_num; j++)
|
|
|
|
|
{
|
|
|
|
|
if (i+48==disk_list[j].Item[3]) continue 1;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
2013-08-10 21:47:40 +04:00
|
|
|
|
|
2012-11-26 19:26:15 +04:00
|
|
|
|
param[1]=i+48;
|
2013-08-10 21:47:40 +04:00
|
|
|
|
param[2]='s';
|
|
|
|
|
param[3]='\0';
|
2015-02-27 04:44:22 +03:00
|
|
|
|
strcat(#param, #new_disk_size);
|
2013-03-01 17:00:21 +04:00
|
|
|
|
err = Console_Work();
|
|
|
|
|
if ((err!=0) && (err<7)) notify(rezult_text[err]);
|
2012-12-06 11:49:06 +04:00
|
|
|
|
pause(5);
|
2012-11-26 19:26:15 +04:00
|
|
|
|
GetDisks();
|
|
|
|
|
DrawTmpDisks();
|
2018-10-31 19:50:25 +03:00
|
|
|
|
GetNewSizeDisk();
|
2012-11-26 19:26:15 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2015-02-27 04:44:22 +03:00
|
|
|
|
void DelDisk()
|
|
|
|
|
{
|
|
|
|
|
byte err;
|
|
|
|
|
if (disk_num==0)
|
|
|
|
|
{
|
|
|
|
|
notify(NOTIFY_TEXT_NO_DISK);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2018-10-01 19:41:14 +03:00
|
|
|
|
if (disk_list[selected].Item[3]=='0') && (! key_modifier & KEY_LSHIFT) && (! key_modifier & KEY_RSHIFT)
|
|
|
|
|
{
|
|
|
|
|
notify(NOTIFY_SYSTEM_DISK0);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2015-02-27 04:44:22 +03:00
|
|
|
|
param[0]='d';
|
|
|
|
|
param[1]=disk_list[selected].Item[3];
|
|
|
|
|
err = byte Console_Work();
|
|
|
|
|
if ((err!=0) && (err<7)) notify(rezult_text[err]);
|
|
|
|
|
pause(15);
|
|
|
|
|
GetDisks();
|
|
|
|
|
DrawTmpDisks();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2012-11-26 19:26:15 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|