mirror of
https://github.com/KolibriOS/kolibrios.git
synced 2024-12-16 20:02:35 +03:00
tmpdisk 0.46: add field for disk size
git-svn-id: svn://kolibrios.org@3866 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
2cb1ab7e42
commit
6c763c9b39
@ -2,17 +2,17 @@
|
|||||||
///////////////////////// êîíñîëü ////////////////////
|
///////////////////////// êîíñîëü ////////////////////
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
/*#ifdef LANG_RUS
|
#ifdef LANG_RUS
|
||||||
char *rezult_text[]={
|
char *rezult_text[]={
|
||||||
"операция успешно завершена"w,
|
"®¯¥à æ¨ï ãá¯¥è® § ¢¥àè¥ ",
|
||||||
"неизвестный IOCTL, неверный размер предоставляемых данных..."w,
|
"¥¨§¢¥áâë© IOCTL, ¥¢¥àë© à §¬¥à ¯à¥¤®áâ ¢«ï¥¬ëå ¤ ëå...",
|
||||||
"номер диска должен быть от 0 до 9"w,
|
"®¬¥à ¤¨áª ¤®«¦¥ ¡ëâì ®â 0 ¤® 9",
|
||||||
"размер создаваемого диска слишком велик"w,
|
"à §¬¥à ᮧ¤ ¢ ¥¬®£® ¤¨áª ᫨誮¬ ¢¥«¨ª",
|
||||||
"размер создаваемого диска слишком мал"w,
|
"à §¬¥à ᮧ¤ ¢ ¥¬®£® ¤¨áª ᫨誮¬ ¬ «",
|
||||||
"ошибка выделения памяти"w,
|
"®è¨¡ª ¢ë¤¥«¥¨ï ¯ ¬ïâ¨",
|
||||||
"неизвестная ошибка O_o"w,
|
"¥¨§¢¥áâ ï ®è¨¡ª O_o",
|
||||||
0};
|
0};
|
||||||
#else*/
|
#else
|
||||||
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...",
|
||||||
@ -22,7 +22,7 @@
|
|||||||
"memory allocation failed",
|
"memory allocation failed",
|
||||||
"unknown error O_o",
|
"unknown error O_o",
|
||||||
0};
|
0};
|
||||||
//#endif
|
#endif
|
||||||
|
|
||||||
char Console_Work()
|
char Console_Work()
|
||||||
{
|
{
|
||||||
@ -30,6 +30,7 @@ char Console_Work()
|
|||||||
char size_t[256];
|
char size_t[256];
|
||||||
|
|
||||||
strlwr(#param);
|
strlwr(#param);
|
||||||
|
debug(#param);
|
||||||
|
|
||||||
switch (param[0])
|
switch (param[0])
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include "..\lib\figures.h"
|
#include "..\lib\figures.h"
|
||||||
#include "..\lib\mem.h"
|
#include "..\lib\mem.h"
|
||||||
#include "..\lib\dll.h"
|
#include "..\lib\dll.h"
|
||||||
|
#include "..\lib\lib.obj\box_lib.h"
|
||||||
|
|
||||||
#ifdef LANG_RUS
|
#ifdef LANG_RUS
|
||||||
unsigned char *but_text[]={
|
unsigned char *but_text[]={
|
||||||
@ -12,6 +13,7 @@
|
|||||||
?define INTRO_TEXT_1 "‡¤¥áì ¡ã¤¥â ®â®¡à ¦ âìáï ᯨ᮪"
|
?define INTRO_TEXT_1 "‡¤¥áì ¡ã¤¥â ®â®¡à ¦ âìáï ᯨ᮪"
|
||||||
?define INTRO_TEXT_2 "¢¨àâã «ìëå ¤¨áª®¢ ¢ á¨á⥬¥."
|
?define INTRO_TEXT_2 "¢¨àâã «ìëå ¤¨áª®¢ ¢ á¨á⥬¥."
|
||||||
?define INTRO_TEXT_3 "<EFBFBD>®¯à®¡ã©â¥ ¤®¡ ¢¨âì ®¤¨..."
|
?define INTRO_TEXT_3 "<EFBFBD>®¯à®¡ã©â¥ ¤®¡ ¢¨âì ®¤¨..."
|
||||||
|
?define INTRO_TEXT_4 "<EFBFBD> §¬¥à:"
|
||||||
|
|
||||||
?define NOTIFY_TEXT_NO_DISK "„«ï ç « ¤®¡ ¢ì⥠å®âï ¡ë ®¤¨ ¤¨áª"
|
?define NOTIFY_TEXT_NO_DISK "„«ï ç « ¤®¡ ¢ì⥠å®âï ¡ë ®¤¨ ¤¨áª"
|
||||||
?define NOTIFY_TEXT_DISK_LIMIT "„®á⨣ã⠯।¥« ª®«¨ç¥á⢠¢¨àâã «ìëå ¤¨áª®¢"
|
?define NOTIFY_TEXT_DISK_LIMIT "„®á⨣ã⠯।¥« ª®«¨ç¥á⢠¢¨àâã «ìëå ¤¨áª®¢"
|
||||||
@ -26,6 +28,7 @@
|
|||||||
?define INTRO_TEXT_1 " There will be list of mounted"
|
?define INTRO_TEXT_1 " There will be list of mounted"
|
||||||
?define INTRO_TEXT_2 " virtual disks."
|
?define INTRO_TEXT_2 " virtual disks."
|
||||||
?define INTRO_TEXT_3 " Try to add one..."
|
?define INTRO_TEXT_3 " Try to add one..."
|
||||||
|
?define INTRO_TEXT_4 " Size:"
|
||||||
|
|
||||||
?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"
|
||||||
@ -41,25 +44,37 @@ int selected;
|
|||||||
system_colors sc;
|
system_colors sc;
|
||||||
proc_info Form;
|
proc_info Form;
|
||||||
|
|
||||||
int mouse_dd;
|
|
||||||
unsigned char dsize[30];
|
unsigned char dsize[30];
|
||||||
|
|
||||||
unsigned char icons[14*56] = FROM "icons.raw";
|
unsigned char icons[14*56] = FROM "icons.raw";
|
||||||
#define TOPPANELH 30
|
#define TOPPANELH 50
|
||||||
#define BOTPANELH 20
|
#define BOTPANELH 20
|
||||||
|
|
||||||
|
int mouse_dd;
|
||||||
|
char disk_size[30]="\0";
|
||||||
|
edit_box edit_disk_size= {60,48,5,0xffffff,0x94AECE,0x000000,0xffffff,0,sizeof(disk_size)+2,#disk_size,#mouse_dd, 1000000000000000b};
|
||||||
|
|
||||||
void Main_Window()
|
void Main_Window()
|
||||||
{
|
{
|
||||||
unsigned int id, key, err;
|
unsigned int id, key, err;
|
||||||
int i, x;
|
int i, x, fr;
|
||||||
|
|
||||||
mem_Init();
|
mem_Init();
|
||||||
|
if (load_dll2(boxlib, #box_lib_init,0)!=0) notify("Error while loading GUI library /sys/lib/boxlib.obj");
|
||||||
|
fr = GetFreeRAM() / 5;
|
||||||
|
fr = itoa(fr / 2048);
|
||||||
|
strcat(#disk_size, fr);
|
||||||
|
edit_disk_size.size = strlen(#disk_size);
|
||||||
|
SetEventMask(0x27);
|
||||||
loop()
|
loop()
|
||||||
{
|
{
|
||||||
switch(WaitEvent())
|
switch(WaitEvent())
|
||||||
{
|
{
|
||||||
|
case evMouse:
|
||||||
|
IF (GetProcessSlot(Form.ID)-GetActiveProcess()!=0) break;
|
||||||
|
edit_box_mouse stdcall (#edit_disk_size);
|
||||||
|
break;
|
||||||
|
|
||||||
case evButton:
|
case evButton:
|
||||||
id=GetButtonID();
|
id=GetButtonID();
|
||||||
if (id==1) ExitProcess();
|
if (id==1) ExitProcess();
|
||||||
@ -116,21 +131,26 @@ void Main_Window()
|
|||||||
selected+=3;
|
selected+=3;
|
||||||
DrawTmpDisks();
|
DrawTmpDisks();
|
||||||
}
|
}
|
||||||
|
EAX=key<<8;
|
||||||
|
edit_box_key stdcall(#edit_disk_size);
|
||||||
break;
|
break;
|
||||||
case evReDraw:
|
case evReDraw:
|
||||||
sc.get();
|
sc.get();
|
||||||
DefineAndDrawWindow(170,150,314,250,0x74,sc.work,"Virtual Disk Manager 0.45",0);
|
DefineAndDrawWindow(170,150,314,270,0x74,sc.work,"Virtual Disk Manager 0.46",0);
|
||||||
GetProcessInfo(#Form, SelfInfo);
|
GetProcessInfo(#Form, SelfInfo);
|
||||||
if (Form.status_window>2) return;
|
if (Form.status_window>2) return;
|
||||||
|
|
||||||
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);
|
||||||
|
WriteText(5, 9, 0x80, sc.work_text, INTRO_TEXT_4);
|
||||||
|
edit_box_draw stdcall (#edit_disk_size);
|
||||||
|
WriteText(115, 9, 0x80, sc.work_text, "MB.");
|
||||||
x=6;
|
x=6;
|
||||||
for (i=0; i<2; i++)
|
for (i=0; i<2; i++)
|
||||||
{
|
{
|
||||||
DefineButton(x,5, 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,8, 14,14, i*14*14*3+#icons);
|
_PutImage(x+3,28, 14,14, i*14*14*3+#icons);
|
||||||
WriteText(x+22,11, 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;
|
x+=strlen(but_text[i])*6+37;
|
||||||
}
|
}
|
||||||
GetDisks();
|
GetDisks();
|
||||||
@ -176,12 +196,12 @@ void GetDisks()
|
|||||||
|
|
||||||
|
|
||||||
unsigned int disk_pos_x[]={13,13,13,83,83,83,153,153,153,223,223,223};
|
unsigned int disk_pos_x[]={13,13,13,83,83,83,153,153,153,223,223,223};
|
||||||
unsigned int disk_pos_y[]={40,65,90,40,65,90,40,65,90,40,65,90};
|
unsigned int disk_pos_y[]={60,85,110,60,85,110,60,85,110,60,85,110};
|
||||||
|
|
||||||
void DrawTmpDisks()
|
void DrawTmpDisks()
|
||||||
{
|
{
|
||||||
int i,FreeRAM=GetFreeRAM()/1024;
|
int i,FreeRAM=GetFreeRAM()/1024;
|
||||||
DrawBar(0,31, 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:");
|
WriteText(10, Form.cheight-13, 0x80, sc.work_text, "Free RAM size:");
|
||||||
@ -189,9 +209,9 @@ void DrawTmpDisks()
|
|||||||
WriteText(strlen(itoa(FreeRAM))*6 + 100, Form.cheight-13, 0x80, sc.work_text, " MB");
|
WriteText(strlen(itoa(FreeRAM))*6 + 100, Form.cheight-13, 0x80, sc.work_text, " MB");
|
||||||
if (disk_num==0)
|
if (disk_num==0)
|
||||||
{
|
{
|
||||||
WriteText(17,45, 0x90, 0x777777, INTRO_TEXT_1);
|
WriteText(17,65, 0x90, 0x777777, INTRO_TEXT_1);
|
||||||
WriteText(17,45+15, 0x90, 0x777777, INTRO_TEXT_2);
|
WriteText(17,65+15, 0x90, 0x777777, INTRO_TEXT_2);
|
||||||
WriteText(17,45+42, 0x90, 0x777777, INTRO_TEXT_3);
|
WriteText(17,65+42, 0x90, 0x777777, INTRO_TEXT_3);
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
if (selected>=disk_num) selected=disk_num-1; //restore selected
|
if (selected>=disk_num) selected=disk_num-1; //restore selected
|
||||||
@ -213,6 +233,7 @@ void AddDisk()
|
|||||||
notify(NOTIFY_TEXT_DISK_LIMIT);
|
notify(NOTIFY_TEXT_DISK_LIMIT);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
param[0]='a';
|
param[0]='a';
|
||||||
for (i=0; i<9; i++)
|
for (i=0; i<9; i++)
|
||||||
{
|
{
|
||||||
@ -222,7 +243,11 @@ void AddDisk()
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
param[1]=i+48;
|
param[1]=i+48;
|
||||||
|
param[2]='s';
|
||||||
|
param[3]='\0';
|
||||||
|
strcat(#param, #disk_size);
|
||||||
err = Console_Work();
|
err = Console_Work();
|
||||||
if ((err!=0) && (err<7)) notify(rezult_text[err]);
|
if ((err!=0) && (err<7)) notify(rezult_text[err]);
|
||||||
pause(5);
|
pause(5);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#define MEMSIZE 0x8E80
|
#define MEMSIZE 0xA0000
|
||||||
#include "..\lib\kolibri.h"
|
#include "..\lib\kolibri.h"
|
||||||
#include "..\lib\strings.h"
|
#include "..\lib\strings.h"
|
||||||
#include "..\lib\file_system.h"
|
#include "..\lib\file_system.h"
|
||||||
@ -8,7 +8,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////
|
||||||
///////////////////////// îáëàñòü äàííûõ ////////////////////
|
///////////////////////// ®¡« áâì ¤ ëå ////////////////////
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
struct ioctl_struct
|
struct ioctl_struct
|
||||||
|
Loading…
Reference in New Issue
Block a user