mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2025-06-07 00:04:48 +00:00
minor reformatting, spacing, brackets movement.
This commit is contained in:
parent
aa46a1c1fc
commit
3c69be5412
Binary file not shown.
@ -1,4 +1,6 @@
|
||||
$WW,1$$FG,5$$TX+CX,"ChangeLog"$$FG$
|
||||
$IV,1$----04/11/20 18:10:58----$IV,0$
|
||||
* Beginning efforts to reformat files some. Currently, keeping a temp log of progress at $LK,"FilesRefactored",A="FI:C:/Home/FilesRefactored.DD"$.
|
||||
|
||||
$IV,1$----04/11/20 01:34:08----$IV,0$
|
||||
* Net Code Asterisks moving
|
||||
|
19
src/Home/FilesRefactored.DD
Executable file
19
src/Home/FilesRefactored.DD
Executable file
@ -0,0 +1,19 @@
|
||||
$FG,7$Files reformatted starting from ::/ 'root' directory.$FG,0$
|
||||
StartOS.CC
|
||||
Once.CC
|
||||
HomeWrappers.CC
|
||||
HomeSys.CC
|
||||
HomeLocalize.CC
|
||||
HomeKeyPlugins.CC
|
||||
|
||||
/Zenith/
|
||||
DevInfo.CC
|
||||
InFile.CC
|
||||
MakeZenith.CC
|
||||
TaskSettings.CC
|
||||
Training.CC
|
||||
WallPaper.CC
|
||||
Win.CC
|
||||
|
||||
|
||||
$FG,7$-Tom$FG,0$
|
@ -4,11 +4,11 @@
|
||||
U0 TimeIns()
|
||||
{
|
||||
CDate cdt;
|
||||
cdt=Now;
|
||||
"$$IV,1$$----%D %T----$$IV,0$$\n",cdt,cdt;
|
||||
cdt = Now;
|
||||
"$$IV,1$$----%D %T----$$IV,0$$\n", cdt, cdt;
|
||||
}
|
||||
|
||||
Bool MyPutKey(I64 ch,I64 sc)
|
||||
Bool MyPutKey(I64 ch, I64 sc)
|
||||
{//ch=ASCII; sc=scan_code
|
||||
|
||||
//See $LK,"Char",A="HI:Char"$ for definition of scan codes.
|
||||
@ -33,16 +33,16 @@ Bool MyPutKey(I64 ch,I64 sc)
|
||||
switch (sc.u8[0])
|
||||
{
|
||||
case SC_F1:
|
||||
if (sc&SCF_SHIFT)
|
||||
if (sc & SCF_SHIFT)
|
||||
{
|
||||
if (sc&SCF_KEY_DESC)
|
||||
if (sc & SCF_KEY_DESC)
|
||||
KeyDescSet("Dol /LTPURPLE");
|
||||
else
|
||||
"$$LTPURPLE$$";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sc&SCF_KEY_DESC)
|
||||
if (sc & SCF_KEY_DESC)
|
||||
KeyDescSet("Dol /PURPLE");
|
||||
else
|
||||
"$$PURPLE$$";
|
||||
@ -51,48 +51,54 @@ Bool MyPutKey(I64 ch,I64 sc)
|
||||
case SC_F2:
|
||||
if (sc & SCF_SHIFT)
|
||||
{
|
||||
if (sc&SCF_KEY_DESC)
|
||||
if (sc & SCF_KEY_DESC)
|
||||
KeyDescSet("Dol /LTRED");
|
||||
else
|
||||
"$$LTRED$$";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sc&SCF_KEY_DESC)
|
||||
if (sc & SCF_KEY_DESC)
|
||||
KeyDescSet("Dol /RED");
|
||||
else
|
||||
"$$RED$$";
|
||||
}
|
||||
return TRUE;
|
||||
case SC_F3:
|
||||
if (sc&SCF_SHIFT) {
|
||||
if (sc&SCF_KEY_DESC)
|
||||
if (sc & SCF_SHIFT)
|
||||
{
|
||||
if (sc & SCF_KEY_DESC)
|
||||
KeyDescSet("Dol /LTGREEN");
|
||||
else
|
||||
"$$LTGREEN$$";
|
||||
} else {
|
||||
if (sc&SCF_KEY_DESC)
|
||||
}
|
||||
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)
|
||||
if (sc & SCF_SHIFT)
|
||||
{
|
||||
if (sc & SCF_KEY_DESC)
|
||||
KeyDescSet("Dol /Default Color");
|
||||
else
|
||||
"$$FG$$";
|
||||
} else {
|
||||
if (sc&SCF_KEY_DESC)
|
||||
}
|
||||
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)
|
||||
if (!(sc & SCF_SHIFT)) {
|
||||
if (sc & SCF_KEY_DESC)
|
||||
KeyDescSet("Cmd /TimeIns");
|
||||
else
|
||||
TimeIns;
|
||||
@ -109,25 +115,25 @@ Bool MyPutKey(I64 ch,I64 sc)
|
||||
}
|
||||
break;
|
||||
case 'a':
|
||||
if (sc&SCF_KEY_DESC)
|
||||
if (sc & SCF_KEY_DESC)
|
||||
KeyDescSet("Cmd /AutoComplete On");
|
||||
else
|
||||
AutoComplete(ON);
|
||||
return TRUE;
|
||||
case 'A':
|
||||
if (sc&SCF_KEY_DESC)
|
||||
if (sc & SCF_KEY_DESC)
|
||||
KeyDescSet("Cmd /AutoComplete Off");
|
||||
else
|
||||
AutoComplete;
|
||||
return TRUE;
|
||||
case 'h':
|
||||
if (sc&SCF_KEY_DESC)
|
||||
if (sc & SCF_KEY_DESC)
|
||||
KeyDescSet("Cmd /WinTileHorz");
|
||||
else
|
||||
WinTileHorz;
|
||||
return TRUE;
|
||||
case 'm':
|
||||
if (sc&SCF_KEY_DESC)
|
||||
if (sc & SCF_KEY_DESC)
|
||||
KeyDescSet("Cmd /WinMax");
|
||||
else {
|
||||
WinBorder;
|
||||
@ -135,66 +141,65 @@ Bool MyPutKey(I64 ch,I64 sc)
|
||||
}
|
||||
return TRUE;
|
||||
case 'v':
|
||||
if (sc&SCF_KEY_DESC)
|
||||
if (sc & SCF_KEY_DESC)
|
||||
KeyDescSet("Cmd /WinTileVert");
|
||||
else
|
||||
WinTileVert;
|
||||
return TRUE;
|
||||
case 'l':
|
||||
if (sc&SCF_KEY_DESC)
|
||||
if (sc & SCF_KEY_DESC)
|
||||
KeyDescSet("Edit/Put Link to Cur Pos on Clip");
|
||||
else {
|
||||
ClipDel;
|
||||
st=FileNameAbs(DocPut->filename.name);
|
||||
DocPrint(sys_clip_doc,"$$LK,\"FL:%s,%d\"$$", st,DocPut->cur_entry->y+1);
|
||||
st = FileNameAbs(DocPut->filename.name);
|
||||
DocPrint(sys_clip_doc, "$$LK,\"FL:%s,%d\"$$", st, DocPut->cur_entry->y + 1);
|
||||
Free(st);
|
||||
}
|
||||
return TRUE;
|
||||
case 'L':
|
||||
if (sc&SCF_KEY_DESC)
|
||||
if (sc & SCF_KEY_DESC)
|
||||
KeyDescSet("Edit/Place Anchor, Put Link to Clip");
|
||||
else {
|
||||
i=RandU32;
|
||||
i = RandU32;
|
||||
ClipDel;
|
||||
DocPrint(sys_clip_doc,"$$LK,\"<TODO>\",A=\"FA:%s,ANC%d\"$$",
|
||||
DocPut->filename.name,i);
|
||||
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)
|
||||
if (sc & SCF_KEY_DESC)
|
||||
KeyDescSet("Dol /ã");
|
||||
else
|
||||
'ã';
|
||||
return TRUE;
|
||||
case '2':
|
||||
if (sc&SCF_KEY_DESC)
|
||||
if (sc & SCF_KEY_DESC)
|
||||
KeyDescSet("Dol /é");
|
||||
else
|
||||
'é';
|
||||
return TRUE;
|
||||
case '3':
|
||||
if (sc&SCF_KEY_DESC)
|
||||
if (sc & SCF_KEY_DESC)
|
||||
KeyDescSet("Dol /è");
|
||||
else
|
||||
'è';
|
||||
return TRUE;
|
||||
case '4':
|
||||
if (sc&SCF_KEY_DESC)
|
||||
if (sc & SCF_KEY_DESC)
|
||||
KeyDescSet("Dol /ê");
|
||||
else
|
||||
'ê';
|
||||
return TRUE;
|
||||
case '9':
|
||||
if (sc&SCF_KEY_DESC)
|
||||
if (sc & SCF_KEY_DESC)
|
||||
KeyDescSet("Dol /Indent 5");
|
||||
else
|
||||
"$$ID,5$$";
|
||||
return TRUE;
|
||||
case '0':
|
||||
if (sc&SCF_KEY_DESC)
|
||||
if (sc & SCF_KEY_DESC)
|
||||
KeyDescSet("Dol /Unindent 5");
|
||||
else
|
||||
"$$ID,-5$$";
|
||||
@ -209,4 +214,4 @@ Bool MyPutS(U8 *)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
KeyDevAdd(&MyPutKey,&MyPutS,0x20000000,TRUE);
|
||||
KeyDevAdd(&MyPutKey, &MyPutS, 0x20000000, TRUE);
|
||||
|
@ -5,15 +5,15 @@
|
||||
KbdTypeMatic(0);
|
||||
|
||||
//Set Time Zone
|
||||
local_time_offset=0*60*60*CDATE_FREQ; //Do daylight savings by hand
|
||||
local_time_offset = 0 * 60 * 60 * CDATE_FREQ; //Do daylight savings by hand
|
||||
|
||||
//$AN,"",A="mouse_move_scale"$adjust these to set mouse move scale
|
||||
mouse_hard.scale.x=0.5;
|
||||
mouse_hard.scale.y=0.5;
|
||||
mouse_hard.scale.z=1.0; //wheel
|
||||
mouse_hard.scale.x = 0.5;
|
||||
mouse_hard.scale.y = 0.5;
|
||||
mouse_hard.scale.z = 1.0; //wheel
|
||||
|
||||
//don't change these
|
||||
mouse_hard.prescale.x=mouse_hard.pos.x/mouse_hard.scale.x;
|
||||
mouse_hard.prescale.y=mouse_hard.pos.y/mouse_hard.scale.y;
|
||||
mouse_hard.prescale.z=mouse_hard.pos.z/mouse_hard.scale.z;
|
||||
mouse_hard.prescale.x = mouse_hard.pos.x / mouse_hard.scale.x;
|
||||
mouse_hard.prescale.y = mouse_hard.pos.y / mouse_hard.scale.y;
|
||||
mouse_hard.prescale.z = mouse_hard.pos.z / mouse_hard.scale.z;
|
||||
|
||||
|
@ -5,7 +5,7 @@ U0 UserStartUp()
|
||||
{//Run each time a user a spawned
|
||||
DocTermNew;
|
||||
Type("::/Doc/Start.DD");
|
||||
LBts(&Fs->display_flags,DISPLAYf_SHOW);
|
||||
LBts(&Fs->display_flags, DISPLAYf_SHOW);
|
||||
WinToTop;
|
||||
WinZBufUpdate;
|
||||
Dir;
|
||||
@ -14,7 +14,7 @@ U0 UserStartUp()
|
||||
U0 ServerStartUp()
|
||||
{//Run each time a server task is spawned.
|
||||
DocTermNew;
|
||||
LBts(&Fs->display_flags,DISPLAYf_SHOW);
|
||||
LBts(&Fs->display_flags, DISPLAYf_SHOW);
|
||||
WinToTop;
|
||||
WinZBufUpdate;
|
||||
}
|
||||
@ -25,7 +25,7 @@ U0 StartUpTasks()
|
||||
WinToTop(user);
|
||||
WinTileVert;
|
||||
"Boot Time:%7.3fs\n",tS;
|
||||
XTalk(user,"Cd;#include \"Once\";\n");
|
||||
XTalk(user, "Cd;#include \"Once\";\n");
|
||||
Silent;//no output to screen
|
||||
ACInit("/*");
|
||||
Silent(OFF); //no output to screen
|
||||
|
@ -5,24 +5,24 @@
|
||||
|
||||
//These are customized quick commands.
|
||||
//Feel free to add more or change.
|
||||
public I64 F(U8 *needle_str,U8 *fu_flags=NULL)
|
||||
public I64 F(U8 *needle_str, U8 *fu_flags = NULL)
|
||||
{//Find text in all text files.
|
||||
return Find(needle_str,"/*",fu_flags);
|
||||
return Find(needle_str, "/*", fu_flags);
|
||||
}
|
||||
|
||||
public I64 R(U8 *needle_str,U8 *replace_text=NULL,U8 *fu_flags="+l-i")
|
||||
public I64 R(U8 *needle_str, U8 *replace_text = NULL, U8 *fu_flags = "+l-i")
|
||||
{//Find text and replace in all text files.
|
||||
return Find(needle_str,"/*",fu_flags,replace_text);
|
||||
return Find(needle_str, "/*", fu_flags, replace_text);
|
||||
}
|
||||
|
||||
public I64 FD(U8 *needle_str,U8 *fu_flags=NULL)
|
||||
public I64 FD(U8 *needle_str, U8 *fu_flags = NULL)
|
||||
{//Find text in cur dir text files.
|
||||
return Find(needle_str,"*",fu_flags);
|
||||
return Find(needle_str, "*", fu_flags);
|
||||
}
|
||||
|
||||
public I64 RD(U8 *needle_str,U8 *replace_text=NULL,U8 *fu_flags="+l-i")
|
||||
public I64 RD(U8 *needle_str, U8 *replace_text = NULL, U8 *fu_flags = "+l-i")
|
||||
{//Find text and replace in cur dir text files.
|
||||
return Find(needle_str,"*",fu_flags,replace_text);
|
||||
return Find(needle_str, "*", fu_flags, replace_text);
|
||||
}
|
||||
|
||||
public U0 Cls()
|
||||
|
20
src/Once.CC
20
src/Once.CC
@ -10,10 +10,12 @@
|
||||
U0 Tmp()
|
||||
{
|
||||
OnceExe;
|
||||
switch (sys_boot_src.u16[0]) {
|
||||
switch (sys_boot_src.u16[0])
|
||||
{
|
||||
case BOOT_SRC_ROM:
|
||||
"Continue booting hard drive ";
|
||||
if (YorN) {
|
||||
if (YorN)
|
||||
{
|
||||
DocBottom;
|
||||
ExeFile("C:/Home/Once");
|
||||
}
|
||||
@ -22,11 +24,13 @@ U0 Tmp()
|
||||
"\nIf you answer 'No' you can play with\n"
|
||||
"the live CD without installing.\n\n"
|
||||
"Install onto hard drive ";
|
||||
if (YorN) {
|
||||
if (YorN)
|
||||
{
|
||||
DocBottom;
|
||||
RunFile("::/Misc/OSInstall",,TRUE);
|
||||
RunFile("::/Misc/OSInstall",, TRUE);
|
||||
}
|
||||
if (FileFind("::/Misc/Tour")) {
|
||||
if (FileFind("::/Misc/Tour"))
|
||||
{
|
||||
"\nTake Tour";
|
||||
if (YorN) {
|
||||
DocBottom;
|
||||
@ -40,9 +44,11 @@ U0 Tmp()
|
||||
"$$PURPLE$$$$TX+CX,\"Tip of the Day\"$$$$FG$$\n";
|
||||
TipOfDay;
|
||||
// Type("::/Doc/Customize.DD");
|
||||
// if (FileFind("::/Misc/Tour")) {
|
||||
// if (FileFind("::/Misc/Tour"))
|
||||
// {
|
||||
// "\nTake Tour";
|
||||
// if (YorN) {
|
||||
// if (YorN)
|
||||
// {
|
||||
// DocBottom;
|
||||
// Cd("::/Misc/Tour");
|
||||
// InFile("Tour");
|
||||
|
@ -2,7 +2,7 @@
|
||||
//See $LK,"Zenith Start-up",A="FF:::/Kernel/KMain.CC,\"StartOS"$.
|
||||
|
||||
#help_index "Compiler/Directive"
|
||||
public extern I8i Option(I64i num,I8i val);
|
||||
public extern I8i Option(I64i num, I8i val);
|
||||
Option(0,0); //(0,0)=EchoOff (0,1)=EchoOn
|
||||
|
||||
#include "/Kernel/KernelA.HH"
|
||||
@ -11,32 +11,31 @@ Option(0,0); //(0,0)=EchoOff (0,1)=EchoOn
|
||||
#include "/Kernel/KernelC.HH"
|
||||
#include "/Compiler/CompilerB.HH"
|
||||
|
||||
Option(OPTf_WARN_PAREN,ON);
|
||||
Option(OPTf_WARN_DUP_TYPES,ON);
|
||||
Option(OPTf_WARN_PAREN, ON);
|
||||
Option(OPTf_WARN_DUP_TYPES, ON);
|
||||
HashTablePurge(zenith_task->hash_table);
|
||||
|
||||
#include "/Zenith/MakeZenith"
|
||||
|
||||
//Debug("Type 'G;'");
|
||||
DocTermNew;
|
||||
WinVert(2,text.rows / 5);
|
||||
WinVert(2, text.rows / 5);
|
||||
|
||||
sys_winmgr_task=Spawn(&WinMgrTask,NULL,"Window Mgr");
|
||||
Fs->win_inhibit=WIG_TASK_DEFAULT-WIF_SELF_BORDER
|
||||
-WIF_SELF_GRAB_SCROLL-WIF_SELF_CTRLS;
|
||||
LBts(&Fs->display_flags,DISPLAYf_CHILDREN_NOT_ON_TOP);
|
||||
LBts(&Fs->display_flags,DISPLAYf_SHOW);
|
||||
sys_winmgr_task = Spawn(&WinMgrTask, NULL, "Window Mgr");
|
||||
Fs->win_inhibit = WIG_TASK_DEFAULT - WIF_SELF_BORDER - WIF_SELF_GRAB_SCROLL - WIF_SELF_CTRLS;
|
||||
LBts(&Fs->display_flags, DISPLAYf_CHILDREN_NOT_ON_TOP);
|
||||
LBts(&Fs->display_flags, DISPLAYf_SHOW);
|
||||
RegInit;
|
||||
LBts(&sys_run_level,RLf_REGISTRY);
|
||||
LBts(&sys_run_level, RLf_REGISTRY);
|
||||
|
||||
WallPaperInit;
|
||||
|
||||
if (DriveIsWritable)
|
||||
DirMake("/Tmp"); //Good to have a Tmp
|
||||
|
||||
Option(OPTf_WARN_PAREN,OFF);
|
||||
Option(OPTf_WARN_DUP_TYPES,OFF);
|
||||
LBts(&sys_run_level,RLf_HOME);
|
||||
Option(OPTf_WARN_PAREN, OFF);
|
||||
Option(OPTf_WARN_DUP_TYPES, OFF);
|
||||
LBts(&sys_run_level, RLf_HOME);
|
||||
|
||||
#help_index ""
|
||||
#include "~/MakeHome"
|
||||
|
@ -201,18 +201,18 @@ public CPCIDev *PCIDevFind(U16 class_code=NULL, U16 sub_code=NULL,
|
||||
public U0 PCIRep()
|
||||
{//Report description of PCI devices.
|
||||
CPCIDev *tmppci;
|
||||
"PCI Buses:%d\n",sys_pci_buses;
|
||||
"PCI Buses:%d\n", sys_pci_buses;
|
||||
if (!FileFind(PCI_DEV_FILE)) {
|
||||
"You don't have the PCI device file.\n";
|
||||
return;
|
||||
}
|
||||
PCILookUpDevs;
|
||||
tmppci=dev.pci_head.next;
|
||||
while (tmppci!=&dev.pci_head) {
|
||||
tmppci = dev.pci_head.next;
|
||||
while (tmppci != &dev.pci_head) {
|
||||
"%02X:%02X:%01X %02X-%02X-%02X $$GREEN$$%s $$CYAN$$%s$$FG$$\n",
|
||||
tmppci->bus,tmppci->dev,tmppci->fun,
|
||||
tmppci->class_code,tmppci->sub_code,tmppci->prog_if,
|
||||
tmppci->vendor_str,tmppci->dev_id_str;
|
||||
tmppci->bus, tmppci->dev, tmppci->fun,
|
||||
tmppci->class_code, tmppci->sub_code, tmppci->prog_if,
|
||||
tmppci->vendor_str, tmppci->dev_id_str;
|
||||
tmppci=tmppci->next;
|
||||
}
|
||||
}
|
||||
@ -231,15 +231,15 @@ public U0 MemBIOSRep()
|
||||
"%08X-%08X See $LK,"VBE Mode",A="FF:::/Kernel/KernelA.HH,framebuffer"$\n", text.fb_alias,
|
||||
text.fb_alias(U8 *) + text.buffer_size - 1;
|
||||
"\n$$PURPLE$$32 Bit Device Mem$$FG$$\n";
|
||||
while (LBts(&sys_semas[SEMA_DEV_MEM],0))
|
||||
while (LBts(&sys_semas[SEMA_DEV_MEM], 0))
|
||||
Yield;
|
||||
tmpmr=dev.mem32_head.next;
|
||||
while (tmpmr!=&dev.mem32_head) {
|
||||
tmpmr = dev.mem32_head.next;
|
||||
while (tmpmr != &dev.mem32_head) {
|
||||
"%z:%08X-%08X\n",
|
||||
tmpmr->type,"Unused\0RAM\0Device",tmpmr->base,tmpmr->base+tmpmr->size-1;
|
||||
tmpmr=tmpmr->next;
|
||||
tmpmr->type, "Unused\0RAM\0Device", tmpmr->base, tmpmr->base + tmpmr->size - 1;
|
||||
tmpmr = tmpmr->next;
|
||||
}
|
||||
LBtr(&sys_semas[SEMA_DEV_MEM],0);
|
||||
LBtr(&sys_semas[SEMA_DEV_MEM], 0);
|
||||
|
||||
"\n$$PURPLE$$BIOS Memory Report 15:E801$$FG$$\n"
|
||||
"0000000000000000-%016X\n", 0x100000 + m01[0] * 1024 - 1;
|
||||
@ -283,17 +283,17 @@ public U0 MemBIOSRep()
|
||||
|
||||
public U0 MemPageRep()
|
||||
{//Page Table Report.
|
||||
"MAPPED\t :%010X with ",mem_mapped_space;
|
||||
if (Bt(&mem_page_size,30))
|
||||
"MAPPED\t :%010X with ", mem_mapped_space;
|
||||
if (Bt(&mem_page_size, 30))
|
||||
"$$RED$$1GIG$$FG$$ pages\n";
|
||||
else
|
||||
"$$RED$$2MEG$$FG$$ pages\n";
|
||||
"PML2\t :%010X 2MEG :%08X\n",
|
||||
*MEM_PML2(U64 *),*MEM_2MEG_NUM(U64 *);
|
||||
*MEM_PML2(U64 *), *MEM_2MEG_NUM(U64 *);
|
||||
"PML3\t :%010X 1GIG :%08X\n",
|
||||
*MEM_PML3(U64 *),*MEM_1GIG_NUM(U64 *);
|
||||
*MEM_PML3(U64 *), *MEM_1GIG_NUM(U64 *);
|
||||
"PML4\t :%010X 512GIG:%08X\n",
|
||||
*MEM_PML4(U64 *),*MEM_512GIG_NUM(U64 *);
|
||||
"FIXED_AREA:%010X\n",SYS_FIXED_AREA;
|
||||
"HEAP_BASE :%010X\nHEAP_LIMIT:%010X\n",mem_heap_base,mem_heap_limit;
|
||||
*MEM_PML4(U64 *), *MEM_512GIG_NUM(U64 *);
|
||||
"FIXED_AREA:%010X\n", SYS_FIXED_AREA;
|
||||
"HEAP_BASE :%010X\nHEAP_LIMIT:%010X\n", mem_heap_base, mem_heap_limit;
|
||||
}
|
||||
|
@ -3,19 +3,24 @@
|
||||
|
||||
public U0 InGetStr(U8 *st)
|
||||
{//Wait for user to type certain str.
|
||||
I64 ch,sc;
|
||||
U8 buf[256],*st2;
|
||||
while (*st) {
|
||||
I64 ch, sc;
|
||||
U8 buf[256], *st2;
|
||||
while (*st)
|
||||
{
|
||||
ch=KeyGet(&sc,FALSE);
|
||||
if (sc.u8[0]!=SC_SHIFT &&
|
||||
sc.u8[0]!=SC_ALT &&
|
||||
sc.u8[0]!=SC_CTRL) {
|
||||
if (ch==*st) {
|
||||
if (sc.u8[0] != SC_SHIFT &&
|
||||
sc.u8[0] != SC_ALT &&
|
||||
sc.u8[0] != SC_CTRL)
|
||||
{
|
||||
if (ch == *st)
|
||||
{
|
||||
'' ch;
|
||||
st++;
|
||||
} else {
|
||||
st2=Char2KeyName(*st);
|
||||
StrPrint(buf,"Press the $$GREEN$$<%s>$$FG$$ key.",st2);
|
||||
}
|
||||
else
|
||||
{
|
||||
st2 = Char2KeyName(*st);
|
||||
StrPrint(buf, "Press the $$GREEN$$<%s>$$FG$$ key.", st2);
|
||||
Free(st2);
|
||||
PopUpOk(buf);
|
||||
}
|
||||
@ -23,118 +28,128 @@ public U0 InGetStr(U8 *st)
|
||||
}
|
||||
}
|
||||
|
||||
public U0 InPrint(I64 mS=100,U8 *format,...)
|
||||
public U0 InPrint(I64 mS=100, U8 *format,...)
|
||||
{//Print message with delay after each char.
|
||||
U8 *buf=StrPrintJoin(NULL,format,argc,argv),*st=buf;
|
||||
U8 *buf = StrPrintJoin(NULL, format, argc, argv), *st=buf;
|
||||
I64 ch;
|
||||
while (ch=*st++) {
|
||||
while (ch = *st++)
|
||||
{
|
||||
'' ch;
|
||||
Sleep(mS);
|
||||
}
|
||||
Free(buf);
|
||||
}
|
||||
|
||||
public U0 InKeyGet(I64 scan_code,I64 sc_mask=0xFF|SCF_SHIFT|SCF_CTRL|SCF_ALT)
|
||||
public U0 InKeyGet(I64 scan_code, I64 sc_mask = 0xFF | SCF_SHIFT | SCF_CTRL | SCF_ALT)
|
||||
{//Wait for user to press certain key.
|
||||
I64 sc,ch;
|
||||
U8 buf[STR_LEN],*st;
|
||||
do {
|
||||
ch=KeyGet(&sc);
|
||||
if (sc.u8[0]!=SC_PRINTSCREEN1 &&
|
||||
!(sc.u8[0]==SC_SHIFT && scan_code&SCF_SHIFT) &&
|
||||
!(sc.u8[0]==SC_CTRL && scan_code&SCF_CTRL) &&
|
||||
!(sc.u8[0]==SC_ALT && scan_code&SCF_ALT) ) {
|
||||
if (sc&sc_mask!=scan_code&sc_mask) {
|
||||
st=ScanCode2KeyName(scan_code);
|
||||
StrPrint(buf,"Press the $$GREEN$$<%s>$$FG$$ key",st);
|
||||
I64 sc, ch;
|
||||
U8 buf[STR_LEN], *st;
|
||||
do
|
||||
{
|
||||
ch = KeyGet(&sc);
|
||||
if (sc.u8[0] != SC_PRINTSCREEN1 &&
|
||||
!(sc.u8[0] == SC_SHIFT && scan_code & SCF_SHIFT) &&
|
||||
!(sc.u8[0] == SC_CTRL && scan_code & SCF_CTRL) &&
|
||||
!(sc.u8[0] == SC_ALT && scan_code & SCF_ALT) )
|
||||
{
|
||||
if (sc & sc_mask != scan_code & sc_mask)
|
||||
{
|
||||
st = ScanCode2KeyName(scan_code);
|
||||
StrPrint(buf, "Press the $$GREEN$$<%s>$$FG$$ key", st);
|
||||
Free(st);
|
||||
PopUpOk(buf);
|
||||
}
|
||||
}
|
||||
} while (sc&sc_mask!=scan_code&sc_mask);
|
||||
Message(MESSAGE_KEY_DOWN,ch,sc);
|
||||
} while (sc & sc_mask != scan_code & sc_mask);
|
||||
Message(MESSAGE_KEY_DOWN, ch, sc);
|
||||
}
|
||||
|
||||
public I64 InCharGet(...)
|
||||
{//Wait for user to press one of set of chars.
|
||||
I64 i,sc,ch;
|
||||
U8 buf[512],*st;
|
||||
while (TRUE) {
|
||||
ch=KeyGet(&sc);
|
||||
if (sc.u8[0]!=SC_SHIFT && sc.u8[0]!=SC_ALT && sc.u8[0]!=SC_CTRL) {
|
||||
for (i=0;i<argc;i++)
|
||||
if (ch==argv[i]) {
|
||||
Message(MESSAGE_KEY_DOWN,ch,sc);
|
||||
I64 i, sc, ch;
|
||||
U8 buf[512], *st;
|
||||
while (TRUE)
|
||||
{
|
||||
ch = KeyGet(&sc);
|
||||
if (sc.u8[0] != SC_SHIFT && sc.u8[0] != SC_ALT && sc.u8[0] != SC_CTRL)
|
||||
{
|
||||
for (i = 0; i < argc; i++)
|
||||
if (ch == argv[i])
|
||||
{
|
||||
Message(MESSAGE_KEY_DOWN, ch, sc);
|
||||
return ch;
|
||||
}
|
||||
StrPrint(buf,"Press ");
|
||||
for (i=0;i<argc;i++) {
|
||||
st=Char2KeyName(argv[i]);
|
||||
CatPrint(buf,"$$GREEN$$<%s>$$FG$$",st);
|
||||
StrPrint(buf, "Press ");
|
||||
for (i = 0; i < argc; i++)
|
||||
{
|
||||
st = Char2KeyName(argv[i]);
|
||||
CatPrint(buf, "$$GREEN$$<%s>$$FG$$", st);
|
||||
Free(st);
|
||||
if (argc==i+1)
|
||||
CatPrint(buf,".");
|
||||
else if (argc==i+2)
|
||||
CatPrint(buf," or ");
|
||||
if (argc == i+1)
|
||||
CatPrint(buf, ".");
|
||||
else if (argc == i + 2)
|
||||
CatPrint(buf, " or ");
|
||||
else
|
||||
CatPrint(buf,", ");
|
||||
CatPrint(buf, ", ");
|
||||
}
|
||||
PopUpOk(buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public U0 InUntilKey(I64 scan_code,I64 sc_mask=0xFF|SCF_SHIFT|SCF_CTRL|SCF_ALT)
|
||||
public U0 InUntilKey(I64 scan_code, I64 sc_mask = 0xFF | SCF_SHIFT | SCF_CTRL | SCF_ALT)
|
||||
{//Let user type until he presses certain key.
|
||||
I64 sc,ch;
|
||||
do {
|
||||
ch=KeyGet(&sc);
|
||||
Message(MESSAGE_KEY_DOWN,ch,sc);
|
||||
} while (sc&sc_mask!=scan_code&sc_mask);
|
||||
I64 sc, ch;
|
||||
do
|
||||
{
|
||||
ch = KeyGet(&sc);
|
||||
Message(MESSAGE_KEY_DOWN, ch, sc);
|
||||
} while (sc & sc_mask != scan_code & sc_mask);
|
||||
}
|
||||
|
||||
public I64 InUntilChar(...)
|
||||
{//Let user type until he presses one of set of chars.
|
||||
I64 i,sc,ch;
|
||||
while (TRUE) {
|
||||
ch=KeyGet(&sc);
|
||||
Message(MESSAGE_KEY_DOWN,ch,sc);
|
||||
for (i=0;i<argc;i++)
|
||||
if (ch==argv[i])
|
||||
I64 i, sc, ch;
|
||||
while (TRUE)
|
||||
{
|
||||
ch = KeyGet(&sc);
|
||||
Message(MESSAGE_KEY_DOWN, ch, sc);
|
||||
for (i = 0 ;i < argc; i++)
|
||||
if (ch == argv[i])
|
||||
return ch;
|
||||
}
|
||||
}
|
||||
|
||||
public Bool InView()
|
||||
{//Let user type until <ESC> or <SHIFT-ESC>.
|
||||
Bool res=View;
|
||||
Bool res = View;
|
||||
DocBottom;
|
||||
return res;
|
||||
}
|
||||
|
||||
#help_index "InFile;Help System/Training;Mouse"
|
||||
I64 in_plot_l,in_plot_r;
|
||||
I64 in_plot_l, in_plot_r;
|
||||
|
||||
Bool InSetMousePlot(I64 mS,I64 x,I64 y,I64 z)
|
||||
Bool InSetMousePlot(I64 mS, I64 x, I64 y, I64 z)
|
||||
{
|
||||
MouseSet(x,y,z,in_plot_l,in_plot_r);
|
||||
MouseSet(x, y, z, in_plot_l, in_plot_r);
|
||||
Sleep(mS);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
public U0 InSetMouse(I64 mS=7,I64 x=I64_MAX,I64 y=I64_MAX,I64 z=I64_MAX,
|
||||
I64 l=I64_MAX,I64 r=I64_MAX)
|
||||
public U0 InSetMouse(I64 mS=7, I64 x = I64_MAX, I64 y = I64_MAX, I64 z = I64_MAX,
|
||||
I64 l = I64_MAX, I64 r = I64_MAX)
|
||||
{//Move mouse to spot at certain speed.
|
||||
if (!(0<=x<GR_WIDTH))
|
||||
x=mouse.pos.x;
|
||||
if (!(0<=y<GR_HEIGHT))
|
||||
y=mouse.pos.y;
|
||||
if (z==I64_MAX)
|
||||
z=mouse.pos.z;
|
||||
if (!(FALSE<=l<=TRUE))
|
||||
l=mouse.lb;
|
||||
if (!(FALSE<=r<=TRUE))
|
||||
r=mouse.rb;
|
||||
in_plot_l=l; in_plot_r=r;
|
||||
Line(mS,mouse.pos.x,mouse.pos.y,mouse.pos.z,x,y,z,&InSetMousePlot);
|
||||
if (!(0 <= x < GR_WIDTH))
|
||||
x = mouse.pos.x;
|
||||
if (!(0 <= y < GR_HEIGHT))
|
||||
y = mouse.pos.y;
|
||||
if (z == I64_MAX)
|
||||
z = mouse.pos.z;
|
||||
if (!(FALSE <= l <= TRUE))
|
||||
l = mouse.lb;
|
||||
if (!(FALSE <= r <= TRUE))
|
||||
r = mouse.rb;
|
||||
in_plot_l = l; in_plot_r = r;
|
||||
Line(mS, mouse.pos.x, mouse.pos.y, mouse.pos.z, x, y, z, &InSetMousePlot);
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ Cd(__DIR__);;
|
||||
#include "ZDebug"
|
||||
#include "Divination"
|
||||
#include "DolDoc/MakeDoc"
|
||||
LBts(&sys_run_level,RLf_DOC);
|
||||
LBts(&sys_run_level, RLf_DOC);
|
||||
#include "Ctrls/MakeCtrls"
|
||||
#include "InFile"
|
||||
#include "ZRegistry"
|
||||
|
@ -1,86 +1,90 @@
|
||||
#help_index "Task/Settings"
|
||||
|
||||
public CTaskSettings *SettingsPush(CTask *task=NULL,I64 flags=0)
|
||||
public CTaskSettings *SettingsPush(CTask *task = NULL, I64 flags = 0)
|
||||
{//Typically, called at start of an application.
|
||||
//It saves many settings so they can be restored
|
||||
//at the end of the application with $LK,"SettingsPop",A="MN:SettingsPop"$().
|
||||
|
||||
CTaskSettings *tmpse;
|
||||
CDoc *doc;
|
||||
if (!task) task=Fs;
|
||||
if (!task) task = Fs;
|
||||
if (!TaskValidate(task)) return NULL;
|
||||
tmpse=CAlloc(sizeof(CTaskSettings),task);
|
||||
tmpse->cur_dir=DirCur(task,task);
|
||||
tmpse->draw_it=task->draw_it;
|
||||
tmpse = CAlloc(sizeof(CTaskSettings), task);
|
||||
tmpse->cur_dir = DirCur(task, task);
|
||||
tmpse->draw_it = task->draw_it;
|
||||
GrPaletteGet(tmpse->palette);
|
||||
tmpse->task_end_cb=task->task_end_cb;
|
||||
tmpse->task_end_cb = task->task_end_cb;
|
||||
|
||||
if (!(flags&TSF_SAME_SONG)) {
|
||||
if (tmpse->song_task=task->song_task) {
|
||||
if (!(flags & TSF_SAME_SONG))
|
||||
{
|
||||
if (tmpse->song_task = task->song_task)
|
||||
{
|
||||
Suspend(task->song_task);
|
||||
Sound;
|
||||
}
|
||||
task->song_task=NULL;
|
||||
}
|
||||
|
||||
if (tmpse->animate_task=task->animate_task)
|
||||
if (tmpse->animate_task = task->animate_task)
|
||||
Suspend(task->animate_task);
|
||||
task->animate_task=NULL;
|
||||
|
||||
if (doc=DocPut(task)) {
|
||||
tmpse->hide_cursor=!Bt(&doc->flags,DOCf_HIDE_CURSOR);
|
||||
tmpse->highlight_cursor=!Bt(&doc->flags,DOCf_DONT_HIGHLIGHT_CURSOR);
|
||||
tmpse->scroll=!Bt(&doc->flags,DOCf_NO_SCROLL_BARS);
|
||||
if (doc = DocPut(task))
|
||||
{
|
||||
tmpse->hide_cursor = !Bt(&doc->flags, DOCf_HIDE_CURSOR);
|
||||
tmpse->highlight_cursor = !Bt(&doc->flags, DOCf_DONT_HIGHLIGHT_CURSOR);
|
||||
tmpse->scroll = !Bt(&doc->flags, DOCf_NO_SCROLL_BARS);
|
||||
}
|
||||
|
||||
tmpse->left=task->win_left;
|
||||
tmpse->right=task->win_right;
|
||||
tmpse->top=task->win_top;
|
||||
tmpse->bottom=task->win_bottom;
|
||||
tmpse->left = task->win_left;
|
||||
tmpse->right = task->win_right;
|
||||
tmpse->top = task->win_top;
|
||||
tmpse->bottom = task->win_bottom;
|
||||
|
||||
tmpse->scroll_x=task->scroll_x;
|
||||
tmpse->scroll_y=task->scroll_y;
|
||||
tmpse->scroll_z=task->scroll_z;
|
||||
tmpse->scroll_x = task->scroll_x;
|
||||
tmpse->scroll_y = task->scroll_y;
|
||||
tmpse->scroll_z = task->scroll_z;
|
||||
|
||||
tmpse->win_inhibit=task->win_inhibit;
|
||||
tmpse->text_attr=task->text_attr;
|
||||
StrCopy(tmpse->task_title,task->task_title);
|
||||
tmpse->title_src =task->title_src;
|
||||
tmpse->border_attr=task->border_attr;
|
||||
tmpse->border_src =task->border_src;
|
||||
tmpse->border=!Bt(&task->display_flags,DISPLAYf_NO_BORDER);
|
||||
tmpse->win_inhibit = task->win_inhibit;
|
||||
tmpse->text_attr = task->text_attr;
|
||||
StrCopy(tmpse->task_title, task->task_title);
|
||||
tmpse->title_src = task->title_src;
|
||||
tmpse->border_attr = task->border_attr;
|
||||
tmpse->border_src = task->border_src;
|
||||
tmpse->border = !Bt(&task->display_flags, DISPLAYf_NO_BORDER);
|
||||
if (TaskValidate(ac.task))
|
||||
tmpse->autocomplete=TRUE;
|
||||
tmpse->autocomplete = TRUE;
|
||||
else
|
||||
tmpse->autocomplete=FALSE;
|
||||
tmpse->autocomplete = FALSE;
|
||||
|
||||
tmpse->next=task->next_settings;
|
||||
task->next_settings=tmpse;
|
||||
tmpse->next = task->next_settings;
|
||||
task->next_settings = tmpse;
|
||||
return tmpse;
|
||||
}
|
||||
|
||||
U0 SettingsPop2(CTask *task,CTaskSettings *tmpse)
|
||||
U0 SettingsPop2(CTask *task, CTaskSettings *tmpse)
|
||||
{
|
||||
CDoc *doc;
|
||||
|
||||
if (doc=DocPut(task)) {
|
||||
LBEqual(&doc->flags,DOCf_HIDE_CURSOR,!tmpse->hide_cursor);
|
||||
LBEqual(&doc->flags,DOCf_DONT_HIGHLIGHT_CURSOR,!tmpse->highlight_cursor);
|
||||
LBEqual(&doc->flags,DOCf_NO_SCROLL_BARS,!tmpse->scroll);
|
||||
if (doc = DocPut(task))
|
||||
{
|
||||
LBEqual(&doc->flags, DOCf_HIDE_CURSOR, !tmpse->hide_cursor);
|
||||
LBEqual(&doc->flags, DOCf_DONT_HIGHLIGHT_CURSOR, !tmpse->highlight_cursor);
|
||||
LBEqual(&doc->flags, DOCf_NO_SCROLL_BARS, !tmpse->scroll);
|
||||
}
|
||||
|
||||
WinBorder(tmpse->border,task);
|
||||
WinHorz(tmpse->left,tmpse->right,task);
|
||||
WinVert(tmpse->top,tmpse->bottom,task);
|
||||
task->scroll_x=tmpse->scroll_x;
|
||||
task->scroll_y=tmpse->scroll_y;
|
||||
task->scroll_z=tmpse->scroll_z;
|
||||
task->win_inhibit=tmpse->win_inhibit;
|
||||
task->text_attr=tmpse->text_attr;
|
||||
task->border_attr=tmpse->border_attr;
|
||||
task->border_src =tmpse->border_src;
|
||||
task->title_src =tmpse->title_src;
|
||||
StrCopy(task->task_title,tmpse->task_title);
|
||||
WinBorder(tmpse->border, task);
|
||||
WinHorz(tmpse->left, tmpse->right, task);
|
||||
WinVert(tmpse->top, tmpse->bottom, task);
|
||||
task->scroll_x = tmpse->scroll_x;
|
||||
task->scroll_y = tmpse->scroll_y;
|
||||
task->scroll_z = tmpse->scroll_z;
|
||||
task->win_inhibit = tmpse->win_inhibit;
|
||||
task->text_attr = tmpse->text_attr;
|
||||
task->border_attr = tmpse->border_attr;
|
||||
task->border_src = tmpse->border_src;
|
||||
task->title_src = tmpse->title_src;
|
||||
StrCopy(task->task_title, tmpse->task_title);
|
||||
AutoComplete(tmpse->autocomplete);
|
||||
GrPaletteSet(tmpse->palette);
|
||||
Sound;
|
||||
@ -92,28 +96,30 @@ public U0 SettingsPop(CTask *task=NULL,I64 flags=0)
|
||||
if (!task) task=Fs;
|
||||
if (!TaskValidate(task))
|
||||
return;
|
||||
if (tmpse=task->next_settings) {
|
||||
task->next_settings=tmpse->next;
|
||||
if (tmpse=task->next_settings)
|
||||
{
|
||||
task->next_settings = tmpse->next;
|
||||
Cd(tmpse->cur_dir);
|
||||
Free(tmpse->cur_dir);
|
||||
task->draw_it=tmpse->draw_it;
|
||||
task->task_end_cb=tmpse->task_end_cb;
|
||||
task->draw_it = tmpse->draw_it;
|
||||
task->task_end_cb = tmpse->task_end_cb;
|
||||
|
||||
if (task->animate_task)
|
||||
Kill(task->animate_task);
|
||||
if (task->animate_task=tmpse->animate_task)
|
||||
if (task->animate_task = tmpse->animate_task)
|
||||
Suspend(task->animate_task,FALSE);
|
||||
|
||||
if (!(flags&TSF_SAME_SONG)) {
|
||||
if (!(flags & TSF_SAME_SONG))
|
||||
{
|
||||
if (task->song_task)
|
||||
Kill(task->song_task);
|
||||
if (task->song_task=tmpse->song_task)
|
||||
if (task->song_task = tmpse->song_task)
|
||||
Suspend(task->song_task,FALSE);
|
||||
}
|
||||
|
||||
SettingsPop2(task,tmpse); //Do it to get ress fast
|
||||
SettingsPop2(task, tmpse); //Do it to get ress fast
|
||||
Refresh(,TRUE);
|
||||
SettingsPop2(task,tmpse); //Redo in case was lost by old update
|
||||
SettingsPop2(task, tmpse); //Redo in case was lost by old update
|
||||
|
||||
Free(tmpse);
|
||||
}
|
||||
|
@ -1,32 +1,32 @@
|
||||
#help_index "Help System"
|
||||
|
||||
U8 *KeyMapKeyMStrPrint(I64 sc,U0 (*fp_handler)(I64 sc),
|
||||
U8 *desc,CTask *task=NULL)
|
||||
U8 *KeyMapKeyMStrPrint(I64 sc, U0 (*fp_handler)(I64 sc),
|
||||
U8 *desc, CTask *task = NULL)
|
||||
{
|
||||
I64 i=9,k,c;
|
||||
U8 *st,*st2,*res,*ptr;
|
||||
CHashTable *old_hash=Fs->hash_table;
|
||||
st=ScanCode2KeyName(sc);
|
||||
if (sc&SCF_CTRL) i+=5;
|
||||
if (sc&SCF_ALT) i+=4;
|
||||
if (sc&(SCF_SHIFT|SCF_NO_SHIFT)) i+=6;
|
||||
I64 i=9, k, c;
|
||||
U8 *st, *st2, *res, *ptr;
|
||||
CHashTable *old_hash = Fs->hash_table;
|
||||
st = ScanCode2KeyName(sc);
|
||||
if (sc & SCF_CTRL) i+=5;
|
||||
if (sc & SCF_ALT) i+=4;
|
||||
if (sc & (SCF_SHIFT | SCF_NO_SHIFT)) i+=6;
|
||||
if (TaskValidate(task))
|
||||
Fs->hash_table=task->hash_table;
|
||||
st2=SrcEdLink(fp_handler,256);
|
||||
Fs->hash_table=old_hash;
|
||||
Fs->hash_table = task->hash_table;
|
||||
st2 = SrcEdLink(fp_handler, 256);
|
||||
Fs->hash_table = old_hash;
|
||||
|
||||
k=*desc(U32 *);
|
||||
if (k=='Edit') c=BLUE;
|
||||
else if (k=='Dol ') c=GREEN;
|
||||
else if (k=='Cmd ') c=RED;
|
||||
else c=BLACK;
|
||||
k = *desc(U32 *);
|
||||
if (k == 'Edit') c=BLUE;
|
||||
else if (k == 'Dol ') c=GREEN;
|
||||
else if (k == 'Cmd ') c=RED;
|
||||
else c=BLACK;
|
||||
|
||||
res=MStrPrint("%-*s $$FG,%d$$$$TX+UL+L+PU,\"%$$Q\",A=\"%s\"$$$$FG$$\n",
|
||||
i,st,c,desc,st2);
|
||||
res = MStrPrint("%-*s $$FG,%d$$$$TX+UL+L+PU,\"%$$Q\",A=\"%s\"$$$$FG$$\n",
|
||||
i, st, c, desc, st2);
|
||||
Free(st);
|
||||
Free(st2);
|
||||
|
||||
ptr=res;
|
||||
ptr = res;
|
||||
while (*ptr)
|
||||
ptr++;
|
||||
|
||||
@ -34,149 +34,161 @@ U8 *KeyMapKeyMStrPrint(I64 sc,U0 (*fp_handler)(I64 sc),
|
||||
return res;
|
||||
}
|
||||
|
||||
U0 KeyMapKeyPrint(I64 sc,U0 (*fp_handler)(I64 sc),U8 *desc,CTask *task=NULL)
|
||||
U0 KeyMapKeyPrint(I64 sc, U0 (*fp_handler)(I64 sc), U8 *desc, CTask *task = NULL)
|
||||
{
|
||||
U8 *st=KeyMapKeyMStrPrint(sc,fp_handler,desc,task);
|
||||
"%s",st;
|
||||
U8 *st = KeyMapKeyMStrPrint(sc, fp_handler, desc, task);
|
||||
"%s", st;
|
||||
Free(st);
|
||||
}
|
||||
|
||||
U0 KeyMapCtrlAltFamily(Bool no_shift,Bool shift)
|
||||
U0 KeyMapCtrlAltFamily(Bool no_shift, Bool shift)
|
||||
{
|
||||
I64 i,no_shift_f;
|
||||
I64 i, no_shift_f;
|
||||
if (no_shift && shift)
|
||||
no_shift_f=SCF_NO_SHIFT;
|
||||
no_shift_f = SCF_NO_SHIFT;
|
||||
else
|
||||
no_shift_f=0;
|
||||
if (no_shift) KeyMapKeyPrint(SC_DELETE+SCF_CTRL+SCF_ALT+no_shift_f,
|
||||
&Reboot,"Cmd /Reboot");
|
||||
if (no_shift) KeyMapKeyPrint(SC_ESC+SCF_CTRL+SCF_ALT+no_shift_f,
|
||||
&User,"Cmd /Terminal Window");
|
||||
if (no_shift) KeyMapKeyPrint(SC_TAB+SCF_CTRL+SCF_ALT+no_shift_f,
|
||||
&WinToTop,"Cmd /Next Focus Task");
|
||||
no_shift_f = 0;
|
||||
if (no_shift) KeyMapKeyPrint(SC_DELETE + SCF_CTRL + SCF_ALT + no_shift_f,
|
||||
&Reboot, "Cmd /Reboot");
|
||||
if (no_shift) KeyMapKeyPrint(SC_ESC + SCF_CTRL + SCF_ALT + no_shift_f,
|
||||
&User, "Cmd /Terminal Window");
|
||||
if (no_shift) KeyMapKeyPrint(SC_TAB + SCF_CTRL + SCF_ALT + no_shift_f,
|
||||
&WinToTop, "Cmd /Next Focus Task");
|
||||
|
||||
for (i=0;i<26;i++)
|
||||
if (keydev.fp_ctrl_alt_cbs[i]) {
|
||||
for (i = 0; i < 26; i++)
|
||||
if (keydev.fp_ctrl_alt_cbs[i])
|
||||
{
|
||||
if (no_shift && keydev.ctrl_alt_no_shift_descs[i])
|
||||
KeyMapKeyPrint(Char2ScanCode(i+'a')+SCF_CTRL+SCF_ALT+no_shift_f,
|
||||
keydev.fp_ctrl_alt_cbs[i],keydev.ctrl_alt_no_shift_descs[i]);
|
||||
KeyMapKeyPrint(Char2ScanCode(i + 'a') + SCF_CTRL + SCF_ALT + no_shift_f,
|
||||
keydev.fp_ctrl_alt_cbs[i], keydev.ctrl_alt_no_shift_descs[i]);
|
||||
if (shift && keydev.ctrl_alt_shift_descs[i])
|
||||
KeyMapKeyPrint(Char2ScanCode(i+'a')+SCF_CTRL+SCF_ALT+SCF_SHIFT,
|
||||
keydev.fp_ctrl_alt_cbs[i],keydev.ctrl_alt_shift_descs[i]);
|
||||
KeyMapKeyPrint(Char2ScanCode(i + 'a') + SCF_CTRL + SCF_ALT + SCF_SHIFT,
|
||||
keydev.fp_ctrl_alt_cbs[i], keydev.ctrl_alt_shift_descs[i]);
|
||||
}
|
||||
}
|
||||
|
||||
U0 KMComparePrepare(U8 *buf,I64 *src)
|
||||
U0 KMComparePrepare(U8 *buf, I64 *src)
|
||||
{
|
||||
I64 i,*dst=buf;
|
||||
I64 i, *dst = buf;
|
||||
U8 *ptr;
|
||||
if (src) {
|
||||
*dst++=*src++;
|
||||
*dst++=*src++;
|
||||
*dst++=*src++;
|
||||
*dst++=*src++;
|
||||
*dst(U8 *)=0;
|
||||
if (ptr=StrMatch("SHIFT",buf)) {
|
||||
for (i=0;i<5;i++)
|
||||
ptr[i]=CH_SPACE;
|
||||
if (ptr=StrMatch("$$",buf))
|
||||
*ptr=255;
|
||||
if (src)
|
||||
{
|
||||
*dst++ = *src++;
|
||||
*dst++ = *src++;
|
||||
*dst++ = *src++;
|
||||
*dst++ = *src++;
|
||||
*dst(U8 *) = 0;
|
||||
if (ptr = StrMatch("SHIFT", buf))
|
||||
{
|
||||
for (i = 0; i < 5; i++)
|
||||
ptr[i] = CH_SPACE;
|
||||
if (ptr = StrMatch("$$", buf))
|
||||
*ptr = 255;
|
||||
}
|
||||
} else
|
||||
}
|
||||
else
|
||||
*buf=0;
|
||||
}
|
||||
|
||||
I64 KMCompare(U8 *e1,U8 *e2)
|
||||
I64 KMCompare(U8 *e1, U8 *e2)
|
||||
{
|
||||
U8 buf1[STR_LEN],buf2[STR_LEN];
|
||||
KMComparePrepare(buf1,e1);
|
||||
KMComparePrepare(buf2,e2);
|
||||
return StrCompare(buf1,buf2);
|
||||
U8 buf1[STR_LEN], buf2[STR_LEN];
|
||||
KMComparePrepare(buf1, e1);
|
||||
KMComparePrepare(buf2, e2);
|
||||
return StrCompare(buf1, buf2);
|
||||
}
|
||||
|
||||
U0 KeyMapFamily2(U8 **entries,CTask *task,I64 scf)
|
||||
U0 KeyMapFamily2(U8 **entries, CTask *task, I64 scf)
|
||||
{
|
||||
I64 i,arg1,arg2;
|
||||
for (i=0;i<256;i++) {
|
||||
arg2=scf|i|SCF_KEY_DESC;
|
||||
arg1=ScanCode2Char(arg2);
|
||||
*keydev.desc=0;
|
||||
keydev.handler=NULL;
|
||||
if (TaskValidate(task) && !Bt(&task->win_inhibit,WIf_SELF_KEY_DESC)) {
|
||||
if (task==Fs)
|
||||
PutKey(arg1,arg2);
|
||||
I64 i, arg1, arg2;
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
arg2 = scf | i | SCF_KEY_DESC;
|
||||
arg1 = ScanCode2Char(arg2);
|
||||
*keydev.desc = 0;
|
||||
keydev.handler = NULL;
|
||||
if (TaskValidate(task) && !Bt(&task->win_inhibit, WIf_SELF_KEY_DESC))
|
||||
{
|
||||
if (task == Fs)
|
||||
PutKey(arg1, arg2);
|
||||
else
|
||||
MessagePost(task,MESSAGE_KEY_DOWN,arg1,arg2);
|
||||
Refresh(0,TRUE);
|
||||
MessagePost(task, MESSAGE_KEY_DOWN, arg1, arg2);
|
||||
Refresh(0, TRUE);
|
||||
Sleep(1); //Open loop because might be no response. TODO: Drops messages.
|
||||
}
|
||||
if (*keydev.desc && StrNCompare(keydev.desc,"Char /",7))
|
||||
entries[i]=KeyMapKeyMStrPrint(arg2,keydev.handler,keydev.desc,task);
|
||||
if (*keydev.desc && StrNCompare(keydev.desc, "Char /",7))
|
||||
entries[i] = KeyMapKeyMStrPrint(arg2, keydev.handler, keydev.desc, task);
|
||||
}
|
||||
}
|
||||
|
||||
U0 KeyMapFamily(CTask *task,I64 scf,Bool no_shift,Bool shift)
|
||||
U0 KeyMapFamily(CTask *task, I64 scf, Bool no_shift, Bool shift)
|
||||
{
|
||||
I64 i,count=0;
|
||||
U8 **entries=CAlloc(2*256*sizeof(U8 *)),**ptr=entries;
|
||||
if (no_shift) {
|
||||
I64 i, count=0;
|
||||
U8 **entries = CAlloc(2 * 256 * sizeof(U8 *)), **ptr = entries;
|
||||
if (no_shift)
|
||||
{
|
||||
if (shift)
|
||||
KeyMapFamily2(ptr,task,scf+SCF_NO_SHIFT);
|
||||
KeyMapFamily2(ptr, task, scf + SCF_NO_SHIFT);
|
||||
else
|
||||
KeyMapFamily2(ptr,task,scf);
|
||||
ptr+=256;
|
||||
count+=256;
|
||||
KeyMapFamily2(ptr, task, scf);
|
||||
ptr += 256;
|
||||
count += 256;
|
||||
}
|
||||
if (shift) {
|
||||
KeyMapFamily2(ptr,task,scf+SCF_SHIFT);
|
||||
ptr+=256;
|
||||
count+=256;
|
||||
if (shift)
|
||||
{
|
||||
KeyMapFamily2(ptr, task, scf + SCF_SHIFT);
|
||||
ptr += 256;
|
||||
count += 256;
|
||||
}
|
||||
QuickSortI64(entries,count,&KMCompare);
|
||||
for (i=0;i<count;i++)
|
||||
if (entries[i]) {
|
||||
"%s",entries[i];
|
||||
QuickSortI64(entries,count, &KMCompare);
|
||||
for (i = 0;i < count; i++)
|
||||
if (entries[i])
|
||||
{
|
||||
"%s", entries[i];
|
||||
Free(entries[i]);
|
||||
}
|
||||
Free(entries);
|
||||
}
|
||||
|
||||
public U0 KeyMap(CTask *task=NULL)
|
||||
public U0 KeyMap(CTask *task = NULL)
|
||||
{//Report desc of all keys.
|
||||
Bool old_key_desc;
|
||||
if (!task) task=Fs;
|
||||
old_key_desc=LBtr(&task->win_inhibit,WIf_SELF_KEY_DESC);
|
||||
if (!task) task = Fs;
|
||||
old_key_desc = LBtr(&task->win_inhibit, WIf_SELF_KEY_DESC);
|
||||
DocMax;
|
||||
KeyMapFamily(task,0,TRUE,TRUE);
|
||||
KeyMapFamily(task,SCF_CTRL,TRUE,TRUE);
|
||||
KeyMapFamily(task,SCF_ALT,TRUE,TRUE);
|
||||
KeyMapCtrlAltFamily(TRUE,TRUE);
|
||||
LBEqual(&task->win_inhibit,WIf_SELF_KEY_DESC,old_key_desc);
|
||||
KeyMapFamily(task, 0, TRUE, TRUE);
|
||||
KeyMapFamily(task, SCF_CTRL, TRUE, TRUE);
|
||||
KeyMapFamily(task, SCF_ALT, TRUE, TRUE);
|
||||
KeyMapCtrlAltFamily(TRUE, TRUE);
|
||||
LBEqual(&task->win_inhibit, WIf_SELF_KEY_DESC, old_key_desc);
|
||||
"\nKeyMap Completed.\n";
|
||||
}
|
||||
|
||||
#help_index "Help System/Training"
|
||||
public U0 TipOfDay(U8 *tip_file="::/Doc/Tips.DD")
|
||||
public U0 TipOfDay(U8 *tip_file = "::/Doc/Tips.DD")
|
||||
{//Print random tip-of-day from ::/Doc/Tips.DD.
|
||||
I64 i=RandU16;
|
||||
CDoc *doc=DocRead(tip_file),*doc2=DocNew;
|
||||
CDocEntry *doc_e=doc->head.next;
|
||||
I64 i = RandU16;
|
||||
CDoc *doc = DocRead(tip_file), *doc2 = DocNew;
|
||||
CDocEntry *doc_e = doc->head.next;
|
||||
"$$WW,1$$\n";
|
||||
while (TRUE) {
|
||||
if (doc_e->type_u8==DOCT_TEXT && *doc_e->tag=='*')
|
||||
while (TRUE)
|
||||
{
|
||||
if (doc_e->type_u8 == DOCT_TEXT && *doc_e->tag == '*')
|
||||
if (!i--) break;
|
||||
doc_e=doc_e->next;
|
||||
doc_e = doc_e->next;
|
||||
}
|
||||
if (doc_e->type_u8==DOCT_TEXT && *doc_e->tag=='*') {
|
||||
while (doc_e!=doc) {
|
||||
if (doc_e->type_u8!=DOCT_ERROR)
|
||||
DocInsEntry(doc2,DocEntryCopy(doc2,doc_e));
|
||||
doc_e=doc_e->next;
|
||||
if (doc_e->type_u8==DOCT_TEXT && *doc_e->tag=='*')
|
||||
if (doc_e->type_u8 == DOCT_TEXT && *doc_e->tag == '*')
|
||||
{
|
||||
while (doc_e != doc)
|
||||
{
|
||||
if (doc_e->type_u8 != DOCT_ERROR)
|
||||
DocInsEntry(doc2, DocEntryCopy(doc2, doc_e));
|
||||
doc_e = doc_e->next;
|
||||
if (doc_e->type_u8 == DOCT_TEXT && *doc_e->tag == '*')
|
||||
break;
|
||||
}
|
||||
}
|
||||
DocInsDoc(DocPut,doc2);
|
||||
DocInsDoc(DocPut, doc2);
|
||||
DocDel(doc2);
|
||||
DocDel(doc);
|
||||
}
|
||||
|
Binary file not shown.
@ -1,86 +1,87 @@
|
||||
#help_index "Windows"
|
||||
#help_file "::/Doc/Windows"
|
||||
|
||||
CMouseStateGlobals old_mouse={{-1000,-1000,0},{-1000,-1000,0},{-1000,-1000,0},
|
||||
{0,0,0},{1.0,1.0,1.0},0.0,TSCGet,0.350,0,0,
|
||||
FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE
|
||||
CMouseStateGlobals old_mouse = {{-1000, -1000, 0}, {-1000, -1000, 0}, {-1000, -1000, 0},
|
||||
{0, 0, 0}, {1.0, 1.0, 1.0}, 0.0, TSCGet, 0.350, 0, 0,
|
||||
FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE
|
||||
};
|
||||
|
||||
public CWinMgrGlobals winmgr={0,0,0,WINMGR_FPS,tS,tS,NULL,FALSE,FALSE,FALSE};
|
||||
winmgr.t=CAlloc(sizeof(CWinMgrTimingGlobals));
|
||||
winmgr.t->last_calc_idle_time=tS;
|
||||
public CWinMgrGlobals winmgr = {0, 0, 0, WINMGR_FPS, tS, tS, NULL, FALSE, FALSE, FALSE};
|
||||
winmgr.t = CAlloc(sizeof(CWinMgrTimingGlobals));
|
||||
winmgr.t->last_calc_idle_time = tS;
|
||||
|
||||
U0 ProgressBarsRegTf(U8 *path=NULL)
|
||||
U0 ProgressBarsRegTf(U8 *path = NULL)
|
||||
{
|
||||
F64 t,p1,p2,p3,p4;
|
||||
if (path) {
|
||||
t=tS;
|
||||
if (progress1_t0) p1=t-progress1_t0; else p1=0;
|
||||
if (progress2_t0) p2=t-progress2_t0; else p2=0;
|
||||
if (progress3_t0) p3=t-progress3_t0; else p3=0;
|
||||
if (progress4_t0) p4=t-progress4_t0; else p4=0;
|
||||
RegWrite(path,"progress1_tf=%0.3f;progress2_tf=%0.3f;\n"
|
||||
"progress3_tf=%0.3f;progress4_tf=%0.3f;\n",p1,p2,p3,p4);
|
||||
F64 t, p1, p2, p3, p4;
|
||||
if (path)
|
||||
{
|
||||
t = tS;
|
||||
if (progress1_t0) p1 = t - progress1_t0; else p1 = 0;
|
||||
if (progress2_t0) p2 = t - progress2_t0; else p2 = 0;
|
||||
if (progress3_t0) p3 = t - progress3_t0; else p3 = 0;
|
||||
if (progress4_t0) p4 = t - progress4_t0; else p4 = 0;
|
||||
RegWrite(path, "progress1_tf=%0.3f;progress2_tf=%0.3f;\n"
|
||||
"progress3_tf=%0.3f;progress4_tf=%0.3f;\n", p1, p2, p3, p4);
|
||||
}
|
||||
}
|
||||
|
||||
#define PROGRESS_BAR_HEIGHT 20
|
||||
#define PROGRESS_BAR_WIDTH (3*GR_WIDTH/4)
|
||||
#define PROGRESS_BAR_WIDTH (3 * GR_WIDTH / 4)
|
||||
U0 DrawProgressBars(CDC *dc)
|
||||
{
|
||||
I64 i,j,k,n,m;
|
||||
U8 *st,*st2;
|
||||
for (i=0;i<PROGRESS_BARS_NUM;i++) {
|
||||
if (m=sys_progresses[i].max) {
|
||||
dc->color=BLACK;
|
||||
GrRect(dc,
|
||||
(GR_WIDTH-PROGRESS_BAR_WIDTH)/2,
|
||||
(GR_HEIGHT-(PROGRESS_BARS_NUM*2-1-i*4)*PROGRESS_BAR_HEIGHT)/2,
|
||||
PROGRESS_BAR_WIDTH,PROGRESS_BAR_HEIGHT);
|
||||
I64 i, j, k, n, m;
|
||||
U8 *st, *st2;
|
||||
for (i = 0; i < PROGRESS_BARS_NUM; i++)
|
||||
{
|
||||
if (m = sys_progresses[i].max)
|
||||
{
|
||||
dc->color = BLACK;
|
||||
GrRect(dc, (GR_WIDTH - PROGRESS_BAR_WIDTH) / 2,
|
||||
(GR_HEIGHT -(PROGRESS_BARS_NUM * 2 - 1 - i * 4) * PROGRESS_BAR_HEIGHT) / 2,
|
||||
PROGRESS_BAR_WIDTH, PROGRESS_BAR_HEIGHT);
|
||||
|
||||
dc->color=LTGREEN;
|
||||
n=sys_progresses[i].val;
|
||||
dc->color = LTGREEN;
|
||||
n = sys_progresses[i].val;
|
||||
if (n>m)
|
||||
n=m;
|
||||
GrRect(dc,
|
||||
(GR_WIDTH-PROGRESS_BAR_WIDTH)/2+2,
|
||||
(GR_HEIGHT-(PROGRESS_BARS_NUM*2-1-i*4)*PROGRESS_BAR_HEIGHT)/2+2,
|
||||
n*(PROGRESS_BAR_WIDTH-4)/m,
|
||||
PROGRESS_BAR_HEIGHT-4);
|
||||
n = m;
|
||||
GrRect(dc, (GR_WIDTH - PROGRESS_BAR_WIDTH) / 2 + 2,
|
||||
(GR_HEIGHT - (PROGRESS_BARS_NUM * 2 - 1 - i * 4) * PROGRESS_BAR_HEIGHT) / 2 + 2,
|
||||
n * (PROGRESS_BAR_WIDTH - 4) / m,
|
||||
PROGRESS_BAR_HEIGHT - 4);
|
||||
|
||||
if (m>1) {
|
||||
dc->color=BLACK;
|
||||
k=m-1;
|
||||
if (k>19) k=19;
|
||||
for (j=0;j<=k;j++)
|
||||
GrLine(dc,
|
||||
(GR_WIDTH-PROGRESS_BAR_WIDTH)/2+1+j*
|
||||
(PROGRESS_BAR_WIDTH-4)/ToF64(k+1),
|
||||
(GR_HEIGHT-(PROGRESS_BARS_NUM*2-1-i*4)*
|
||||
PROGRESS_BAR_HEIGHT)/2+4,
|
||||
(GR_WIDTH-PROGRESS_BAR_WIDTH)/2+1+j*
|
||||
(PROGRESS_BAR_WIDTH-4)/ToF64(k+1),
|
||||
(GR_HEIGHT-(PROGRESS_BARS_NUM*2-3-i*4)*
|
||||
PROGRESS_BAR_HEIGHT)/2-4);
|
||||
if (m>1)
|
||||
{
|
||||
dc->color = BLACK;
|
||||
k = m - 1;
|
||||
if (k > 19) k = 19;
|
||||
for (j = 0; j <= k; j++)
|
||||
GrLine(dc, (GR_WIDTH - PROGRESS_BAR_WIDTH) / 2 + 1 + j * (PROGRESS_BAR_WIDTH - 4) / ToF64(k + 1),
|
||||
(GR_HEIGHT - (PROGRESS_BARS_NUM * 2 - 1 - i * 4) * PROGRESS_BAR_HEIGHT) / 2 + 4,
|
||||
(GR_WIDTH - PROGRESS_BAR_WIDTH) / 2 + 1 + j * (PROGRESS_BAR_WIDTH - 4) / ToF64(k + 1),
|
||||
(GR_HEIGHT - (PROGRESS_BARS_NUM * 2 - 3 - i * 4) * PROGRESS_BAR_HEIGHT) / 2 - 4);
|
||||
}
|
||||
|
||||
dc->color=GREEN;
|
||||
dc->color = GREEN;
|
||||
if (*sys_progresses[i].desc)
|
||||
st=StrNew(sys_progresses[i].desc);
|
||||
st = StrNew(sys_progresses[i].desc);
|
||||
else
|
||||
st=MStrPrint("%d/%d",n,m);
|
||||
if (sys_progresses[i].t0) {
|
||||
st2=MStrPrint("%s %fs",st,tS-sys_progresses[i].t0);
|
||||
st = MStrPrint("%d/%d", n, m);
|
||||
if (sys_progresses[i].t0)
|
||||
{
|
||||
st2 = MStrPrint("%s %fs", st, tS - sys_progresses[i].t0);
|
||||
Free(st);
|
||||
} else
|
||||
st2=st;
|
||||
if (sys_progresses[i].tf) {
|
||||
st=MStrPrint("%s/%fs",st2,sys_progresses[i].tf);
|
||||
}
|
||||
else
|
||||
st2 = st;
|
||||
if (sys_progresses[i].tf)
|
||||
{
|
||||
st = MStrPrint("%s/%fs", st2, sys_progresses[i].tf);
|
||||
Free(st2);
|
||||
} else
|
||||
st=st2;
|
||||
GrPrint(dc,(GR_WIDTH-FONT_WIDTH*StrLen(st))/2,(GR_HEIGHT-FONT_HEIGHT-
|
||||
(PROGRESS_BARS_NUM*2-2-i*4)*PROGRESS_BAR_HEIGHT)/2,"%s",st);
|
||||
}
|
||||
else
|
||||
st = st2;
|
||||
GrPrint(dc, (GR_WIDTH - FONT_WIDTH * StrLen(st)) / 2, (GR_HEIGHT - FONT_HEIGHT -
|
||||
(PROGRESS_BARS_NUM * 2 - 2 - i * 4) * PROGRESS_BAR_HEIGHT) / 2, "%s", st);
|
||||
Free(st);
|
||||
}
|
||||
}
|
||||
@ -89,57 +90,59 @@ U0 DrawProgressBars(CDC *dc)
|
||||
U0 DrawWinGrid(CDC *dc)
|
||||
{
|
||||
F64 d;
|
||||
dc->color=BLACK;
|
||||
dc->thick=1;
|
||||
for (d=mouse_grid.x_offset;d<GR_WIDTH; d+=mouse_grid.x)
|
||||
GrLine(dc,d,0,d,GR_HEIGHT-1);
|
||||
for (d=mouse_grid.y_offset;d<GR_HEIGHT;d+=mouse_grid.y)
|
||||
GrLine(dc,0,d,GR_WIDTH-1,d);
|
||||
dc->color = BLACK;
|
||||
dc->thick = 1;
|
||||
for (d = mouse_grid.x_offset; d < GR_WIDTH; d += mouse_grid.x)
|
||||
GrLine(dc, d, 0, d, GR_HEIGHT - 1);
|
||||
for (d = mouse_grid.y_offset; d < GR_HEIGHT; d += mouse_grid.y)
|
||||
GrLine(dc, 0, d, GR_WIDTH - 1, d);
|
||||
}
|
||||
|
||||
U0 WinGrid(Bool val)
|
||||
{
|
||||
CGridGlobals last_grid;
|
||||
MemCopy(&last_grid,&mouse_grid,sizeof(CGridGlobals));
|
||||
if (!val || PopUpForm(&mouse_grid)) {
|
||||
MemCopy(&last_grid, &mouse_grid, sizeof(CGridGlobals));
|
||||
if (!val || PopUpForm(&mouse_grid))
|
||||
{
|
||||
if (!val)
|
||||
GridInit;
|
||||
mouse_hard.prescale.x*=last_grid.x_speed/mouse_grid.x_speed;
|
||||
mouse_hard.prescale.y*=last_grid.y_speed/mouse_grid.y_speed;
|
||||
mouse_hard.prescale.z*=last_grid.z_speed/mouse_grid.z_speed;
|
||||
} else
|
||||
MemCopy(&mouse_grid,&last_grid,sizeof(CGridGlobals));
|
||||
mouse_hard.prescale.x *= last_grid.x_speed / mouse_grid.x_speed;
|
||||
mouse_hard.prescale.y *= last_grid.y_speed / mouse_grid.y_speed;
|
||||
mouse_hard.prescale.z *= last_grid.z_speed / mouse_grid.z_speed;
|
||||
}
|
||||
else
|
||||
MemCopy(&mouse_grid, &last_grid, sizeof(CGridGlobals));
|
||||
}
|
||||
U0 CtrlAltG(I64 sc)
|
||||
{
|
||||
if (sc&SCF_SHIFT)
|
||||
if (sc & SCF_SHIFT)
|
||||
PopUp("WinGrid(OFF);");
|
||||
else
|
||||
PopUp("WinGrid(ON);");
|
||||
}
|
||||
CtrlAltCBSet('G',&CtrlAltG,"Cmd /Grid On",
|
||||
"Cmd /Grid Off");
|
||||
CtrlAltCBSet('G', &CtrlAltG, "Cmd /Grid On", "Cmd /Grid Off");
|
||||
|
||||
CTask *ext_ASCII_task;
|
||||
U0 ExtendedASCII()
|
||||
{
|
||||
I64 i;
|
||||
CDoc *doc=DocNew;
|
||||
DocPrint(doc,"Sel Char and Press <ESC>\n$$LTBLUE$$");
|
||||
for (i=0;i<256;i++) {
|
||||
if (i >= CH_SPACE && i!=0x7F)
|
||||
CDoc *doc = DocNew;
|
||||
DocPrint(doc, "Sel Char and Press <ESC>\n$$LTBLUE$$");
|
||||
for (i = 0; i<256; i++)
|
||||
{
|
||||
if (i >= CH_SPACE && i != 0x7F)
|
||||
{
|
||||
if (i=='$$')
|
||||
DocPrint(doc,"$$MU-UL,\"\\x24\",LE=%d$$",i);
|
||||
else if (i=='\"'||i=='\\')
|
||||
DocPrint(doc,"$$MU-UL,\"\\%c\",LE=%d$$",i,i);
|
||||
if (i == '$$')
|
||||
DocPrint(doc, "$$MU-UL,\"\\x24\",LE=%d$$", i);
|
||||
else if (i=='\"' || i == '\\')
|
||||
DocPrint(doc, "$$MU-UL,\"\\%c\",LE=%d$$", i, i);
|
||||
else
|
||||
DocPrint(doc,"$$MU-UL,\"%c\",LE=%d$$",i,i);
|
||||
DocPrint(doc, "$$MU-UL,\"%c\",LE=%d$$", i, i);
|
||||
}
|
||||
else
|
||||
DocPrint(doc," ");
|
||||
if (i&15==15)
|
||||
DocPrint(doc,"\n");
|
||||
DocPrint(doc, " ");
|
||||
if (i & 15 == 15)
|
||||
DocPrint(doc, "\n");
|
||||
}
|
||||
i = PopUpMenu(doc);
|
||||
DocDel(doc);
|
||||
@ -149,44 +152,44 @@ U0 ExtendedASCII()
|
||||
|
||||
U0 CtrlAltA(I64)
|
||||
{
|
||||
if (ext_ASCII_task=sys_focus_task)
|
||||
if (ext_ASCII_task = sys_focus_task)
|
||||
Spawn(&ExtendedASCII);
|
||||
}
|
||||
CtrlAltCBSet('A',&CtrlAltA,"Cmd /Extended ASCII");
|
||||
CtrlAltCBSet('A', &CtrlAltA, "Cmd /Extended ASCII");
|
||||
|
||||
public U0 WinScrollNull(CTask *task,CD3I64 *s)
|
||||
public U0 WinScrollNull(CTask *task, CD3I64 *s)
|
||||
{//If panning a window has been done, restore to zero.
|
||||
s->x=task->scroll_x;
|
||||
s->y=task->scroll_y;
|
||||
s->z=task->scroll_z;
|
||||
task->scroll_x=0;
|
||||
task->scroll_y=0;
|
||||
task->scroll_z=0;
|
||||
s->x = task->scroll_x;
|
||||
s->y = task->scroll_y;
|
||||
s->z = task->scroll_z;
|
||||
task->scroll_x = 0;
|
||||
task->scroll_y = 0;
|
||||
task->scroll_z = 0;
|
||||
}
|
||||
|
||||
public U0 WinScrollRestore(CTask *task,CD3I64 *s)
|
||||
public U0 WinScrollRestore(CTask *task, CD3I64 *s)
|
||||
{//Set window pan value to stored value.
|
||||
task->scroll_x=s->x;
|
||||
task->scroll_y=s->y;
|
||||
task->scroll_z=s->z;
|
||||
task->scroll_x = s->x;
|
||||
task->scroll_y = s->y;
|
||||
task->scroll_z = s->z;
|
||||
}
|
||||
|
||||
U0 DrawMouse(CDC *dc)
|
||||
{
|
||||
I64 x,y;
|
||||
I64 x, y;
|
||||
PUSHFD
|
||||
CLI
|
||||
x=mouse.pos.x;
|
||||
y=mouse.pos.y;
|
||||
x = mouse.pos.x;
|
||||
y = mouse.pos.y;
|
||||
POPFD
|
||||
if (mouse.show && mouse_hard.installed)
|
||||
{
|
||||
if (gr.fp_draw_mouse)
|
||||
{
|
||||
if (winmgr.grab_scroll && gr.fp_draw_grab_mouse)
|
||||
(*gr.fp_draw_grab_mouse)(dc,x,y,winmgr.grab_scroll_closed);
|
||||
(*gr.fp_draw_grab_mouse)(dc, x, y, winmgr.grab_scroll_closed);
|
||||
else
|
||||
(*gr.fp_draw_mouse)(dc,x,y);
|
||||
(*gr.fp_draw_mouse)(dc, x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -196,67 +199,76 @@ U0 WinFinalUpdate(CDC *dc)
|
||||
if (mouse_grid.show)
|
||||
DrawWinGrid(dc);
|
||||
if (mouse_grid.coord)
|
||||
GrPrint(dc,GR_WIDTH-FONT_WIDTH*10,FONT_HEIGHT*3,
|
||||
"(%03d,%03d)",mouse.pos.x,mouse.pos.y);
|
||||
GrPrint(dc, GR_WIDTH - FONT_WIDTH * 10, FONT_HEIGHT * 3, "(%03d,%03d)", mouse.pos.x, mouse.pos.y);
|
||||
DrawProgressBars(dc);
|
||||
if (winmgr.show_menu)
|
||||
DrawMenu(dc);
|
||||
else
|
||||
sys_cur_submenu_entry=NULL;
|
||||
sys_cur_submenu_entry = NULL;
|
||||
DrawMouse(dc);
|
||||
}
|
||||
|
||||
gr.fp_final_screen_update=&WinFinalUpdate;
|
||||
gr.fp_final_screen_update = &WinFinalUpdate;
|
||||
|
||||
U0 WinMouseUpdate()
|
||||
{
|
||||
I64 dd;
|
||||
Bool set=FALSE;
|
||||
if (mouse_hard.installed) {
|
||||
mouse.has_wheel=mouse_hard.has_wheel;
|
||||
if (mouse_hard.event) {
|
||||
MouseUpdate(mouse_hard.pos.x,mouse_hard.pos.y,mouse_hard.pos.z,
|
||||
mouse_hard.bttns[0],mouse_hard.bttns[1]);
|
||||
mouse_hard.event=FALSE;
|
||||
set=TRUE;
|
||||
Bool set = FALSE;
|
||||
if (mouse_hard.installed)
|
||||
{
|
||||
mouse.has_wheel = mouse_hard.has_wheel;
|
||||
if (mouse_hard.event)
|
||||
{
|
||||
MouseUpdate(mouse_hard.pos.x, mouse_hard.pos.y, mouse_hard.pos.z, mouse_hard.bttns[0], mouse_hard.bttns[1]);
|
||||
mouse_hard.event = FALSE;
|
||||
set = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (set) {
|
||||
if (mouse_hard.installed) {
|
||||
mouse.speed=mouse_hard.speed;
|
||||
mouse.timestamp=mouse_hard.timestamp;
|
||||
if (set)
|
||||
{
|
||||
if (mouse_hard.installed)
|
||||
{
|
||||
mouse.speed = mouse_hard.speed;
|
||||
mouse.timestamp = mouse_hard.timestamp;
|
||||
}
|
||||
} else
|
||||
mouse.speed*=0.95;
|
||||
if (gr.screen_zoom!=1) {
|
||||
}
|
||||
else
|
||||
mouse.speed *= 0.95;
|
||||
if (gr.screen_zoom != 1)
|
||||
{
|
||||
if (gr.continuous_scroll)
|
||||
GrScaleZoom(1.0);
|
||||
else {
|
||||
dd=(mouse.pos.x-gr.sx)*gr.screen_zoom;
|
||||
if (!(8<=dd<GR_WIDTH-8))
|
||||
else
|
||||
{
|
||||
dd = (mouse.pos.x - gr.sx) * gr.screen_zoom;
|
||||
if (!(8 <= dd < GR_WIDTH - 8))
|
||||
GrScaleZoom(1.0);
|
||||
else {
|
||||
dd=(mouse.pos.y-gr.sy)*gr.screen_zoom;
|
||||
if (!(8<=dd<GR_HEIGHT-8))
|
||||
else
|
||||
{
|
||||
dd = (mouse.pos.y - gr.sy) * gr.screen_zoom;
|
||||
if (!(8 <= dd < GR_HEIGHT - 8))
|
||||
GrScaleZoom(1.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public CTask *WinRefocus(CTask *task=NULL)
|
||||
public CTask *WinRefocus(CTask *task = NULL)
|
||||
{//Reset the focus task if NULL.
|
||||
PUSHFD
|
||||
CLI
|
||||
if (!task) {
|
||||
task=sys_winmgr_task->last_task;
|
||||
while (TaskValidate(task) && task!=sys_winmgr_task) {
|
||||
if (!Bt(&task->win_inhibit,WIf_SELF_FOCUS)) {
|
||||
sys_focus_task=task;
|
||||
if (!task)
|
||||
{
|
||||
task = sys_winmgr_task->last_task;
|
||||
while (TaskValidate(task) && task != sys_winmgr_task)
|
||||
{
|
||||
if (!Bt(&task->win_inhibit, WIf_SELF_FOCUS))
|
||||
{
|
||||
sys_focus_task = task;
|
||||
break;
|
||||
}
|
||||
task=task->last_task;
|
||||
task = task->last_task;
|
||||
}
|
||||
}
|
||||
POPFD
|
||||
@ -265,150 +277,166 @@ public CTask *WinRefocus(CTask *task=NULL)
|
||||
|
||||
I64 WinOnTopWindows()
|
||||
{
|
||||
CTask *task,*task1,*first_moved_fwd=NULL;
|
||||
CTask *task, *task1, *first_moved_fwd = NULL;
|
||||
I64 res=0;
|
||||
PUSHFD
|
||||
CLI //TODO Multiprocessor safe
|
||||
task=sys_winmgr_task->next_task;
|
||||
while (task!=sys_winmgr_task && task!=first_moved_fwd) {
|
||||
task1=task->next_task;
|
||||
if (!TaskValidate(task)) {
|
||||
task = sys_winmgr_task->next_task;
|
||||
while (task != sys_winmgr_task && task != first_moved_fwd)
|
||||
{
|
||||
task1 = task->next_task;
|
||||
if (!TaskValidate(task))
|
||||
{
|
||||
POPFD
|
||||
return res;
|
||||
}
|
||||
if (Bt(&task->display_flags,DISPLAYf_WIN_ON_TOP) &&
|
||||
task!=sys_winmgr_task->last_task) {
|
||||
if (Bt(&task->display_flags, DISPLAYf_WIN_ON_TOP) && task != sys_winmgr_task->last_task)
|
||||
{
|
||||
TaskQueueRemove(task);
|
||||
TaskQueueIns(task,sys_winmgr_task);
|
||||
TaskQueueIns(task, sys_winmgr_task);
|
||||
res++;
|
||||
if (!first_moved_fwd)
|
||||
first_moved_fwd=task;
|
||||
first_moved_fwd = task;
|
||||
}
|
||||
task=task1;
|
||||
task = task1;
|
||||
}
|
||||
POPFD
|
||||
return res;
|
||||
}
|
||||
|
||||
public I64 WinToTop(CTask *task=NULL,Bool update_z_buf=TRUE)
|
||||
public I64 WinToTop(CTask *task = NULL, Bool update_z_buf = TRUE)
|
||||
{//Put task's win on top of window stack.
|
||||
CTask *task1;
|
||||
I64 res=0;
|
||||
if (!task) task=Fs;
|
||||
I64 res = 0;
|
||||
if (!task) task = Fs;
|
||||
if (!TaskValidate(task) || task->gs->num)
|
||||
return 0;
|
||||
TaskDerivedValsUpdate(task,FALSE);
|
||||
TaskDerivedValsUpdate(task, FALSE);
|
||||
if (!sys_winmgr_task || task==sys_winmgr_task)
|
||||
return 0;
|
||||
PUSHFD
|
||||
CLI
|
||||
if (!TaskValidate(task)) {
|
||||
if (!TaskValidate(task))
|
||||
{
|
||||
POPFD
|
||||
return 0;
|
||||
}
|
||||
if (task!=sys_winmgr_task->last_task) {
|
||||
if (task != sys_winmgr_task->last_task)
|
||||
{
|
||||
TaskQueueRemove(task);
|
||||
TaskQueueIns(task,sys_winmgr_task);
|
||||
TaskQueueIns(task, sys_winmgr_task);
|
||||
res++;
|
||||
}
|
||||
if (!Bt(&task->win_inhibit,WIf_SELF_FOCUS))
|
||||
sys_focus_task=task;
|
||||
if (res && !Bt(&task->display_flags,DISPLAYf_CHILDREN_NOT_ON_TOP)) {
|
||||
task1=task->next_child_task;
|
||||
while (task1!=&task->next_child_task) {
|
||||
if (!Bt(&task->win_inhibit, WIf_SELF_FOCUS))
|
||||
sys_focus_task = task;
|
||||
if (res && !Bt(&task->display_flags, DISPLAYf_CHILDREN_NOT_ON_TOP))
|
||||
{
|
||||
task1 = task->next_child_task;
|
||||
while (task1 != &task->next_child_task)
|
||||
{
|
||||
if (!TaskValidate(task1))
|
||||
break;
|
||||
res+=WinToTop(task1,FALSE);
|
||||
task1=task1->next_sibling_task;
|
||||
res += WinToTop(task1, FALSE);
|
||||
task1 = task1->next_sibling_task;
|
||||
}
|
||||
if (task->popup_task &&
|
||||
task->popup_task->parent_task==task)
|
||||
res+=WinToTop(task->popup_task,FALSE);
|
||||
if (task->popup_task && task->popup_task->parent_task == task)
|
||||
res += WinToTop(task->popup_task, FALSE);
|
||||
}
|
||||
POPFD
|
||||
res+=WinOnTopWindows;
|
||||
res += WinOnTopWindows;
|
||||
if (res && update_z_buf)
|
||||
WinZBufUpdate;
|
||||
return res;
|
||||
}
|
||||
ext[EXT_WIN_TO_TOP]=&WinToTop;
|
||||
ext[EXT_WIN_TO_TOP] = &WinToTop;
|
||||
|
||||
public CTask *WinFocus(CTask *task=NULL)
|
||||
public CTask *WinFocus(CTask *task = NULL)
|
||||
{//Set task as focus task.
|
||||
if (!task) task=Fs;
|
||||
if (!task) task = Fs;
|
||||
PUSHFD
|
||||
CLI
|
||||
if (!TaskValidate(task)||Bt(&task->win_inhibit,WIf_SELF_FOCUS))
|
||||
task=WinRefocus(sys_focus_task);
|
||||
WinToTop(sys_focus_task=task);
|
||||
if (!TaskValidate(task) || Bt(&task->win_inhibit, WIf_SELF_FOCUS))
|
||||
task = WinRefocus(sys_focus_task);
|
||||
WinToTop(sys_focus_task = task);
|
||||
POPFD
|
||||
return sys_focus_task;
|
||||
}
|
||||
ext[EXT_WIN_FOCUS]=&WinFocus;
|
||||
ext[EXT_WIN_FOCUS] = &WinFocus;
|
||||
|
||||
public Bool WinHorz(I64 left,I64 right,CTask *task=NULL)
|
||||
public Bool WinHorz(I64 left, I64 right, CTask *task = NULL)
|
||||
{//Set task's win left and right columns.
|
||||
I64 d=right-left;
|
||||
if (!task) task=Fs;
|
||||
I64 d = right - left;
|
||||
if (!task) task = Fs;
|
||||
if (!TaskValidate(task)) return FALSE;
|
||||
if (d<0) d=0;
|
||||
if (left>=TEXT_COLS) {
|
||||
left=TEXT_COLS-1;
|
||||
right=left+d;
|
||||
if (d < 0) d = 0;
|
||||
if (left >= TEXT_COLS)
|
||||
{
|
||||
left = TEXT_COLS - 1;
|
||||
right = left + d;
|
||||
}
|
||||
if (right<0) {
|
||||
right=0;
|
||||
left=right-d;
|
||||
if (right < 0)
|
||||
{
|
||||
right = 0;
|
||||
left = right - d;
|
||||
}
|
||||
if (left>right) {
|
||||
if (left>0)
|
||||
right=left;
|
||||
if (left > right)
|
||||
{
|
||||
if (left > 0)
|
||||
right = left;
|
||||
else
|
||||
left=right;
|
||||
left = right;
|
||||
}
|
||||
PUSHFD
|
||||
CLI //TODO Multiprocessor safe
|
||||
if (task->win_left!=left || task->win_right!=right) {
|
||||
task->win_left=left;
|
||||
task->win_right=right;
|
||||
if (task->win_left != left || task->win_right != right)
|
||||
{
|
||||
task->win_left = left;
|
||||
task->win_right = right;
|
||||
TaskDerivedValsUpdate(task);
|
||||
POPFD
|
||||
return TRUE;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
POPFD
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
public Bool WinVert(I64 top,I64 bottom,CTask *task=NULL)
|
||||
public Bool WinVert(I64 top, I64 bottom, CTask *task = NULL)
|
||||
{//Set task's win top and bottom rows.
|
||||
I64 d=bottom-top;
|
||||
if (!task) task=Fs;
|
||||
I64 d = bottom-top;
|
||||
if (!task) task = Fs;
|
||||
if (!TaskValidate(task)) return FALSE;
|
||||
if (d<0) d=0;
|
||||
if (top>=TEXT_ROWS) {
|
||||
top=TEXT_ROWS-1;
|
||||
bottom=top+d;
|
||||
if (d < 0) d = 0;
|
||||
if (top >= TEXT_ROWS)
|
||||
{
|
||||
top = TEXT_ROWS - 1;
|
||||
bottom = top + d;
|
||||
}
|
||||
if (bottom<=0) {
|
||||
bottom=1;
|
||||
top=bottom-d;
|
||||
if (bottom <= 0)
|
||||
{
|
||||
bottom = 1;
|
||||
top = bottom - d;
|
||||
}
|
||||
if (top>bottom) {
|
||||
if (top>=0)
|
||||
bottom=top;
|
||||
if (top > bottom)
|
||||
{
|
||||
if (top >= 0)
|
||||
bottom = top;
|
||||
else
|
||||
top=bottom;
|
||||
top = bottom;
|
||||
}
|
||||
PUSHFD
|
||||
CLI //TODO Multiprocessor safe
|
||||
if (task->win_top!=top || task->win_bottom!=bottom) {
|
||||
task->win_top=top;
|
||||
task->win_bottom=bottom;
|
||||
if (task->win_top != top || task->win_bottom != bottom) {
|
||||
task->win_top = top;
|
||||
task->win_bottom = bottom;
|
||||
TaskDerivedValsUpdate(task);
|
||||
POPFD
|
||||
return TRUE;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
POPFD
|
||||
return FALSE;
|
||||
}
|
||||
@ -416,117 +444,131 @@ public Bool WinVert(I64 top,I64 bottom,CTask *task=NULL)
|
||||
|
||||
public U0 WinTileHorz()
|
||||
{//Tile windows horizontally top-to-bottom.
|
||||
CTask *task,*last_task=Fs;
|
||||
I64 count,c,i,vert_size,no_border;
|
||||
CTask *task, *last_task = Fs;
|
||||
I64 count, c, i, vert_size, no_border;
|
||||
|
||||
PUSHFD
|
||||
CLI //TODO Multiprocessor safe
|
||||
task=sys_winmgr_task;
|
||||
count=0;
|
||||
do {
|
||||
if (!Bt(&task->win_inhibit,WIf_SELF_FOCUS))
|
||||
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 = 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=count- i&~3;
|
||||
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 = count - i & ~3;
|
||||
if (!c)
|
||||
c=1;
|
||||
else if (c>4)
|
||||
c=4;
|
||||
vert_size=(TEXT_ROWS-1)/c;
|
||||
c = 1;
|
||||
else if (c > 4)
|
||||
c = 4;
|
||||
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);
|
||||
last_task=task;
|
||||
if (i&3==3)
|
||||
WinVert(task->win_top,TEXT_ROWS-2,task);
|
||||
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);
|
||||
last_task = task;
|
||||
if (i & 3 == 3)
|
||||
WinVert(task->win_top, TEXT_ROWS - 2, task);
|
||||
i++;
|
||||
}
|
||||
task=task->last_task;
|
||||
} while (task!=sys_winmgr_task);
|
||||
WinVert(last_task->win_top,TEXT_ROWS-2,last_task);
|
||||
task = task->last_task;
|
||||
} while (task != sys_winmgr_task);
|
||||
WinVert(last_task->win_top, TEXT_ROWS - 2, last_task);
|
||||
POPFD
|
||||
}
|
||||
|
||||
public U0 WinTileVert()
|
||||
{//Tile windows vertically side-by-side.
|
||||
CTask *task,*last_task=Fs;
|
||||
I64 count,c,i,horz_size,no_border;
|
||||
CTask *task, *last_task = Fs;
|
||||
I64 count, c, i, horz_size, no_border;
|
||||
PUSHFD
|
||||
CLI //TODO Multiprocessor safe
|
||||
task=sys_winmgr_task;
|
||||
count=0;
|
||||
do {
|
||||
if (!Bt(&task->win_inhibit,WIf_SELF_FOCUS))
|
||||
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 = 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=count- i&~3;
|
||||
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 = count - i & ~3;
|
||||
if (!c)
|
||||
c=1;
|
||||
else if (c>4)
|
||||
c=4;
|
||||
horz_size=TEXT_COLS/c;
|
||||
WinHorz((i&3)*horz_size+1-no_border,(i&3+1)*horz_size-1+no_border,task);
|
||||
WinVert(2-no_border,TEXT_ROWS-2+no_border,task);
|
||||
last_task=task;
|
||||
if (i&3==3)
|
||||
WinHorz(task->win_left,TEXT_COLS-2,task);
|
||||
c = 1;
|
||||
else if (c > 4)
|
||||
c = 4;
|
||||
horz_size = TEXT_COLS / c;
|
||||
WinHorz((i & 3) * horz_size + 1 - no_border, (i & 3 + 1) * horz_size - 1 + no_border, task);
|
||||
WinVert(2 - no_border, TEXT_ROWS - 2 + no_border, task);
|
||||
last_task = task;
|
||||
if (i & 3 == 3)
|
||||
WinHorz(task->win_left, TEXT_COLS - 2, task);
|
||||
i++;
|
||||
}
|
||||
task=task->last_task;
|
||||
} while (task!=sys_winmgr_task);
|
||||
WinHorz(last_task->win_left,TEXT_COLS-2,last_task);
|
||||
task = task->last_task;
|
||||
} while (task != sys_winmgr_task);
|
||||
WinHorz(last_task->win_left, TEXT_COLS - 2, last_task);
|
||||
POPFD
|
||||
}
|
||||
|
||||
public U0 WinMax(CTask *task=NULL)
|
||||
public U0 WinMax(CTask *task = NULL)
|
||||
{//Maximize task's window
|
||||
I64 no_border;
|
||||
if (!task) task=Fs;
|
||||
if (!task) task = Fs;
|
||||
if (!TaskValidate(task)) return;
|
||||
PUSHFD
|
||||
CLI //TODO Multiprocessor safe
|
||||
no_border=Bt(&task->display_flags,DISPLAYf_NO_BORDER);
|
||||
WinHorz(1-no_border,TEXT_COLS-2+no_border,task);
|
||||
WinVert(2-no_border,TEXT_ROWS-2+no_border,task);
|
||||
no_border = Bt(&task->display_flags, DISPLAYf_NO_BORDER);
|
||||
WinHorz(1 - no_border, TEXT_COLS - 2 + no_border, task);
|
||||
WinVert(2 - no_border, TEXT_ROWS - 2 + no_border, task);
|
||||
WinToTop(task);
|
||||
POPFD
|
||||
}
|
||||
|
||||
public Bool WinBorder(Bool val=OFF,CTask *task=NULL)
|
||||
public Bool WinBorder(Bool val = OFF, CTask *task = NULL)
|
||||
{//Turn off (or on) window border.
|
||||
Bool old_has_border;
|
||||
if (!task) task=Fs;
|
||||
if (!task) task = Fs;
|
||||
if (!TaskValidate(task)) return FALSE;
|
||||
PUSHFD
|
||||
CLI //TODO Multiprocessor safe
|
||||
old_has_border=!Bt(&task->display_flags,DISPLAYf_NO_BORDER);
|
||||
if (val) {
|
||||
if (!old_has_border) {
|
||||
LBtr(&task->display_flags,DISPLAYf_NO_BORDER);
|
||||
task->win_left++; task->win_right--;
|
||||
task->win_top++; task->win_bottom--;
|
||||
TaskDerivedValsUpdate(task,FALSE);
|
||||
old_has_border = !Bt(&task->display_flags, DISPLAYf_NO_BORDER);
|
||||
if (val)
|
||||
{
|
||||
if (!old_has_border)
|
||||
{
|
||||
LBtr(&task->display_flags, DISPLAYf_NO_BORDER);
|
||||
task->win_left++;
|
||||
task->win_right--;
|
||||
task->win_top++;
|
||||
task->win_bottom--;
|
||||
TaskDerivedValsUpdate(task, FALSE);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
if (old_has_border) {
|
||||
LBts(&task->display_flags,DISPLAYf_NO_BORDER);
|
||||
task->win_left--; task->win_right++;
|
||||
task->win_top--; task->win_bottom++;
|
||||
TaskDerivedValsUpdate(task,FALSE);
|
||||
LBts(&task->display_flags, DISPLAYf_NO_BORDER);
|
||||
task->win_left--;
|
||||
task->win_right++;
|
||||
task->win_top--;
|
||||
task->win_bottom++;
|
||||
TaskDerivedValsUpdate(task, FALSE);
|
||||
}
|
||||
}
|
||||
POPFD
|
||||
|
Loading…
x
Reference in New Issue
Block a user