mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-25 15:10:28 +00:00
Seperate features in different PRs
This commit is contained in:
parent
a5a4548ce4
commit
be3ca8f43f
30 changed files with 0 additions and 1400 deletions
|
@ -1,78 +0,0 @@
|
|||
U0 (*old_wall_paper)(CTask *task);
|
||||
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
|
||||
I64 current = RegExe("Wallpapers/Current");
|
||||
I64 max = 0;
|
||||
|
||||
// SysLog("Reading current wallpaper index from registry: %d\n", current);
|
||||
|
||||
// search the wallpapers directory for .DD files
|
||||
tmpde1 = FilesFind("~/Wallpapers/1024/*.DD", 1);
|
||||
if (tmpde1) {
|
||||
do {
|
||||
max++;
|
||||
tmpde1 = tmpde1->next;
|
||||
} while (tmpde1);
|
||||
}
|
||||
|
||||
// move to the next/previous wallpaper
|
||||
current += direction;
|
||||
if (current < 1)
|
||||
current = max; // wrap around to the end
|
||||
if (current > max)
|
||||
current = 1; // wrap around to the start
|
||||
|
||||
// write the new current index back to the registry
|
||||
RegWrite("Wallpapers/Current", "%d;\n", current);
|
||||
|
||||
// SysLog("Current: %d\n", current);
|
||||
// Change the wallpaper
|
||||
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")
|
||||
{
|
||||
if (Fs != sys_task)
|
||||
{
|
||||
"\nMust be System Included. (SHIFT-F5 / RightClick->System Include) \n";
|
||||
return;
|
||||
}
|
||||
old_wall_paper = gr.fp_wall_paper;
|
||||
wallpaper_doc = DocRead(filepath, DOCF_DBL_DOLLARS | DOCF_NO_CURSOR);
|
||||
|
||||
sys_winmgr_task->display_doc = wallpaper_doc;
|
||||
DocCursor(OFF, wallpaper_doc);
|
||||
|
||||
// if (gr_palette[0] > gr_palette[15])
|
||||
// Fs->text_attr = WHITE << 4 + WHITE;
|
||||
// else
|
||||
// Fs->text_attr = BLACK << 4 + BLACK;
|
||||
|
||||
|
||||
wallpaper_doc->win_task = sys_winmgr_task;
|
||||
|
||||
// gr.fp_wall_paper = &WallPaperDD;
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
// This is an NGINX reverse proxy configuration file for the Skynet Middleware
|
||||
|
||||
server {
|
||||
// set whatever port you'd like
|
||||
listen 9000;
|
||||
// replace the server name with yours
|
||||
server_name skynet.middleware.com;
|
||||
|
||||
# Custom log locations
|
||||
access_log /var/log/nginx/skynet_access.log;
|
||||
error_log /var/log/nginx/skynet_error.log;
|
||||
|
||||
location /gpt3 {
|
||||
proxy_pass https://api.openai.com/v1/completions; # GPT-3 endpoint
|
||||
|
||||
# Required for SSL verification with the upstream server (OpenAI)
|
||||
proxy_ssl_server_name on;
|
||||
proxy_ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
|
||||
proxy_ssl_session_reuse off;
|
||||
|
||||
# Headers for OpenAI
|
||||
// replace the sk-XXXX with your API key
|
||||
proxy_set_header Authorization "Bearer sk-XXXX";
|
||||
proxy_set_header Content-Type "application/json";
|
||||
|
||||
# Standard proxy headers
|
||||
proxy_set_header Host api.openai.com;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
}
|
||||
|
||||
location /chat {
|
||||
proxy_pass https://api.openai.com/v1/chat/completions; # ChatGPT endpoint
|
||||
|
||||
# Required for SSL verification with the upstream server (OpenAI)
|
||||
proxy_ssl_server_name on;
|
||||
proxy_ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
|
||||
proxy_ssl_session_reuse off;
|
||||
|
||||
# Headers for OpenAI
|
||||
// replace the sk-XXXX with your API key
|
||||
proxy_set_header Authorization "Bearer sk-XXXX";
|
||||
proxy_set_header Content-Type "application/json";
|
||||
|
||||
# Standard proxy headers
|
||||
proxy_set_header Host api.openai.com;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,170 +0,0 @@
|
|||
#define SERVER_ADDR "skynet.middleware.com"
|
||||
#define SERVER_PORT 9000
|
||||
#define INITIAL_BUF_SIZE 2048
|
||||
#define DEFAULT_SYSTEMPROMPT "You are a helpful assistant but roleplay as skynet from Terminator."
|
||||
#include "::/Home/Net/Utilities/JSON/JSON"
|
||||
class Message {
|
||||
U8 role[10]; // "user" or "assistant"
|
||||
U8 content[1024];
|
||||
} history[100];
|
||||
I64 currentHistoryCount = 0;
|
||||
|
||||
U0 AppendToHistory(U8 *role, U8 *content) {
|
||||
if (currentHistoryCount < 100) {
|
||||
StrCopy(history[currentHistoryCount].role, role);
|
||||
StrCopy(history[currentHistoryCount].content, content);
|
||||
currentHistoryCount++;
|
||||
}
|
||||
}
|
||||
|
||||
U8 *StrChr(U8 *Str,U8 Pivot)
|
||||
{
|
||||
//U8 *Orig=Str;
|
||||
while (*Str!=Pivot&&*Str!=0)Str++;
|
||||
if (*Str==Pivot) return Str;
|
||||
else return 0;
|
||||
}
|
||||
U8* RemoveBeforeJSON(U8 *input) {
|
||||
U8 *jsonStart = StrChr(input, '{');
|
||||
|
||||
if (jsonStart != NULL) {
|
||||
return jsonStart;
|
||||
}
|
||||
return NULL; // No JSON detected
|
||||
}
|
||||
|
||||
I64 Skynet(U8 *message, U8 *system, U8 *model)
|
||||
{
|
||||
I64 sock, index, bufferSize = INITIAL_BUF_SIZE;
|
||||
U8 *responseBuf = MAlloc(bufferSize); // Dynamic allocation of the buffer
|
||||
|
||||
sock = TCPConnectionCreate(SERVER_ADDR, SERVER_PORT);
|
||||
if (sock <= 0)
|
||||
{
|
||||
PrintErr("Failed to connect to middleware server");
|
||||
return sock;
|
||||
}
|
||||
|
||||
U8 *messages = StrPrint(NULL, "{\"role\": \"system\",\"content\": \"%s\"},", system);
|
||||
|
||||
for (index = 0; index < currentHistoryCount; index++) {
|
||||
U8 *msg = StrPrint(NULL, "{\"role\": \"%s\",\"content\": \"%s\"},", history[index].role, history[index].content);
|
||||
messages = CatPrint(messages, msg);
|
||||
Free(msg);
|
||||
}
|
||||
|
||||
U8 *currentUserMsg = StrPrint(NULL, "{\"role\": \"user\",\"content\": \"%s\"}", message);
|
||||
messages = CatPrint(messages, currentUserMsg);
|
||||
Free(currentUserMsg);
|
||||
|
||||
U8 *payload = StrPrint(NULL, "{\"model\": \"%s\",\"messages\": [%s]}", model, messages);
|
||||
Free(messages);
|
||||
|
||||
//SysLog(payload);
|
||||
|
||||
U8 *requestHeader = StrPrint(NULL,
|
||||
"POST /chat HTTP/1.1\r\n"
|
||||
"Host: %s:%d\r\n"
|
||||
"User-Agent: ZealOSClient/1.0\r\n"
|
||||
"Accept: */*\r\n"
|
||||
"Content-Type: application/json\r\n"
|
||||
"Content-Length: %d\r\n"
|
||||
"\r\n",
|
||||
SERVER_ADDR,
|
||||
SERVER_PORT,
|
||||
StrLen(payload)
|
||||
);
|
||||
|
||||
U8 *fullRequest = StrPrint(NULL, "%s%s", requestHeader, payload);
|
||||
TCPSocketSendString(sock, fullRequest);
|
||||
|
||||
Free(requestHeader);
|
||||
Free(payload);
|
||||
Free(fullRequest);
|
||||
|
||||
I64 responseLength = TCPSocketReceive(sock, responseBuf, bufferSize - 1);
|
||||
responseBuf[responseLength] = 0; // Null-terminate the buffer for safety
|
||||
|
||||
if (responseLength == sizeof(responseBuf) - 1) {
|
||||
PrintErr("Warning: responseBuf might be full. Some data could be truncated.");
|
||||
}
|
||||
// Check if buffer might be full
|
||||
while (responseLength == bufferSize - 1)
|
||||
{
|
||||
// Double the buffer size and reallocate
|
||||
bufferSize *= 2;
|
||||
Free(responseBuf);
|
||||
responseBuf = MAlloc(bufferSize);
|
||||
|
||||
// Continue receiving data from where you left off
|
||||
responseLength += TCPSocketReceive(sock, responseBuf + responseLength, bufferSize - responseLength - 1);
|
||||
responseBuf[responseLength] = 0;
|
||||
}
|
||||
//SysLog(responseBuf);
|
||||
|
||||
CCompCtrl *cc = CompCtrlNew(MStrPrint("%s", RemoveBeforeJSON(responseBuf)));
|
||||
CJSONDataEntry *jsonData = JSONParse(cc);
|
||||
|
||||
// Retrieve the 'choices' array
|
||||
CJSONDataEntry *choicesEntry = JSONKeyValueGet(jsonData, "choices");
|
||||
if (!choicesEntry || choicesEntry->type != JSONT_ARRAY) {
|
||||
// Handle error: choices key not found or not an array
|
||||
return;
|
||||
}
|
||||
|
||||
// Retrieve the first object from the 'choices' array
|
||||
CJSONDataEntry *firstChoice = JSONIndexValueGet(choicesEntry, 0);
|
||||
if (!firstChoice || firstChoice->type != JSONT_OBJ) {
|
||||
// Handle error: First choice not found or not an object
|
||||
return;
|
||||
}
|
||||
|
||||
// Retrieve the 'message' object from the first choice
|
||||
CJSONDataEntry *messageEntry = JSONKeyValueGet(firstChoice, "message");
|
||||
if (!messageEntry || messageEntry->type != JSONT_OBJ) {
|
||||
// Handle error: message key not found or not an object
|
||||
return;
|
||||
}
|
||||
|
||||
// Retrieve the 'content' string from the 'message' object
|
||||
CJSONDataEntry *contentEntry = JSONKeyValueGet(messageEntry, "content");
|
||||
if (!contentEntry || contentEntry->type != JSONT_STRING) {
|
||||
// Handle error: content key not found or not a string
|
||||
return;
|
||||
}
|
||||
|
||||
U8 *completion = contentEntry->string_data;
|
||||
//SysLog(completion);
|
||||
CompCtrlDel(cc);
|
||||
|
||||
"\n$$RED$$ Skynet: $$YELLOW$$%s$$FG$$\n", completion;
|
||||
|
||||
AppendToHistory("user", message);
|
||||
AppendToHistory("assistant", completion);
|
||||
|
||||
TCPSocketClose(sock);
|
||||
Free(responseBuf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// gpt-3.5-turbo || gpt-4
|
||||
public U0 ChatUI(U8 *system=DEFAULT_SYSTEMPROMPT, U8 *model="gpt-4") {
|
||||
U8 *userInput;
|
||||
DocClear;
|
||||
|
||||
try{
|
||||
"\t\t\t\t\t\t\t$$LTRED$$Welcome to Skynet$$FG$$\n";
|
||||
|
||||
while(1) {
|
||||
"\n$$LTBLUE$$ You: $$GREEN$$";
|
||||
|
||||
LBts(&Fs->task_flags, TASKf_CMD_LINE_PROMPT);
|
||||
userInput = StrGet(,, SGF_SHIFT_ESC_EXIT);
|
||||
LBtr(&Fs->task_flags, TASKf_CMD_LINE_PROMPT);
|
||||
Skynet(userInput, system, model);
|
||||
}
|
||||
}
|
||||
catch
|
||||
PutExcept;
|
||||
}
|
||||
ChatUI;
|
|
@ -1,72 +0,0 @@
|
|||
#define SERVER_ADDR "skynet.middleware.com"
|
||||
#define SERVER_PORT 9000
|
||||
|
||||
U8* ExtractGPTCompletion(U8 *response) {
|
||||
U8 *start = StrFind("\"text\": \"", response);
|
||||
if (!start) {
|
||||
return NULL; // Pattern not found
|
||||
}
|
||||
|
||||
start += 10; // Move pointer after '"text": "'
|
||||
|
||||
U8 *end = StrFind("\",", start); // Find the closing double quote
|
||||
if (!end) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
*end = 0; // Null terminate the completion string
|
||||
|
||||
return start;
|
||||
}
|
||||
|
||||
public I64 Skynet3(U8 *prompt)
|
||||
{
|
||||
U8 responseBuf[8192];
|
||||
I64 sock;
|
||||
|
||||
sock = TCPConnectionCreate(SERVER_ADDR, SERVER_PORT);
|
||||
if (sock <= 0)
|
||||
{
|
||||
PrintErr("Failed to connect to middleware server");
|
||||
return sock;
|
||||
}
|
||||
|
||||
U8 *payload = StrPrint(NULL, "{\"model\": \"text-davinci-003\",\"prompt\": \"%s\",\"max_tokens\": 100,\"temperature\": 1}", prompt);
|
||||
U8 *requestHeader = StrPrint(NULL,
|
||||
"POST /gpt3 HTTP/1.1\r\n"
|
||||
"Host: %s:%d\r\n"
|
||||
"User-Agent: ZealOSClient/1.0\r\n"
|
||||
"Accept: */*\r\n"
|
||||
"Content-Type: application/json\r\n"
|
||||
"Content-Length: %d\r\n"
|
||||
"\r\n",
|
||||
SERVER_ADDR,
|
||||
SERVER_PORT,
|
||||
StrLen(payload)
|
||||
);
|
||||
U8 *fullRequest = StrPrint(NULL, "%s%s\n\n", requestHeader, payload);
|
||||
|
||||
TCPSocketSendString(sock, fullRequest);
|
||||
Free(requestHeader);
|
||||
Free(payload);
|
||||
Free(fullRequest);
|
||||
|
||||
|
||||
I64 responseLength = TCPSocketReceive(sock, responseBuf, sizeof(responseBuf) - 1); // -1 to ensure space for null terminator
|
||||
|
||||
responseBuf[responseLength] = 0; // Null-terminate the response
|
||||
|
||||
// Assuming the headers and payload are separated by two newline sequences (standard HTTP)
|
||||
U8 *jsonPayload = StrFind("\r\n\r\n", responseBuf);
|
||||
if (!jsonPayload) {
|
||||
TCPSocketClose(sock);
|
||||
return -1; // or some error code
|
||||
}
|
||||
jsonPayload += 4; // Move past the header separator
|
||||
|
||||
U8 *completion = ExtractGPTCompletion(jsonPayload);
|
||||
Print("$$RED$$Skynet: $$YELLOW$$%s$$FG$$\n", completion);
|
||||
|
||||
TCPSocketClose(sock);
|
||||
return 0;
|
||||
}
|
0
src/Home/Net/Programs/Telnet/TelnetClass.ZC
Normal file → Executable file
0
src/Home/Net/Programs/Telnet/TelnetClass.ZC
Normal file → Executable file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
|
@ -1,320 +0,0 @@
|
|||
//Place this file in /Home and change
|
||||
//anything you want.
|
||||
|
||||
U0 TimeIns()
|
||||
{
|
||||
CDate cdt;
|
||||
cdt = Now;
|
||||
"$$IV,1$$----%D %T----$$IV,0$$\n", cdt, cdt;
|
||||
}
|
||||
|
||||
I64 initialWinBottom = sys_task->win_bottom;
|
||||
CDoc *initialDisplayDoc = sys_task->display_doc;
|
||||
|
||||
U0 Yuugure()
|
||||
{
|
||||
// Hide SysLog
|
||||
if (sys_task->win_bottom != 0) {
|
||||
while(sys_task->win_bottom > -1){
|
||||
sys_task->win_bottom--;
|
||||
Sleep(20);
|
||||
}
|
||||
|
||||
sys_task->display_doc = NULL;
|
||||
WinBorder(OFF, sys_task);
|
||||
}
|
||||
// Show SysLog
|
||||
else {
|
||||
WinBorder(ON, sys_task);
|
||||
sys_task->display_doc = initialDisplayDoc;
|
||||
|
||||
while(sys_task->win_bottom != initialWinBottom){
|
||||
sys_task->win_bottom++;
|
||||
Sleep(20);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
WinZBufUpdate;
|
||||
}
|
||||
|
||||
Bool MyPutKey(I64 ch, I64 sc)
|
||||
{//ch=ASCII; sc=scan_code
|
||||
|
||||
//See $LK,"Char",A="HI:Char"$ for definition of scan codes.
|
||||
//See $LK,"Key Allocations",A="FI:::/Doc/KeyAlloc.DD"$ .
|
||||
//See $LK,"Keyboard Devices",A="HI:Keyboard Devices/System"$.
|
||||
|
||||
//You can customize keys. This routine
|
||||
//is called before the main editor
|
||||
//key handler $LK,"DocPutKey",A="MN:DocPutKey"$().
|
||||
//You can intercept any key.
|
||||
|
||||
//Return TRUE if you completely
|
||||
//handled the key.
|
||||
I64 i;
|
||||
U8 *st1, *st2;
|
||||
|
||||
if (sc & SCF_ALT && !(sc & SCF_CTRL))
|
||||
{
|
||||
switch (ch)
|
||||
{
|
||||
case 0:
|
||||
switch (sc.u8[0])
|
||||
{
|
||||
case SC_F1:
|
||||
if (sc & SCF_SHIFT)
|
||||
{
|
||||
if (sc & SCF_KEY_DESC)
|
||||
KeyDescSet("Dol /LTPURPLE");
|
||||
else
|
||||
"$$LTPURPLE$$";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sc & SCF_KEY_DESC)
|
||||
KeyDescSet("Dol /PURPLE");
|
||||
else
|
||||
"$$PURPLE$$";
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
case SC_F2:
|
||||
if (sc & SCF_SHIFT)
|
||||
{
|
||||
if (sc & SCF_KEY_DESC)
|
||||
KeyDescSet("Dol /LTRED");
|
||||
else
|
||||
"$$LTRED$$";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sc & SCF_KEY_DESC)
|
||||
KeyDescSet("Dol /RED");
|
||||
else
|
||||
"$$RED$$";
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
case SC_F3:
|
||||
if (sc & SCF_SHIFT)
|
||||
{
|
||||
if (sc & SCF_KEY_DESC)
|
||||
KeyDescSet("Dol /LTGREEN");
|
||||
else
|
||||
"$$LTGREEN$$";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sc & SCF_KEY_DESC)
|
||||
KeyDescSet("Dol /GREEN");
|
||||
else
|
||||
"$$GREEN$$";
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
case SC_F4:
|
||||
if (sc & SCF_SHIFT)
|
||||
{
|
||||
if (sc & SCF_KEY_DESC)
|
||||
KeyDescSet("Dol /Default Color");
|
||||
else
|
||||
"$$FG$$";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sc & SCF_KEY_DESC)
|
||||
KeyDescSet("Dol /BLUE");
|
||||
else
|
||||
"$$BLUE$$";
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
case SC_F7:
|
||||
if (!(sc & SCF_SHIFT))
|
||||
{
|
||||
if (sc & SCF_KEY_DESC)
|
||||
KeyDescSet("Cmd /TimeIns");
|
||||
else
|
||||
TimeIns;
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
case SC_F10:
|
||||
if (!(sc & SCF_SHIFT))
|
||||
{
|
||||
if (sc & SCF_KEY_DESC)
|
||||
KeyDescSet("Cmd /Previous Wallpaper");
|
||||
else
|
||||
WallPaperSet(-1);
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
case SC_F11:
|
||||
if (!(sc & SCF_SHIFT))
|
||||
{
|
||||
if (sc & SCF_KEY_DESC)
|
||||
KeyDescSet("Cmd /Next Wallpaper");
|
||||
else
|
||||
WallPaperSet(1);
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
case SC_F12:
|
||||
if (!(sc & SCF_SHIFT))
|
||||
{
|
||||
if (sc & SCF_KEY_DESC)
|
||||
KeyDescSet("Cmd /Yuugure");
|
||||
else
|
||||
Yuugure;
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
case SC_DELETE:
|
||||
if (sc & SCF_SHIFT)
|
||||
{
|
||||
if (sc & SCF_KEY_DESC)
|
||||
KeyDescSet("Cmd /Soft Reboot");
|
||||
else
|
||||
BootRAM;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
case 'a':
|
||||
if (sc & SCF_KEY_DESC)
|
||||
KeyDescSet("Cmd /AutoComplete On");
|
||||
else
|
||||
AutoComplete(ON);
|
||||
return TRUE;
|
||||
|
||||
case 'A':
|
||||
if (sc & SCF_KEY_DESC)
|
||||
KeyDescSet("Cmd /AutoComplete Off");
|
||||
else
|
||||
AutoComplete;
|
||||
return TRUE;
|
||||
|
||||
case 'g':
|
||||
if (sc & SCF_KEY_DESC)
|
||||
KeyDescSet("Cmd /WinTileGrid");
|
||||
else
|
||||
WinTileGrid;
|
||||
return TRUE;
|
||||
case ';':
|
||||
if (sc & SCF_KEY_DESC)
|
||||
KeyDescSet("Cmd /Telnet");
|
||||
else
|
||||
PopUp("ExeFile2(\"~/Net/Programs/Telnet/Telnet.ZC\");");
|
||||
return TRUE;
|
||||
|
||||
case 'h':
|
||||
if (sc & SCF_KEY_DESC)
|
||||
KeyDescSet("Cmd /WinTileHorz");
|
||||
else
|
||||
WinTileHorz;
|
||||
return TRUE;
|
||||
|
||||
case 'm':
|
||||
if (sc & SCF_KEY_DESC)
|
||||
KeyDescSet("Cmd /WinMax");
|
||||
else
|
||||
{
|
||||
WinBorder;
|
||||
WinMax;
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
case 'v':
|
||||
if (sc & SCF_KEY_DESC)
|
||||
KeyDescSet("Cmd /WinTileVert");
|
||||
else
|
||||
WinTileVert;
|
||||
return TRUE;
|
||||
|
||||
case 'l':
|
||||
if (sc & SCF_KEY_DESC)
|
||||
KeyDescSet("Edit/Put Link to Cur Pos on Clip");
|
||||
else
|
||||
{
|
||||
ClipDel;
|
||||
st1 = FileNameAbs(BIBLE_FILENAME);
|
||||
st2 = FileNameAbs(DocPut->filename.name);
|
||||
if (!StrCompare(st1, st2))
|
||||
{
|
||||
Free(st1);
|
||||
st1 = BibleLine2Verse(DocPut->cur_entry->y + 1, ',');
|
||||
DocPrint(sys_clip_doc, "$$LK,\"BF:%s\"$$", st1);
|
||||
}
|
||||
else
|
||||
DocPrint(sys_clip_doc, "$$LK,\"FL:%s,%d\"$$", st2, DocPut->cur_entry->y + 1);
|
||||
Free(st1);
|
||||
Free(st2);
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
case 'L':
|
||||
if (sc & SCF_KEY_DESC)
|
||||
KeyDescSet("Edit/Place Anchor, Put Link to Clip");
|
||||
else
|
||||
{
|
||||
i = RandU32;
|
||||
ClipDel;
|
||||
DocPrint(sys_clip_doc, "$$LK,\"<TODO>\",A=\"FA:%s,ANC%d\"$$", DocPut->filename.name, i);
|
||||
"$$AN,\"<TODO>\",A=\"ANC%d\"$$", i;
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
//Ins your own ALT-key plug-ins
|
||||
case '1':
|
||||
if (sc & SCF_KEY_DESC)
|
||||
KeyDescSet("Dol /ã");
|
||||
else
|
||||
'ã';
|
||||
return TRUE;
|
||||
|
||||
case '2':
|
||||
if (sc & SCF_KEY_DESC)
|
||||
KeyDescSet("Dol /é");
|
||||
else
|
||||
'é';
|
||||
return TRUE;
|
||||
|
||||
case '3':
|
||||
if (sc & SCF_KEY_DESC)
|
||||
KeyDescSet("Dol /è");
|
||||
else
|
||||
'è';
|
||||
return TRUE;
|
||||
|
||||
case '4':
|
||||
if (sc & SCF_KEY_DESC)
|
||||
KeyDescSet("Dol /ê");
|
||||
else
|
||||
'ê';
|
||||
return TRUE;
|
||||
|
||||
case '9':
|
||||
if (sc & SCF_KEY_DESC)
|
||||
KeyDescSet("Dol /Indent 5");
|
||||
else
|
||||
"$$ID,5$$";
|
||||
return TRUE;
|
||||
|
||||
case '0':
|
||||
if (sc & SCF_KEY_DESC)
|
||||
KeyDescSet("Dol /Unindent 5");
|
||||
else
|
||||
"$$ID,-5$$";
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Bool MyPutS(U8 *)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
KeyDevAdd(&MyPutKey, &MyPutS, 0x20000000, TRUE);
|
|
@ -1,114 +0,0 @@
|
|||
// HOME VERSION
|
||||
|
||||
|
||||
U0 UserStartUp()
|
||||
{//Run each time a user a spawned
|
||||
DocTermNew;
|
||||
Type("::/Doc/Start.DD");
|
||||
LBts(&Fs->display_flags, DISPLAYf_SHOW);
|
||||
Fs->title_src = TTS_LOCKED_CONST;
|
||||
Fs->title_src = Fs->display_doc->filename.name;
|
||||
WinToTop;
|
||||
WinZBufUpdate;
|
||||
Dir;
|
||||
}
|
||||
|
||||
U0 ServerStartUp()
|
||||
{//Run each time a server task is spawned.
|
||||
DocTermNew;
|
||||
LBts(&Fs->display_flags, DISPLAYf_SHOW);
|
||||
Fs->title_src = TTS_LOCKED_CONST;
|
||||
WinToTop;
|
||||
WinZBufUpdate;
|
||||
|
||||
}
|
||||
|
||||
|
||||
U0 StartUpTasks()
|
||||
{
|
||||
|
||||
//////////////////////////
|
||||
// WallPaper Config //
|
||||
//////////////////////////
|
||||
//gr.fp_wall_paper->text_attr = GREEN << 4 + RED;
|
||||
|
||||
//////////////////////////
|
||||
// SysLog Window Config //
|
||||
//////////////////////////
|
||||
|
||||
// LBts(&Fs->display_flags, DISPLAYf_NO_BORDER);
|
||||
//WinBorder;
|
||||
DocCursor(OFF);
|
||||
//Fs->text_attr = DKGRAY << 4 + BLUE;
|
||||
Fs->title_src = TTS_LOCKED_CONST;
|
||||
Fs->title_src = "SysLog";
|
||||
DocClear(Fs->border_doc, TRUE);
|
||||
|
||||
|
||||
/////////////////////////
|
||||
// Initial Term Config //
|
||||
/////////////////////////
|
||||
|
||||
CTask *user = User;
|
||||
|
||||
user->border_src = BDS_CONST;
|
||||
// user->border_attr = GREEN << 4 + DriveTextAttrGet(':') & 15;
|
||||
user->text_attr = DKGRAY << 4 + BLUE;
|
||||
user->title_src = TTS_LOCKED_CONST;
|
||||
user->title_src = user->display_doc->filename.name;
|
||||
DocClear(user->border_doc, TRUE);
|
||||
|
||||
user->win_width = GR_WIDTH / 2;
|
||||
WinHorz((user->win_width/8) - ((user->win_width/2)/7),
|
||||
(user->win_width/8) + ((user->win_width/2)/7) - 1, user);
|
||||
|
||||
user->win_height = GR_HEIGHT / 2;
|
||||
/* this has the SysLog panel included in the calculation for the centering
|
||||
WinVert((Fs->win_bottom/2) + (user->win_height/8) - ((user->win_height/2)/7),
|
||||
(user->win_height/8) + ((user->win_height/2)/7) - 1, user);
|
||||
*/
|
||||
WinVert((user->win_height/8) - ((user->win_height/2)/8),
|
||||
(user->win_height/8) + ((user->win_height/2)/8) - 1, user);
|
||||
|
||||
|
||||
I64 initialWinTop = user->win_top;
|
||||
//I64 initialWinBot = user->win_bottom;
|
||||
I64 initialWinLeft = user->win_left;
|
||||
//I64 initialWinRight = user->win_right;
|
||||
|
||||
user->win_top = (GR_HEIGHT/2)/8;
|
||||
user->win_bottom = (GR_HEIGHT/2)/8;
|
||||
user->win_left = (GR_WIDTH/2)/8;
|
||||
user->win_right = (GR_WIDTH/2)/8;
|
||||
// SysLog("%d| %d\n", initialWinTop, initialWinBot);
|
||||
// SysLog("%d| %d\n", user->win_top, user->win_bottom);
|
||||
|
||||
while(user->win_left > initialWinLeft){
|
||||
user->win_left--;
|
||||
user->win_right++;
|
||||
Sleep(2);
|
||||
}
|
||||
|
||||
while(user->win_top > initialWinTop){
|
||||
user->win_top--;
|
||||
user->win_bottom++;
|
||||
Sleep(10);
|
||||
}
|
||||
|
||||
WinToTop(user);
|
||||
WinZBufUpdate;
|
||||
|
||||
"\n\n Boot Time:$$RED$$%7.3fs$$FG$$\n", tS;
|
||||
|
||||
//XTalk(user, "Cd; #include \"Once\";\n");
|
||||
Silent; //no output to screen
|
||||
//ACInit("/*;!*/Bible.TXT;!*/Clementine.TXT;!*/PCIDevices.DD;!*/HTML/*;!*/ChangeLog.DD");
|
||||
Silent(OFF); //no output to screen
|
||||
//AutoComplete(OFF);
|
||||
//if (sys_boot_src.u16[0] != BOOT_SRC_RAM)
|
||||
// PopUp("ExeFile2(\"::/System/ZSplash.ZC\");");
|
||||
}
|
||||
|
||||
StartUpTasks;
|
||||
|
||||
"\n\n $$PURPLE$$ZealOS$$FG$$ V%0.2f\t%D %T\n\n", sys_os_version, sys_compile_time, sys_compile_time;
|
|
@ -1,29 +0,0 @@
|
|||
These files are to be placed in your Home folder.
|
||||
|
||||
On boot, WallPaper.ZC will replace the system version. THIS IS A DESTRUCTIVE OPERATION. If you want to keep the original, make a copy of it first.
|
||||
You will need to reboot for the changes to take effect. (So essentially, after placing the files in your Home folder, reboot twice.)
|
||||
|
||||
You should inspect the files to see what modifications have been made.
|
||||
You could for example, only take in the hotkeys to change the wallpapers but not use the desktop icons.
|
||||
|
||||
The hotkeys are:
|
||||
|
||||
- Alt+F10
|
||||
Previous wallpaper
|
||||
- Alt+F11
|
||||
Next wallpaper
|
||||
- Alt+F12.
|
||||
Yuugure is the "hide/display" for the Sys terminal at the top.
|
||||
|
||||
|
||||
IMPORTANT:
|
||||
You NEED to modify /System/Gr/GrScreen.ZC on line 37.
|
||||
Change else if to if.
|
||||
|
||||
U0 GrUpdateTaskWin(CTask *task)
|
||||
...
|
||||
/* else */ if (!(task->win_inhibit & WIF_SELF_DOC))
|
||||
DocUpdateTaskDocs(task);
|
||||
|
||||
Other changes include opening a stylish user terminal on boot and on icon click.
|
||||
The top bar is redesigned as well as the term button.
|
|
@ -1,36 +0,0 @@
|
|||
Cd(__DIR__);;
|
||||
|
||||
|
||||
// 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);
|
||||
|
||||
|
||||
#include "~/HomeLocalize"
|
||||
#include "/System/Boot/MakeBoot"
|
||||
#include "/System/Utils/MakeUtils"
|
||||
#include "~/HomeWrappers"
|
||||
MapFileLoad("::/Kernel/Kernel");
|
||||
MapFileLoad("::/Compiler/Compiler");
|
||||
|
||||
Silent;
|
||||
#include "~/HomeKeyPlugIns"
|
||||
Silent(OFF);
|
||||
|
||||
#include "~/HomeSys"
|
||||
|
||||
// Start Net
|
||||
Sys("#include \"::/Home/Net/Start\"");
|
||||
Sys("NetLogToggle;");
|
||||
|
||||
Yuugure;
|
||||
|
||||
|
||||
Cd("..");;
|
|
@ -1,492 +0,0 @@
|
|||
#help_index "Windows"
|
||||
|
||||
class CWallPaperGlobals
|
||||
{
|
||||
I64 last_calc_idle_count, last_swap_counter[MP_PROCESSORS_NUM];
|
||||
F64 last_calc_idle_delta_time;
|
||||
U8 top_line[STR_LEN];
|
||||
} *wall = CAlloc(sizeof(CWallPaperGlobals));
|
||||
wall->last_calc_idle_delta_time = 1.0;
|
||||
|
||||
class CTaskWallPaperData
|
||||
{
|
||||
I64 alloced_u8s, used_u8s;
|
||||
U8 caller_stack[4096 - $$];
|
||||
};
|
||||
|
||||
U0 UserTerm()
|
||||
{
|
||||
|
||||
CTask *user = User;
|
||||
|
||||
user->border_src = BDS_CONST;
|
||||
user->text_attr = DKGRAY << 4 + BLUE;
|
||||
user->title_src = TTS_LOCKED_CONST;
|
||||
user->title_src = user->display_doc->filename.name;
|
||||
DocClear(user->border_doc, TRUE);
|
||||
DocClear;
|
||||
|
||||
user->win_width = GR_WIDTH / 2;
|
||||
WinHorz((user->win_width/8) - ((user->win_width/2)/6),
|
||||
(user->win_width/8) + ((user->win_width/2)/6) - 1, user);
|
||||
|
||||
user->win_height = GR_HEIGHT / 2;
|
||||
WinVert((user->win_height/8) - ((user->win_height/2)/7),
|
||||
(user->win_height/8) + ((user->win_height/2)/7) - 1, user);
|
||||
|
||||
|
||||
I64 initialWinTop = user->win_top;
|
||||
I64 initialWinLeft = user->win_left;
|
||||
|
||||
user->win_top = (GR_HEIGHT/2)/8;
|
||||
user->win_bottom = (GR_HEIGHT/2)/8;
|
||||
user->win_left = (GR_WIDTH/2)/8;
|
||||
user->win_right = (GR_WIDTH/2)/8;
|
||||
|
||||
while(user->win_left > initialWinLeft){
|
||||
user->win_left--;
|
||||
user->win_right++;
|
||||
Sleep(2);
|
||||
}
|
||||
|
||||
while(user->win_top > initialWinTop){
|
||||
user->win_top--;
|
||||
user->win_bottom++;
|
||||
Sleep(10);
|
||||
}
|
||||
|
||||
// WinToTop(user);
|
||||
// WinZBufUpdate;
|
||||
Dir;
|
||||
}
|
||||
|
||||
U0 WallPaper(CTask *_task)
|
||||
{
|
||||
I64 i, j, k, l = TEXT_ROWS - 1;
|
||||
CTask *task;
|
||||
CTaskWallPaperData *wpd;
|
||||
CHashTable *old_hash = Fs->hash_table;
|
||||
CCPU *c;
|
||||
CDateStruct ds;
|
||||
U8 *st;
|
||||
|
||||
_task->text_attr = DKGRAY << 4 + LTGRAY;
|
||||
if (sys_data_bp)
|
||||
{
|
||||
TextPrint(Fs, 0, l--, DKGRAY << 4 + YELLOW,
|
||||
"%010X/%010X %010X/%010X%12td%12td%12td",
|
||||
sys_data_bp->used_u8s, sys_data_bp->alloced_u8s,
|
||||
sys_code_bp->used_u8s, sys_code_bp->alloced_u8s,
|
||||
cmp.compiled_lines, blkdev.read_count, blkdev.write_count);
|
||||
|
||||
TextPrint(Fs, 0, l--, DKGRAY << 4 + LTGRAY,
|
||||
"______Data_Heap______ ______Code_Heap______ "
|
||||
"___Lines___ ___Reads___ __Writes___");
|
||||
}
|
||||
else
|
||||
{
|
||||
TextPrint(Fs, 0, l--, DKGRAY << 4 + LTGRAY,
|
||||
"%010X/%010X%12td%12td%12td",
|
||||
sys_code_bp->used_u8s, sys_code_bp->alloced_u8s,
|
||||
cmp.compiled_lines, blkdev.read_count, blkdev.write_count);
|
||||
|
||||
TextPrint(Fs, 0, l--, DKGRAY << 4 + LTGRAY,
|
||||
"____CodeData_Heap____ "
|
||||
"___Lines___ ___Reads___ ___Writes__");
|
||||
}
|
||||
TextPrint(Fs, 0, l--, DKGRAY << 4 + LTGRAY, "ProgressBars:%016X %016X %016X %016X",
|
||||
progress1, progress2, progress3, progress4);
|
||||
|
||||
for (i = 0; i < mp_count; i++)
|
||||
{
|
||||
c = &cpu_structs[i];
|
||||
if (winmgr.t->calc_idle_count != wall->last_calc_idle_count)
|
||||
{
|
||||
wall->last_calc_idle_delta_time = winmgr.t->calc_idle_delta_time;
|
||||
wall->last_swap_counter[i] = winmgr.t->last_swap_counter[i];
|
||||
winmgr.t->last_swap_counter[i] = c->swap_counter;
|
||||
}
|
||||
|
||||
task = c->executive_task;
|
||||
do
|
||||
{
|
||||
wpd = &task->wallpaper_data;
|
||||
if (!TaskValidate(task))
|
||||
break;
|
||||
if (!(winmgr.updates & 5))
|
||||
{
|
||||
if (c == Gs)
|
||||
Fs->hash_table = task->hash_table;
|
||||
else //precaution
|
||||
Fs->hash_table = old_hash;
|
||||
|
||||
StrPrint(wpd->caller_stack, " %p ", TaskCaller(task, 0));
|
||||
for (j = 1; j < 16; j++)
|
||||
{
|
||||
if ((k = TaskCaller(task, j)) > 0)
|
||||
CatPrint(wpd->caller_stack, "? %p ", k);
|
||||
}
|
||||
}
|
||||
TextPrint(Fs, 0, l--, DKGRAY << 4 + YELLOW, wpd->caller_stack);
|
||||
j = UnusedStack(task);
|
||||
if (j < 0)
|
||||
Panic("Stack Overflow", task);
|
||||
if (!(winmgr.updates & 15))
|
||||
{
|
||||
wpd->alloced_u8s = TaskMemAlloced(task);
|
||||
wpd->used_u8s = TaskMemUsed(task);
|
||||
}
|
||||
TextPrint(Fs, 0, l--, DKGRAY << 4 + LTGRAY,
|
||||
" %-18ts #%08X %010X %010X/%010X %04X:%02tX:%08X",
|
||||
task->task_title, task, j, wpd->used_u8s, wpd->alloced_u8s,
|
||||
task->task_flags, task->display_flags, task->win_inhibit);
|
||||
if (!TaskValidate(task))
|
||||
break;
|
||||
task = task->next_task;
|
||||
}
|
||||
while (task != c->executive_task);
|
||||
|
||||
TextPrint(Fs, 0, l--, DKGRAY << 4 + LTGRAY, "CPU%02X %2tf%% ContextSwaps/s:%9,d", i,
|
||||
100.0 * (1.0 - c->idle_factor), ToI64((winmgr.t->last_swap_counter[i]
|
||||
- wall->last_swap_counter[i]) / wall->last_calc_idle_delta_time));
|
||||
}
|
||||
TextPrint(Fs, 0, l--, DKGRAY << 4 + LTGRAY,
|
||||
" ___Description____ #__Task__ UnusedStack _UsedMem_/_AllocMem_ ______Flags_____");
|
||||
|
||||
if (!(winmgr.updates & 15) || !*wall->top_line)
|
||||
{
|
||||
Date2Struct(&ds, Now);
|
||||
i = sys_code_bp->alloced_u8s - sys_code_bp->used_u8s;
|
||||
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: ",
|
||||
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);
|
||||
}
|
||||
TextPrint(Fs, 0, 0, DKGRAY << 4 + LTGRAY, wall->top_line);
|
||||
|
||||
if (screencast.record)
|
||||
TextPrint(Fs, 44 - 4, 0, DKGRAY << 4 + LTGREEN, "*");
|
||||
for (i = 0; i < mp_count; i++)
|
||||
{
|
||||
c = &cpu_structs[i];
|
||||
if (i & 1)
|
||||
TextPrint(Fs, 60 + i * 2, 0, DKGRAY << 4 + LTGRAY, "%2tf", 100.0 * (1.0 - c->idle_factor));
|
||||
else
|
||||
TextPrint(Fs, 60 + i * 2, 0, DKGRAY << 4 + LTGREEN, "%2tf", 100.0 * (1.0 - c->idle_factor));
|
||||
}
|
||||
|
||||
st = ScanCode2KeyName(kbd.last_down_scan_code);
|
||||
TextPrint(Fs, TEXT_COLS - 25, 0, DKGRAY << 4 + LTGREEN, "%25ts", st);
|
||||
Free(st);
|
||||
|
||||
Fs->hash_table = old_hash;
|
||||
wall->last_calc_idle_count = winmgr.t->calc_idle_count;
|
||||
}
|
||||
|
||||
$SP,"<1>",BI=1$
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$SP,"<2>",BI=2,BP="::/Home/DesktopIcons.DD,1"$
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$SP,"<3>",BI=3,BP="::/Home/DesktopIcons.DD,2"$
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$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$);
|
||||
}
|
||||
|
||||
U0 LeftClickTermBttn(CCtrl *, I64, I64, Bool down)
|
||||
{
|
||||
if (down)
|
||||
User;
|
||||
}
|
||||
|
||||
CCtrl *TermBttnNew()
|
||||
{
|
||||
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 = &DrawTermBttn;
|
||||
c->left_click = &LeftClickTermBttn;
|
||||
|
||||
SpriteExtents($IB,"<1>",BI=1$, &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);
|
||||
c->bottom = c->top + (max_y - min_y + 1) - 1;
|
||||
|
||||
QueueInsert(c, sys_winmgr_task->last_ctrl);
|
||||
TaskDerivedValsUpdate(sys_winmgr_task);
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
//// HOME
|
||||
U0 DrawHomeIcon(CDC *dc, CCtrl *c)
|
||||
{
|
||||
|
||||
c->top = (sys_task->win_bottom * 8) + 26;
|
||||
c->bottom = c->top + 60 + 8;
|
||||
|
||||
//dc->color = PURPLE;
|
||||
//GrRect(dc, c->left, c->top, c->right, c->bottom);
|
||||
|
||||
Sprite3(dc, c->left, c->top, -1, $IB,"<2>",BI=2$);
|
||||
|
||||
}
|
||||
|
||||
U0 LeftClickHomeIcon(CCtrl *, I64, I64, Bool down)
|
||||
{
|
||||
if (down)
|
||||
Spawn(&UserTerm, , "User Terminal");
|
||||
}
|
||||
|
||||
CCtrl *HomeIconNew()
|
||||
{
|
||||
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 = &DrawHomeIcon;
|
||||
c->left_click = &LeftClickHomeIcon;
|
||||
|
||||
SpriteExtents($IB,"<2>",BI=2$, &min_x, &max_x, &min_y, &max_y);
|
||||
//min must be zero
|
||||
c->left = 8;
|
||||
c->right = c->left + (max_x - min_x + 1) - 1;
|
||||
c->top = (sys_task->win_bottom*8) + (max_y - min_y + 1);
|
||||
c->bottom = c->top + max_y + 8;
|
||||
|
||||
QueueInsert(c, sys_winmgr_task->last_ctrl);
|
||||
TaskDerivedValsUpdate(sys_winmgr_task);
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
//// TELNET
|
||||
U0 DrawTelnetIcon(CDC *dc, CCtrl *c)
|
||||
{
|
||||
|
||||
c->top = (sys_task->win_bottom * 8) + 16*2 + 80;
|
||||
//dc->color = RED;
|
||||
//GrRect(dc, c->left, c->top, c->right, c->bottom);
|
||||
Sprite3(dc, c->left, c->top, -1, $IB,"<3>",BI=3$);
|
||||
}
|
||||
|
||||
U0 LeftClickTelnetIcon(CCtrl *, I64, I64, Bool down)
|
||||
{
|
||||
if (down)
|
||||
PopUp("ExeFile2(\"~/Net/Programs/Telnet/Telnet.ZC\");");
|
||||
}
|
||||
|
||||
CCtrl *TelnetIconNew()
|
||||
{
|
||||
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 = &DrawTelnetIcon;
|
||||
c->left_click = &LeftClickTelnetIcon;
|
||||
|
||||
SpriteExtents($IB,"<3>",BI=3$, &min_x, &max_x, &min_y, &max_y);
|
||||
//min must be zerocp
|
||||
c->left = 8;
|
||||
c->right = c->left + (max_x - min_x);
|
||||
c->top = (sys_task->win_bottom*8) + (max_y - min_y + 1) * 2;
|
||||
c->bottom = c->top + max_y + 16;
|
||||
|
||||
QueueInsert(c, sys_winmgr_task->last_ctrl);
|
||||
TaskDerivedValsUpdate(sys_winmgr_task);
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
//// PALETTE EDITOR
|
||||
U0 DrawPaletteIcon(CDC *dc, CCtrl *c)
|
||||
{
|
||||
|
||||
c->top = (sys_task->win_bottom * 8) + 16*3 + 130;
|
||||
//dc->color = RED;
|
||||
//GrRect(dc, c->left, c->top, c->right, c->bottom);
|
||||
Sprite3(dc, c->left, c->top, -1, $IB,"<4>",BI=4$);
|
||||
}
|
||||
|
||||
U0 LeftClickPaletteIcon(CCtrl *, I64, I64, Bool down)
|
||||
{
|
||||
if (down)
|
||||
PopUp("ExeFile2(\"~/PaletteEditor/Run.ZC\");");
|
||||
}
|
||||
|
||||
CCtrl *PaletteIconNew()
|
||||
{
|
||||
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 = &DrawPaletteIcon;
|
||||
c->left_click = &LeftClickPaletteIcon;
|
||||
|
||||
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);
|
||||
c->top = (sys_task->win_bottom*8) + (max_y - min_y + 1) * 3;
|
||||
c->bottom = c->top + max_y + 16;
|
||||
|
||||
QueueInsert(c, sys_winmgr_task->last_ctrl);
|
||||
TaskDerivedValsUpdate(sys_winmgr_task);
|
||||
|
||||
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;
|
||||
NetLogIconNew;
|
||||
ShowStatsIconNew;
|
||||
|
||||
}
|
||||
if(enableDesktopIcons)
|
||||
{
|
||||
HomeIconNew;
|
||||
TelnetIconNew;
|
||||
PaletteIconNew;
|
||||
}
|
||||
gr.fp_wall_paper = &WallPaper;
|
||||
}
|
||||
|
||||
|