From ac3e0cee2d8369933a45d52da82d48c2bf85363c Mon Sep 17 00:00:00 2001 From: TomAwezome Date: Thu, 30 Dec 2021 22:22:37 -0500 Subject: [PATCH] Implement WinTileGrid. --- src/Doc/ChangeLog.DD | 4 +++ src/Doc/StandBy.DD | 1 + src/Home/Net/Tests/ICMPTest.ZC | 22 ++++++++++++++ src/HomeKeyPlugIns.ZC | 7 +++++ src/Kernel/KGlobals.ZC | 2 +- src/System/Win.ZC | 53 +++++++++++++++++++++++++++++++++- 6 files changed, 87 insertions(+), 2 deletions(-) create mode 100755 src/Home/Net/Tests/ICMPTest.ZC diff --git a/src/Doc/ChangeLog.DD b/src/Doc/ChangeLog.DD index 08b75651..1c36f562 100755 --- a/src/Doc/ChangeLog.DD +++ b/src/Doc/ChangeLog.DD @@ -1,4 +1,8 @@ $WW,1$$FG,5$$TX+CX,"ChangeLog"$$FG$ +$IV,1$----12/30/21 22:08:17----$IV,0$ +* Raised version number to 1.08. +* Implemented $LK+PU,"WinTileGrid",A="MN:WinTileGrid"$. + $IV,1$----12/30/21 17:12:01----$IV,0$ * Added $LK+PU,"LexDemo",A="FI:::/Demo/Lectures/LexDemo.ZC"$. diff --git a/src/Doc/StandBy.DD b/src/Doc/StandBy.DD index 9327d90c..4ed2e933 100755 --- a/src/Doc/StandBy.DD +++ b/src/Doc/StandBy.DD @@ -16,6 +16,7 @@ $FG,2$ $FG$ Find $FG,2$ $FG$ Max Window $FG,2$ $FG$ Horz Tile $FG,2$ $FG$ Vert Tile +$FG,2$ $FG$ Grid Tile $FG,2$ $FG$ Text Menu $FG,2$ $FG$ God Word $FG,2$ $FG$ God Passage diff --git a/src/Home/Net/Tests/ICMPTest.ZC b/src/Home/Net/Tests/ICMPTest.ZC new file mode 100755 index 00000000..c2e9b23d --- /dev/null +++ b/src/Home/Net/Tests/ICMPTest.ZC @@ -0,0 +1,22 @@ + +U8 dst_mac[6] = {0xF0, 0x0D, 0xBE, 0xAD, 0xDE, 0xAF}; + +U32 dst_ip = 0x01020304; + +U0 ICMPTest() +{ + U8 *data_payload = CAlloc(8); + + *(data_payload(U64 *)) = EndianU64(0xDEADC0DEBEEFFADE); + + ARPCachePut(dst_ip, dst_mac); // Force entry into ARP Cache so IPV4 can match it with IPV4AddressMACGet + + while (TRUE) + { + ICMPReplySend(dst_ip, EndianU16(0xDEAD), EndianU16(0xBEEF), EndianU16(0xC0DE), data_payload, 8); + Sleep(300); + } + +} + +ICMPTest; \ No newline at end of file diff --git a/src/HomeKeyPlugIns.ZC b/src/HomeKeyPlugIns.ZC index 7e3f90e3..fdc3bda9 100755 --- a/src/HomeKeyPlugIns.ZC +++ b/src/HomeKeyPlugIns.ZC @@ -135,6 +135,13 @@ Bool MyPutKey(I64 ch, I64 sc) AutoComplete; return TRUE; + case 'g': + if (sc & SCF_KEY_DESC) + KeyDescSet("Cmd /WinTileGrid"); + else + WinTileGrid; + return TRUE; + case 'h': if (sc & SCF_KEY_DESC) KeyDescSet("Cmd /WinTileHorz"); diff --git a/src/Kernel/KGlobals.ZC b/src/Kernel/KGlobals.ZC index 7da5e5e5..46278cec 100755 --- a/src/Kernel/KGlobals.ZC +++ b/src/Kernel/KGlobals.ZC @@ -13,7 +13,7 @@ CTask *sys_winmgr_task, U8 *rev_bits_table; //Table with U8 bits reversed CDate local_time_offset; F64 *pow10_I64, - sys_os_version = 1.07; + sys_os_version = 1.08; CAutoCompleteDictGlobals acd; CAutoCompleteGlobals ac; diff --git a/src/System/Win.ZC b/src/System/Win.ZC index 1e952655..bc5cb976 100755 --- a/src/System/Win.ZC +++ b/src/System/Win.ZC @@ -495,7 +495,7 @@ public U0 WinTileHorz() c = 1; else if (c > 4) c = 4; - vert_size = (TEXT_ROWS -1) / c; + vert_size = (TEXT_ROWS - 1) / c; WinHorz(1 - no_border, TEXT_COLS - 2 + no_border, task); WinVert((i & 3) * vert_size + 2 - no_border, (i & 3 + 1) * vert_size + no_border, task); @@ -557,6 +557,57 @@ public U0 WinTileVert() POPFD } +public U0 WinTileGrid() +{//Tile windows in a grid. + CTask *task, *last_task = Fs; + I64 count, c, i, j, horz_size, vert_size, no_border; + + PUSHFD + CLI //TODO Multiprocessor safe + task = sys_winmgr_task; + count = 0; + do + { + if (!Bt(&task->win_inhibit, WIf_SELF_FOCUS)) + count++; + task = task->last_task; + } + while (task != sys_winmgr_task); + + task = sys_winmgr_task; + i = 0; + do + { + if (!Bt(&task->win_inhibit, WIf_SELF_FOCUS)) + { + no_border = Bt(&task->display_flags, DISPLAYf_NO_BORDER); + + c = 1 + i % 2; + vert_size = (TEXT_ROWS - 1) / c; + horz_size = TEXT_COLS / c; + + j = i % 4; + if (j < 2) // top half of screen + WinVert(2 - no_border, TEXT_ROWS / 2 - 1 + no_border, task); + else // bottom half of screen + WinVert(TEXT_ROWS / 2 + 1 - no_border, TEXT_ROWS - 2 + no_border, task); + + if (j % 2 == 0) // left half of screen + WinHorz(1 - no_border, TEXT_COLS / 2 - 1 + no_border, task); + else // right half of screen + WinHorz(TEXT_COLS / 2 + 1 - no_border, TEXT_COLS - 2 + no_border, task); + + last_task = task; + i++; + } + task = task->last_task; + } + while (task != sys_winmgr_task); + + POPFD +} + + public U0 WinMax(CTask *task = NULL) {//Maximize task's window I64 no_border;