forked from KolibriOS/kolibrios
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:
parent
1d49faceef
commit
088f181657
@ -1,9 +1,8 @@
|
|||||||
del lang.h
|
@del lang.h
|
||||||
echo #define LANG_ENG 1 >lang.h--
|
@echo #define LANG_ENG 1 >lang.h--
|
||||||
|
|
||||||
..\C--\C-- tmpdisk.c
|
..\C--\C-- tmpdisk.c
|
||||||
del tmpdisk
|
@del tmpdisk
|
||||||
rename tmpdisk.com tmpdisk
|
@rename tmpdisk.com tmpdisk
|
||||||
rem ..\C--\kpack tmpdisk
|
@del warning.txt
|
||||||
pause
|
@pause
|
||||||
del warning.txt
|
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
del lang.h
|
@del lang.h
|
||||||
echo #define LANG_RUS 1 >lang.h--
|
@echo #define LANG_RUS 1 >lang.h--
|
||||||
|
|
||||||
..\C--\C-- tmpdisk.c /lst
|
..\C--\C-- tmpdisk.c
|
||||||
del tmpdisk
|
@del tmpdisk
|
||||||
rename tmpdisk.com tmpdisk
|
@rename tmpdisk.com tmpdisk
|
||||||
rem ..\C--\kpack tmpdisk
|
@del warning.txt
|
||||||
pause
|
@pause
|
||||||
del warning.txt
|
|
||||||
|
@ -18,13 +18,13 @@
|
|||||||
"unknown IOCTL code, wrong input/output size...",
|
"unknown IOCTL code, wrong input/output size...",
|
||||||
"DiskId must be from 0 to 9",
|
"DiskId must be from 0 to 9",
|
||||||
"DiskSize is too large",
|
"DiskSize is too large",
|
||||||
"DiskSize is too small",
|
"DiskSize is too small, may be too less free RAM",
|
||||||
"memory allocation failed",
|
"memory allocation failed",
|
||||||
"unknown error O_o",
|
"unknown error O_o",
|
||||||
0};
|
0};
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
void Console_Work()
|
char Console_Work()
|
||||||
{
|
{
|
||||||
unsigned int disk_size, driver_rezult;
|
unsigned int disk_size, driver_rezult;
|
||||||
char size_t[256];
|
char size_t[256];
|
||||||
@ -81,5 +81,6 @@ void Console_Work()
|
|||||||
|
|
||||||
driver_rezult = RuleDriver(#ioctl);
|
driver_rezult = RuleDriver(#ioctl);
|
||||||
if (driver_rezult<7) debug(rezult_text[driver_rezult]);
|
if (driver_rezult<7) debug(rezult_text[driver_rezult]);
|
||||||
|
return driver_rezult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,13 +47,15 @@ unsigned char dsize[30];
|
|||||||
edit_box edit1= {40,20,200,0xffffff,0x94AECE,0x94AECE,0x94AECE,0,4,#dsize,#mouse_dd,100000000000010b};
|
edit_box edit1= {40,20,200,0xffffff,0x94AECE,0x94AECE,0x94AECE,0,4,#dsize,#mouse_dd,100000000000010b};
|
||||||
|
|
||||||
unsigned char icons[14*56] = FROM "icons.raw";
|
unsigned char icons[14*56] = FROM "icons.raw";
|
||||||
|
#define TOPPANELH 30
|
||||||
|
#define BOTPANELH 20
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Main_Window()
|
void Main_Window()
|
||||||
{
|
{
|
||||||
unsigned int id;
|
unsigned int id, key, err;
|
||||||
unsigned char key;
|
int i, x;
|
||||||
|
|
||||||
mem_Init();
|
mem_Init();
|
||||||
if (load_dll2(boxlib, #edit_box_draw,0)!=0)
|
if (load_dll2(boxlib, #edit_box_draw,0)!=0)
|
||||||
@ -83,7 +85,8 @@ void Main_Window()
|
|||||||
}
|
}
|
||||||
param[0]='d';
|
param[0]='d';
|
||||||
param[1]=disk_list[selected].Item[3];
|
param[1]=disk_list[selected].Item[3];
|
||||||
Console_Work();
|
err = Console_Work();
|
||||||
|
if ((err!=0) && (err<7)) notify(rezult_text[err]);
|
||||||
pause(15);
|
pause(15);
|
||||||
GetDisks();
|
GetDisks();
|
||||||
DrawTmpDisks();
|
DrawTmpDisks();
|
||||||
@ -127,8 +130,24 @@ void Main_Window()
|
|||||||
//EAX=key<<8;
|
//EAX=key<<8;
|
||||||
//edit_box_key stdcall(#edit1);
|
//edit_box_key stdcall(#edit1);
|
||||||
break;
|
break;
|
||||||
case evReDraw:
|
case evReDraw:
|
||||||
Draw_Window();
|
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()
|
void DrawTmpDisks()
|
||||||
{
|
{
|
||||||
int i;
|
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)
|
if (disk_num==0)
|
||||||
{
|
{
|
||||||
WriteText(17,45, 0x90, 0x777777, INTRO_TEXT_1);
|
WriteText(17,45, 0x90, 0x777777, INTRO_TEXT_1);
|
||||||
@ -183,7 +207,7 @@ void DrawTmpDisks()
|
|||||||
WriteText(17,45+42, 0x90, 0x777777, INTRO_TEXT_3);
|
WriteText(17,45+42, 0x90, 0x777777, INTRO_TEXT_3);
|
||||||
return;
|
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<10; i++) DeleteButton(20+i);
|
||||||
for (i=0; i<disk_num; i++)
|
for (i=0; i<disk_num; i++)
|
||||||
{
|
{
|
||||||
@ -196,7 +220,7 @@ void DrawTmpDisks()
|
|||||||
|
|
||||||
void AddDisk()
|
void AddDisk()
|
||||||
{
|
{
|
||||||
unsigned int i, j;
|
unsigned int i, j, err;
|
||||||
if (disk_num>=10)
|
if (disk_num>=10)
|
||||||
{
|
{
|
||||||
notify(NOTIFY_TEXT_DISK_LIMIT);
|
notify(NOTIFY_TEXT_DISK_LIMIT);
|
||||||
@ -212,52 +236,13 @@ void AddDisk()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
param[1]=i+48;
|
param[1]=i+48;
|
||||||
Console_Work();
|
err = Console_Work();
|
||||||
|
if ((err!=0) && (err<7)) notify(rezult_text[err]);
|
||||||
pause(5);
|
pause(5);
|
||||||
GetDisks();
|
GetDisks();
|
||||||
DrawTmpDisks();
|
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);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#define MEMSIZE 0x8E80
|
||||||
#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"
|
||||||
@ -50,7 +51,7 @@ int driver_handle;
|
|||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
debug("========= tmpdisk 0.4 =========");
|
debug("========= tmpdisk 0.45 =========");
|
||||||
driver_handle = LoadDriver("tmpdisk");
|
driver_handle = LoadDriver("tmpdisk");
|
||||||
if (driver_handle==0)
|
if (driver_handle==0)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user