NetToggle and WallPaper Stats

This commit is contained in:
y4my4my4m 2023-08-25 01:11:34 +09:00
parent 0a518e23ac
commit a5a4548ce4
4 changed files with 129 additions and 15 deletions

View file

@ -4,6 +4,8 @@ CDoc *wallpaper_doc;
RegDefault("Wallpapers/Current", "1;\n"); RegDefault("Wallpapers/Current", "1;\n");
RegExe("Wallpapers/Current"); RegExe("Wallpapers/Current");
Bool show_stats = FALSE;
U0 WallPaperSet(I8 direction) { U0 WallPaperSet(I8 direction) {
CDirEntry *tmpde1; CDirEntry *tmpde1;
// read the current wallpaper index from the registry // read the current wallpaper index from the registry
@ -36,6 +38,20 @@ U0 WallPaperSet(I8 direction) {
Sys("WallPaperDolDocInit(\"~/Wallpapers/1024/%d.DD\");\n", current); 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") U0 WallPaperDolDocInit(I64 filepath="::/Home/Wallpapers/Default.DD")
{ {

View file

@ -30,6 +30,11 @@ U0 NetLogInit()
} }
U0 NetLogToggle() { U0 NetLogToggle() {
if (Fs != sys_task)
{
"\nMust be ran as system";
return;
}
net_log_enabled = !net_log_enabled; net_log_enabled = !net_log_enabled;
if(!net_log_enabled) if(!net_log_enabled)
Kill(net_log_task); Kill(net_log_task);

View file

@ -1,12 +1,14 @@
Cd(__DIR__);; Cd(__DIR__);;
// Takes 2 boot to see but whatever
// Takes 2 boot to see but whatever
Silent; Silent;
Copy("WallPaper.ZC", "::/System/WallPaper.ZC"); Copy("WallPaper.ZC", "::/System/WallPaper.ZC");
Silent(OFF); //no output to screen Silent(OFF); //no output to screen
#include "~/PaletteEditor/Palettes/Tradition" #include "~/PaletteEditor/Palettes/Tradition"
PaletteSetTradition; PaletteSetTradition;
#include "::/Demo/Graphics/WallPaperDolDoc" #include "::/Demo/Graphics/WallPaperDolDoc"
WallPaperSet(0); WallPaperSet(0);
@ -24,11 +26,11 @@ Silent(OFF);
#include "~/HomeSys" #include "~/HomeSys"
// Hide SysLog
Yuugure;
// Start Net // Start Net
Sys("#include \"::/Home/Net/Start\""); Sys("#include \"::/Home/Net/Start\"");
Sys("NetLogToggle;");
Yuugure;
Cd("..");; Cd("..");;

View file

@ -160,7 +160,7 @@ U0 WallPaper(CTask *_task)
if (sys_data_bp) if (sys_data_bp)
i += sys_data_bp->alloced_u8s - sys_data_bp->used_u8s; i += sys_data_bp->alloced_u8s - sys_data_bp->used_u8s;
StrPrint(wall->top_line, 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.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); 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) U0 DrawTermBttn(CDC *dc, CCtrl *c)
{ {
Sprite3(dc, c->left-8, c->top-8, 0, $IB,"<1>",BI=1$); Sprite3(dc, c->left-8, c->top-8, 0, $IB,"<1>",BI=1$);
@ -371,7 +383,7 @@ CCtrl *PaletteIconNew()
c->draw_it = &DrawPaletteIcon; c->draw_it = &DrawPaletteIcon;
c->left_click = &LeftClickPaletteIcon; 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 //min must be zerocp
c->left = 8; c->left = 8;
c->right = c->left + (max_x - min_x); c->right = c->left + (max_x - min_x);
@ -384,10 +396,87 @@ CCtrl *PaletteIconNew()
return c; 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) U0 WallPaperInit(Bool enableTermIcon = TRUE, Bool enableDesktopIcons = TRUE)
{ {
if(enableTermIcon) if(enableTermIcon)
{
TermBttnNew; TermBttnNew;
NetLogIconNew;
ShowStatsIconNew;
}
if(enableDesktopIcons) if(enableDesktopIcons)
{ {
HomeIconNew; HomeIconNew;
@ -398,4 +487,6 @@ U0 WallPaperInit(Bool enableTermIcon = TRUE, Bool enableDesktopIcons = TRUE)
} }
; N L ; N L
TERMINALn 6 5 1  BBS !60&Telnet TERMINALn 6 5 1  BBS !60&Telnet9 N L
NetLog8 N L
Stats