mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-25 15:10:28 +00:00
NetToggle and WallPaper Stats
This commit is contained in:
parent
0a518e23ac
commit
a5a4548ce4
4 changed files with 129 additions and 15 deletions
|
@ -4,6 +4,8 @@ CDoc *wallpaper_doc;
|
|||
RegDefault("Wallpapers/Current", "1;\n");
|
||||
RegExe("Wallpapers/Current");
|
||||
|
||||
Bool show_stats = FALSE;
|
||||
|
||||
U0 WallPaperSet(I8 direction) {
|
||||
CDirEntry *tmpde1;
|
||||
// read the current wallpaper index from the registry
|
||||
|
@ -36,6 +38,20 @@ U0 WallPaperSet(I8 direction) {
|
|||
Sys("WallPaperDolDocInit(\"~/Wallpapers/1024/%d.DD\");\n", current);
|
||||
}
|
||||
|
||||
U0 WallPaperToggle()
|
||||
{
|
||||
if (Fs != sys_task)
|
||||
{
|
||||
"\nMust be ran as system";
|
||||
return;
|
||||
}
|
||||
|
||||
show_stats = !show_stats;
|
||||
if(show_stats)
|
||||
sys_winmgr_task->display_doc = old_wall_paper;
|
||||
else
|
||||
sys_winmgr_task->display_doc = wallpaper_doc;
|
||||
}
|
||||
|
||||
U0 WallPaperDolDocInit(I64 filepath="::/Home/Wallpapers/Default.DD")
|
||||
{
|
||||
|
|
|
@ -30,6 +30,11 @@ U0 NetLogInit()
|
|||
}
|
||||
|
||||
U0 NetLogToggle() {
|
||||
if (Fs != sys_task)
|
||||
{
|
||||
"\nMust be ran as system";
|
||||
return;
|
||||
}
|
||||
net_log_enabled = !net_log_enabled;
|
||||
if(!net_log_enabled)
|
||||
Kill(net_log_task);
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
Cd(__DIR__);;
|
||||
|
||||
// Takes 2 boot to see but whatever
|
||||
|
||||
// Takes 2 boot to see but whatever
|
||||
Silent;
|
||||
Copy("WallPaper.ZC", "::/System/WallPaper.ZC");
|
||||
Silent(OFF); //no output to screen
|
||||
|
||||
#include "~/PaletteEditor/Palettes/Tradition"
|
||||
PaletteSetTradition;
|
||||
|
||||
#include "::/Demo/Graphics/WallPaperDolDoc"
|
||||
WallPaperSet(0);
|
||||
|
||||
|
@ -24,11 +26,11 @@ Silent(OFF);
|
|||
|
||||
#include "~/HomeSys"
|
||||
|
||||
// Hide SysLog
|
||||
Yuugure;
|
||||
|
||||
// Start Net
|
||||
Sys("#include \"::/Home/Net/Start\"");
|
||||
Sys("NetLogToggle;");
|
||||
|
||||
Yuugure;
|
||||
|
||||
|
||||
Cd("..");;
|
||||
|
|
|
@ -160,7 +160,7 @@ U0 WallPaper(CTask *_task)
|
|||
if (sys_data_bp)
|
||||
i += sys_data_bp->alloced_u8s - sys_data_bp->used_u8s;
|
||||
StrPrint(wall->top_line,
|
||||
" ð %3tZ %02d/%02d/%02d %02d:%02d:%02d ³ FPS: %2tf ³ Mem: %010X ³ CPU: ",
|
||||
" đ %3tZ %02d/%02d/%02d %02d:%02d:%02d ł FPS: %2tf ł Mem: %010X ł CPU: ",
|
||||
ds.day_of_week, "ST_DAYS_OF_WEEK", ds.mon, ds.day_of_mon, ds.year % 100,
|
||||
ds.hour, ds.min, ds.sec, winmgr.fps, i);
|
||||
}
|
||||
|
@ -224,6 +224,18 @@ $SP,"<4>",BI=4,BP="::/Home/DesktopIcons.DD,3"$
|
|||
|
||||
|
||||
|
||||
$SP,"<5>",BI=5$
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$SP,"<6>",BI=6$
|
||||
|
||||
|
||||
|
||||
|
||||
U0 DrawTermBttn(CDC *dc, CCtrl *c)
|
||||
{
|
||||
Sprite3(dc, c->left-8, c->top-8, 0, $IB,"<1>",BI=1$);
|
||||
|
@ -371,7 +383,7 @@ CCtrl *PaletteIconNew()
|
|||
c->draw_it = &DrawPaletteIcon;
|
||||
c->left_click = &LeftClickPaletteIcon;
|
||||
|
||||
SpriteExtents($IB,"<5>",BI=5$, &min_x, &max_x, &min_y, &max_y);
|
||||
SpriteExtents($IB,"<7>",BI=7$, &min_x, &max_x, &min_y, &max_y);
|
||||
//min must be zerocp
|
||||
c->left = 8;
|
||||
c->right = c->left + (max_x - min_x);
|
||||
|
@ -384,18 +396,97 @@ CCtrl *PaletteIconNew()
|
|||
return c;
|
||||
}
|
||||
|
||||
|
||||
U0 DrawNetLogBttn(CDC *dc, CCtrl *c)
|
||||
{
|
||||
Sprite3(dc, c->left-8, c->top-8, 0, $IB,"<5>",BI=5$);
|
||||
}
|
||||
|
||||
U0 LeftClickNetLogBttn(CCtrl *, I64, I64, Bool down)
|
||||
{
|
||||
if(down)
|
||||
Sys("NetLogToggle;");
|
||||
}
|
||||
|
||||
CCtrl *NetLogIconNew()
|
||||
{
|
||||
I64 min_x, max_x, min_y, max_y;
|
||||
CCtrl *c = SysCAlloc(sizeof(CCtrl));
|
||||
|
||||
c->win_task = sys_winmgr_task;
|
||||
c->flags = CTRLF_SHOW;
|
||||
c->type = CTRLT_GENERIC;
|
||||
c->draw_it = &DrawNetLogBttn;
|
||||
c->left_click = &LeftClickNetLogBttn;
|
||||
|
||||
SpriteExtents($IB,"<5>",BI=5$, &min_x, &max_x, &min_y, &max_y);
|
||||
//min must be zero
|
||||
c->left = sys_winmgr_task->pix_width - (max_x - min_x + 1);
|
||||
c->right = c->left + (max_x - min_x + 1) - 1;
|
||||
c->top = sys_winmgr_task->pix_height - (max_y - min_y + 1) - 40;
|
||||
c->bottom = c->top + (max_y - min_y + 1) - 1;
|
||||
|
||||
QueueInsert(c, sys_winmgr_task->last_ctrl);
|
||||
TaskDerivedValsUpdate(sys_winmgr_task);
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
U0 DrawShowStatsBttn(CDC *dc, CCtrl *c)
|
||||
{
|
||||
Sprite3(dc, c->left-8, c->top-8, 0, $IB,"<6>",BI=6$);
|
||||
}
|
||||
|
||||
U0 LeftClickShowStatsBttn(CCtrl *, I64, I64, Bool down)
|
||||
{
|
||||
if(down)
|
||||
Sys("WallPaperToggle;");
|
||||
}
|
||||
|
||||
CCtrl *ShowStatsIconNew()
|
||||
{
|
||||
I64 min_x, max_x, min_y, max_y;
|
||||
CCtrl *c = SysCAlloc(sizeof(CCtrl));
|
||||
|
||||
c->win_task = sys_winmgr_task;
|
||||
c->flags = CTRLF_SHOW;
|
||||
c->type = CTRLT_GENERIC;
|
||||
c->draw_it = &DrawShowStatsBttn;
|
||||
c->left_click = &LeftClickShowStatsBttn;
|
||||
|
||||
SpriteExtents($IB,"<6>",BI=6$, &min_x, &max_x, &min_y, &max_y);
|
||||
//min must be zero
|
||||
c->left = sys_winmgr_task->pix_width - (max_x - min_x + 1);
|
||||
c->right = c->left + (max_x - min_x + 1) - 1;
|
||||
c->top = sys_winmgr_task->pix_height - (max_y - min_y + 1) - 80;
|
||||
c->bottom = c->top + (max_y - min_y + 1) - 1;
|
||||
|
||||
QueueInsert(c, sys_winmgr_task->last_ctrl);
|
||||
TaskDerivedValsUpdate(sys_winmgr_task);
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
U0 WallPaperInit(Bool enableTermIcon = TRUE, Bool enableDesktopIcons = TRUE)
|
||||
{
|
||||
if(enableTermIcon)
|
||||
TermBttnNew;
|
||||
if(enableDesktopIcons)
|
||||
{
|
||||
HomeIconNew;
|
||||
TelnetIconNew;
|
||||
PaletteIconNew;
|
||||
}
|
||||
if(enableTermIcon)
|
||||
{
|
||||
TermBttnNew;
|
||||
NetLogIconNew;
|
||||
ShowStatsIconNew;
|
||||
|
||||
}
|
||||
if(enableDesktopIcons)
|
||||
{
|
||||
HomeIconNew;
|
||||
TelnetIconNew;
|
||||
PaletteIconNew;
|
||||
}
|
||||
gr.fp_wall_paper = &WallPaper;
|
||||
}
|
||||
|
||||
|