diff --git a/programs/cmm/tmpdisk/t_console.c b/programs/cmm/tmpdisk/t_console.c index 0f7ae6ae02..0c66322974 100644 --- a/programs/cmm/tmpdisk/t_console.c +++ b/programs/cmm/tmpdisk/t_console.c @@ -3,6 +3,10 @@ ///////////////////////////////////////////////////////////////////////////////////////// #ifdef LANG_RUS + ?define ADD_DISK_TEXT "пробую добавить виртуальный диск" + ?define DELETE_DISK_TEXT "пробую удалить виртуальный диск" + ?define DONT_KNOW_DISK_SIZE_TEXT "его размер не указан, 10% свободной ОЗУ будет использовано" + ?define NEW_DISK_TEXT "размер диска будет: " char *rezult_text[]={ "операция успешно завершена", "неизвестный IOCTL, неверный размер предоставляемых данных...", @@ -13,6 +17,10 @@ "неизвестная ошибка O_o", 0}; #else + ?define ADD_DISK_TEXT "trying to add disk" + ?define DELETE_DISK_TEXT "trying to delete virtual disk" + ?define DONT_KNOW_DISK_SIZE_TEXT "its size is not specified, 10% from free RAM will be used" + ?define NEW_DISK_TEXT "new DiskSize: " char *rezult_text[]={ "operation completed successfully", "unknown IOCTL code, wrong input/output size...", @@ -42,7 +50,7 @@ char Console_Work() ExitProcess(); break; case 'd': //єфрышЄ№ фшёъ - debug("trying to delete disk"); + debug(DELETE_DISK_TEXT); del_disk.DiskId = param[1]-'0'; ioctl.handle = driver_handle; ioctl.io_code = DEV_DEL_DISK; @@ -52,20 +60,19 @@ char Console_Work() ioctl.out_size = 0; break; case 'a': //фюсртшЄ№ фшёъ - debug("trying to add disk"); + debug(ADD_DISK_TEXT); disk_size= strchr(#param, 's'); if (!disk_size) { add_disk.DiskSize = GetFreeRAM() / 5; - debug("disk size is not specified"); - strcpy(#size_t, "10% from free RAM will be used, new DiskSize: "); - strcat(#size_t, itoa(add_disk.DiskSize/2048)); - strcat(#size_t, " MB"); - debug(#size_t); + debug(DONT_KNOW_DISK_SIZE_TEXT); } else add_disk.DiskSize = atoi(#param+disk_size)*2048; - + strcpy(#size_t, NEW_DISK_TEXT); + strcat(#size_t, itoa(add_disk.DiskSize/2048)); + strcat(#size_t, " MB"); + debug(#size_t); add_disk.DiskId = param[1]-'0'; ioctl.handle = driver_handle; ioctl.io_code = DEV_ADD_DISK; diff --git a/programs/cmm/tmpdisk/t_window.c b/programs/cmm/tmpdisk/t_window.c index 770ac9b1dc..b072cd95c6 100644 --- a/programs/cmm/tmpdisk/t_window.c +++ b/programs/cmm/tmpdisk/t_window.c @@ -17,6 +17,7 @@ ?define NOTIFY_TEXT_NO_DISK "Для начала добавьте хотя бы один диск" ?define NOTIFY_TEXT_DISK_LIMIT "Достигнут предел количества виртуальных дисков" + ?define FREE_RAM_TEXT "Размер свободной оперативной памяти: " #else unsigned char *but_text[]={ @@ -32,6 +33,7 @@ ?define NOTIFY_TEXT_NO_DISK "You need to have at least one disk" ?define NOTIFY_TEXT_DISK_LIMIT "Reached the limit of the number of virtual disks" + ?define FREE_RAM_TEXT "Free RAM size: " #endif struct path_string { unsigned char Item[256]; }; @@ -51,12 +53,8 @@ unsigned char icons[14*56] = FROM "icons.raw"; #define BOTPANELH 20 int mouse_dd; -char disk_size[30]="\0"; -#ifdef LANG_RUS -edit_box edit_disk_size= {60,50,5,0xffffff,0x94AECE,0x000000,0xffffff,0,sizeof(disk_size)+2,#disk_size,#mouse_dd, 0b100000000000000}; -#else -edit_box edit_disk_size= {60,40,5,0xffffff,0x94AECE,0x000000,0xffffff,0,sizeof(disk_size)+2,#disk_size,#mouse_dd, 0b100000000000000}; -#endif +char disk_size[30]; +edit_box edit_disk_size= {50,0,5,0xffffff,0x94AECE,0x000000,0xffffff,0,4,#disk_size,#mouse_dd, 1000000000000010b}; void Main_Window() { @@ -69,13 +67,14 @@ void Main_Window() fr = itoa(fr / 2048); strcat(#disk_size, fr); edit_disk_size.size = strlen(#disk_size); + edit_disk_size.left = strlen(INTRO_TEXT_4)*6 + 10; SetEventMask(0x27); loop() { switch(WaitEvent()) { case evMouse: - IF (GetProcessSlot(Form.ID)-GetActiveProcess()!=0) break; + if (GetProcessSlot(Form.ID)-GetActiveProcess()!=0) break; edit_box_mouse stdcall (#edit_disk_size); break; @@ -157,27 +156,20 @@ void Main_Window() break; case evReDraw: sc.get(); - DefineAndDrawWindow(170,150,314,270,0x74,sc.work,"Virtual Disk Manager 0.47",0); + DefineAndDrawWindow(170,150,314,270,0x74,sc.work,"Virtual Disk Manager 0.5",0); GetProcessInfo(#Form, SelfInfo); if (Form.status_window>2) break; DrawBar(0,0, Form.cwidth,TOPPANELH, sc.work); DrawBar(0,TOPPANELH, Form.cwidth,1, sc.work_graph); - #ifdef LANG_RUS WriteText(6, 9, 0x80, sc.work_text, INTRO_TEXT_4); - WriteText(117, 9, 0x80, sc.work_text, "MB."); - #else - WriteText(6, 9, 0x80, sc.work_text, INTRO_TEXT_4); - WriteText(107, 9, 0x80, sc.work_text, "MB."); - #endif + WriteText(edit_disk_size.left + edit_disk_size.width + 8, 9, 0x80, sc.work_text, "MB."); edit_box_draw stdcall (#edit_disk_size); - x=6; - for (i=0; i<2; i++) + for (i=0, x=6; i<2; i++, x+=strlen(but_text[i])*6+37) { DefineButton(x,25, strlen(but_text[i])*6+28,19, 10+i, sc.work_button); _PutImage(x+3,28, 14,14, i*14*14*3+#icons); WriteText(x+22,31, 0x80, sc.work_button_text, but_text[i]); - x+=strlen(but_text[i])*6+37; } GetDisks(); DrawTmpDisks(); @@ -226,13 +218,15 @@ unsigned int disk_pos_y[]={60,85,110,60,85,110,60,85,110,60,85,110}; void DrawTmpDisks() { + char free_ram_text[60]; int i,FreeRAM=GetFreeRAM()/1024; DrawBar(0,51, Form.cwidth,Form.cheight-TOPPANELH-BOTPANELH-2, 0xFFFFFF); DrawBar(0,Form.cheight-BOTPANELH-1, Form.cwidth,1, sc.work_graph); DrawBar(0,Form.cheight-BOTPANELH, Form.cwidth,BOTPANELH, sc.work); - WriteText(10, Form.cheight-13, 0x80, sc.work_text, "Free RAM size:"); - WriteText(100, Form.cheight-13, 0x80, sc.work_text, itoa(FreeRAM)); - WriteText(strlen(itoa(FreeRAM))*6 + 100, Form.cheight-13, 0x80, sc.work_text, " MB"); + strcpy(#free_ram_text, FREE_RAM_TEXT); + strcat(#free_ram_text, itoa(FreeRAM)); + strcat(#free_ram_text, " MB"); + WriteText(10, Form.cheight-13, 0x80, sc.work_text, #free_ram_text); if (disk_num==0) { WriteText(17,65, 0x90, 0x777777, INTRO_TEXT_1); diff --git a/programs/cmm/tmpdisk/tmpdisk.c b/programs/cmm/tmpdisk/tmpdisk.c index 2926a046b8..b9a6cab068 100644 --- a/programs/cmm/tmpdisk/tmpdisk.c +++ b/programs/cmm/tmpdisk/tmpdisk.c @@ -8,7 +8,7 @@ #endif ///////////////////////////////////////////////////////////////////////////////////////// -///////////////////////// область данных //////////////////// +///////////////////////// Program data //////////////////// ///////////////////////////////////////////////////////////////////////////////////////// struct ioctl_struct @@ -43,7 +43,7 @@ del_disk_struc del_disk; int driver_handle; ///////////////////////////////////////////////////////////////////////////////////////// -///////////////////////// ъюф //////////////////// +///////////////////////// Code //////////////////// ///////////////////////////////////////////////////////////////////////////////////////// #include "t_console.c" #include "t_window.c" @@ -51,12 +51,11 @@ int driver_handle; void main() { - debug("========= tmpdisk 0.45 ========="); driver_handle = LoadDriver("tmpdisk"); if (driver_handle==0) { notify("error: /rd1/1/drivers/tmpdisk.obj driver loading failed"); - notify("program terminated"); + notify("virtual disk wouldn't be added"); ExitProcess(); }