TmpDisk 0.5: better translation, optimizations
git-svn-id: svn://kolibrios.org@3975 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
234f8b76b2
commit
521fc78528
@ -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;
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
?define NOTIFY_TEXT_NO_DISK "„«ï ç « ¤®¡ ¢ì⥠å®âï ¡ë ®¤¨ ¤¨áª"
|
||||
?define NOTIFY_TEXT_DISK_LIMIT "„®á⨣ã⠯।¥« ª®«¨ç¥á⢠¢¨àâã «ìëå ¤¨áª®¢"
|
||||
?define FREE_RAM_TEXT "<EFBFBD> §¬¥à ᢮¡®¤®© ®¯¥à ⨢®© ¯ ¬ïâ¨: "
|
||||
|
||||
#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);
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user