tmpdisk 0.45: show error notifications from GUI, free RAM size indication

git-svn-id: svn://kolibrios.org@3306 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2013-03-01 13:00:21 +00:00
parent 1d49faceef
commit 088f181657
5 changed files with 52 additions and 67 deletions

View File

@ -1,9 +1,8 @@
del lang.h
echo #define LANG_ENG 1 >lang.h--
@del lang.h
@echo #define LANG_ENG 1 >lang.h--
..\C--\C-- tmpdisk.c
del tmpdisk
rename tmpdisk.com tmpdisk
rem ..\C--\kpack tmpdisk
pause
del warning.txt
@del tmpdisk
@rename tmpdisk.com tmpdisk
@del warning.txt
@pause

View File

@ -1,9 +1,8 @@
del lang.h
echo #define LANG_RUS 1 >lang.h--
@del lang.h
@echo #define LANG_RUS 1 >lang.h--
..\C--\C-- tmpdisk.c /lst
del tmpdisk
rename tmpdisk.com tmpdisk
rem ..\C--\kpack tmpdisk
pause
del warning.txt
..\C--\C-- tmpdisk.c
@del tmpdisk
@rename tmpdisk.com tmpdisk
@del warning.txt
@pause

View File

@ -18,13 +18,13 @@
"unknown IOCTL code, wrong input/output size...",
"DiskId must be from 0 to 9",
"DiskSize is too large",
"DiskSize is too small",
"DiskSize is too small, may be too less free RAM",
"memory allocation failed",
"unknown error O_o",
0};
//#endif
void Console_Work()
char Console_Work()
{
unsigned int disk_size, driver_rezult;
char size_t[256];
@ -81,5 +81,6 @@ void Console_Work()
driver_rezult = RuleDriver(#ioctl);
if (driver_rezult<7) debug(rezult_text[driver_rezult]);
return driver_rezult;
}

View File

@ -47,13 +47,15 @@ unsigned char dsize[30];
edit_box edit1= {40,20,200,0xffffff,0x94AECE,0x94AECE,0x94AECE,0,4,#dsize,#mouse_dd,100000000000010b};
unsigned char icons[14*56] = FROM "icons.raw";
#define TOPPANELH 30
#define BOTPANELH 20
void Main_Window()
{
unsigned int id;
unsigned char key;
unsigned int id, key, err;
int i, x;
mem_Init();
if (load_dll2(boxlib, #edit_box_draw,0)!=0)
@ -83,7 +85,8 @@ void Main_Window()
}
param[0]='d';
param[1]=disk_list[selected].Item[3];
Console_Work();
err = Console_Work();
if ((err!=0) && (err<7)) notify(rezult_text[err]);
pause(15);
GetDisks();
DrawTmpDisks();
@ -127,8 +130,24 @@ void Main_Window()
//EAX=key<<8;
//edit_box_key stdcall(#edit1);
break;
case evReDraw:
Draw_Window();
case evReDraw:
sc.get();
DefineAndDrawWindow(170,150,314,250,0x74,sc.work,"Virtual Disk Manager 0.45",0);
GetProcessInfo(#Form, SelfInfo);
if (Form.status_window>2) return;
DrawBar(0,0, Form.cwidth,TOPPANELH, sc.work);
DrawBar(0,TOPPANELH, Form.cwidth,1, sc.work_graph);
x=6;
for (i=0; i<2; i++)
{
DefineButton(x,5, strlen(but_text[i])*6+28,19, 10+i, sc.work_button);
_PutImage(x+3,8, 14,14, i*14*14*3+#icons);
WriteText(x+22,11, 0x80, sc.work_button_text, but_text[i]);
x+=strlen(but_text[i])*6+37;
}
GetDisks();
DrawTmpDisks();
}
}
}
@ -175,7 +194,12 @@ unsigned int disk_pos_y[]={40,65,90,40,65,90,40,65,90,40,65,90};
void DrawTmpDisks()
{
int i;
DrawBar(0,31, Form.width-9,Form.height-GetSkinHeight()-5-30, 0xFFFFFF);
DrawBar(0,31, 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(GetFreeRAM()/2048));
WriteText(strlen(itoa(GetFreeRAM()/2048))*6 + 100, Form.cheight-13, 0x80, sc.work_text, " MB");
if (disk_num==0)
{
WriteText(17,45, 0x90, 0x777777, INTRO_TEXT_1);
@ -183,7 +207,7 @@ void DrawTmpDisks()
WriteText(17,45+42, 0x90, 0x777777, INTRO_TEXT_3);
return;
};
if (selected>=disk_num) selected=disk_num-1; //âîññòàíàâëèâàåò âûäåëåíèå - õîðîøàÿ ôè÷à
if (selected>=disk_num) selected=disk_num-1; //restore selected
for (i=0; i<10; i++) DeleteButton(20+i);
for (i=0; i<disk_num; i++)
{
@ -196,7 +220,7 @@ void DrawTmpDisks()
void AddDisk()
{
unsigned int i, j;
unsigned int i, j, err;
if (disk_num>=10)
{
notify(NOTIFY_TEXT_DISK_LIMIT);
@ -212,52 +236,13 @@ void AddDisk()
break;
}
param[1]=i+48;
Console_Work();
err = Console_Work();
if ((err!=0) && (err<7)) notify(rezult_text[err]);
pause(5);
GetDisks();
DrawTmpDisks();
}
void Draw_Window()
{
int i, x;
sc.get();
DefineAndDrawWindow(170,150,314,250,0x74,sc.work,"Virtual Disk Manager 0.4",0);
GetProcessInfo(#Form, SelfInfo);
if (Form.status_window>2) return;
//ðèñóåì ïàíåëü
DrawBar(0,0, Form.width-9,30, sc.work);
DrawBar(0,30, Form.width-9,1, sc.work_graph);
x=6;
for (i=0; i<2; i++)
{
DefineButton(x,5, strlen(but_text[i])*6+28,19, 10+i, sc.work_button);
_PutImage(x+3,8, 14,14, i*14*14*3+#icons);
WriteText(x+22,11, 0x80, sc.work_button_text, but_text[i]);
x+=strlen(but_text[i])*6+37;
}
GetDisks();
DrawTmpDisks();
//AddPanel();
}
/*void AddPanel()
{
DrawBar(0,Form.height-GetSkinHeight()-40, Form.width-9,1, sc.work_graph);
DrawBar(0,Form.height-GetSkinHeight()-39, Form.width-9,35, sc.work);
strcpy(#dsize, itoa(GetFreeRAM()/10));
//strcpy(#dsize, "100");
edit1.size=edit1.pos=strlen(#dsize);
edit_box_draw stdcall(#edit1); //ðèñóåì ñòðîêó àäðåñà
//DefineButton(-strlen(but_text[2])+Form.width-9,200, strlen(but_text[2])*6+28,19, 12, sc.work_button);
//_PutImage(-strlen(but_text[2])+Form.width-9+3,200+3, 14,14, 2*14*14*3+#icons);
}*/

View File

@ -1,3 +1,4 @@
#define MEMSIZE 0x8E80
#include "..\lib\kolibri.h"
#include "..\lib\strings.h"
#include "..\lib\file_system.h"
@ -50,7 +51,7 @@ int driver_handle;
void main()
{
debug("========= tmpdisk 0.4 =========");
debug("========= tmpdisk 0.45 =========");
driver_handle = LoadDriver("tmpdisk");
if (driver_handle==0)
{