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
|
#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[]={
|
char *rezult_text[]={
|
||||||
"®¯¥à æ¨ï ãá¯¥è® § ¢¥àè¥ ",
|
"®¯¥à æ¨ï ãá¯¥è® § ¢¥àè¥ ",
|
||||||
"¥¨§¢¥áâë© IOCTL, ¥¢¥àë© à §¬¥à ¯à¥¤®áâ ¢«ï¥¬ëå ¤ ëå...",
|
"¥¨§¢¥áâë© IOCTL, ¥¢¥àë© à §¬¥à ¯à¥¤®áâ ¢«ï¥¬ëå ¤ ëå...",
|
||||||
@ -13,6 +17,10 @@
|
|||||||
"¥¨§¢¥áâ ï ®è¨¡ª O_o",
|
"¥¨§¢¥áâ ï ®è¨¡ª O_o",
|
||||||
0};
|
0};
|
||||||
#else
|
#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[]={
|
char *rezult_text[]={
|
||||||
"operation completed successfully",
|
"operation completed successfully",
|
||||||
"unknown IOCTL code, wrong input/output size...",
|
"unknown IOCTL code, wrong input/output size...",
|
||||||
@ -42,7 +50,7 @@ char Console_Work()
|
|||||||
ExitProcess();
|
ExitProcess();
|
||||||
break;
|
break;
|
||||||
case 'd': //óäàëèòü äèñê
|
case 'd': //óäàëèòü äèñê
|
||||||
debug("trying to delete disk");
|
debug(DELETE_DISK_TEXT);
|
||||||
del_disk.DiskId = param[1]-'0';
|
del_disk.DiskId = param[1]-'0';
|
||||||
ioctl.handle = driver_handle;
|
ioctl.handle = driver_handle;
|
||||||
ioctl.io_code = DEV_DEL_DISK;
|
ioctl.io_code = DEV_DEL_DISK;
|
||||||
@ -52,20 +60,19 @@ char Console_Work()
|
|||||||
ioctl.out_size = 0;
|
ioctl.out_size = 0;
|
||||||
break;
|
break;
|
||||||
case 'a': //äîáàâèòü äèñê
|
case 'a': //äîáàâèòü äèñê
|
||||||
debug("trying to add disk");
|
debug(ADD_DISK_TEXT);
|
||||||
disk_size= strchr(#param, 's');
|
disk_size= strchr(#param, 's');
|
||||||
if (!disk_size)
|
if (!disk_size)
|
||||||
{
|
{
|
||||||
add_disk.DiskSize = GetFreeRAM() / 5;
|
add_disk.DiskSize = GetFreeRAM() / 5;
|
||||||
debug("disk size is not specified");
|
debug(DONT_KNOW_DISK_SIZE_TEXT);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
add_disk.DiskSize = atoi(#param+disk_size)*2048;
|
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';
|
add_disk.DiskId = param[1]-'0';
|
||||||
ioctl.handle = driver_handle;
|
ioctl.handle = driver_handle;
|
||||||
ioctl.io_code = DEV_ADD_DISK;
|
ioctl.io_code = DEV_ADD_DISK;
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
?define NOTIFY_TEXT_NO_DISK "„«ï ç « ¤®¡ ¢ì⥠å®âï ¡ë ®¤¨ ¤¨áª"
|
?define NOTIFY_TEXT_NO_DISK "„«ï ç « ¤®¡ ¢ì⥠å®âï ¡ë ®¤¨ ¤¨áª"
|
||||||
?define NOTIFY_TEXT_DISK_LIMIT "„®á⨣ã⠯।¥« ª®«¨ç¥á⢠¢¨àâã «ìëå ¤¨áª®¢"
|
?define NOTIFY_TEXT_DISK_LIMIT "„®á⨣ã⠯।¥« ª®«¨ç¥á⢠¢¨àâã «ìëå ¤¨áª®¢"
|
||||||
|
?define FREE_RAM_TEXT "<EFBFBD> §¬¥à ᢮¡®¤®© ®¯¥à ⨢®© ¯ ¬ïâ¨: "
|
||||||
|
|
||||||
#else
|
#else
|
||||||
unsigned char *but_text[]={
|
unsigned char *but_text[]={
|
||||||
@ -32,6 +33,7 @@
|
|||||||
|
|
||||||
?define NOTIFY_TEXT_NO_DISK "You need to have at least one disk"
|
?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 NOTIFY_TEXT_DISK_LIMIT "Reached the limit of the number of virtual disks"
|
||||||
|
?define FREE_RAM_TEXT "Free RAM size: "
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct path_string { unsigned char Item[256]; };
|
struct path_string { unsigned char Item[256]; };
|
||||||
@ -51,12 +53,8 @@ unsigned char icons[14*56] = FROM "icons.raw";
|
|||||||
#define BOTPANELH 20
|
#define BOTPANELH 20
|
||||||
|
|
||||||
int mouse_dd;
|
int mouse_dd;
|
||||||
char disk_size[30]="\0";
|
char disk_size[30];
|
||||||
#ifdef LANG_RUS
|
edit_box edit_disk_size= {50,0,5,0xffffff,0x94AECE,0x000000,0xffffff,0,4,#disk_size,#mouse_dd, 1000000000000010b};
|
||||||
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
|
|
||||||
|
|
||||||
void Main_Window()
|
void Main_Window()
|
||||||
{
|
{
|
||||||
@ -69,13 +67,14 @@ void Main_Window()
|
|||||||
fr = itoa(fr / 2048);
|
fr = itoa(fr / 2048);
|
||||||
strcat(#disk_size, fr);
|
strcat(#disk_size, fr);
|
||||||
edit_disk_size.size = strlen(#disk_size);
|
edit_disk_size.size = strlen(#disk_size);
|
||||||
|
edit_disk_size.left = strlen(INTRO_TEXT_4)*6 + 10;
|
||||||
SetEventMask(0x27);
|
SetEventMask(0x27);
|
||||||
loop()
|
loop()
|
||||||
{
|
{
|
||||||
switch(WaitEvent())
|
switch(WaitEvent())
|
||||||
{
|
{
|
||||||
case evMouse:
|
case evMouse:
|
||||||
IF (GetProcessSlot(Form.ID)-GetActiveProcess()!=0) break;
|
if (GetProcessSlot(Form.ID)-GetActiveProcess()!=0) break;
|
||||||
edit_box_mouse stdcall (#edit_disk_size);
|
edit_box_mouse stdcall (#edit_disk_size);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -157,27 +156,20 @@ void Main_Window()
|
|||||||
break;
|
break;
|
||||||
case evReDraw:
|
case evReDraw:
|
||||||
sc.get();
|
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);
|
GetProcessInfo(#Form, SelfInfo);
|
||||||
if (Form.status_window>2) break;
|
if (Form.status_window>2) break;
|
||||||
|
|
||||||
DrawBar(0,0, Form.cwidth,TOPPANELH, sc.work);
|
DrawBar(0,0, Form.cwidth,TOPPANELH, sc.work);
|
||||||
DrawBar(0,TOPPANELH, Form.cwidth,1, sc.work_graph);
|
DrawBar(0,TOPPANELH, Form.cwidth,1, sc.work_graph);
|
||||||
#ifdef LANG_RUS
|
|
||||||
WriteText(6, 9, 0x80, sc.work_text, INTRO_TEXT_4);
|
WriteText(6, 9, 0x80, sc.work_text, INTRO_TEXT_4);
|
||||||
WriteText(117, 9, 0x80, sc.work_text, "MB.");
|
WriteText(edit_disk_size.left + edit_disk_size.width + 8, 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
|
|
||||||
edit_box_draw stdcall (#edit_disk_size);
|
edit_box_draw stdcall (#edit_disk_size);
|
||||||
x=6;
|
for (i=0, x=6; i<2; i++, x+=strlen(but_text[i])*6+37)
|
||||||
for (i=0; i<2; i++)
|
|
||||||
{
|
{
|
||||||
DefineButton(x,25, strlen(but_text[i])*6+28,19, 10+i, sc.work_button);
|
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);
|
_PutImage(x+3,28, 14,14, i*14*14*3+#icons);
|
||||||
WriteText(x+22,31, 0x80, sc.work_button_text, but_text[i]);
|
WriteText(x+22,31, 0x80, sc.work_button_text, but_text[i]);
|
||||||
x+=strlen(but_text[i])*6+37;
|
|
||||||
}
|
}
|
||||||
GetDisks();
|
GetDisks();
|
||||||
DrawTmpDisks();
|
DrawTmpDisks();
|
||||||
@ -226,13 +218,15 @@ unsigned int disk_pos_y[]={60,85,110,60,85,110,60,85,110,60,85,110};
|
|||||||
|
|
||||||
void DrawTmpDisks()
|
void DrawTmpDisks()
|
||||||
{
|
{
|
||||||
|
char free_ram_text[60];
|
||||||
int i,FreeRAM=GetFreeRAM()/1024;
|
int i,FreeRAM=GetFreeRAM()/1024;
|
||||||
DrawBar(0,51, Form.cwidth,Form.cheight-TOPPANELH-BOTPANELH-2, 0xFFFFFF);
|
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-1, Form.cwidth,1, sc.work_graph);
|
||||||
DrawBar(0,Form.cheight-BOTPANELH, Form.cwidth,BOTPANELH, sc.work);
|
DrawBar(0,Form.cheight-BOTPANELH, Form.cwidth,BOTPANELH, sc.work);
|
||||||
WriteText(10, Form.cheight-13, 0x80, sc.work_text, "Free RAM size:");
|
strcpy(#free_ram_text, FREE_RAM_TEXT);
|
||||||
WriteText(100, Form.cheight-13, 0x80, sc.work_text, itoa(FreeRAM));
|
strcat(#free_ram_text, itoa(FreeRAM));
|
||||||
WriteText(strlen(itoa(FreeRAM))*6 + 100, Form.cheight-13, 0x80, sc.work_text, " MB");
|
strcat(#free_ram_text, " MB");
|
||||||
|
WriteText(10, Form.cheight-13, 0x80, sc.work_text, #free_ram_text);
|
||||||
if (disk_num==0)
|
if (disk_num==0)
|
||||||
{
|
{
|
||||||
WriteText(17,65, 0x90, 0x777777, INTRO_TEXT_1);
|
WriteText(17,65, 0x90, 0x777777, INTRO_TEXT_1);
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////
|
||||||
///////////////////////// ®¡« áâì ¤ ëå ////////////////////
|
///////////////////////// Program data ////////////////////
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
struct ioctl_struct
|
struct ioctl_struct
|
||||||
@ -43,7 +43,7 @@ del_disk_struc del_disk;
|
|||||||
int driver_handle;
|
int driver_handle;
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////
|
||||||
///////////////////////// êîä ////////////////////
|
///////////////////////// Code ////////////////////
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////
|
||||||
#include "t_console.c"
|
#include "t_console.c"
|
||||||
#include "t_window.c"
|
#include "t_window.c"
|
||||||
@ -51,12 +51,11 @@ int driver_handle;
|
|||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
debug("========= tmpdisk 0.45 =========");
|
|
||||||
driver_handle = LoadDriver("tmpdisk");
|
driver_handle = LoadDriver("tmpdisk");
|
||||||
if (driver_handle==0)
|
if (driver_handle==0)
|
||||||
{
|
{
|
||||||
notify("error: /rd1/1/drivers/tmpdisk.obj driver loading failed");
|
notify("error: /rd1/1/drivers/tmpdisk.obj driver loading failed");
|
||||||
notify("program terminated");
|
notify("virtual disk wouldn't be added");
|
||||||
ExitProcess();
|
ExitProcess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user