Add desktop feature

This commit is contained in:
y4my4my4m 2023-08-24 17:37:20 +09:00
parent 21f1cc9cfa
commit 4a93b3f19b
5 changed files with 898 additions and 0 deletions

View file

@ -0,0 +1,320 @@
//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);

View file

@ -0,0 +1,114 @@
// 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;

View file

@ -0,0 +1,29 @@
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.

View file

@ -0,0 +1,34 @@
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"
// Hide SysLog
Yuugure;
// Start Net
Sys("#include \"::/Home/Net/Start\"");
Cd("..");;

View file

@ -0,0 +1,401 @@
#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"$
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,"<5>",BI=5$, &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 WallPaperInit(Bool enableTermIcon = TRUE, Bool enableDesktopIcons = TRUE)
{
if(enableTermIcon)
TermBttnNew;
if(enableDesktopIcons)
{
HomeIconNew;
TelnetIconNew;
PaletteIconNew;
}
gr.fp_wall_paper = &WallPaper;
}
; N L
TERMINALn 6 5 1  BBS !60&Telnet