From a5a4548ce4ecaf5fff3b293a931820edf108664b Mon Sep 17 00:00:00 2001 From: y4my4my4m <8145020+y4my4my4m@users.noreply.github.com> Date: Fri, 25 Aug 2023 01:11:34 +0900 Subject: [PATCH] NetToggle and WallPaper Stats --- src/Demo/Graphics/WallPaperDolDoc.ZC | 16 ++++ src/Home/Net/Utilities/NetLog.ZC | 5 + src/Home/Wallpapers/Desktop/MakeHome.ZC | 10 +- src/Home/Wallpapers/Desktop/WallPaper.ZC | 113 ++++++++++++++++++++--- 4 files changed, 129 insertions(+), 15 deletions(-) diff --git a/src/Demo/Graphics/WallPaperDolDoc.ZC b/src/Demo/Graphics/WallPaperDolDoc.ZC index 66707edb..fd85cea6 100755 --- a/src/Demo/Graphics/WallPaperDolDoc.ZC +++ b/src/Demo/Graphics/WallPaperDolDoc.ZC @@ -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") { diff --git a/src/Home/Net/Utilities/NetLog.ZC b/src/Home/Net/Utilities/NetLog.ZC index ddb0719c..c16728a6 100755 --- a/src/Home/Net/Utilities/NetLog.ZC +++ b/src/Home/Net/Utilities/NetLog.ZC @@ -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); diff --git a/src/Home/Wallpapers/Desktop/MakeHome.ZC b/src/Home/Wallpapers/Desktop/MakeHome.ZC index 5b86d674..94310952 100755 --- a/src/Home/Wallpapers/Desktop/MakeHome.ZC +++ b/src/Home/Wallpapers/Desktop/MakeHome.ZC @@ -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("..");; diff --git a/src/Home/Wallpapers/Desktop/WallPaper.ZC b/src/Home/Wallpapers/Desktop/WallPaper.ZC index 99db5192..90ae9361 100755 --- a/src/Home/Wallpapers/Desktop/WallPaper.ZC +++ b/src/Home/Wallpapers/Desktop/WallPaper.ZC @@ -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; } ; N L -TERMINALn 6 5 1  BBS !60&Telnet \ No newline at end of file +TERMINALn 6 5 1  BBS !60&Telnet9 N L +NetLog8 N L +Stats \ No newline at end of file