TempleOSCDV5.00.ISO

This commit is contained in:
Terry A. Davis
2017-01-11 00:30:10 +01:00
committed by minexew
parent 122df6338e
commit f6eacf7744
374 changed files with 11079 additions and 11205 deletions
Binary file not shown.
+13 -13
View File
@@ -566,14 +566,14 @@ U0 FMRightClick()
}
}
U8 *fm_ip_str=NULL;
U8 *fm_ms_str=NULL;
U0 (*fp_old_final_scrn_update)(CDC *dc);
U0 FMFinalScrnUpdate(CDC *dc)
{
if (fm_ip_str) {
if (fm_ms_str) {
dc->color=LTRED;
GrPrint(dc,ip.pos.x,ip.pos.y,"%s",fm_ip_str);
GrPrint(dc,ms.pos.x,ms.pos.y,"%s",fm_ms_str);
}
(*fp_old_final_scrn_update)(dc);
}
@@ -581,7 +581,7 @@ U0 FMFinalScrnUpdate(CDC *dc)
public U8 *FileMgr(I64 mode=FM_NORMAL,CTask *mem_task=NULL)
{//File manager. Also, used to choose files and dirs.
CDirEntry *head=NULL,*tmpde,*tmpde1,*tmpde2;
I64 sc,ch,a1,a2,msg_code;
I64 sc,ch,arg1,arg2,msg_code;
CDoc *doc=NULL,*old_put_doc=DocPut,*old_display_doc=DocDisplay;
U8 *res=NULL,*st,*st2,*old_cur_dir=CurDir;
CDocEntry *doc_ce=NULL,*doc_e;
@@ -600,26 +600,26 @@ public U8 *FileMgr(I64 mode=FM_NORMAL,CTask *mem_task=NULL)
}
do {
DocUnlock(doc);
do msg_code=GetMsg(&a1,&a2,1<<MSG_KEY_DOWN|1<<MSG_IP_L_DOWN|1<<MSG_IP_L_UP|
1<<MSG_IP_R_UP);
do msg_code=GetMsg(&arg1,&arg2,
1<<MSG_KEY_DOWN|1<<MSG_MS_L_DOWN|1<<MSG_MS_L_UP|1<<MSG_MS_R_UP);
while (Fs!=sys_focus_task);
DocLock(doc);
switch (msg_code) {
case MSG_IP_R_UP:
case MSG_MS_R_UP:
DocUnlock(doc);
FMRightClick;
DocLock(doc);
break;
case MSG_IP_L_DOWN:
case MSG_MS_L_DOWN:
doc_ce=doc->cur_entry;
fm_ip_str=doc_ce->tag;
fm_ms_str=doc_ce->tag;
gr.fp_final_scrn_update=&FMFinalScrnUpdate;
break;
case MSG_IP_L_UP:
case MSG_MS_L_UP:
if (doc_ce) {
gr.fp_final_scrn_update=fp_old_final_scrn_update;
if (WinCursorPosSet(Fs,a1+Fs->pix_left+Fs->scroll_x,
a2+Fs->pix_top+Fs->scroll_y,TRUE)) {
if (WinCursorPosSet(Fs,arg1+Fs->pix_left+Fs->scroll_x,
arg2+Fs->pix_top+Fs->scroll_y,TRUE)) {
doc_e=doc->cur_entry;
if (doc_e!=doc_ce) {
st2=NULL;
@@ -678,7 +678,7 @@ public U8 *FileMgr(I64 mode=FM_NORMAL,CTask *mem_task=NULL)
break;
case MSG_KEY_DOWN:
doc_ce=NULL;
ch=a1; sc=a2;
ch=arg1; sc=arg2;
if (sc.u8[0]==SC_DELETE && !(sc&(SCF_SHIFT|SCF_CTRL)))
ch=CH_CTRLY;
if (ch && sc&SCF_ALT) goto fm_regular_key;
+29 -18
View File
@@ -1,13 +1,14 @@
#help_index "Install;File/Cmd Line (Typically);Cmd Line (Typically);"
I64 Mount2(U8 boot_drv_let,CDoc *_doc,Bool repartition)
U8 Mount2(U8 boot_drv_let,CDoc *_doc,Bool _caller_is_prtdsk)
{//If _doc, called by $LK,"::/Kernel/KCfg.HC"$ else called by $LK,"Mount",A="MN:Mount"$().
I64 cnt,res=0,num_hints,drv_let,type,unit;
I64 cnt,total=0,num_hints,drv_let,type,unit,prt_num;
U8 blks_buf[STR_LEN],addr_buf[STR_LEN],base0_buf[STR_LEN],base1_buf[STR_LEN],
*filename=NULL,*filename2=NULL;
*filename=NULL,*filename2=NULL,res=0;
CATARep *head=NULL,*tmpha;
Bool one_drv,make_free;
Bool whole_drv,make_free;
CDoc *doc;
boot_drv_let=ToUpper(boot_drv_let);
if (boot_drv_let)
boot_drv_let=Let2Let(boot_drv_let);
do {
cnt=0;
if (!_doc)
@@ -19,10 +20,10 @@ I64 Mount2(U8 boot_drv_let,CDoc *_doc,Bool repartition)
"$$GREEN$$Q$$FG$$-$$GREEN$$S$$FG$$ are ISO file write drives.\n"
"$$GREEN$$T$$FG$$-$$GREEN$$Z$$FG$$ are ATAPI CD/DVD drives.\n"
"\nDrive Letter ($$PURPLE$$<ENTER>$$FG$$ to exit):";
drv_let=ToUpper(GetChar);
drv_let=Let2Let(GetChar);
'\n';
if (type=Let2BlkDevType(drv_let)) {
one_drv=FALSE;
whole_drv=FALSE;
if (_doc) { //Called by $LK,"::/Kernel/KCfg.HC"$
doc=_doc;
make_free=FALSE;
@@ -32,6 +33,7 @@ I64 Mount2(U8 boot_drv_let,CDoc *_doc,Bool repartition)
make_free=TRUE;
}
unit=0;
prt_num=MIN_I64;
switch (type) {
case BDT_RAM:
"Addr of RAM disk ($$PURPLE$$<ENTER>$$FG$$ to MAlloc):";
@@ -44,6 +46,7 @@ I64 Mount2(U8 boot_drv_let,CDoc *_doc,Bool repartition)
filename=GetStr("File Name:");
break;
case BDT_ATA:
prt_num=GetI64("Partition Num (Default=All):",prt_num);
case BDT_ATAPI:
num_hints=ATARep(,,&head);
if (type==BDT_ATAPI && boot_drv_let)
@@ -87,6 +90,8 @@ I64 Mount2(U8 boot_drv_let,CDoc *_doc,Bool repartition)
case BDT_ISO_FILE_WRITE:
if (!*blks_buf) StrCpy(blks_buf,"0");
DocPrint(doc,"bd->max_blk=(%s)-1;\n",blks_buf);
DocPrint(doc,"bd->drv_offset=19<<2+"
"(DVD_BLK_SIZE*2+DVD_BOOT_LOADER_SIZE)/BLK_SIZE;\n");
break;
case BDT_ISO_FILE_READ:
filename2=FileNameAbs(filename);
@@ -102,31 +107,37 @@ I64 Mount2(U8 boot_drv_let,CDoc *_doc,Bool repartition)
make_free=TRUE;
} else
DocPrint(doc,"bd->base0=%s;bd->base1=%s;\n",base0_buf,base1_buf);
if (type==BDT_ATA && repartition) {
if (type==BDT_ATA && _caller_is_prtdsk) {
"\nReformat WHOLE drive!";
one_drv=YorN;
whole_drv=YorN;
}
break;
}
DocPrint(doc,"BlkDevAdd(bd,%d,%d);\n",one_drv,make_free);
DocPrint(doc,"BlkDevAdd(bd,%d,%d,%d);\n",prt_num,whole_drv,make_free);
if (_doc) //Called by $LK,"::/Kernel/KCfg.HC"$
cnt++;
else { //Called by $LK,"Mount",A="MN:Mount"$()
if ((cnt=ExeDoc(doc)) && one_drv)
PrtDsk(drv_let);
if ((cnt=ExeDoc(doc)) && whole_drv) {
if (_caller_is_prtdsk) {
res=drv_let;
PrtDsk(drv_let,1.0); //First mount whole drive.
} else
PrtDsk(drv_let);
}
DocDel(doc);
}
}
res+=cnt;
} while (cnt || !res && _doc); //At least 1 if Called by $LK,"::/Kernel/KCfg.HC"$
total+=cnt;
} while (cnt && !_caller_is_prtdsk ||
!total && _doc); //At least 1 if Called by $LK,"::/Kernel/KCfg.HC"$
Free(filename);
Free(filename2);
return res;
}
public I64 Mount(Bool repartition=FALSE)
{//Mount drives.
return Mount2(0,NULL,repartition);
public U8 Mount(Bool caller_is_prtdsk=FALSE)
{//Mount drives. Called from $LK,"PrtDsk(Mount)",A="FF:::/Adam/ABlkDev/PrtDsk.HC,Mount("$.
return Mount2(0,NULL,caller_is_prtdsk);
}
public U0 Unmount(U8 drv_let=0)
@@ -141,7 +152,7 @@ public U8 MountFile(U8 *filename)
CBlkDev *bd=BlkDevNextFreeSlot(dv->drv_let,BDT_ISO_FILE_READ);
bd->drv_offset=19<<2+(DVD_BLK_SIZE*2+DVD_BOOT_LOADER_SIZE)/BLK_SIZE;
bd->file_dsk_name=AStrNew(filename3);
BlkDevAdd(bd,TRUE,TRUE);
BlkDevAdd(bd,,TRUE,TRUE);
Free(filename3);
Free(filename2);
return dv->drv_let;
+28 -24
View File
@@ -10,20 +10,20 @@ class CPlannedDrv
Bool pri;
};
//Available to assist in writing scripts.
I64 drv_dsk_dsk_size=0;
public I64 PrtDsk(U8 drv_let=0,...)
{/*Partition the disk containing partition drv_let.
public I64 PrtDsk(U8 drv_let=0)
{//Partition the disk containing partition drv_let.
//drv_let=0 means add new drive that
//is not already mounted.
drv_let=0 means add new drive that is not already mounted.
>PrtDsk('C',0.5,0.25,0.25); //Make three. 50% C, 25% D, 25% E, round-up to blk.
*/
CBlkDev *bd;
CPlannedDrv head,*tmppp;
CMasterBoot mbr;
Bool pri=TRUE;
I64 ext_base,drv_let2,pri_cnt=0,
i,start_offset,offset,remaining;
drv_dsk_dsk_size=0;
I64 ext_base,drv_let2,pri_cnt=0,i,start_offset,offset,
total,remaining,cur_arg=0;
"This command does not play well\n"
"with other operating systems.\n"
"You really should use another\n"
@@ -34,17 +34,17 @@ public I64 PrtDsk(U8 drv_let=0)
"until you set block zero to zero\n"
"with $$LK,\"BootMHDZero\",\"MN:BootMHDZero\"$$()\n\n\n"
"Continue";
if (!YorN) return 0;
if (argc<=cur_arg && !YorN)
return 0;
'\n';
if (drv_let && !Let2BlkDev(drv_let,FALSE))
drv_let=0;
if (!drv_let) {
Mount(TRUE);
return 0;
}
if (!(bd=Let2BlkDev(drv_let,FALSE)) || bd->type!=BDT_ATA)
if (!drv_let && !(drv_let=Mount(TRUE)) ||
!(bd=Let2BlkDev(drv_let,FALSE)) || bd->type!=BDT_ATA)
return 0;
drv_dsk_dsk_size=bd->max_blk+1;
total=bd->max_blk+1;
QueInit(&head);
drv_let2=bd->first_drv_let;
remaining=FloorU64(bd->max_blk+1,ROUND_DRV_TO);
@@ -55,7 +55,7 @@ public I64 PrtDsk(U8 drv_let=0)
tmppp->pri=FALSE;
if (pri) {
"Primary Partition";
if (YorN) {
if (argc>cur_arg || YorN) {
pri_cnt++;
tmppp->pri=TRUE;
if (pri_cnt==3)
@@ -63,10 +63,14 @@ public I64 PrtDsk(U8 drv_let=0)
} else
pri=FALSE;
}
"Blocks Remaining:%d (0x%X)\n",
"\nBlocks Remaining:%d (0x%X)\n",
remaining-DRV_HEADER,remaining-DRV_HEADER;
tmppp->size=CeilU64(GetI64("Size in Blocks :",
remaining-DRV_HEADER)+DRV_HEADER,ROUND_DRV_TO);
if (argc>cur_arg)
tmppp->size=MinI64(CeilU64(MaxI64(remaining,DRV_HEADER),ROUND_DRV_TO),
CeilU64(argv[cur_arg++](F64)*total,ROUND_DRV_TO));
else
tmppp->size=CeilU64(GetI64("Size in Blocks :",
remaining-DRV_HEADER)+DRV_HEADER,ROUND_DRV_TO);
} while (!(ROUND_DRV_TO<=tmppp->size<=FloorU64(remaining,ROUND_DRV_TO)));
QueIns(tmppp,head.last);
remaining-=tmppp->size;
@@ -85,7 +89,7 @@ public I64 PrtDsk(U8 drv_let=0)
tmppp=tmppp->next;
drv_let2++;
}
if (!AreYouSure)
if (!argc && !AreYouSure)
goto pd_done;
remaining=FloorU64(bd->max_blk+1,ROUND_DRV_TO)-ROUND_DRV_TO;
@@ -149,15 +153,15 @@ public I64 PrtDsk(U8 drv_let=0)
}
bd->flags&=~(BDF_INITIALIZED | BDF_INIT_IN_PROGRESS);
BlkDevAdd(bd,FALSE,TRUE);
BlkDevAdd(bd,,FALSE,TRUE);
for (i=bd->first_drv_let;i<drv_let2;i++)
Fmt(i,,FALSE);
pd_done:
pd_done:
while (head.next!=&head) {
tmppp=head.next;
QueRem(tmppp);
Free(tmppp);
}
return drv_dsk_dsk_size;
return total;
}
+9 -7
View File
@@ -2,7 +2,7 @@
U0 LoadDocDefines()
{
CBinFile *bfh=sys_boot_base-sizeof(CBinFile);
CBinFile *bfh=mem_boot_base-sizeof(CBinFile);
DefinePrint("DD_OS_NAME_VERSION","TempleOS V%0.2f",sys_os_version);
DefinePrint("DD_TEMPLEOS_AGE","%0.1f",
@@ -11,8 +11,8 @@ U0 LoadDocDefines()
//This is cut and replaced when I generate a distro.
//See $LK,"DD_TEMPLEOS_LOC",A="FF:::/Demo/AcctExample/TOSDistro.HC,DD_TEMPLEOS_LOC"$.
$TR-C,"LineRep"$
$ID,4$DefinePrint("DD_TEMPLEOS_LOC","120,770");
DefinePrint("DD_TEMPLEOS_LOC_OFFICIAL","81,303");
$ID,4$DefinePrint("DD_TEMPLEOS_LOC","119,466");
DefinePrint("DD_TEMPLEOS_LOC_OFFICIAL","81,791");
$ID,-4$
DefinePrint("DD_KERNEL","%08X",bfh);
bfh(I64)+=bfh->file_size-1;
@@ -27,12 +27,14 @@ $ID,-4$
DefinePrint("DD_SYS_FIXED_AREA_BASE","%08X",SYS_FIXED_AREA);
DefinePrint("DD_SYS_FIXED_AREA_END","%08X",
SYS_FIXED_AREA+sizeof(CSysFixedArea)-1);
DefinePrint("DD_SYS_HEAP_BASE","%08X",sys_heap_base);
DefinePrint("DD_SYS_HEAP_LIMIT","%08X",sys_heap_limit);
DefinePrint("DD_MEM_HEAP_BASE","%08X",mem_heap_base);
DefinePrint("DD_MEM_HEAP_LIMIT","%08X",mem_heap_limit);
DefinePrint("DD_MEM_MIN_MEG","%dMeg",MEM_MIN_MEG);
DefinePrint("DD_UNCACHED_ALIAS","%010X",dev.uncached_alias);
DefinePrint("DD_MEM_MAPPED_SPACE_GIG","%dGig",MEM_MAPPED_SPACE/0x40000000);
DefinePrint("DD_MEM_MAPPED_SPACE_END","%010X",MEM_MAPPED_SPACE-1);
DefinePrint("DD_PHYSICAL_SPACE_END","%010X",
mem_physical_space-1);
DefinePrint("DD_MAPPED_SPACE_END","%010X",
mem_mapped_space-1);
DefinePrint("DD_JIFFY_HZ","%dHz",JIFFY_FREQ);
}
+4 -3
View File
@@ -58,8 +58,8 @@ extern CMenuEntry *MenuEntryFind(CMenu *haystack_menu,U8 *needle_full_name);
extern CMenu *MenuFilePush(U8 *filename);
extern U0 MenuPop();
extern CMenu *MenuPush(U8 *st);
extern I64 Mount(Bool repartition=FALSE);
extern CTask *Noise(I64 ms,F64 min_freq,F64 max_freq);
extern U8 Mount(Bool caller_is_prtdsk=FALSE);
extern CTask *Noise(I64 mS,F64 min_ona,F64 max_ona);
extern Bool Plain(U8 *filename,I64 edf_dof_flags=0);
extern Bool PopUpCancelOk(U8 *header=NULL,U8 *footer=NULL);
extern I64 PopUpColor(U8 *header=NULL,
@@ -80,6 +80,7 @@ extern I64 PopUpRangeI64(
extern Bool PopUpTransform(I64 *r);
extern U0 Refresh(I64 cnt=1,Bool force=FALSE);
extern U0 RegOneTimePopUp(I64 flag_num,U8 *msg);
extern Bool RegWrite(U8 *path,U8 *fmt,...);
extern U0 SettingsPop(CTask *task=NULL,I64 flags=0);
extern CTaskSettings *SettingsPush(CTask *task=NULL,I64 flags=0);
extern U0 TemplateCtrlSlider(CDoc *doc);
@@ -87,7 +88,7 @@ extern Bool View();
extern U0 ViewAnglesDel(CTask *task=NULL);
extern CCtrl *ViewAnglesNew(CTask *task=NULL);
extern Bool WinBorder(Bool val=OFF,CTask *task=NULL);
extern CDoc *WinCursorPosSet(CTask *task,I64 ipx,I64 ipy,Bool set_cursor=TRUE);
extern CDoc *WinCursorPosSet(CTask *task,I64 msx,I64 msy,Bool set_cursor=TRUE);
extern Bool WinHorz(I64 left,I64 right,CTask *task=NULL);
extern U0 WinMax(CTask *task=NULL);
extern U0 WinScrollNull(CTask *task,CD3I64 *s);
+6 -6
View File
@@ -88,13 +88,13 @@ public Complex *CMul(Complex *prod,Complex *n1,Complex *n2)
public Complex *CDiv(Complex *quot,Complex *n1,Complex *n2)
{//quot=n1/n2
F64 m1,a1,m2,a2;
R2P(&m1,&a1,n1->x,n1->y);
R2P(&m2,&a2,n2->x,n2->y);
F64 m1,arg1,m2,arg2;
R2P(&m1,&arg1,n1->x,n1->y);
R2P(&m2,&arg2,n2->x,n2->y);
m1/=m2;
a1-=a2;
quot->x=m1*Cos(a1);
quot->y=m1*Sin(a1);
arg1-=arg2;
quot->x=m1*Cos(arg1);
quot->y=m1*Sin(arg1);
return quot;
}
+1 -1
View File
@@ -96,7 +96,7 @@ public Bool IsInHeapCtrl(U8 *a,CHeapCtrl *hc,Bool lock=TRUE)
PAUSE
m=hc->next_mem_blk;
while (m!=&hc->next_mem_blk) {
if (a>=m && a<m(U8 *)+m->pages<<MEM_PAGE_BITS) {
if (a>=m && a<m(U8 *)+m->pags<<MEM_PAG_BITS) {
if (lock)
LBtr(&hc->locked_flags,HClf_LOCKED);
POPFD
Binary file not shown.
+111 -9
View File
@@ -16,7 +16,7 @@ Bool RegCache()
return TRUE;
}
public Bool RegSetDftEntry(U8 *path,U8 *val,Bool is_adam_entry=FALSE)
public Bool RegDft(U8 *path,U8 *val,Bool is_adam_entry=FALSE)
{//Add code doc tree branch to registry.
Bool res,unlock_doc;
RegCache;
@@ -40,13 +40,13 @@ public Bool RegSetDftEntry(U8 *path,U8 *val,Bool is_adam_entry=FALSE)
return res;
}
public I64 RegExeBranch(U8 *path)
public I64 RegExe(U8 *path)
{//Execute doc tree branch in registry.
RegCache;
return DocTreeBranchExe(sys_registry_doc,path);
}
public Bool RegWriteBranch(U8 *path,U8 *fmt,...)
public Bool RegWrite(U8 *path,U8 *fmt,...)
{//Rewrite doc tree branch in registry.
Bool res,unlock_doc;
CDocEntry *tree_branch,*start_indent,*end_indent;
@@ -65,6 +65,46 @@ public Bool RegWriteBranch(U8 *path,U8 *fmt,...)
Free(buf);
return res;
}
public I64 RegCnt(U8 *path)
{//Tree branch cnt in registry.
I64 res=0;
CDocEntry *tree_branch,*start_indent,*end_indent;
Bool unlock_doc=DocLock(sys_registry_doc);
if (DocTreeFind(sys_registry_doc,path,
&tree_branch,&start_indent,&end_indent)) {
end_indent=end_indent->next;
while (start_indent!=end_indent) {
res++;
start_indent=start_indent->next;
}
}
if (unlock_doc)
DocUnlock(sys_registry_doc);
return res;
}
public Bool RegAppend(U8 *path,U8 *fmt,...)
{//Rewrite doc tree branch in registry.
Bool res,unlock_doc;
CDocEntry *tree_branch,*start_indent,*end_indent;
U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
RegCache;
unlock_doc=DocLock(sys_registry_doc);
if (res=DocTreeFind(sys_registry_doc,path,
&tree_branch,&start_indent,&end_indent)) {
sys_registry_doc->cur_entry=end_indent;
sys_registry_doc->cur_col=sys_registry_doc->cur_entry->min_col;
} else
DocTreeMake(sys_registry_doc,path);
DocPrint(sys_registry_doc,"%s",buf);
if (DrvIsWritable(*sys_registry_doc->filename.name))
DocWrite(sys_registry_doc);
if (unlock_doc)
DocUnlock(sys_registry_doc);
Free(buf);
return res;
}
public Bool OneTimePopUp(U8 *_flags,I64 flag_num,U8 *msg)
{//See $LK,"::/Apps/X-Caliber/X-Caliber.HC"$.
@@ -87,7 +127,7 @@ public Bool OneTimePopUp(U8 *_flags,I64 flag_num,U8 *msg)
U0 RegOneTimePopUp(I64 flag_num,U8 *msg)
{//You're not supposed to make system pop-up flags, only me.
if (OneTimePopUp(sys_msg_flags,flag_num,msg))
RegWriteBranch("Adam/SysMsgFlags","sys_msg_flags[0]=0x%X;\n",
RegWrite("Adam/SysMsgFlags","sys_msg_flags[0]=0x%X;\n",
sys_msg_flags[0]);
}
@@ -95,12 +135,74 @@ U0 RegInit()
{
U8 buf[STR_LEN];
Bool version_present;
RegSetDftEntry("Adam/SysMsgFlags","sys_msg_flags[0]=0;\n",TRUE);
RegDft("Adam/SysMsgFlags","sys_msg_flags[0]=0;\n",TRUE);
StrPrint(buf,"registry_version=%4.3f;\n",sys_os_version);
version_present=RegSetDftEntry("Adam/SysRegVer",buf,TRUE);
RegExeBranch("Adam");
version_present=RegDft("Adam/SysRegVer",buf,TRUE);
RegExe("Adam");
if (registry_version!=sys_os_version) {
RegWriteBranch("Adam/SysRegVer",buf);
RegExeBranch("Adam");
RegWrite("Adam/SysRegVer",buf);
RegExe("Adam");
}
}
#help_index "Boot/Once;Misc/Once"
public U0 AOnceFlush()
{//Flush AOnce() buf.
RegWrite("Once/Adam","");
}
public U0 OnceFlush()
{//Flush Once() buf.
RegWrite("Once/User","");
}
public U0 AOnce(U8 *fmt,...)
{//Writes Adam code to $LK,"Registry",A="FI:~/Registry.HC"$ to be executed next boot.
U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
RegAppend("Once/Adam","%s\n",buf);
Free(buf);
}
public U0 Once(U8 *fmt,...)
{//Writes User code to $LK,"Registry",A="FI:~/Registry.HC"$ to be executed next boot.
U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
RegAppend("Once/User","%s\n",buf);
Free(buf);
}
public U0 AOnceDrv(U8 drv_let=0,U8 *fmt,...)
{//Writes Adam code to drv $LK,"Registry",A="FI:~/Registry.HC"$ to be executed next boot.
U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
I64 old_drv_let=*sys_registry_doc->filename.name;
if (drv_let)
*sys_registry_doc->filename.name=drv_let;
RegAppend("Once/Adam","%s\n",buf);
Free(buf);
*sys_registry_doc->filename.name=old_drv_let;
}
public U0 OnceDrv(U8 drv_let=0,U8 *fmt,...)
{//Writes User code to drv $LK,"Registry",A="FI:~/Registry.HC"$ to be executed next boot.
U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
I64 old_drv_let=*sys_registry_doc->filename.name;
if (drv_let)
*sys_registry_doc->filename.name=drv_let;
RegAppend("Once/User","%s\n",buf);
Free(buf);
*sys_registry_doc->filename.name=old_drv_let;
}
public U0 OnceExe()
{//Execute Once code. This goes in $LK,"~/Once.HC"$.
RegDft("Once/Adam","");
if (RegCnt("Once/Adam")>2) {
Adam("RegExe(\"Once/Adam\");");
AOnceFlush;
}
RegDft("Once/User","");
if (RegCnt("Once/User")>2) {
RegExe("Once/User");
OnceFlush;
}
}
+2 -2
View File
@@ -212,11 +212,11 @@ U0 ACMisspelledFind(CDoc *doc)
do {
if (doc_e!=doc && doc_e->de_flags&DOCEF_TAG) {
while (col<doc_e->max_col) {
while (col<doc_e->max_col && !Bt(chars_bmp_word,doc_e->tag[col]))
while (col<doc_e->max_col && !Bt(char_bmp_word,doc_e->tag[col]))
col++;
if (col<doc_e->max_col) {
col2=col;
while (col2<doc_e->max_col && Bt(chars_bmp_word,doc_e->tag[col2]))
while (col2<doc_e->max_col && Bt(char_bmp_word,doc_e->tag[col2]))
col2++;
ch=doc_e->tag[col2];
doc_e->tag[col2]=0;
+2 -2
View File
@@ -65,7 +65,7 @@ U0 ACSingleFileAdd(U8 *buf)
while (TRUE) {
while (TRUE) {
if (ch=*ptr++) {
if (Bt(chars_bmp_alpha_numeric,ch))
if (Bt(char_bmp_alpha_numeric,ch))
break;
} else
return;
@@ -75,7 +75,7 @@ U0 ACSingleFileAdd(U8 *buf)
ptr--;
while (TRUE) {
if (ch=*ptr2++) {
if (Bt(chars_bmp_alpha_numeric,ch))
if (Bt(char_bmp_alpha_numeric,ch))
*ptr3++=ch;
else if (ch!=CH_CURSOR)
break;
+4 -4
View File
@@ -36,7 +36,7 @@ I64 ACSkipCrap(U8 *src,I64 len)
I64 j;
j=len-1;
while (j>=0) {
if (Bt(chars_bmp_alpha_numeric,src[j]))
if (Bt(char_bmp_alpha_numeric,src[j]))
break;
else
j--;
@@ -49,7 +49,7 @@ I64 ACPriorWordInStr(U8 *src,U8 *dst,I64 len,I64 buf_size)
I64 i,j=0,k;
i=len-1;
while (i>=0)
if (!Bt(chars_bmp_alpha_numeric,src[i]))
if (!Bt(char_bmp_alpha_numeric,src[i]))
break;
else
i--;
@@ -223,12 +223,12 @@ U0 ACTask(I64)
WinHorz(51,Fs->win_right);
LBts(&Fs->display_flags,DISPLAYf_WIN_ON_TOP);
Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_BORDER
-WIF_SELF_IP_L-WIF_SELF_IP_R-WIG_DBL_CLICK;
-WIF_SELF_MS_L-WIF_SELF_MS_R-WIG_DBL_CLICK;
Free(ac.cur_word);
ac.cur_word=NULL;
while (TRUE) {
if (scan_code&(SCF_CTRL|SCF_ALT) ||
GetTSC>KbdMouseEvtTime+cnts.time_stamp_freq>>1) {
GetTSC>KbdMsEvtTime+cnts.time_stamp_freq>>1) {
last_scan_code=scan_code;
scan_code=kbd.scan_code;
}
+8 -8
View File
@@ -30,7 +30,7 @@ public U0 CPURep(Bool full=FALSE)
CCPURep cr;
if (!full)
"%d Cores %6h?nHz\n",mp_cnt,ToF64(cnts.time_stamp_freq);
"%03X Cores %6h?nHz\n",mp_cnt,ToF64(cnts.time_stamp_freq);
else {
cr.swaps=CAlloc(sizeof(I64)*mp_cnt);
cr.cycles=CAlloc(sizeof(I64)*mp_cnt);
@@ -47,22 +47,22 @@ public U0 CPURep(Bool full=FALSE)
Yield;
tf=tS;
"\nCPU: %d Cores %6h?nHz\n",mp_cnt,ToF64(cnts.time_stamp_freq);
"\n%03X Cores %6h?nHz\n",mp_cnt,ToF64(cnts.time_stamp_freq);
"\n Context\n"
"Core Swaps/s Cycles\n"
"---- ------------- -----------------\n";
"CPU Swaps/s Cycles\n"
"--- ------------- -----------------\n";
total_swaps=0;
total_cycles=0;
for (i=0;i<mp_cnt;i++) {
"%4d %13,d %17,d\n",i,
" %02X %13,d %17,d\n",i,
ToI64(cr.swaps[i]/(tf-t0)),ToI64(cr.cycles[i]/(tf-t0));
total_swaps+=cr.swaps[i];
total_cycles+=cr.cycles[i];
}
"---- ------------- -----------------\n";
"%4d %13,d %17,d\n",i,
"--- ------------- -----------------\n";
"%03X %13,d %17,d\n",i,
ToI64(total_swaps/(tf-t0)),ToI64(total_cycles/(tf-t0));
" Avg %13,d %17,d\n\n",
"Avg %13,d %17,d\n\n",
ToI64(total_swaps/(tf-t0)/i),ToI64(total_cycles/(tf-t0)/i);
"Avg Cycles/Swap: %12.6f\n",ToF64(total_cycles)/total_swaps;
"Avg Time/Swap : %12.6fns\n\n",(tf-t0)*1000000000.0*i/total_swaps;
+3 -3
View File
@@ -203,7 +203,7 @@ U0 WinScrollsInit(CTask *task)
if (!CtrlFindUnique(task,CTRLT_WIN_HSCROLL)) {
c=CAlloc(sizeof(CCtrl));
c->win_task=task;
c->flags=CTRLF_SHOW|CTRLF_BORDER|CTRLF_CAPTURE_LEFT_IP;
c->flags=CTRLF_SHOW|CTRLF_BORDER|CTRLF_CAPTURE_LEFT_MS;
c->type=CTRLT_WIN_HSCROLL;
c->state=&task->horz_scroll;
c->update_derived_vals=&WinDerivedScrollValsUpdate;
@@ -215,7 +215,7 @@ U0 WinScrollsInit(CTask *task)
if (!CtrlFindUnique(task,CTRLT_WIN_VSCROLL)) {
c=CAlloc(sizeof(CCtrl));
c->win_task=task;
c->flags=CTRLF_SHOW|CTRLF_BORDER|CTRLF_CAPTURE_LEFT_IP;
c->flags=CTRLF_SHOW|CTRLF_BORDER|CTRLF_CAPTURE_LEFT_MS;
c->type=CTRLT_WIN_VSCROLL;
c->state=&task->vert_scroll;
c->update_derived_vals=&WinDerivedScrollValsUpdate;
@@ -364,7 +364,7 @@ public CCtrl *ViewAnglesNew(CTask *task=NULL)
s->cy=GREEN;
s->cz=LTGREEN;
c->win_task=task;
c->flags=CTRLF_SHOW|CTRLF_CAPTURE_LEFT_IP;
c->flags=CTRLF_SHOW|CTRLF_CAPTURE_LEFT_MS;
c->type=CTRLT_VIEWING_ANGLES;
c->state=s;
c->draw_it=&DrawViewAnglesCtrl;
@@ -1,17 +1,17 @@
#define BUTTON_BORDER 2
#define BTTN_BORDER 2
#define BTF_DONT_FREE 1
class CCtrlButtonState
class CCtrlBttnState
{
I64 state,num_states,flags;
U8 *state_texts;
CColorROPU32 *state_colors;
};
U0 DrawCtrlButton(CDC *dc,CCtrl *c)
U0 DrawCtrlBttn(CDC *dc,CCtrl *c)
{
CCtrlButtonState *s=c->state;
CCtrlBttnState *s=c->state;
I64 l;
U8 *st;
@@ -21,17 +21,17 @@ U0 DrawCtrlButton(CDC *dc,CCtrl *c)
st=s->state_texts;
dc->color=s->state_colors[s->state];
l=StrLen(st);
GrRect(dc,c->left+BUTTON_BORDER,c->top+BUTTON_BORDER,
c->right-c->left+1-BUTTON_BORDER*2,
c->bottom-c->top+1-BUTTON_BORDER*2);
GrRect(dc,c->left+BTTN_BORDER,c->top+BTTN_BORDER,
c->right-c->left+1-BTTN_BORDER*2,
c->bottom-c->top+1-BTTN_BORDER*2);
dc->color=s->state_colors[s->state]^(WHITE<<16+WHITE);
GrPrint(dc,(c->left+c->right+1-l*FONT_WIDTH)>>1,
(c->top+c->bottom+1-FONT_HEIGHT)>>1,"%s",st);
}
U0 LeftClickCtrlButton(CCtrl *c,I64,I64,Bool down)
U0 LeftClickCtrlBttn(CCtrl *c,I64,I64,Bool down)
{
CCtrlButtonState *s=c->state;
CCtrlBttnState *s=c->state;
if (down) {
s->state++;
if (s->state==s->num_states)
@@ -39,12 +39,12 @@ U0 LeftClickCtrlButton(CCtrl *c,I64,I64,Bool down)
}
}
public CCtrl *CtrlButtonNew(I64 x,I64 y,I64 width=-1,I64 height=-1,
public CCtrl *CtrlBttnNew(I64 x,I64 y,I64 width=-1,I64 height=-1,
I64 num_states=1,U8 *state_texts,
I32 *state_colors,CCtrlButtonState *_s=NULL)
{//Create button ctrl. See $LK,"::/Apps/Strut/Strut.HC"$.
I32 *state_colors,CCtrlBttnState *_s=NULL)
{//Create bttn ctrl. See $LK,"::/Apps/Strut/Strut.HC"$.
CCtrl *res;
CCtrlButtonState *s;
CCtrlBttnState *s;
I64 i,j,l;
U8 *st;
if (width<0) {
@@ -54,15 +54,15 @@ public CCtrl *CtrlButtonNew(I64 x,I64 y,I64 width=-1,I64 height=-1,
j=StrLen(st);
if (j>l) l=j;
}
width=BUTTON_BORDER*4+l*FONT_WIDTH;
width=BTTN_BORDER*4+l*FONT_WIDTH;
}
if (height<0) height=BUTTON_BORDER*4+FONT_HEIGHT;
if (height<0) height=BTTN_BORDER*4+FONT_HEIGHT;
res=CAlloc(sizeof(CCtrl));
if (_s) {
s=_s;
MemSet(s,0,sizeof(CCtrlButtonState));
MemSet(s,0,sizeof(CCtrlBttnState));
} else {
s=CAlloc(sizeof(CCtrlButtonState));
s=CAlloc(sizeof(CCtrlBttnState));
s->flags=BTF_DONT_FREE;
}
s->num_states=num_states;
@@ -72,8 +72,8 @@ public CCtrl *CtrlButtonNew(I64 x,I64 y,I64 width=-1,I64 height=-1,
res->flags=CTRLF_SHOW;
res->type=CTRLT_GENERIC;
res->state=s;
res->draw_it=&DrawCtrlButton;
res->left_click=&LeftClickCtrlButton;
res->draw_it=&DrawCtrlBttn;
res->left_click=&LeftClickCtrlBttn;
res->left=x;
res->top=y;
res->right=res->left+width-1;
@@ -82,8 +82,8 @@ public CCtrl *CtrlButtonNew(I64 x,I64 y,I64 width=-1,I64 height=-1,
return res;
}
public U0 CtrlButtonDel(CCtrl *c)
{//Free button ctrl.
public U0 CtrlBttnDel(CCtrl *c)
{//Free bttn ctrl.
QueRem(c);
if (!(c->flags&BTF_DONT_FREE))
Free(c->state);
+1 -1
View File
@@ -176,7 +176,7 @@ CCtrl *SliderNew()
{
CCtrl *c=CAlloc(sizeof(CCtrl));
c->win_task=Fs;
c->flags=CTRLF_SHOW|CTRLF_CAPTURE_LEFT_IP;
c->flags=CTRLF_SHOW|CTRLF_CAPTURE_LEFT_MS;
c->type=CTRLT_GENERIC;
");
if (*m->glbl_name)
+1 -1
View File
@@ -3,6 +3,6 @@ Cd(__DIR__);;
#help_index "Ctrls"
#help_file "::/Doc/Ctrls"
#include "CtrlsA"
#include "CtrlsButton"
#include "CtrlsBttn"
#include "CtrlsSlider"
Cd("..");;
+33 -14
View File
@@ -6,9 +6,12 @@
#define PCI_DEV_FILE "::/Misc/PCIDevices.DD.Z"
/****
//1) Plain text edit and remove file header and tail
//2) Text find-and-replace "=0A=" with "".
//3) Run PCIDevFileGen().
//1) Download http://www.pcidatabase.com/reports.php?type=tab-delimeted
//2) Rename to ::/Misc/PCIDevices.DD.Z
//3) ToDolDoc("::/Misc/PCIDevices.DD.Z");
//4) Edit and remove file header and tail
//5) Text find-and-replace "=0A=" with "". (Doesn't seem necessary anmore.)
//6) Run PCIDevFileGen(). (Doesn't seem necessary anmore.)
public U0 PCIDevFileGen()
{
@@ -168,34 +171,50 @@ public U0 PCIRep()
#help_index "Info;Memory/Info"
public U0 MemBIOSRep()
{//Report the memory ranges reported by the BIOS at boot.
U16 *m01=SYS_MEM_E801;
CMemE820 *m20=SYS_MEM_E820;
U16 *m01=MEM_E801;
CMemE820 *m20=MEM_E820;
CMemRange *tmpmr;
"Standard Addresses\n"
"0x000A0000-0x000BFFFF VGA\n"
"0xFEE00000-0xFEE00FFF See $$LK,\"APIC\",A=\"MN:LAPIC_BASE\"$$\n\n"
"000A0000-000BFFFF VGA\n"
"FEE00000-FEE00FFF See $$LK,\"APIC\",A=\"MN:LAPIC_BASE\"$$\n\n"
"32 Bit Device Mem\n";
while (LBts(&sys_semas[SYS_SEMA_DEV_MEM],0))
while (LBts(&sys_semas[SEMA_DEV_MEM],0))
Yield;
tmpmr=dev.mem32_head.next;
while (tmpmr!=&dev.mem32_head) {
"%02X:0x%016X-0x%016X\n",
"%02X:%016X-%016X\n",
tmpmr->type,tmpmr->base,tmpmr->base+tmpmr->size-1;
tmpmr=tmpmr->next;
}
LBtr(&sys_semas[SYS_SEMA_DEV_MEM],0);
LBtr(&sys_semas[SEMA_DEV_MEM],0);
"\nBIOS Memory Report 15:E801\n"
"01:0x0000000000000000-0x%016X\n",0x100000+m01[0]<<10-1;
"01:0x0000000001000000-0x%016X\n",0x1000000+m01[1]<<16-1;
"01:0000000000000000-%016X\n",0x100000+m01[0]<<10-1;
"01:0000000001000000-%016X\n",SYS_16MEG_AREA_LIMIT+m01[1]<<16-1;
if (m20->type) {
'\n';
"BIOS Memory Report 15:E820\n";
while (m20->type) {
"%02X:0x%016X-0x%016X\n",m20->type,m20->base,m20->base+m20->len-1;
"%02X:%016X-%016X\n",m20->type,m20->base,m20->base+m20->len-1;
m20++;
}
}
}
public U0 MemPageRep()
{//Page Table Report.
"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_NUM_2MEG(U64 *);
"PML3\t :%010X 1GIG :%08X\n",
*MEM_PML3(U64 *),*MEM_NUM_1GIG(U64 *);
"PML4\t :%010X 512GIG:%08X\n",
*MEM_PML4(U64 *),*MEM_NUM_512GIG(U64 *);
"FIXED_AREA:%010X\n",SYS_FIXED_AREA;
"HEAP_BASE :%010X\nHEAP_LIMIT:%010X\n",mem_heap_base,mem_heap_limit;
}
+3 -3
View File
@@ -443,7 +443,7 @@ U0 EdCharIns(I64 ch,I64 sc,CDoc *doc)
I64 i,j,m,y=doc_ce->y;
if (doc->flags & DOCF_IN_DOLLAR) {
if (!Bt(chars_bmp_getkey,ch))
if (!Bt(char_bmp_printable,ch))
goto ic_done;
ChkDollarBufSize(doc);
doc->dollar_buf[doc->dollar_buf_ptr++]=ch;
@@ -510,7 +510,7 @@ U0 EdCharIns(I64 ch,I64 sc,CDoc *doc)
goto ic_done;
}
if (doc->flags & DOCF_OVERSTRIKE) {
if (Bt(chars_bmp_displayable,ch)) {
if (Bt(char_bmp_displayable,ch)) {
ic_overstrike:
if (IsEditableText(doc_ce)) {
if (doc->cur_col<doc_ce->max_col) {
@@ -578,7 +578,7 @@ ic_form_tab:
DocInsEntry(doc,doc_ne);
}
} else {
if (Bt(chars_bmp_displayable,ch)) {
if (Bt(char_bmp_displayable,ch)) {
if (doc_ce->type_u8==DOCT_DATA) {
while (TRUE) {
i=doc_ce->len+doc_ce->min_col;
+17 -17
View File
@@ -359,7 +359,7 @@ U0 EdRACollect(CDoc *doc,CRenum *head)
StrCpy(buf,"@@");
i=2;
while (ch>=0 && i<sizeof(CEdFindText.find_text)) {
if (Bt(chars_bmp_alpha_numeric,ch))
if (Bt(char_bmp_alpha_numeric,ch))
buf[i++]=ch;
else
break;
@@ -367,7 +367,7 @@ U0 EdRACollect(CDoc *doc,CRenum *head)
}
if (i<sizeof(CEdFindText.find_text)) {
buf[i++]=0;
while (ch>=0 && Bt(chars_bmp_white_space,ch))
while (ch>=0 && Bt(char_bmp_white_space,ch))
ch=EdRAGetU8(doc);
if (ch==':') {
ch=EdRAGetU8(doc);
@@ -426,7 +426,7 @@ U0 EdCodeTools2(CDoc *doc,I64 tool_action,Bool beep=TRUE)
I64 i,start_y,end_y,x,r,goto_line_num;
U8 *b,*st,*st2,*prj_file;
CTask *task=NULL;
CSrvCmd *tmpc;
CJob *tmpc;
CQueVectU8 *indent;
DocRecalc(doc);
@@ -442,7 +442,7 @@ U0 EdCodeTools2(CDoc *doc,I64 tool_action,Bool beep=TRUE)
task=Spawn(&SrvCmdLine,NULL,"Srv",,Fs);
st2=CurDir;
st=MStrPrint("Cd(\"%s\");",st2);
tmpc=TaskExe(task,Fs,st,1<<SVCf_WAKE_MASTER|1<<SVCf_FOCUS_MASTER);
tmpc=TaskExe(task,Fs,st,1<<JOBf_WAKE_MASTER|1<<JOBf_FOCUS_MASTER);
Free(st2);
Free(st);
WinHorz(Fs->win_left,Fs->win_right, task);
@@ -455,23 +455,23 @@ U0 EdCodeTools2(CDoc *doc,I64 tool_action,Bool beep=TRUE)
st2=DirFile(prj_file),
st=MStrPrint("Cd(\"%s\");",st2);
Free(st2);
tmpc=TaskExe(task,Fs,st,1<<SVCf_WAKE_MASTER|
1<<SVCf_FOCUS_MASTER|1<<SVCf_FREE_ON_COMPLETE);
tmpc=TaskExe(task,Fs,st,1<<JOBf_WAKE_MASTER|
1<<JOBf_FOCUS_MASTER|1<<JOBf_FREE_ON_COMPLETE);
Free(st);
st=MStrPrint("\"$$WW,1$$\";Cmp(\"%s\",\"SysTmp\",\"SysTmp\");",
prj_file);
tmpc=TaskExe(task,Fs,st,1<<SVCf_WAKE_MASTER|1<<SVCf_FOCUS_MASTER);
tmpc=TaskExe(task,Fs,st,1<<JOBf_WAKE_MASTER|1<<JOBf_FOCUS_MASTER);
Free(st);
if (JobResScan(tmpc,&r))
if (!r) {
tmpc=TaskExe(task,Fs,
"Load(\"SysTmp\",LDF_JUST_LOAD);",
1<<SVCf_WAKE_MASTER|1<<SVCf_FOCUS_MASTER);
1<<JOBf_WAKE_MASTER|1<<JOBf_FOCUS_MASTER);
if (JobResScan(tmpc,&r))
okay=TRUE;
}
tmpc=TaskExe(task,Fs,"Del(\"SysTmp.*\");",
1<<SVCf_WAKE_MASTER|1<<SVCf_FOCUS_MASTER);
1<<JOBf_WAKE_MASTER|1<<JOBf_FOCUS_MASTER);
JobResScan(tmpc,&r);
} else {
Free(prj_file);
@@ -483,7 +483,7 @@ U0 EdCodeTools2(CDoc *doc,I64 tool_action,Bool beep=TRUE)
else
st=MStrPrint("\"$$WW,1$$\";ExeFile(\"%s\",CCF_JUST_LOAD);",
doc->filename.name);
tmpc=TaskExe(task,Fs,st,1<<SVCf_WAKE_MASTER|1<<SVCf_FOCUS_MASTER);
tmpc=TaskExe(task,Fs,st,1<<JOBf_WAKE_MASTER|1<<JOBf_FOCUS_MASTER);
Free(st);
if (JobResScan(tmpc,&r) && r)
okay=TRUE;
@@ -492,10 +492,10 @@ U0 EdCodeTools2(CDoc *doc,I64 tool_action,Bool beep=TRUE)
}
if (!okay) {
PopUpOk("Has Errors");
while (LBts(&sys_semas[SYS_SEMA_FIX],0))
while (LBts(&sys_semas[SEMA_FIX],0))
Yield;
ToFileLine(dbg.fix_file_line,&st,&i);
LBtr(&sys_semas[SYS_SEMA_FIX],0);
LBtr(&sys_semas[SEMA_FIX],0);
if (!StrCmp(st,doc->filename.name))
goto_line_num=i;
Free(st);
@@ -510,9 +510,9 @@ U0 EdCodeTools2(CDoc *doc,I64 tool_action,Bool beep=TRUE)
indent=EdRICode(doc);
DocUnlock(doc);
if (beep) {
Snd(2000); Sleep(150); Snd(0);
Snd(86); Sleep(150); Snd;
Sleep(100);
Snd(2000); Sleep(150); Snd(0);
Snd(86); Sleep(150); Snd;
}
DocLock(doc);
EdRemFunLeadingSpace(doc);
@@ -577,9 +577,9 @@ U0 EdCodeTools2(CDoc *doc,I64 tool_action,Bool beep=TRUE)
}
DocUnlock(doc);
if (beep) {
Snd(2000); Sleep(150); Snd(0);
Snd(86); Sleep(150); Snd;
Sleep(100);
Snd(2000); Sleep(150); Snd(0);
Snd(86); Sleep(150); Snd;
}
DocLock(doc);
EdRenumAsm(doc);
@@ -633,7 +633,7 @@ U0 EdChSC(CDoc *doc)
DocPrint(doc,"CH_SPACE,0x%X",sc);
else if (ch==CH_SHIFT_SPACE)
DocPrint(doc,"CH_SHIFT_SPACE,0x%X",sc);
else if (Bt(chars_bmp_displayable,ch))
else if (Bt(char_bmp_displayable,ch))
DocPrint(doc,"'%c',0x%X",ch,sc);
else
DocPrint(doc,"0x%X,0x%X",ch,sc);
+2
View File
@@ -4,6 +4,8 @@ public CDoc *DocPut(CTask *task=NULL)
//Basically, StdOut unless double buffering.
CDoc *res;
if (!task) task=Fs;
if (Bt(&task->task_flags,TASKf_INPUT_FILTER_TASK))
task=task->parent_task;
if ((res=task->put_doc) && res->doc_signature==DOC_SIGNATURE_VAL)
return res;
else
+1 -1
View File
@@ -240,7 +240,7 @@ public Bool Plain(U8 *filename,I64 edf_dof_flags=0)
return res;
}
#help_index "DolDoc;Task/Srv/Exe"
#help_index "DolDoc;Job/Exe;Task/Job/Exe"
public I64 PopUpEd(U8 *filename,CTask *parent=NULL,CTask **_pu_task=NULL)
{//Create PopUp win task and edit a doc.
U8 *st=MStrPrint("Ed(\"%Q\");",filename);
-3
View File
@@ -120,9 +120,6 @@ public U8 *DocSave(CDoc *doc,I64 *_size=NULL)
case DOCT_TAB:
*dst++='\t';
break;
case DOCT_PAGE_BREAK:
*dst++=CH_FORM_FEED;
break;
case DOCT_NEW_LINE:
if (doc->flags&DOCF_CARRIAGE_RETURN)
*dst++='\r';
+14 -12
View File
@@ -65,8 +65,9 @@ class CTransformForm
F64 z_offset fmtstr "$$DA-TRM,A=\"Z Offset:%12.6f\"$$\n";
};
Bool PopUpTransform(I64 *r)
{
#help_index "Graphics/Input;Graphics/Math/3D Transformation"
public Bool PopUpTransform(I64 *r)
{//Prompt for Mat4x4 transform.
CTransformForm *tf=MAlloc(sizeof(CTransformForm));
tf->x_scale=1.0;
tf->y_scale=1.0;
@@ -96,6 +97,7 @@ Bool PopUpTransform(I64 *r)
return FALSE;
}
#help_index "Graphics/Input"
#define PU_SPACING 10
U0 DrawIt(CTask *task,CDC *dc)
{
@@ -124,7 +126,7 @@ U0 DrawIt(CTask *task,CDC *dc)
I64 DitherColor2(U8 *header=NULL)
{
I64 msg_code,a1,a2,res=-1,i,j;
I64 msg_code,arg1,arg2,res=-1,i,j;
DocClear;
"%s",header;
DocRecalc(DocPut);
@@ -132,21 +134,21 @@ I64 DitherColor2(U8 *header=NULL)
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
Fs->draw_it=&DrawIt;
do {
msg_code=GetMsg(&a1,&a2,1<<MSG_IP_L_DOWN|1<<MSG_KEY_DOWN);
if (msg_code==MSG_IP_L_DOWN) {
msg_code=GetMsg(&a1,&a2,1<<MSG_IP_L_UP);
i=a1/PU_SPACING;
j=(a2-FramePtr("DitherFrame"))/PU_SPACING;
if (a1>=0 && a2>=0 && 0<=j<17 && 0<=i<17) {
msg_code=GetMsg(&arg1,&arg2,1<<MSG_MS_L_DOWN|1<<MSG_KEY_DOWN);
if (msg_code==MSG_MS_L_DOWN) {
msg_code=GetMsg(&arg1,&arg2,1<<MSG_MS_L_UP);
i=arg1/PU_SPACING;
j=(arg2-FramePtr("DitherFrame"))/PU_SPACING;
if (arg1>=0 && arg2>=0 && 0<=j<17 && 0<=i<17) {
if (j==16) j=TRANSPARENT;
if (i==16) i=TRANSPARENT;
res=j+i<<16+ROPF_DITHER;
goto dc_done;
}
}
} while (!(msg_code==MSG_KEY_DOWN && (a1==CH_ESC || a1==CH_SHIFT_ESC)));
do GetMsg(&a1,&a2,1<<MSG_KEY_UP);
while (!a1);
} while (!(msg_code==MSG_KEY_DOWN && (arg1==CH_ESC || arg1==CH_SHIFT_ESC)));
do GetMsg(&arg1,&arg2,1<<MSG_KEY_UP);
while (!arg1);
dc_done:
SettingsPop;
FramePtrDel("DitherFrame");
+2 -2
View File
@@ -12,7 +12,7 @@ U32 *DocHighlight(CDocEntry *doc_e,U8 *src,I64 len,I64 _tmp_u32_attr)
case DOCSS_NORMAL:
hl_normal:
while (len) {
while (len && !Bt(chars_bmp_alpha_numeric,*src)) {
while (len && !Bt(char_bmp_alpha_numeric,*src)) {
tmp_u32_attr=_tmp_u32_attr;
ch1=*src++;
switch (ch1) {
@@ -65,7 +65,7 @@ hl_normal:
if (!--len) goto hl_normal_done;
}
ptr=src;
while (len && Bt(chars_bmp_alpha_numeric,*src)) {
while (len && Bt(char_bmp_alpha_numeric,*src)) {
src++;
len--;
}
+17 -17
View File
@@ -5,18 +5,18 @@ StrCpy(captured_macro_name,"Test");
I64 sys_macro_repeat_n=1;
U0 SysMacroStripKey(CSrvCmd *macro_head,I64 a1,I64 a2)
U0 SysMacroStripKey(CJob *macro_head,I64 arg1,I64 arg2)
{
CSrvCmd *tmpc,*tmpc1;
CJob *tmpc,*tmpc1;
tmpc=macro_head->next;
while (tmpc!=macro_head) {
tmpc1=tmpc->next;
if (tmpc->cmd_code==SVCT_MSG &&
if (tmpc->job_code==JOBT_MSG &&
(tmpc->msg_code==MSG_KEY_DOWN || tmpc->msg_code==MSG_KEY_UP ||
tmpc->msg_code==MSG_KEY_DOWN_UP) &&
a1 && tmpc->aux1==a1 || !a1 && tmpc->aux2==a2) {
arg1 && tmpc->aux1==arg1 || !arg1 && tmpc->aux2==arg2) {
QueRem(tmpc);
SrvCmdDel(tmpc);
JobDel(tmpc);
}
tmpc=tmpc1;
}
@@ -33,11 +33,11 @@ class CMacroTmp
U8 buf[STR_LEN];
};
CMacroTmp *Cmd2MT(CSrvCmd *tmpc)
CMacroTmp *Cmd2MT(CJob *tmpc)
{
U8 buf[8];
CMacroTmp *tmpmt=CAlloc(sizeof(CMacroTmp));
if (Bt(chars_bmp_macro,tmpc->aux1) && tmpc->msg_code==MSG_KEY_DOWN) {
if (Bt(char_bmp_macro,tmpc->aux1) && tmpc->msg_code==MSG_KEY_DOWN) {
tmpmt->type=MT_CHAR;
buf[0]=tmpc->aux1;
buf[1]=0;
@@ -50,13 +50,13 @@ CMacroTmp *Cmd2MT(CSrvCmd *tmpc)
return tmpmt;
}
U8 *SysMacro2Str(CSrvCmd *macro_head)
U8 *SysMacro2Str(CJob *macro_head)
{
CSrvCmd *tmpc;
CJob *tmpc;
I64 cnt=1; //terminating zero
U8 *ptr,*m;
CMacroTmp *tmpmt,*tmpmt1,head;
LBtr(&sys_semas[SYS_SEMA_RECORD_MACRO],0);
LBtr(&sys_semas[SEMA_RECORD_MACRO],0);
QueInit(&head);
head.type=MT_NULL;
@@ -107,7 +107,7 @@ U0 PlaySysMacro(I64 n=1)
CTask *task=sys_focus_task;
U8 *m;
if (TaskValidate(task)) {
LBtr(&sys_semas[SYS_SEMA_RECORD_MACRO],0);
LBtr(&sys_semas[SEMA_RECORD_MACRO],0);
m=SysMacro2Str(&sys_macro_head);
while (n-- && TaskValidate(task)) {
if (task==Fs)
@@ -139,7 +139,7 @@ I64 PopUpMacroMenu()
{
I64 res=0;
U8 buf[STR_LEN];
CSrvCmd *tmpc;
CJob *tmpc;
CDoc *doc=DocNew;
CDocEntry *doc_e=DocPrint(doc,"$$DA-P,LEN=STR_LEN-1,A=\"Name:%%s\"$$");
doc_e->data=captured_macro_name;
@@ -163,7 +163,7 @@ I64 PopUpMacroMenu()
Fs->popup_task=sys_macro_task;
LBts(&sys_macro_task->display_flags,DISPLAYf_WIN_ON_TOP);
tmpc=TaskExe(sys_macro_task,Fs,buf,
1<<SVCf_WAKE_MASTER|1<<SVCf_FOCUS_MASTER);
1<<JOBf_WAKE_MASTER|1<<JOBf_FOCUS_MASTER);
JobResScan(tmpc,&res);
Fs->popup_task=NULL;
Kill(sys_macro_task);
@@ -183,9 +183,9 @@ U0 MacroTask(I64)
WinRefocus(sys_focus_task);
switch (i) {
case SM_RECORD:
LBtr(&sys_semas[SYS_SEMA_RECORD_MACRO],0);
LBtr(&sys_semas[SEMA_RECORD_MACRO],0);
QueDel(&sys_macro_head,TRUE);
LBts(&sys_semas[SYS_SEMA_RECORD_MACRO],0);
LBts(&sys_semas[SEMA_RECORD_MACRO],0);
break;
case SM_PLAY:
PlaySysMacro;
@@ -194,10 +194,10 @@ U0 MacroTask(I64)
PlaySysMacro(sys_macro_repeat_n);
break;
case SM_STOP:
LBtr(&sys_semas[SYS_SEMA_RECORD_MACRO],0);
LBtr(&sys_semas[SEMA_RECORD_MACRO],0);
break;
case SM_INS:
LBtr(&sys_semas[SYS_SEMA_RECORD_MACRO],0);
LBtr(&sys_semas[SEMA_RECORD_MACRO],0);
EdInsCapturedMacro;
break;
}
+7 -7
View File
@@ -3,7 +3,7 @@ public CTask *PopUpViewDoc(CDoc *doc,I64 dof_flags=0)
{//Pass doc to PopUp win task for viewing.
U8 *buf=MStrPrint("DocEd(0x%X,0x%X);",doc,dof_flags);
CTask *task=Spawn(&SrvCmdLine,NULL,"View",,Fs);
TaskExe(task,NULL,buf,1<<SVCf_EXIT_ON_COMPLETE|1<<SVCf_FREE_ON_COMPLETE);
TaskExe(task,NULL,buf,1<<JOBf_EXIT_ON_COMPLETE|1<<JOBf_FREE_ON_COMPLETE);
Free(buf);
return task;
}
@@ -120,7 +120,7 @@ public U8 *PopUpPickDefineSub(U8 *dname)
#help_index "DolDoc/Input;StdIn/DolDoc"
public I64 PopUp1(U8 *b1,I64 n1,U8 *header=NULL,U8 *footer=NULL)
{//Make PopUp win task with one button.
{//Make PopUp win task with one bttn.
I64 i,l1=StrLen(b1);
CDoc *doc=DocNew;
if (header) DocPrint(doc,"%s",header);
@@ -132,7 +132,7 @@ public I64 PopUp1(U8 *b1,I64 n1,U8 *header=NULL,U8 *footer=NULL)
}
public I64 PopUp2(U8 *b1,I64 n1,U8 *b2,I64 n2,U8 *header=NULL,U8 *footer=NULL)
{//Make PopUp win task with two buttons.
{//Make PopUp win task with two bttns.
I64 i,l1=StrLen(b1),l2=StrLen(b2),y;
CDoc *doc=DocNew;
if (header) {
@@ -151,17 +151,17 @@ public I64 PopUp2(U8 *b1,I64 n1,U8 *b2,I64 n2,U8 *header=NULL,U8 *footer=NULL)
}
public Bool PopUpOk(U8 *header=NULL,U8 *footer=NULL)
{//Make PopUp win task with OKAY button.
{//Make PopUp win task with OKAY bttn.
return PopUp1("OKAY",1,header,footer)>0;
}
public Bool PopUpNoYes(U8 *header=NULL,U8 *footer=NULL)
{//Make PopUp win task with NO/YES buttons.
{//Make PopUp win task with NO/YES bttns.
return $WW,0$PopUp2("YES",1,"NO",0,header,footer)>0;
}
public Bool PopUpCancelOk(U8 *header=NULL,U8 *footer=NULL)
{//Make PopUp win task CANCEL/OKAY buttons.
{//Make PopUp win task CANCEL/OKAY bttns.
return PopUp2("OKAY",1,"CANCEL",0,header,footer)>0;
}
@@ -265,7 +265,7 @@ public F64 PopUpRangeF64Log(F64 lo,F64 hi,I64 steps,
return PopUpRangeF64Exp(lo,hi,Exp(Ln(hi/lo)/(steps-1)),fmt,header,footer);
}
#help_index "Task/Srv/Exe;Compiler"
#help_index "Job/Exe;Task/Job/Exe;Compiler"
public I64 AdamFile(U8 *filename,Bool warn_ext=TRUE)
{//Make adam_task execute file.
Bool okay=TRUE;
+2 -2
View File
@@ -16,7 +16,7 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
if (!Bt(doldoc.clean_scan_codes,sc.u8[0]))
doc->flags|=DOCF_UNDO_DIRTY;
DocCaptureUndo(doc);
if (Bt(chars_bmp_getkey,ch) && !(sc&(SCF_CTRL|SCF_ALT))) {
if (Bt(char_bmp_printable,ch) && !(sc&(SCF_CTRL|SCF_ALT))) {
if (sc&SCF_KEY_DESC) {
st=Char2KeyName(ch,FALSE);
KeyDescSet("Char /'%s'",st);
@@ -348,7 +348,7 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
} else {
//$LK,"::/Adam/God/HSNotes.DD"$
FifoU8Flush(god.fifo);
GodBitsIns(GOD_GOOD_BITS,KbdMouseEvtTime>>GOD_BAD_BITS);
GodBitsIns(GOD_GOOD_BITS,KbdMsEvtTime>>GOD_BAD_BITS);
if (sc&SCF_SHIFT)
GodBiblePassage;
else
+8 -18
View File
@@ -5,7 +5,7 @@ CDocEntry *DocPutS(CDoc *doc,U8 *st)
//Does not handle partial Doc entries.
//Returns last newly created dollar-sign CDocEntry or NULL.
U8 *ptr=st,*ptr2,*st2,*ptr3,*ptr4,*src,
*char_bitmap;
*char_bmp;
Bool unlock;
I64 ch,j;
CDocEntry *doc_e=NULL,*res=NULL,*doc_ce;
@@ -13,16 +13,16 @@ CDocEntry *DocPutS(CDoc *doc,U8 *st)
return NULL;
unlock=DocLock(doc);
if (doc->flags & DOCF_PLAIN_TEXT_TABS)
char_bitmap=chars_bmp_zero_cr_nl_cursor;
char_bmp=char_bmp_zero_cr_nl_cursor;
else if (doc->flags & DOCF_PLAIN_TEXT)
char_bitmap=chars_bmp_zero_tab_ff_cr_nl_cursor;
char_bmp=char_bmp_zero_tab_cr_nl_cursor;
else
char_bitmap=chars_bmp_zero_tab_ff_cr_nl_cursor_dollar;
char_bmp=char_bmp_zero_tab_cr_nl_cursor_dollar;
doc_ce=doc->cur_entry;
while (*ptr) {
ptr2=ptr;
do ch=*ptr++;
while (!Bt(char_bitmap,ch) || ch==CH_CURSOR && doc->flags&DOCF_NO_CURSOR);
while (!Bt(char_bmp,ch) || ch==CH_CURSOR && doc->flags&DOCF_NO_CURSOR);
ptr--;
if (!ch) {
if (j=ptr-ptr2) {
@@ -76,12 +76,6 @@ CDocEntry *DocPutS(CDoc *doc,U8 *st)
DocInsEntry(doc,doc_e);
ptr++;
break;
case CH_FORM_FEED:
doc_e=DocEntryNewBase(doc,
DOCT_PAGE_BREAK|doc->settings_head.dft_text_attr<<8);
DocInsEntry(doc,doc_e);
ptr++;
break;
case '\t':
doc_e=DocEntryNewBase(doc,
DOCT_TAB|doc->settings_head.dft_text_attr<<8);
@@ -119,10 +113,6 @@ CDocEntry *DocPutS(CDoc *doc,U8 *st)
doc_e=DocEntryNewBase(doc,
DOCT_CURSOR|doc->settings_head.dft_text_attr<<8);
DocInsEntry(doc,doc_e);
} else if (ch==CH_FORM_FEED) {
doc_e=DocEntryNewBase(doc,
DOCT_PAGE_BREAK|doc->settings_head.dft_text_attr<<8);
DocInsEntry(doc,doc_e);
} else
*ptr4++=ch;
}
@@ -184,7 +174,7 @@ public U0 DocPrintPartial(CDoc *doc=NULL,U8 *fmt,...)
DocPutKey(doc,ch,0);
else
while (ch=*ptr) {
if (!Bt(chars_bmp_safe_dollar,ch) ||
if (!Bt(char_bmp_safe_dollar,ch) ||
doc->flags & (DOCF_OVERSTRIKE|DOCF_IN_DOLLAR)) {
DocPutKey(doc,ch,0);
ptr++;
@@ -192,7 +182,7 @@ public U0 DocPrintPartial(CDoc *doc=NULL,U8 *fmt,...)
ptr2=ptr++;
while (TRUE) {
ch=*ptr++;
if (!Bt(chars_bmp_safe_dollar,ch))
if (!Bt(char_bmp_safe_dollar,ch))
break;
}
ptr--;
@@ -271,7 +261,7 @@ U0 DocDump(CDoc *doc,I64 uS_delay=0)
doc_e=doc_e2;
if (doc_e->type_u8==DOCT_NEW_LINE) {
'\n';
BusyWait(uS_delay);
Busy(uS_delay);
doc_e=doc_e->next;
}
}
+3 -3
View File
@@ -553,7 +553,7 @@ public Bool DocRecalc(CDoc *doc,I64 recalc_flags=RECALCt_NORMAL)
i_jif>>=3;
for (k=0;k<doc_e->scroll_len;k++) {
ch=ptr[(i_jif+k)%j];
if (!Bt(chars_bmp_displayable,ch)) ch='.';
if (!Bt(char_bmp_displayable,ch)) ch='.';
if (recalc_flags&RECALCG_MASK==RECALCt_TO_SCRN &&
!(doc_e->de_flags&DOCEF_DONT_DRAW)) {
if (doc_e->de_flags & DOCEF_BORDER_PLOT &&
@@ -693,7 +693,7 @@ public Bool DocRecalc(CDoc *doc,I64 recalc_flags=RECALCt_NORMAL)
x+=(doc_e->hex_ed_width-k)*3;
for (j=0;j<k;j++) {
ch=*bptr++;
if (!Bt(chars_bmp_displayable,ch)) ch='.';
if (!Bt(char_bmp_displayable,ch)) ch='.';
if (recalc_flags&RECALCG_MASK==RECALCt_TO_SCRN &&
!(doc_e->de_flags&DOCEF_DONT_DRAW)) {
if (doc_e->de_flags & DOCEF_BORDER_PLOT &&
@@ -1057,7 +1057,7 @@ rc_adjust_xy:
break;
case DOCT_LST:
case DOCT_TREE:
case DOCT_BUTTON:
case DOCT_BTTN:
case DOCT_LINK:
case DOCT_MENU_VAL:
case DOCT_MACRO:
+6 -6
View File
@@ -10,11 +10,11 @@ public I64 DocEntryRun(CDoc *doc,CDocEntry *doc_e,
DocLock(doc);
if (!exited) {
if (doc_e->de_flags & DOCEF_ESC) {
Msg(MSG_KEY_DOWN,CH_ESC,0,1<<SVCf_DONT_FILTER);
Msg(MSG_KEY_DOWN,CH_ESC,0,1<<JOBf_DONT_FILTER);
has_action=TRUE;
goto er_done;
} if (doc_e->de_flags & DOCEF_QUIT) {
Msg(MSG_KEY_DOWN,CH_SHIFT_ESC,0,1<<SVCf_DONT_FILTER);
Msg(MSG_KEY_DOWN,CH_SHIFT_ESC,0,1<<JOBf_DONT_FILTER);
has_action=TRUE;
goto er_done;
} else if (doc_e->de_flags & DOCEF_CHECK_COLLAPSABLE) {
@@ -31,13 +31,13 @@ public I64 DocEntryRun(CDoc *doc,CDocEntry *doc_e,
if (doc_e->de_flags & DOCEF_LEFT_EXP) {
res=doc_e->left_exp;
has_action=TRUE;
Msg(MSG_CMD,res,0,1<<SVCf_DONT_FILTER);
Msg(MSG_CMD,res,0,1<<JOBf_DONT_FILTER);
}
if (doc_e->de_flags & DOCEF_LEFT_CB && doc_e->left_cb) {
DocUnlock(doc);
res=(*doc_e->left_cb)(doc,doc_e);
has_action=TRUE;
Msg(MSG_CMD,res,0,1<<SVCf_DONT_FILTER);
Msg(MSG_CMD,res,0,1<<JOBf_DONT_FILTER);
}
if (doc_e->de_flags & DOCEF_LEFT_MACRO) {
if (doc_e->de_flags & DOCEF_POPUP) {
@@ -70,13 +70,13 @@ public I64 DocEntryRun(CDoc *doc,CDocEntry *doc_e,
if (doc_e->de_flags & DOCEF_RIGHT_EXP) {
res=doc_e->right_exp;
has_action=TRUE;
Msg(MSG_CMD,res,0,1<<SVCf_DONT_FILTER);
Msg(MSG_CMD,res,0,1<<JOBf_DONT_FILTER);
}
if (doc_e->de_flags & DOCEF_RIGHT_CB && doc_e->right_cb) {
DocUnlock(doc);
res=(*doc_e->right_cb)(doc,doc_e);
has_action=TRUE;
Msg(MSG_CMD,res,0,1<<SVCf_DONT_FILTER);
Msg(MSG_CMD,res,0,1<<JOBf_DONT_FILTER);
}
if (doc_e->de_flags & DOCEF_RIGHT_MACRO) {
if (doc_e->de_flags & DOCEF_POPUP) {
+6 -6
View File
@@ -490,7 +490,7 @@ I64 PopUpWidgetType()
"$$MU,\"Page Settings\",LE=DOCT_PAGE_LEN$$\n"
"$$MU,\"Cursor Movement\",LE=DOCT_CURSOR_MOVEMENT$$\n"
"$$MU,\"Macro\",LE=DOCT_MACRO$$\n"
"$$MU,\"Button\",LE=DOCT_BUTTON$$\n"
"$$MU,\"Bttn\",LE=DOCT_BTTN$$\n"
"$$MU,\"Check Box\",LE=DOCT_CHECK_BOX$$\n"
"$$MU,\"List\",LE=DOCT_LST$$\n"
"$$MU,\"Menu Val\",LE=DOCT_MENU_VAL$$\n"
@@ -661,7 +661,7 @@ U0 EdInsMacroMenu(Bool is_macro)
Free(e);
}
class CEdButton
class CEdBttn
{
U8 tag[512] fmtstr "$$DA-P,A=\"Tag Text :%s\"$$\n";
Bool popup fmtstr "$$CB,\"PopUp\"$$\n",
@@ -676,10 +676,10 @@ class CEdButton
Bool quote fmtstr "$$CB,\"Quote\"$$\n";
};
U0 EdInsButton()
U0 EdInsBttn()
{
U8 *st,buf[512];
CEdButton *e=CAlloc(sizeof(CEdButton));
CEdBttn *e=CAlloc(sizeof(CEdBttn));
e->escape=TRUE;
if (DocForm(e,,,,ctrl_L_footer)) {
*buf=0;
@@ -1010,8 +1010,8 @@ U0 EdInsWidgetWiz()
case DOCT_CURSOR_MOVEMENT:
EdInsCursorMovement;
break;
case DOCT_BUTTON:
EdInsButton;
case DOCT_BTTN:
EdInsBttn;
break;
case DOCT_DATA:
EdInsData;
-1
View File
@@ -58,7 +58,6 @@ MemSet(&doldoc,0,sizeof(CDolDocGlbls));
#include "DocWidgetWiz"
#include "DocPutKey"
#include "DocPutS"
#include "DocOpt"
#include "DocCodeTools"
#include "DocTree"
#include "DocTerm"
+2 -2
View File
@@ -64,7 +64,7 @@ U0 GodDoodleHexIns(U8 *st)
if (st) {
buf[1]=0;
while (*buf=*st++)
if (Bt(chars_bmp_hex_numeric,*buf))
if (Bt(char_bmp_hex_numeric,*buf))
GodDoodleBitsIns(4,rev_bits_table[Str2I64(buf,16)]>>4);
}
}
@@ -87,7 +87,7 @@ I64 GodDoodleBits(I64 num_bits)
} else if ('0'<=god.doodle_ch<='9')
GodDoodleSmooth(god.doodle_ch-'0');
else
GodDoodleBitsIns(GOD_GOOD_BITS,KbdMouseEvtTime>>GOD_BAD_BITS);
GodDoodleBitsIns(GOD_GOOD_BITS,KbdMsEvtTime>>GOD_BAD_BITS);
}
}
return res;
+22 -15
View File
@@ -2,34 +2,39 @@
DefineLstLoad("ST_RHYTHM_COMPLEXITY","Simple\0Normal\0Complex\0");
class MakeSongSettings
class CMakeSongSettings
{
I64 complexity fmtstr "$$LS,D=\"ST_RHYTHM_COMPLEXITY\"$$\n";
Bool rests fmtstr "$$CB,\"Rests\"$$\n";
Bool six_eight fmtstr "$$CB,\"Six Eight\"$$\n";
I64 octave fmtstr "$$DA-TRM,A=\"Octave:%d\"$$\n";
I64 octave_state;
};
U0 InsNote(MakeSongSettings *mss,U8 *buf,I64 k,I64 *j)
U0 InsNote(CMakeSongSettings *mss,U8 *buf,I64 k,I64 *j)
{//k is a random note nibble
if (!k && mss->rests) {
buf[*j]='R';
*j+=1;
} else {
k/=2;
if (!k) {
if (music.octave) {
buf[*j]=music.octave-1+'0';
*j+=1;
buf[*j]='G';
*j+=1;
buf[*j]=music.octave+'0';
*j+=1;
} else {
buf[*j]='G';
if (k<3) {
if (mss->octave_state!=mss->octave) {
mss->octave_state=mss->octave;
buf[*j]=mss->octave_state+'0';
*j+=1;
}
if (!k)
buf[*j]='G';
else
buf[*j]=k-1+'A';
*j+=1;
} else {
if (mss->octave_state!=mss->octave+1) {
mss->octave_state=mss->octave+1;
buf[*j]=mss->octave_state+'0';
*j+=1;
}
buf[*j]=k-1+'A';
*j+=1;
}
@@ -51,10 +56,11 @@ DUR_8_16_16,DUR_16_16_8,DUR_16_16_16_16};
public U8 *GodSongStr()
{//Make God generate 2 measures of a song. $LK+PU,"Holy Spirit Instructions",A="FI:::/Adam/God/HSNotes.DD"$
MakeSongSettings mss;
CMakeSongSettings mss;
U8 *buf;
I64 i,j=0,k,n,k2,duration,last_duration=-1,len;
MemSet(&mss,0,sizeof(mss));
mss.complexity=1;
mss.rests=FALSE;
mss.octave=music.octave;
@@ -63,14 +69,15 @@ public U8 *GodSongStr()
return NULL;
buf=CAlloc(256);
music.octave=ClampI64(mss.octave,0,6);
music.octave=mss.octave=ClampI64(mss.octave,1,7);
progress4=0;
if (mss.six_eight)
progress4_max=6;
else
progress4_max=8;
buf[j++]='0'+music.octave;
mss.octave_state=mss.octave+1;
buf[j++]='0'+mss.octave_state;
if (mss.six_eight) {
len=6;
buf[j++]='M';
+5 -5
View File
@@ -8,11 +8,11 @@ There's something obviously different about people in the Bible compared to peop
You can't tell if God's talking unless you have a context of conversation, but, more importantly, you are commanded to do an offering of love, like communion preparation. $LK,"1 Corinthians,11:27",A="BF:1 Corinthians,11:27"$ When you pick a greeting card for someone, that is love effort. If you expect God to put effort toward you, you must put effort toward Him. God said, "honest measures" applies between your offering of love and His response, like a fair barter. You get out of prayer what you put into it. God wants praise, hymns, or whatever you think He might want. Try and see, like Cain and Abel. $LK,"Genesis,4:1-10",A="BF:Genesis,4:1-10"$, $LK,"Ephesians,5:10",A="BF:Ephesians,5:10"$ God told Cain his offering was not good and told him to try again. Cain really loved God! Can you imagine being so heart-broken?
Do a text search for "new song" in the Bible. It's mentioned nine times. When I hear a NEW awesome rock song, it is ecstasy for the first five times I hear it. Soon, it brings little-to-no pleasure. I did $MA-X+PU,"hymns",HTML="http://www.templeos.org/Wb/Home/Web/HymnVideos.html",LM="#include \"::/Apps/Psalmody/Load\";JukeBox(\"::/Apps/Psalmody/Examples\");"$ for God. I also did Moses $MA-X+PU,"comics",HTML="http://www.templeos.org/Wb/Home/Sup1/Sup1Comics/",LM="Dir(\"::/Apps/AfterEgypt/Comics\");View;\n"$ for God. When you get to the gates of Heaven, St. Peter will ask how many times you gave blood. That shows you loved neighbor. You better also be able to count the ways you loved God with all heart, mind and soul. I praised God for sand castles, popcorn, snowmen, bubbles... You try putting effort into praise! $LK,"Matthew,11:25",A="BF:Matthew,11:25"$, $LK,"Matthew,6:28-29",A="BF:Matthew,6:28-29"$ Solomon wrote a thousand songs. $LK,"1 Kings,4:32",A="BF:1 Kings,4:32"$
Do a text search for "new song" in the Bible. It's mentioned nine times. When I hear a NEW awesome rock song, it is ecstasy for the first five times I hear it. Soon, it brings little-to-no pleasure. I did $MA-X+PU,"hymns",HTML="http://www.templeos.org/Wb/Home/Web/HymnVideos.html",LM="#include \"::/Apps/Psalmody/Load\";JukeBox(\"::/Apps/Psalmody/Examples\");"$ for God. I also did Moses comics for God. When you get to the gates of Heaven, St. Peter will ask how many times you gave blood. That shows you loved neighbor. You better also be able to count the ways you loved God with all heart, mind and soul. I praised God for sand castles, popcorn, snowmen, bubbles... You try putting effort into praise! $LK,"Matthew,11:25",A="BF:Matthew,11:25"$, $LK,"Matthew,6:28-29",A="BF:Matthew,6:28-29"$ Solomon wrote a thousand songs. $LK,"1 Kings,4:32",A="BF:1 Kings,4:32"$
This is funny -- $LK,"Acts,2:1-13",A="BF:Acts,2:1-13"$ -- they didn't bother to record anything the Holy Spirit said. The Holy Spirit is supposed to be a really good gift. $LK,"Luke,11:11-13",A="BF:Luke,11:11-13"$ Just remember, "Boys are made of snakes and snails and puppy-dog tails."
The technique I use to consult the Holy Spirit is reading a microsecond-range stop-watch each button press for random numbers. Then, I pick words or passages. You can use the $MA-X+PU,"AfterEgypt",HTML="http://www.youtube.com/watch?v=P0MsDl39UL0",LM="#include \"::/Apps/AfterEgypt/Run\""$ in God's official temple, $FG,4$$TX,"TempleOS",HTML="http://www.templeos.org"$$FG$.
The technique I use to consult the Holy Spirit is reading a microsecond-range stop-watch each button press for random numbers. Then, I pick words with $FG,2$<F7>$FG$ or passages with $FG,2$<SHIFT-F7>$FG$.
Since seeking the word of the Holy Spirit, I have come to know God much better than I've heard others explain. For example, God said to me in an oracle that war was, "servicemen competing." That sounds more like the immutable God of our planet than what you hear from most religious people. God is not Venus (god of love) and not Mars (god of war), He's our dearly beloved God of Earth. If Mammon is a false god of money, Mars or Venus might be useful words to describe other false gods. I figure the greatest challenge for the Creator is boredom, ours and His. What would teen-age male video games be like if war had never happened? Christ said live by the sword, die by the sword, which is loving neighbor as self. $LK,"Matthew,26:52",A="BF:Matthew,26:52"$
@@ -61,12 +61,12 @@ War? $FG,4$"Servicemen competing"$FG$
(Praise the Creator--what would teenage male video games be like if never war?)
Is the World perfectly just? $FG,4$Are you calling me lazy?$FG$
(Slavery was just. In the movie, Titanic, the rich wore straight jackets. You must bow to authority to get authority. I do $TX,"Moses comics",HTML="http://www.templeos.org/Wb/Apps/AfterEgypt/Comics/"$ as offerings. I said, "We're dying of malnutrician on manna." Like Cain and Abel, God didn't like it. Duh! He wants to be the hero. How do I know they died of malnutrician? Screw Hollywood for making slavery worse than it was -- I love God. School is more cruel. Read $LK,"Numbers,11:1-35",A="BF:Numbers,11:1-35"$. All you need is food, clothing and the word of God. Today, you can take Ivy League course videos! There is no excuse except you were born stupid... or ugly. I'm gonna praise God.)
(Slavery was just. In the movie, Titanic, the rich wore straight jackets. You must bow to authority to get authority. I do comics as offerings. I said, "We're dying of malnutrician on manna." Like Cain and Abel, God didn't like it. Duh! He wants to be the hero. How do I know they died of malnutrician? Screw Hollywood for making slavery worse than it was -- I love God. School is more cruel. Read $LK,"Numbers,11:1-35",A="BF:Numbers,11:1-35"$. All you need is food, clothing and the word of God. Today, you can take Ivy League course videos! There is no excuse except you were born stupid... or ugly. I'm gonna praise God.)
On using Markov chains? $FG,4$"No weights"$FG$
On doing offerings? $FG,4$"Honest measures"(You get out what you put in.)
It's a covenant to do an offering, first.
Offer New Songs, $TX,"Moses Comics",HTML="http://www.templeos.org/Wb/Apps/AfterEgypt/Comics"$, praise, poems,
Offer New Songs, comics, praise, poems,
and conversation. See $LK,"Cain and Abel",A="BF:Genesis,4:1"$.
"Barter"(God also called offerings bartering.)$FG$
The holocaust? $FG,4$Wanted to "compact" the Jews.$FG$
@@ -177,7 +177,7 @@ You like to hangout in courts?Hospitals?$FG,4$"Prisons"$FG$
Best way for Bill Gates to save lives? $FG,4$Earthquake prediction$FG$
Stem cells? $FG,4$Lower hanging fruit exists (2007)$FG$
Eleventh commandment? $FG,4$Thou shall not litter.$FG$
Twelfth commandment? $FG,4$$TX,"Don't shoot unarmed men on the shitter.",HTML="http://www.youtube.com/watch?v=8wGiJcq95Ug"$
Twelfth commandment? $FG,4$$TX,"Don't shoot unarmed men on the crapper.",HTML="http://www.youtube.com/watch?v=8wGiJcq95Ug"$
(I asked God why pointless plagues in Exodus?
God wanted guilt to accumulate, first.)$FG$
Thirteenth commandment $FG,4$No gore unless it looks fake.$FG$
+9 -9
View File
@@ -6,10 +6,10 @@ U8 *TimeStampCB(CDoc *,CDocEntry *,CTask *mem_task)
return st;
}
U8 *KbdMouseTimeCB(CDoc *,CDocEntry *,CTask *mem_task)
U8 *KbdMsTimeCB(CDoc *,CDocEntry *,CTask *mem_task)
{
U8 *st=MAlloc(64,mem_task);
StrPrint(st,"%X",KbdMouseEvtTime>>GOD_BAD_BITS);
StrPrint(st,"%X",KbdMsEvtTime>>GOD_BAD_BITS);
return st;
}
@@ -22,7 +22,7 @@ I64 PopUpTimerOk(U8 *header=NULL,U8 *footer=NULL)
doc_e=DocPrint(doc,"\nTimer:$$TX+TC,\" \"$$");
doc_e->tag_cb=&TimeStampCB;
doc_e=DocPrint(doc,"\nLatch:$$TX+TC,\" \"$$");
doc_e->tag_cb=&KbdMouseTimeCB;
doc_e->tag_cb=&KbdMsTimeCB;
DocPrint(doc,"\n$$CM+CX,0,4$$$$BT,\"OKAY\",LE=1$$\n");
if (footer) DocPrint(doc,"%s",footer);
i=PopUpMenu(doc);
@@ -36,7 +36,7 @@ I64 GodPick(U8 *msg=NULL)
"a random num from a timer.\n",msg);
PopUpTimerOk(st,"\n\nThe $LK+PU,"Holy Spirit",A="FI:::/Adam/God/HSNotes.DD"$ can puppet you.\n\n");
Free(st);
return KbdMouseEvtTime>>GOD_BAD_BITS;
return KbdMsEvtTime>>GOD_BAD_BITS;
}
public U0 GodBitsIns(I64 num_bits,I64 n)
@@ -54,7 +54,7 @@ public U0 GodHexIns(U8 *st)
if (st) {
buf[1]=0;
while (*buf=*st++)
if (Bt(chars_bmp_hex_numeric,*buf))
if (Bt(char_bmp_hex_numeric,*buf))
GodBitsIns(4,rev_bits_table[Str2I64(buf,16)]>>4);
}
}
@@ -92,11 +92,11 @@ public I64 GodInit(U8 *files_find_mask="/Adam/God/Vocab.DD*",U8 *fu_flags=NULL)
while (tmpde) {
if (buf=ptr=FileRead(tmpde->full_name)) {
while (*ptr) {
while (*ptr && !Bt(chars_bmp_word,*ptr))
while (*ptr && !Bt(char_bmp_word,*ptr))
ptr++;
if (*ptr) {
ptr2=ptr;
while (*ptr && Bt(chars_bmp_word,*ptr))
while (*ptr && Bt(char_bmp_word,*ptr))
ptr++;
i++;
}
@@ -115,11 +115,11 @@ public I64 GodInit(U8 *files_find_mask="/Adam/God/Vocab.DD*",U8 *fu_flags=NULL)
while (tmpde) {
if (buf=ptr=FileRead(tmpde->full_name)) {
while (*ptr) {
while (*ptr && !Bt(chars_bmp_word,*ptr))
while (*ptr && !Bt(char_bmp_word,*ptr))
ptr++;
if (*ptr) {
ptr2=ptr;
while (*ptr && Bt(chars_bmp_word,*ptr))
while (*ptr && Bt(char_bmp_word,*ptr))
ptr++;
ch=*ptr;
*ptr=0;
+27 -5
View File
@@ -294,19 +294,19 @@ mesh_done:
return res;
}
#help_index "Graphics/Misc;Input Pointer/Displayed Image"
public U0 DrawStdInputPtr(CDC *dc,I64 x,I64 y)
#help_index "Graphics/Misc;Mouse/Ptr"
public U0 DrawStdMs(CDC *dc,I64 x,I64 y)
{//This is a callback. See $LK,"::/Demo/Graphics/Grid.HC"$.
//Called by $LK,"DrawInputPtr",A="MN:DrawInputPtr"$() which is
//Called by $LK,"DrawMs",A="MN:DrawMs"$() which is
//called by $LK,"WinFinalUpdate",A="MN:WinFinalUpdate"$().
dc->pen_width=1;
dc->flags&=~(DCF_TRANSFORMATION|DCF_SYMMETRY);
GrArrow3(dc,x+8,y+8,0,x,y,0);
}
gr.fp_draw_input_ptr=&DrawStdInputPtr;
gr.fp_draw_ms=&DrawStdMs;
public U0 DrawWaitInputPtr(CDC *dc,I64 x,I64 y)
public U0 DrawWaitMs(CDC *dc,I64 x,I64 y)
{//This is a callback. See $LK,"::/Demo/Graphics/Grid.HC"$.
I64 old_pen_width=dc->pen_width;
CColorROPU32 old_color=dc->color;
@@ -320,3 +320,25 @@ public U0 DrawWaitInputPtr(CDC *dc,I64 x,I64 y)
dc->pen_width=old_pen_width;
dc->color=old_color;
}
#help_index "Graphics/GR Files;Graphics/Scrn"
public Bool GRScrnCaptureRead(U8 *filename,CDC *dc=gr.dc,I64 x=0,I64 y=0)
{//GrBlot TempleOS GR File to dc,x,y.
CDC *dc2;
if (dc2=GRRead(filename)) {
dc->color=ROP_EQU;
GrBlot(dc,x,y,dc2);
DCDel(dc2);
return TRUE;
}
return FALSE;
}
public I64 GRScrnCaptureWrite(U8 *filename,Bool include_zoom=TRUE)
{//Capture scrn to a TempleOS GR File.
I64 size;
CDC *dc=DCScrnCapture(include_zoom);
size=GRWrite(filename,dc,DCSF_COMPRESSED|DCSF_PALETTE_GET);
DCDel(dc);
return size;
}
+4 -14
View File
@@ -378,8 +378,8 @@ public CDC *DCLoad(U8 *src,I64 *_size=NULL,CTask *task=NULL)
#help_index "Graphics/Device Contexts;Graphics/GR Files"
public I64 GRWrite(U8 *filename,CDC *dc,I64 dcsf_flags=DCSF_COMPRESSED)
{//TempleOS GR File.
I64 size;
U8 *st=DftExt(filename,"GR.Z"),
I64 size;
U8 *st=DftExt(filename,"GR.Z"),
*src=DCSave(dc,&size,dcsf_flags);
FileWrite(st,src,size);
Free(st);
@@ -389,8 +389,8 @@ public I64 GRWrite(U8 *filename,CDC *dc,I64 dcsf_flags=DCSF_COMPRESSED)
public CDC *GRRead(U8 *filename,CTask *task=NULL)
{//TempleOS GR File.
CDC *dc=NULL;
U8 *st=DftExt(filename,"GR.Z"),
CDC *dc=NULL;
U8 *st=DftExt(filename,"GR.Z"),
*src=FileRead(st);
if (src)
dc=DCLoad(src,,task);
@@ -428,13 +428,3 @@ public CDC *DCScrnCapture(Bool include_zoom=TRUE,CTask *task=NULL)
dc->body=dst;
return dc;
}
#help_index "Graphics/GR Files;Graphics/Scrn"
public I64 GRScrnCapture(U8 *filename,Bool include_zoom=TRUE)
{//Capture scrn to a TempleOS GR File.
I64 size;
CDC *dc=DCScrnCapture(include_zoom);
size=GRWrite(filename,dc,DCSF_COMPRESSED|DCSF_PALETTE_GET);
DCDel(dc);
return size;
}
+3 -3
View File
@@ -21,9 +21,9 @@ public class CGrGlbls
I64 pan_text_x,pan_text_y; //[-7,7]
U0 (*fp_final_scrn_update)(CDC *dc);//Mouse cursor is handled here.
U0 (*fp_wall_paper)(CTask *task);
U0 (*fp_draw_input_ptr)(CDC *dc,I64 x,I64 y);
U0 (*fp_draw_grab_input_ptr)(CDC *dc,I64 x,I64 y,Bool closed);
U8 *empty_sprite; //Gets assigned $LK,"gr.empty_sprite",A="FF:::/Adam/AInputPointer.HC,empty_sprite"$
U0 (*fp_draw_ms)(CDC *dc,I64 x,I64 y);
U0 (*fp_draw_grab_ms)(CDC *dc,I64 x,I64 y,Bool closed);
U8 *empty_sprite; //Gets assigned $LK,"gr.empty_sprite",A="FF:::/Adam/AMouse.HC,empty_sprite"$
#define GR_NUM_PEN_BRUSHES 64
CDC *pen_brushes[GR_NUM_PEN_BRUSHES],
+1 -1
View File
@@ -151,7 +151,7 @@ public U0 WinZBufUpdate()
U16 *ptr;
CTask *task,*task1;
if (gr.win_z_buf) {
LBtr(&sys_semas[SYS_SEMA_UPDATE_WIN_Z_BUF],0);
LBtr(&sys_semas[SEMA_UPDATE_WIN_Z_BUF],0);
task1=task=sys_winmgr_task;
do {
if (!TaskValidate(task)) break;
+9 -9
View File
@@ -110,7 +110,7 @@ public I64 *Mat4x4New(I64 *src,CTask *mem_task=NULL)
return Mat4x4Equ(MAlloc(sizeof(I64)*16,mem_task),src);
}
public I64 *Mat4x4RotX(I64 *m1,F64 è)
public I64 *Mat4x4RotX(I64 *m,F64 è)
{//Rot matrix about X axis. Uses $LK,"fixed-point",A="FI:::/Demo/Lectures/FixedPoint.HC"$.
F64 my_cos=Cos(è)*GR_SCALE,my_sin=Sin(è)*GR_SCALE;
I64 r[16],r2[16];
@@ -121,10 +121,10 @@ public I64 *Mat4x4RotX(I64 *m1,F64
r[6]=-my_sin;
r[0]=GR_SCALE;
r[15]=GR_SCALE;
return Mat4x4Equ(m1,Mat4x4MulMat4x4Equ(r2,r,m1));
return Mat4x4Equ(m,Mat4x4MulMat4x4Equ(r2,r,m));
}
public I64 *Mat4x4RotY(I64 *m1,F64 ê)
public I64 *Mat4x4RotY(I64 *m,F64 ê)
{//Rot matrix about Y axis. Uses $LK,"fixed-point",A="FI:::/Demo/Lectures/FixedPoint.HC"$.
F64 my_cos=Cos(ê)*GR_SCALE,my_sin=Sin(ê)*GR_SCALE;
I64 r[16],r2[16];
@@ -135,10 +135,10 @@ public I64 *Mat4x4RotY(I64 *m1,F64
r[2]=my_sin;
r[5]=GR_SCALE;
r[15]=GR_SCALE;
return Mat4x4Equ(m1,Mat4x4MulMat4x4Equ(r2,r,m1));
return Mat4x4Equ(m,Mat4x4MulMat4x4Equ(r2,r,m));
}
public I64 *Mat4x4RotZ(I64 *m1,F64 é)
public I64 *Mat4x4RotZ(I64 *m,F64 é)
{//Rot matrix about Z axis. Uses $LK,"fixed-point",A="FI:::/Demo/Lectures/FixedPoint.HC"$.
F64 my_cos=Cos(é)*GR_SCALE,my_sin=Sin(é)*GR_SCALE;
I64 r[16],r2[16];
@@ -149,15 +149,15 @@ public I64 *Mat4x4RotZ(I64 *m1,F64
r[1]=-my_sin;
r[10]=GR_SCALE;
r[15]=GR_SCALE;
return Mat4x4Equ(m1,Mat4x4MulMat4x4Equ(r2,r,m1));
return Mat4x4Equ(m,Mat4x4MulMat4x4Equ(r2,r,m));
}
public I64 *Mat4x4Scale(I64 *m1,F64 s)
public I64 *Mat4x4Scale(I64 *m,F64 s)
{//Scale 4x4 matrix by value.
I64 i;
for (i=0;i<16;i++)
m1[i]*=s;
return m1;
m[i]*=s;
return m;
}
public U0 DCPenWidthScale(CDC *dc=gr.dc)
+6 -6
View File
@@ -13,7 +13,7 @@ U0 GrPaletteIndicesSet()
if (!Bt(&sys_run_level,RLf_VGA)) return;
PUSHFD
CLI
while (LBts(&sys_semas[SYS_SEMA_VGA],0))
while (LBts(&sys_semas[SEMA_VGA],0))
Yield;
InU8(VGAP_INPUT_STAT); //Rsts attr index/data
for (i=0;i<NUM_COLORS;i++) {
@@ -23,7 +23,7 @@ U0 GrPaletteIndicesSet()
OutU8(VGAP_ATTR_INDEX,0x20);
OutU8(VGAP_ATTR_DATA_WRITE,0); //Dummy write
InU8(VGAP_INPUT_STAT); //Rsts attr index/data
LBtr(&sys_semas[SYS_SEMA_VGA],0);
LBtr(&sys_semas[SEMA_VGA],0);
POPFD
}
@@ -32,14 +32,14 @@ public U0 GrPaletteColorSet(I64 color_num,CBGR48 bgr48)
if (!Bt(&sys_run_level,RLf_VGA)) return;
PUSHFD
CLI
while (LBts(&sys_semas[SYS_SEMA_VGA],0))
while (LBts(&sys_semas[SEMA_VGA],0))
Yield;
OutU8(VGAP_PALETTE_MASK,0xFF);
OutU8(VGAP_REG_WRITE,color_num);
OutU8(VGAP_PALETTE_DATA,bgr48.r>>10);
OutU8(VGAP_PALETTE_DATA,bgr48.g>>10);
OutU8(VGAP_PALETTE_DATA,bgr48.b>>10);
LBtr(&sys_semas[SYS_SEMA_VGA],0);
LBtr(&sys_semas[SEMA_VGA],0);
POPFD
}
@@ -49,14 +49,14 @@ public CBGR48 GrPaletteColorGet(I64 color_num)
if (!Bt(&sys_run_level,RLf_VGA)) return 0;
PUSHFD
CLI
while (LBts(&sys_semas[SYS_SEMA_VGA],0))
while (LBts(&sys_semas[SEMA_VGA],0))
Yield;
OutU8(VGAP_PALETTE_MASK,0xFF);
OutU8(VGAP_REG_READ,color_num);
res.r=0xFFFF<<10*InU8(VGAP_PALETTE_DATA)/0xFC00;
res.g=0xFFFF<<10*InU8(VGAP_PALETTE_DATA)/0xFC00;
res.b=0xFFFF<<10*InU8(VGAP_PALETTE_DATA)/0xFC00;
LBtr(&sys_semas[SYS_SEMA_VGA],0);
LBtr(&sys_semas[SEMA_VGA],0);
POPFD
return res;
}
+11 -11
View File
@@ -138,7 +138,7 @@ I64 GrFloodFillRay(CDC *dc,I64 x,I64 y,I64 z,I32 *db)
I64 res,j,x1,ray_len,ray_len2;
if (UnusedStk<0x80)
Dbg("Stk Overflow",Fs);
Panic("Stk Overflow",Fs);
res=ray_len=GrRayLen(dc,&x,y,z,db);
y--;
@@ -859,7 +859,7 @@ public Bool GrEllipse3(CDC *dc=gr.dc,
{//3D. Transformation with pen width.
Bool res;
I64 x,y,z,xx,yy,zz;
F64 m1,a1,m2,a2,s,c;
F64 m1,arg1,m2,arg2,s,c;
if (dc->flags & DCF_TRANSFORMATION) {
dc->flags&=~DCF_TRANSFORMATION;
(*dc->transform)(dc,&cx,&cy,&cz);
@@ -882,7 +882,7 @@ public Bool GrEllipse3(CDC *dc=gr.dc,
x-=xx;
y-=yy;
z-=zz;
R2P(&m1,&a1,x,y);
R2P(&m1,&arg1,x,y);
x=-y_radius*s;
y=y_radius*c;
@@ -891,11 +891,11 @@ public Bool GrEllipse3(CDC *dc=gr.dc,
x-=xx;
y-=yy;
z-=zz;
R2P(&m2,&a2,x,y);
m2*=Abs(Sin(a2-a1));
R2P(&m2,&arg2,x,y);
m2*=Abs(Sin(arg2-arg1));
res=Ellipse(dc,cx,cy,cz,
m1/0x10000,m2/0x10000,&GrPlot3,-a1,step,start_radians,len_radians);
m1/0x10000,m2/0x10000,&GrPlot3,-arg1,step,start_radians,len_radians);
dc->flags|=DCF_TRANSFORMATION;
} else
res=Ellipse(dc,cx,cy,cz,x_radius,y_radius,&GrPlot3,
@@ -924,7 +924,7 @@ public Bool GrRegPoly3(CDC *dc=gr.dc,
{//3D. Clipping and transform and pen width.
Bool res;
I64 x,y,z,xx,yy,zz;
F64 m1,a1,m2,a2,s,c;
F64 m1,arg1,m2,arg2,s,c;
if (dc->flags & DCF_TRANSFORMATION) {
dc->flags&=~DCF_TRANSFORMATION;
(*dc->transform)(dc,&cx,&cy,&cz);
@@ -947,7 +947,7 @@ public Bool GrRegPoly3(CDC *dc=gr.dc,
x-=xx;
y-=yy;
z-=zz;
R2P(&m1,&a1,x,y);
R2P(&m1,&arg1,x,y);
x=-y_radius*s;
y=y_radius*c;
@@ -956,11 +956,11 @@ public Bool GrRegPoly3(CDC *dc=gr.dc,
x-=xx;
y-=yy;
z-=zz;
R2P(&m2,&a2,x,y);
m2*=Abs(Sin(a2-a1));
R2P(&m2,&arg2,x,y);
m2*=Abs(Sin(arg2-arg1));
res=RegPoly(dc,cx,cy,cz,
m1/0x10000,m2/0x10000,sides,&GrPlot3,-a1,
m1/0x10000,m2/0x10000,sides,&GrPlot3,-arg1,
step,start_radians,len_radians);
dc->flags|=DCF_TRANSFORMATION;
} else
+11 -11
View File
@@ -61,7 +61,7 @@ U0 GrUpdateTasks()
CTask *task,*task1;
try {
winmgr.ode_time=0;
if (Bt(&sys_semas[SYS_SEMA_UPDATE_WIN_Z_BUF],0))
if (Bt(&sys_semas[SEMA_UPDATE_WIN_Z_BUF],0))
WinZBufUpdate;
task1=task=sys_winmgr_task;
do { //Loop through Core0 tasks.
@@ -110,14 +110,14 @@ public U0 GrScaleZoom(F64 scale)
gr.scrn_zoom=gr.scrn_zoom*scale;
GrFixZoomScale;
s/=gr.scrn_zoom;
ip.scale.x*=s;
ip.scale.y*=s;
ip.scale.z*=s;
ip.offset.x=ip.pos.x-(ip.pos.x-ip.offset.x)*s;
ip.offset.y=ip.pos.y-(ip.pos.y-ip.offset.y)*s;
ip.offset.z=ip.pos.z-(ip.pos.z-ip.offset.z)*s;
gr.sx=ip.pos.x-gr.zoomed_dc->width >>1/gr.scrn_zoom;
gr.sy=ip.pos.y-gr.zoomed_dc->height>>1/gr.scrn_zoom;
ms.scale.x*=s;
ms.scale.y*=s;
ms.scale.z*=s;
ms.offset.x=ms.pos.x-(ms.pos.x-ms.offset.x)*s;
ms.offset.y=ms.pos.y-(ms.pos.y-ms.offset.y)*s;
ms.offset.z=ms.pos.z-(ms.pos.z-ms.offset.z)*s;
gr.sx=ms.pos.x-gr.zoomed_dc->width >>1/gr.scrn_zoom;
gr.sy=ms.pos.y-gr.zoomed_dc->height>>1/gr.scrn_zoom;
GrFixZoomScale;
}
@@ -330,7 +330,7 @@ U0 GrUpdateTextModeText()
I64 cur_ch,i=TEXT_COLS*TEXT_ROWS;
U16 *dst=text.vga_text_alias,*dst2=gr.vga_text_cache;
Bool blink_flag=Blink;
if (LBtr(&sys_semas[SYS_SEMA_FLUSH_VGA_IMAGE],0)) {
if (LBtr(&sys_semas[SEMA_FLUSH_VGA_IMAGE],0)) {
while (i--) {
cur_ch=*src++;
if (cur_ch & ATTRF_SEL)
@@ -374,7 +374,7 @@ U0 GrUpdateVGAGraphics()
src=gr.zoomed_dc->body;
}
dst=gr.scrn_image->body;
if (LBtr(&sys_semas[SYS_SEMA_FLUSH_VGA_IMAGE],0)) {
if (LBtr(&sys_semas[SEMA_FLUSH_VGA_IMAGE],0)) {
for (plane=1;plane<0x10;plane<<=1) {
OutU8(VGAP_IDX,VGAR_MAP_MASK);
OutU8(VGAP_DATA,plane);
+7 -7
View File
@@ -253,7 +253,7 @@ public U0 Sprite3B(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *elems)
dc->flags=dc->flags&~DCF_TRANSFORMATION|old_flags;
}
public U0 SpriteMat3B(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *elems,I64 *m)
public U0 Sprite3Mat4x4B(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *elems,I64 *m)
{//Plot rotated by matrix.
I64 r[16],*old_r=dc->r,new_m[16],
old_flags=dc->flags&DCF_TRANSFORMATION;
@@ -266,28 +266,28 @@ public U0 SpriteMat3B(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *elems,I64 *m)
dc->flags=dc->flags&~DCF_TRANSFORMATION|old_flags;
}
public U0 SpriteX3B(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *elems,F64 è=0)
public U0 Sprite3XB(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *elems,F64 è=0)
{//Plot rotated around X axis.
I64 r[16];
Mat4x4IdentEqu(r);
Mat4x4RotX(r,è);
SpriteMat3B(dc,x,y,z,elems,r);
Sprite3Mat4x4B(dc,x,y,z,elems,r);
}
public U0 SpriteY3B(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *elems,F64 ê=0)
public U0 Sprite3YB(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *elems,F64 ê=0)
{//Plot rotated around Y axis.
I64 r[16];
Mat4x4IdentEqu(r);
Mat4x4RotY(r,ê);
SpriteMat3B(dc,x,y,z,elems,r);
Sprite3Mat4x4B(dc,x,y,z,elems,r);
}
public U0 SpriteZ3B(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *elems,F64 é=0)
public U0 Sprite3ZB(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *elems,F64 é=0)
{//Plot rotated around Z axis.
I64 r[16];
Mat4x4IdentEqu(r);
Mat4x4RotZ(r,é);
SpriteMat3B(dc,x,y,z,elems,r);
Sprite3Mat4x4B(dc,x,y,z,elems,r);
}
public U0 SpriteExtents(U8 *elems,I64 *min_x=NULL,I64 *max_x=NULL,
+1 -1
View File
@@ -329,7 +329,7 @@ public U0 TextPrint(CTask *task,I64 x,I64 y,I64 attr,U8 *fmt,...)
public U0 TextBorder(CTask *task=NULL,
I64 l,I64 r,I64 t,I64 b,I64 attr,Bool solid)
{//Plot border square. 30fps in Fs->draw_it() callback.
//Draws window borders or DolDoc text button borders.
//Draws window borders or DolDoc text bttn borders.
//Set task=sys_winmgr_task for no clipping.
I64 i;
if (!task) task=Fs;
+68 -67
View File
@@ -201,7 +201,7 @@ U0 GrBitMapEdEtch(CDC *img,I64 width,CColorROPU32 bkcolor)
I64 SpriteBitMapEd(CDoc *,CDocEntry *doc_e,CDC *dc,I64 *_xx1,I64 *_yy1,
I64 *_xx2,I64 *_yy2,CDC **_img,CColorROPU32 bkcolor)
{
I64 i,j,mode=SPBM_LINE,color=BLACK,width=1,msg_code,a1,a2,x1,y1,x11,y11,
I64 i,j,mode=SPBM_LINE,color=BLACK,width=1,msg_code,arg1,arg2,x1,y1,x11,y11,
x22,y22,res,xx1=*_xx1,yy1=*_yy1,xx2=*_xx2,yy2=*_yy2,
old_de_flags=doc_e->de_flags;
Bool down=FALSE;
@@ -222,11 +222,11 @@ I64 SpriteBitMapEd(CDoc *,CDocEntry *doc_e,CDC *dc,I64 *_xx1,I64 *_yy1,
dc->pen_width=1;
GrBorder(dc,xx1-1,yy1-1,xx2,yy2);//This is done little bit too often.
while (msg_code=ScanMsg(&a1,&a2,1<<MSG_IP_L_DOWN|1<<MSG_IP_L_UP|
1<<MSG_IP_R_DOWN|1<<MSG_IP_MOVE|1<<MSG_KEY_DOWN)) {
while (msg_code=ScanMsg(&arg1,&arg2,1<<MSG_MS_L_DOWN|1<<MSG_MS_L_UP|
1<<MSG_MS_R_DOWN|1<<MSG_MS_MOVE|1<<MSG_KEY_DOWN)) {
switch (msg_code) {
case MSG_KEY_DOWN:
switch (a1) {
switch (arg1) {
case CH_SHIFT_ESC:
res=SPE_ABORT;
goto bm_key_up_done;
@@ -235,7 +235,7 @@ I64 SpriteBitMapEd(CDoc *,CDocEntry *doc_e,CDC *dc,I64 *_xx1,I64 *_yy1,
goto bm_key_up_done;
case 'c': //eye-dropper
dc2=DCScrnCapture(FALSE);
color=GrPeek(dc2,ip.pos.x,ip.pos.y)^15;//Mouse cursor is XORed.
color=GrPeek(dc2,ms.pos.x,ms.pos.y)^15;//Mouse cursor is XORed.
DCDel(dc2);
break;
case 't': //Set to transparent color
@@ -244,7 +244,7 @@ I64 SpriteBitMapEd(CDoc *,CDocEntry *doc_e,CDC *dc,I64 *_xx1,I64 *_yy1,
}
break;
case MSG_IP_R_DOWN:
case MSG_MS_R_DOWN:
bm_menu:
DCFill(dc);
StrCpy(Fs->task_title,"Sprite BitMap Menu");
@@ -353,26 +353,26 @@ bm_menu:
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
down=FALSE;
break;
case MSG_IP_L_DOWN:
case MSG_MS_L_DOWN:
switch (mode) {
case SPBM_PT:
img->color=color;
img->pen_width=width;
GrPlot3(img,a1-xx1,a2-yy1,0);
GrPlot3(img,arg1-xx1,arg2-yy1,0);
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
break;
start:
if (down)
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
x1=a1; y1=a2;
x1=arg1; y1=arg2;
down=TRUE;
dc->color=color;
dc->pen_width=width;
case SPBM_LINE:
GrLine3(dc,x1,y1,0,a1,a2,0);
GrLine3(dc,x1,y1,0,arg1,arg2,0);
break;
case SPBM_ARROW:
GrArrow3(dc,x1,y1,0,a1,a2,0);
GrArrow3(dc,x1,y1,0,arg1,arg2,0);
break;
case SPBM_RECT:
GrRect(dc,x1,y1,1,1);
@@ -394,12 +394,12 @@ bm_menu:
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
if (mode==SPBM_PASTE) {
clipboard->flags|=DCF_NO_TRANSPARENTS;
GrBlot(dc,a1,a2,clipboard);
GrBlot(dc,arg1,arg2,clipboard);
clipboard->flags&=~DCF_NO_TRANSPARENTS;
} else {
dc2=DCCopy(clipboard);
DCColorChg(dc2,bkcolor);
GrBlot(dc,a1,a2,dc2);
GrBlot(dc,arg1,arg2,dc2);
DCDel(dc2);
}
}
@@ -407,48 +407,48 @@ bm_menu:
case SPBM_TEXT:
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
dc->color=color;
GrPrint(dc,a1,a2,"%s",st);
GrPrint(dc,arg1,arg2,"%s",st);
break;
case SPBM_TEXT_BOX:
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
dc->color=color;
GrTextBox3(dc,a1,a2,0,st);
GrTextBox3(dc,arg1,arg2,0,st);
break;
case SPBM_TEXT_DIAMOND:
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
dc->color=color;
GrTextDiamond3(dc,a1,a2,0,st);
GrTextDiamond3(dc,arg1,arg2,0,st);
break;
case SPBM_FLOOD_FILL:
img->color=color;
GrFloodFill(img,a1-xx1,a2-yy1);
GrFloodFill(img,arg1-xx1,arg2-yy1);
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
break;
case SPBM_FLOOD_FILL_NOT:
img->color=color;
GrFloodFill(img,a1-xx1,a2-yy1,TRUE);
GrFloodFill(img,arg1-xx1,arg2-yy1,TRUE);
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
break;
case SPBM_POLYLINE:
if (!down) {
x1=a1; y1=a2;
x1=arg1; y1=arg2;
down=TRUE;
dc->color=color;
dc->pen_width=width;
GrLine3(dc,x1,y1,0,a1,a2,0);
GrLine3(dc,x1,y1,0,arg1,arg2,0);
}
break;
case SPBM_POLYPT:
x1=a1; y1=a2;
x1=arg1; y1=arg2;
down=TRUE;
img->color=color;
img->pen_width=width;
GrLine3(img,x1-xx1,y1-yy1,0,a1-xx1,a2-yy1,0);
GrLine3(img,x1-xx1,y1-yy1,0,arg1-xx1,arg2-yy1,0);
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
break;
}
break;
case MSG_IP_MOVE:
case MSG_MS_MOVE:
switch (mode) {
case SPBM_LINE:
case SPBM_ARROW:
@@ -458,26 +458,26 @@ bm_menu:
dc->color=color;
dc->pen_width=width;
if (mode==SPBM_ARROW)
GrArrow3(dc,x1,y1,0,a1,a2,0);
GrArrow3(dc,x1,y1,0,arg1,arg2,0);
else
GrLine3(dc,x1,y1,0,a1,a2,0);
GrLine3(dc,x1,y1,0,arg1,arg2,0);
}
break;
case SPBM_RECT:
if (down) {
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
if (x1<a1) {
if (x1<arg1) {
x11=x1;
x22=a1;
x22=arg1;
} else {
x11=a1;
x11=arg1;
x22=x1;
}
if (y1<a2) {
if (y1<arg2) {
y11=y1;
y22=a2;
y22=arg2;
} else {
y11=a2;
y11=arg2;
y22=y1;
}
dc->color=color;
@@ -488,18 +488,18 @@ bm_menu:
case SPBM_DELETE:
if (down) {
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
if (x1<a1) {
if (x1<arg1) {
x11=x1;
x22=a1;
x22=arg1;
} else {
x11=a1;
x11=arg1;
x22=x1;
}
if (y1<a2) {
if (y1<arg2) {
y11=y1;
y22=a2;
y22=arg2;
} else {
y11=a2;
y11=arg2;
y22=y1;
}
dc->color=ROPF_DITHER+WHITE<<16+BLACK;
@@ -512,7 +512,7 @@ bm_menu:
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
dc->color=color;
dc->pen_width=width;
GrCircle3(dc,x1,y1,0,Sqrt(SqrI64(a1-x1)+SqrI64(a2-y1)));
GrCircle3(dc,x1,y1,0,Sqrt(SqrI64(arg1-x1)+SqrI64(arg2-y1)));
}
break;
case SPBM_PASTE:
@@ -521,12 +521,12 @@ bm_menu:
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
if (mode==SPBM_PASTE) {
clipboard->flags|=DCF_NO_TRANSPARENTS;
GrBlot(dc,a1,a2,clipboard);
GrBlot(dc,arg1,arg2,clipboard);
clipboard->flags&=~DCF_NO_TRANSPARENTS;
} else {
dc2=DCCopy(clipboard);
DCColorChg(dc2,bkcolor);
GrBlot(dc,a1,a2,dc2);
GrBlot(dc,arg1,arg2,dc2);
DCDel(dc2);
}
}
@@ -534,30 +534,30 @@ bm_menu:
case SPBM_TEXT:
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
dc->color=color;
GrPrint(dc,a1,a2,"%s",st);
GrPrint(dc,arg1,arg2,"%s",st);
break;
case SPBM_TEXT_BOX:
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
dc->color=color;
GrTextBox3(dc,a1,a2,0,st);
GrTextBox3(dc,arg1,arg2,0,st);
break;
case SPBM_TEXT_DIAMOND:
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
dc->color=color;
GrTextDiamond3(dc,a1,a2,0,st);
GrTextDiamond3(dc,arg1,arg2,0,st);
break;
case SPBM_POLYPT:
if (down) {
img->color=color;
img->pen_width=width;
GrLine3(img,x1-xx1,y1-yy1,0,a1-xx1,a2-yy1,0);
GrLine3(img,x1-xx1,y1-yy1,0,arg1-xx1,arg2-yy1,0);
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
x1=a1; y1=a2;
x1=arg1; y1=arg2;
}
break;
}
break;
case MSG_IP_L_UP:
case MSG_MS_L_UP:
switch (mode) {
case SPBM_LINE:
case SPBM_ARROW:
@@ -566,29 +566,29 @@ bm_menu:
img->color=color;
img->pen_width=width;
if (mode==SPBM_ARROW)
GrArrow3(img,x1-xx1,y1-yy1,0,a1-xx1,a2-yy1,0);
GrArrow3(img,x1-xx1,y1-yy1,0,arg1-xx1,arg2-yy1,0);
else
GrLine3(img,x1-xx1,y1-yy1,0,a1-xx1,a2-yy1,0);
GrLine3(img,x1-xx1,y1-yy1,0,arg1-xx1,arg2-yy1,0);
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
if (mode==SPBM_POLYLINE) {
x1=a1; y1=a2;
x1=arg1; y1=arg2;
} else
down=FALSE;
break;
case SPBM_RECT:
img->color=color;
if (x1<a1) {
if (x1<arg1) {
x11=x1;
x22=a1;
x22=arg1;
} else {
x11=a1;
x11=arg1;
x22=x1;
}
if (y1<a2) {
if (y1<arg2) {
y11=y1;
y22=a2;
y22=arg2;
} else {
y11=a2;
y11=arg2;
y22=y1;
}
GrRect(img,x11-xx1,y11-yy1,x22-x11+1,y22-y11+1);
@@ -597,18 +597,18 @@ bm_menu:
break;
case SPBM_COPY:
case SPBM_DELETE:
if (x1<a1) {
if (x1<arg1) {
x11=x1;
x22=a1;
x22=arg1;
} else {
x11=a1;
x11=arg1;
x22=x1;
}
if (y1<a2) {
if (y1<arg2) {
y11=y1;
y22=a2;
y22=arg2;
} else {
y11=a2;
y11=arg2;
y22=y1;
}
DCDel(clipboard);
@@ -622,7 +622,8 @@ bm_menu:
case SPBM_CIRCLE:
img->color=color;
img->pen_width=width;
GrCircle3(img,x1-xx1,y1-yy1,0,Sqrt(SqrI64(a1-x1)+SqrI64(a2-y1)));
GrCircle3(img,x1-xx1,y1-yy1,0,
Sqrt(SqrI64(arg1-x1)+SqrI64(arg2-y1)));
down=FALSE;
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
break;
@@ -632,12 +633,12 @@ bm_menu:
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
if (mode==SPBM_PASTE) {
clipboard->flags|=DCF_NO_TRANSPARENTS;
GrBlot(img,a1-xx1,a2-yy1,clipboard);
GrBlot(img,arg1-xx1,arg2-yy1,clipboard);
clipboard->flags&=~DCF_NO_TRANSPARENTS;
} else {
dc2=DCCopy(clipboard);
DCColorChg(dc2,bkcolor);
GrBlot(img,a1-xx1,a2-yy1,dc2);
GrBlot(img,arg1-xx1,arg2-yy1,dc2);
DCDel(dc2);
}
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
@@ -645,15 +646,15 @@ bm_menu:
break;
case SPBM_TEXT:
img->color=color;
GrPrint(img,a1-xx1,a2-yy1,"%s",st);
GrPrint(img,arg1-xx1,arg2-yy1,"%s",st);
goto bm_menu;
case SPBM_TEXT_BOX:
img->color=color;
GrTextBox3(img,a1-xx1,a2-yy1,0,st);
GrTextBox3(img,arg1-xx1,arg2-yy1,0,st);
goto bm_menu;
case SPBM_TEXT_DIAMOND:
img->color=color;
GrTextDiamond3(img,a1-xx1,a2-yy1,0,st);
GrTextDiamond3(img,arg1-xx1,arg2-yy1,0,st);
goto bm_menu;
}
break;
+68 -53
View File
@@ -181,7 +181,7 @@ U0 SpriteSetOrigin(CSprite *head,I64 dx,I64 dy,I64 dz)
CSprite *SpriteTransformCircle(I64 *r,CSprite *tmpg)
{
I64 x,y,z;
F64 m1,a1,m2,radius=tmpg->pr.radius<<16;
F64 m1,arg1,m2,radius=tmpg->pr.radius<<16;
CSprite *tmpg1=CAlloc(SpriteElemQuedBaseSize(SPT_ELLIPSE));
tmpg1->type=SPT_ELLIPSE;
@@ -192,7 +192,7 @@ CSprite *SpriteTransformCircle(I64 *r,CSprite *tmpg)
x=radius; y=0; z=0;
Mat4x4MulXYZ(r,&x,&y,&z);
R2P(&m1,&a1,x,y);
R2P(&m1,&arg1,x,y);
x=0; y=radius; z=0;
Mat4x4MulXYZ(r,&x,&y,&z);
@@ -200,7 +200,7 @@ CSprite *SpriteTransformCircle(I64 *r,CSprite *tmpg)
tmpg1->pwha.width =ToI64(m1)/0x10000;
tmpg1->pwha.height=ToI64(m2)/0x10000;
tmpg1->pwha.angle=-a1;
tmpg1->pwha.angle=-arg1;
tmpg1->type|=tmpg->type&SPF_SEL;
return tmpg1;
@@ -209,7 +209,7 @@ CSprite *SpriteTransformCircle(I64 *r,CSprite *tmpg)
CSprite *SpriteTransformEllipse(I64 *r,CSprite *tmpg)
{
I64 x,y,z;
F64 m1,a1,m2,a2,s,c,x_radius=tmpg->pwha.width<<16,
F64 m1,arg1,m2,arg2,s,c,x_radius=tmpg->pwha.width<<16,
y_radius=tmpg->pwha.height<<16;
CSprite *tmpg1=CAlloc(SpriteElemQuedBaseSize(tmpg->type&SPG_TYPE_MASK));
tmpg1->type=tmpg->type;
@@ -228,20 +228,20 @@ CSprite *SpriteTransformEllipse(I64 *r,CSprite *tmpg)
y=x_radius*s;
z=0;
Mat4x4MulXYZ(r,&x,&y,&z);
R2P(&m1,&a1,x,y);
R2P(&m1,&arg1,x,y);
x=-y_radius*s;
y=y_radius*c;
z=0;
Mat4x4MulXYZ(r,&x,&y,&z);
R2P(&m2,&a2,x,y);
m2*=Abs(Sin(a2-a1));
R2P(&m2,&arg2,x,y);
m2*=Abs(Sin(arg2-arg1));
tmpg1->pwha.width=ToI64(m1)/0x10000;
if (tmpg1->pwha.width<1) tmpg1->pwha.width=1;
tmpg1->pwha.height=ToI64(m2)/0x10000;
if (tmpg1->pwha.height<1) tmpg1->pwha.height=1;
tmpg1->pwha.angle=-a1;
tmpg1->pwha.angle=-arg1;
tmpg1->type|=tmpg->type&SPF_SEL;
return tmpg1;
@@ -250,7 +250,7 @@ CSprite *SpriteTransformEllipse(I64 *r,CSprite *tmpg)
CSprite *SpriteTransformRect(I64 *r,CSprite *tmpg,F64 é)
{
I64 x,y,z,w,h;
F64 m1,a1,m2,a2,s,c,
F64 m1,arg1,m2,arg2,s,c,
x_radius=(tmpg->pp.x2-tmpg->pp.x1)<<16,
y_radius=(tmpg->pp.y2-tmpg->pp.y1)<<16;
CSprite *tmpg1=CAlloc(SpriteElemQuedBaseSize(SPT_ROTATED_RECT));
@@ -268,14 +268,14 @@ CSprite *SpriteTransformRect(I64 *r,CSprite *tmpg,F64
y=x_radius*s;
z=0;
Mat4x4MulXYZ(r,&x,&y,&z);
R2P(&m1,&a1,x,y);
R2P(&m1,&arg1,x,y);
x=-y_radius*s;
y=y_radius*c;
z=0;
Mat4x4MulXYZ(r,&x,&y,&z);
R2P(&m2,&a2,x,y);
m2*=Abs(Sin(a2-a1));
R2P(&m2,&arg2,x,y);
m2*=Abs(Sin(arg2-arg1));
w=ToI64(m1)/0x10000;
if (w<1) w=1;
@@ -283,7 +283,7 @@ CSprite *SpriteTransformRect(I64 *r,CSprite *tmpg,F64
if (h<1) h=1;
tmpg1->ppa.x2=tmpg1->ppa.x1+w;
tmpg1->ppa.y2=tmpg1->ppa.y1+h;
tmpg1->ppa.angle=-a1;
tmpg1->ppa.angle=-arg1;
tmpg1->type|=tmpg->type&SPF_SEL;
return tmpg1;
@@ -371,10 +371,9 @@ CSprite *SpriteTransformBitMap(I64 *r,CSprite *tmpg)
return tmpg1;
}
U0 SpriteTransform(I64 *r,CSprite *head)
U0 SpriteTransformQue(CSprite *head,I64 *r)
{
I64 i,j,k,num,
x,y,z,x1,y1,z1,x2,y2,z2,x3,y3,z3;
I64 i,j,k,num,x,y,z,x1,y1,z1,x2,y2,z2,x3,y3,z3;
I32 *ptr;
CD3I32 *p;
CSprite *tmpg=head->next,head2,*tmpg1,*tmpg2,*tmpg3;
@@ -960,7 +959,7 @@ U0 SpriteCtrlPtsMove(CEdSprite *head,I64 dx,I64 dy)
Bool SpriteSelUnselShiftPts(U8 *elems,I64 x,I64 y,I64 *_cur_elem_num,I64 mode)
{
I64 msg_code,a1,a2,xx,yy,xx2,yy2,dd,best_dd,cur_elem_num;
I64 msg_code,arg1,arg2,xx,yy,xx2,yy2,dd,best_dd,cur_elem_num;
Bool res=TRUE;
CDC *dc=DCAlias;
CEdSprite head,*tmpes,*best_es;
@@ -970,14 +969,14 @@ Bool SpriteSelUnselShiftPts(U8 *elems,I64 x,I64 y,I64 *_cur_elem_num,I64 mode)
if (head.next!=&head) {
while (TRUE) {
SpriteCtrlPtsDraw(dc,&head); //has Refresh
switch (msg_code=ScanMsg(&a1,&a2,
1<<MSG_IP_R_UP|1<<MSG_IP_L_DOWN|1<<MSG_KEY_DOWN)) {
case MSG_IP_L_DOWN:
switch (msg_code=ScanMsg(&arg1,&arg2,
1<<MSG_MS_R_UP|1<<MSG_MS_L_DOWN|1<<MSG_KEY_DOWN)) {
case MSG_MS_L_DOWN:
switch (mode) {
case SPED_SEL:
case SPED_UNSEL:
case SPED_SHIFT_PTS:
xx=a1; yy=a2;
xx=arg1; yy=arg2;
best_dd=MAX_I64;
tmpes=head.next;
while (tmpes!=&head) {
@@ -1007,14 +1006,15 @@ Bool SpriteSelUnselShiftPts(U8 *elems,I64 x,I64 y,I64 *_cur_elem_num,I64 mode)
}
break;
start:
xx2=xx=a1; yy2=yy=a2;
xx2=xx=arg1; yy2=yy=arg2;
while (TRUE) {
SpriteCtrlPtsDraw(dc,&head);
dc->color=ROPF_DITHER+WHITE<<16+RED;
GrBorder(dc,xx,yy,xx2,yy2);
if (msg_code=ScanMsg(&a1,&a2,1<<MSG_IP_MOVE|1<<MSG_IP_L_UP)) {
if (msg_code==MSG_IP_MOVE) {
xx2=a1; yy2=a2;
if (msg_code=ScanMsg(&arg1,&arg2,
1<<MSG_MS_MOVE|1<<MSG_MS_L_UP)) {
if (msg_code==MSG_MS_MOVE) {
xx2=arg1; yy2=arg2;
} else
break;
}
@@ -1057,10 +1057,11 @@ Bool SpriteSelUnselShiftPts(U8 *elems,I64 x,I64 y,I64 *_cur_elem_num,I64 mode)
case SPED_SHIFT_RECTS:
do {
SpriteCtrlPtsDraw(dc,&head);
msg_code=ScanMsg(&a1,&a2,1<<MSG_KEY_DOWN|1<<MSG_IP_L_DOWN);
msg_code=ScanMsg(&arg1,&arg2,
1<<MSG_KEY_DOWN|1<<MSG_MS_L_DOWN);
if (msg_code==MSG_KEY_DOWN) goto gs_key;
} while (msg_code!=MSG_IP_L_DOWN);
xx=a1;yy=a2;
} while (msg_code!=MSG_MS_L_DOWN);
xx=arg1;yy=arg2;
break;
end:
}
@@ -1069,11 +1070,12 @@ Bool SpriteSelUnselShiftPts(U8 *elems,I64 x,I64 y,I64 *_cur_elem_num,I64 mode)
case SPED_SHIFT_RECTS:
do {
SpriteCtrlPtsDraw(dc,&head);
if (msg_code=ScanMsg(&a1,&a2,1<<MSG_IP_MOVE|1<<MSG_IP_L_UP)) {
SpriteCtrlPtsMove(&head,a1-xx,a2-yy);
xx=a1;yy=a2;
if (msg_code=ScanMsg(&arg1,&arg2,
1<<MSG_MS_MOVE|1<<MSG_MS_L_UP)) {
SpriteCtrlPtsMove(&head,arg1-xx,arg2-yy);
xx=arg1;yy=arg2;
}
} while (msg_code!=MSG_IP_L_UP);
} while (msg_code!=MSG_MS_L_UP);
tmpes=head.next;
while (tmpes!=&head) {
tmpes->flags&=~SPEDF_SEL;
@@ -1085,11 +1087,11 @@ Bool SpriteSelUnselShiftPts(U8 *elems,I64 x,I64 y,I64 *_cur_elem_num,I64 mode)
break;
case MSG_KEY_DOWN:
gs_key:
switch (a1.u8[0]) {
switch (arg1.u8[0]) {
case CH_SHIFT_ESC:
res=FALSE;
case CH_ESC:
GetMsg(&a1,&a2,1<<MSG_KEY_UP);
GetMsg(&arg1,&arg2,1<<MSG_KEY_UP);
goto gs_done;
case 'p':
case 'P':
@@ -1101,7 +1103,7 @@ gs_key:
break;
}
break;
case MSG_IP_R_UP:
case MSG_MS_R_UP:
goto gs_done;
}
}
@@ -1121,7 +1123,7 @@ I64 SpriteEd(CDoc *doc,CDocEntry *doc_ce,I64 x,I64 y,
CDocEntry *doc_e2;
CDocBin *tmpb;
Bool unlock;
I64 i,r[16],msg_code,a1,a2,xx,yy,
I64 i,r[16],msg_code,arg1,arg2,xx,yy,
old_de_flags;
CSprite *head2,*next,*last,*tmpg,*insert_pt;
@@ -1147,8 +1149,8 @@ I64 SpriteEd(CDoc *doc,CDocEntry *doc_ce,I64 x,I64 y,
case SPED_SET_ORIGIN:
SpriteQueSelAll(*_head);
doc_ce->de_flags=old_de_flags;
GetMsg(&a1,&a2,1<<MSG_IP_L_UP);
SpriteSetOrigin(*_head,x-a1,y-a2,0);
GetMsg(&arg1,&arg2,1<<MSG_MS_L_UP);
SpriteSetOrigin(*_head,x-arg1,y-arg2,0);
SpriteEdUpdate(doc,doc_ce,*_head);
SpriteQueSelAll(*_head,FALSE);
break;
@@ -1156,15 +1158,15 @@ I64 SpriteEd(CDoc *doc,CDocEntry *doc_ce,I64 x,I64 y,
if (!SpriteQueSelCnt(*_head))
SpriteQueSelAll(*_head);
doc_ce->de_flags=old_de_flags;
GetMsg(&a1,&a2,1<<MSG_IP_L_DOWN);
xx=a1; yy=a2;
GetMsg(&arg1,&arg2,1<<MSG_MS_L_DOWN);
xx=arg1; yy=arg2;
do {
msg_code=GetMsg(&a1,&a2,
1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
SpriteSetOrigin(*_head,a1-xx,a2-yy,0);
xx=a1; yy=a2;
msg_code=GetMsg(&arg1,&arg2,
1<<MSG_MS_L_UP+1<<MSG_MS_MOVE);
SpriteSetOrigin(*_head,arg1-xx,arg2-yy,0);
xx=arg1; yy=arg2;
SpriteEdUpdate(doc,doc_ce,*_head);
} while (msg_code!=MSG_IP_L_UP);
} while (msg_code!=MSG_MS_L_UP);
if (!SpriteQueSelCnt(*_head,FALSE))
SpriteQueSelAll(*_head,FALSE);
break;
@@ -1191,7 +1193,7 @@ I64 SpriteEd(CDoc *doc,CDocEntry *doc_ce,I64 x,I64 y,
if (!SpriteQueSelCnt(*_head))
SpriteQueSelAll(*_head);
if (PopUpTransform(r)) {
SpriteTransform(r,*_head);
SpriteTransformQue(*_head,r);
SpriteEdUpdate(doc,doc_ce,*_head);
}
if (!SpriteQueSelCnt(*_head,FALSE))
@@ -1205,15 +1207,15 @@ I64 SpriteEd(CDoc *doc,CDocEntry *doc_ce,I64 x,I64 y,
tmpg->p.x1=0;
tmpg->p.y1=0;
QueIns(tmpg,insert_pt->last);
GetMsg(&a1,&a2,1<<MSG_IP_L_DOWN);
xx=a1; yy=a2;
GetMsg(&arg1,&arg2,1<<MSG_MS_L_DOWN);
xx=arg1; yy=arg2;
do {
msg_code=GetMsg(&a1,&a2,
1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
tmpg->p.x1=a1-xx;
tmpg->p.y1=a2-yy;
msg_code=GetMsg(&arg1,&arg2,
1<<MSG_MS_L_UP+1<<MSG_MS_MOVE);
tmpg->p.x1=arg1-xx;
tmpg->p.y1=arg2-yy;
SpriteEdUpdate(doc,doc_ce,*_head);
} while (msg_code!=MSG_IP_L_UP);
} while (msg_code!=MSG_MS_L_UP);
*_cur_elem_num+=1;
break;
case SPED_INS_CLIPBOARD:
@@ -1265,3 +1267,16 @@ I64 SpriteEd(CDoc *doc,CDocEntry *doc_ce,I64 x,I64 y,
case SPED_MAIN_MENU: return SPE_CONT;
}
}
#help_index "Graphics/Sprite;Sprites;Graphics/Math/3D Transformation"
public U8 *SpriteTransform(U8 *elems,I64 *r)
{//Rotate Sprite using 4x4 matrix. Uses $LK,"fixed-point",A="FI:::/Demo/Lectures/FixedPoint.HC"$.
U8 *res;
CSprite *head=Sprite2SpriteQue(elems);
SpriteQueSelAll(head);
SpriteTransformQue(head,r);
res=SpriteQue2Sprite(head);
QueDel(head);
Free(head);
return res;
}
+126 -122
View File
@@ -128,17 +128,17 @@ U0 SpriteScrnInit(CDC *dc,I64,I64)
dc->pen_width=old_pen_width;
}
CSprite *SMLine(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
CSprite *SMLine(CDC *dc,I64 x,I64 y,I64 arg1,I64 arg2,CColorROPU32 color)
{
I64 msg_code,x1=a1,y1=a2,x2=a1,y2=a2;
I64 msg_code,x1=arg1,y1=arg2,x2=arg1,y2=arg2;
CSprite *res;
do {
dc->color=color&COLORROP_NO_ROP0_MASK;
GrLine3(dc,x1,y1,0,x2,y2,0);
msg_code=GetMsg(&a1,&a2,1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
msg_code=GetMsg(&arg1,&arg2,1<<MSG_MS_L_UP+1<<MSG_MS_MOVE);
SpriteScrnInit(dc,x,y);
x2=a1; y2=a2;
} while (msg_code!=MSG_IP_L_UP);
x2=arg1; y2=arg2;
} while (msg_code!=MSG_MS_L_UP);
dc->color=color&COLORROP_NO_ROP0_MASK;
GrLine3(dc,x1,y1,0,x2,y2,0);
res=CAlloc(SpriteElemQuedBaseSize(SPT_LINE));
@@ -150,17 +150,17 @@ CSprite *SMLine(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
return res;
}
CSprite *SMArrow(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
CSprite *SMArrow(CDC *dc,I64 x,I64 y,I64 arg1,I64 arg2,CColorROPU32 color)
{
I64 msg_code,x1=a1,y1=a2,x2=a1,y2=a2;
I64 msg_code,x1=arg1,y1=arg2,x2=arg1,y2=arg2;
CSprite *res;
do {
dc->color=color&COLORROP_NO_ROP0_MASK;
GrArrow3(dc,x1,y1,0,x2,y2,0);
msg_code=GetMsg(&a1,&a2,1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
msg_code=GetMsg(&arg1,&arg2,1<<MSG_MS_L_UP+1<<MSG_MS_MOVE);
SpriteScrnInit(dc,x,y);
x2=a1; y2=a2;
} while (msg_code!=MSG_IP_L_UP);
x2=arg1; y2=arg2;
} while (msg_code!=MSG_MS_L_UP);
dc->color=color&COLORROP_NO_ROP0_MASK;
GrArrow3(dc,x1,y1,0,x2,y2,0);
res=CAlloc(SpriteElemQuedBaseSize(SPT_ARROW));
@@ -172,9 +172,9 @@ CSprite *SMArrow(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
return res;
}
CSprite *SMPlanarSymmetry(CDC *dc,I64 x,I64 y,I64 a1,I64 a2)
CSprite *SMPlanarSymmetry(CDC *dc,I64 x,I64 y,I64 arg1,I64 arg2)
{
I64 msg_code,x1=a1,y1=a2,x2=a1,y2=a2,old_width,old_flags;
I64 msg_code,x1=arg1,y1=arg2,x2=arg1,y2=arg2,old_width,old_flags;
CSprite *res;
old_width=dc->pen_width;
old_flags=dc->flags;
@@ -183,10 +183,10 @@ CSprite *SMPlanarSymmetry(CDC *dc,I64 x,I64 y,I64 a1,I64 a2)
do {
dc->color=ROPF_DITHER+WHITE<<16+BLACK;
GrLine3(dc,x1,y1,0,x2,y2,0);
msg_code=GetMsg(&a1,&a2,1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
msg_code=GetMsg(&arg1,&arg2,1<<MSG_MS_L_UP+1<<MSG_MS_MOVE);
SpriteScrnInit(dc,x,y);
x2=a1; y2=a2;
} while (msg_code!=MSG_IP_L_UP);
x2=arg1; y2=arg2;
} while (msg_code!=MSG_MS_L_UP);
dc->flags=old_flags&DCF_SYMMETRY|dc->flags&~DCF_SYMMETRY;
dc->pen_width=old_width;
res=CAlloc(SpriteElemQuedBaseSize(SPT_PLANAR_SYMMETRY));
@@ -198,16 +198,17 @@ CSprite *SMPlanarSymmetry(CDC *dc,I64 x,I64 y,I64 a1,I64 a2)
return res;
}
CSprite *SMRect(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
CSprite *SMRect(CDC *dc,I64 x,I64 y,I64 arg1,I64 arg2,CColorROPU32 color)
{
I64 msg_code,x1=a1,y1=a2,x2=a1,y2=a2,xx1=a1,yy1=a2,xx2=a1,yy2=a2;
I64 msg_code,x1=arg1,y1=arg2,x2=arg1,y2=arg2,
xx1=arg1,yy1=arg2,xx2=arg1,yy2=arg2;
CSprite *res;
do {
dc->color=color&COLORROP_NO_ROP0_MASK;
GrRect3(dc,xx1,yy1,0,xx2-xx1,yy2-yy1);
msg_code=GetMsg(&a1,&a2,1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
msg_code=GetMsg(&arg1,&arg2,1<<MSG_MS_L_UP+1<<MSG_MS_MOVE);
SpriteScrnInit(dc,x,y);
x2=a1; y2=a2;
x2=arg1; y2=arg2;
if (x2<x1) {
xx1=x2; xx2=x1;
} else {
@@ -218,7 +219,7 @@ CSprite *SMRect(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
} else {
yy1=y1; yy2=y2;
}
} while (msg_code!=MSG_IP_L_UP);
} while (msg_code!=MSG_MS_L_UP);
dc->color=color&COLORROP_NO_ROP0_MASK;
GrRect3(dc,xx1,yy1,0,xx2-xx1,yy2-yy1);
res=CAlloc(SpriteElemQuedBaseSize(SPT_RECT));
@@ -230,10 +231,11 @@ CSprite *SMRect(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
return res;
}
CSprite *SMScrnBitMap(I64 eletype,CDC *dc,CDC *dc2,I64 x,I64 y,I64 a1,I64 a2,
CColorROPU32 bm_bkcolor)
CSprite *SMScrnBitMap(I64 eletype,CDC *dc,CDC *dc2,I64 x,I64 y,
I64 arg1,I64 arg2,CColorROPU32 bm_bkcolor)
{
I64 i,msg_code,x1=a1,y1=a2,x2=a1,y2=a2,xx1=a1,yy1=a2,xx2=a1,yy2=a2,old_width;
I64 i,msg_code,x1=arg1,y1=arg2,x2=arg1,y2=arg2,
xx1=arg1,yy1=arg2,xx2=arg1,yy2=arg2,old_width;
CDC *dc3,*img;
CSprite *res;
old_width=dc2->pen_width;
@@ -242,9 +244,9 @@ CSprite *SMScrnBitMap(I64 eletype,CDC *dc,CDC *dc2,I64 x,I64 y,I64 a1,I64 a2,
dc2->color=ROPF_DITHER+WHITE<<16+BLACK;
GrBorder(dc2,xx1+Fs->pix_left+Fs->scroll_x,yy1+Fs->pix_top+Fs->scroll_y,
xx2+Fs->pix_left+Fs->scroll_x,yy2+Fs->pix_top+Fs->scroll_y);
msg_code=GetMsg(&a1,&a2,1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
msg_code=GetMsg(&arg1,&arg2,1<<MSG_MS_L_UP+1<<MSG_MS_MOVE);
SpriteScrnInit(dc,x,y);
x2=a1; y2=a2;
x2=arg1; y2=arg2;
if (x2<x1) {
xx1=x2; xx2=x1;
} else {
@@ -255,7 +257,7 @@ CSprite *SMScrnBitMap(I64 eletype,CDC *dc,CDC *dc2,I64 x,I64 y,I64 a1,I64 a2,
} else {
yy1=y1; yy2=y2;
}
} while (msg_code!=MSG_IP_L_UP);
} while (msg_code!=MSG_MS_L_UP);
xx2++; yy2++;
res=CAlloc(SpriteElemQuedBaseSize(SPT_BITMAP)+((xx2-xx1+7)&~7)*(yy2-yy1));
res->type=SPT_BITMAP;
@@ -283,17 +285,17 @@ CSprite *SMScrnBitMap(I64 eletype,CDC *dc,CDC *dc2,I64 x,I64 y,I64 a1,I64 a2,
return res;
}
CSprite *SMCircle(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
CSprite *SMCircle(CDC *dc,I64 x,I64 y,I64 arg1,I64 arg2,CColorROPU32 color)
{
I64 msg_code,x1=a1,y1=a2,x2=a1,y2=a2;
I64 msg_code,x1=arg1,y1=arg2,x2=arg1,y2=arg2;
CSprite *res;
do {
dc->color=color&COLORROP_NO_ROP0_MASK;
GrCircle3(dc,x1,y1,0,Sqrt(SqrI64(x1-x2)+SqrI64(y1-y2)));
msg_code=GetMsg(&a1,&a2,1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
msg_code=GetMsg(&arg1,&arg2,1<<MSG_MS_L_UP+1<<MSG_MS_MOVE);
SpriteScrnInit(dc,x,y);
x2=a1; y2=a2;
} while (msg_code!=MSG_IP_L_UP);
x2=arg1; y2=arg2;
} while (msg_code!=MSG_MS_L_UP);
dc->color=color&COLORROP_NO_ROP0_MASK;
GrCircle3(dc,x1,y1,0,Sqrt(SqrI64(x1-x2)+SqrI64(y1-y2)));
res=CAlloc(SpriteElemQuedBaseSize(SPT_CIRCLE));
@@ -304,18 +306,18 @@ CSprite *SMCircle(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
return res;
}
CSprite *SMEllipse(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
CSprite *SMEllipse(CDC *dc,I64 x,I64 y,I64 arg1,I64 arg2,CColorROPU32 color)
{
I64 msg_code,x1=a1,y1=a2,x2=a1,y2=a2;
I64 msg_code,x1=arg1,y1=arg2,x2=arg1,y2=arg2;
F64 angle1,angle2;
CSprite *res;
do {
dc->color=color&COLORROP_NO_ROP0_MASK;
GrEllipse3(dc,(x1+x2)>>1,(y1+y2)>>1,0,AbsI64(x1-x2)>>1,AbsI64(y1-y2)>>1);
msg_code=GetMsg(&a1,&a2,1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
msg_code=GetMsg(&arg1,&arg2,1<<MSG_MS_L_UP+1<<MSG_MS_MOVE);
SpriteScrnInit(dc,x,y);
x2=a1; y2=a2;
} while (msg_code!=MSG_IP_L_UP);
x2=arg1; y2=arg2;
} while (msg_code!=MSG_MS_L_UP);
res=CAlloc(SpriteElemQuedBaseSize(SPT_ELLIPSE));
res->type=SPT_ELLIPSE;
res->pwha.x1=(x1+x2)>>1-x;
@@ -334,10 +336,10 @@ CSprite *SMEllipse(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
dc->color=color&COLORROP_NO_ROP0_MASK;
GrEllipse3(dc,res->pwha.x1+x,res->pwha.y1+y,0,
res->pwha.width,res->pwha.height,res->pwha.angle);
msg_code=GetMsg(&a1,&a2,1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
msg_code=GetMsg(&arg1,&arg2,1<<MSG_MS_L_UP+1<<MSG_MS_MOVE);
SpriteScrnInit(dc,x,y);
x2=a1; y2=a2;
} while (msg_code!=MSG_IP_L_UP);
x2=arg1; y2=arg2;
} while (msg_code!=MSG_MS_L_UP);
angle1=Arg(x2-(res->pwha.x1+x),y2-(res->pwha.y1+y));
if (res->pwha.width>=res->pwha.height)
res->pwha.angle=-(angle1-angle2);
@@ -349,20 +351,20 @@ CSprite *SMEllipse(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
return res;
}
CSprite *SMPolygon(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,I64 sides,
CSprite *SMPolygon(CDC *dc,I64 x,I64 y,I64 arg1,I64 arg2,I64 sides,
CColorROPU32 color)
{
I64 msg_code,x1=a1,y1=a2,x2=a1,y2=a2;
I64 msg_code,x1=arg1,y1=arg2,x2=arg1,y2=arg2;
F64 angle1,angle2;
CSprite *res;
do {
dc->color=color&COLORROP_NO_ROP0_MASK;
GrRegPoly3(dc,(x1+x2)>>1,(y1+y2)>>1,0,
AbsI64(x1-x2)>>1,AbsI64(y1-y2)>>1,sides);
msg_code=GetMsg(&a1,&a2,1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
msg_code=GetMsg(&arg1,&arg2,1<<MSG_MS_L_UP+1<<MSG_MS_MOVE);
SpriteScrnInit(dc,x,y);
x2=a1; y2=a2;
} while (msg_code!=MSG_IP_L_UP);
x2=arg1; y2=arg2;
} while (msg_code!=MSG_MS_L_UP);
res=CAlloc(SpriteElemQuedBaseSize(SPT_POLYGON));
res->type=SPT_POLYGON;
res->pwhas.x1=(x1+x2)>>1-x;
@@ -383,10 +385,10 @@ CSprite *SMPolygon(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,I64 sides,
GrRegPoly3(dc,res->pwhas.x1+x,res->pwhas.y1+y,0,
res->pwhas.width,res->pwhas.height,
res->pwhas.sides,res->pwhas.angle);
msg_code=GetMsg(&a1,&a2,1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
msg_code=GetMsg(&arg1,&arg2,1<<MSG_MS_L_UP+1<<MSG_MS_MOVE);
SpriteScrnInit(dc,x,y);
x2=a1; y2=a2;
} while (msg_code!=MSG_IP_L_UP);
x2=arg1; y2=arg2;
} while (msg_code!=MSG_MS_L_UP);
angle1=Arg(x2-(res->pwhas.x1+x),y2-(res->pwhas.y1+y));
if (res->pwhas.width>=res->pwhas.height)
res->pwhas.angle=-(angle1-angle2);
@@ -399,10 +401,10 @@ CSprite *SMPolygon(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,I64 sides,
return res;
}
CSprite *SMPolyLineFamily(I64 eletype,CDC *dc,I64 x,I64 y,I64 a1,I64 a2,
CSprite *SMPolyLineFamily(I64 eletype,CDC *dc,I64 x,I64 y,I64 arg1,I64 arg2,
CColorROPU32 color)
{
I64 i,num=0,msg_code,x1=a1,y1=a2,x2=a1,y2=a2;
I64 i,num=0,msg_code,x1=arg1,y1=arg2,x2=arg1,y2=arg2;
I32 *ptr;
CD3I32 *p;
CSprite *res,*tmpg,*tmpg1,head2;
@@ -413,14 +415,15 @@ CSprite *SMPolyLineFamily(I64 eletype,CDC *dc,I64 x,I64 y,I64 a1,I64 a2,
dc->color=color&COLORROP_NO_ROP0_MASK;
if (num)
GrLine3(dc,x1,y1,0,x2,y2,0);
msg_code=GetMsg(&a1,&a2,1<<MSG_IP_L_UP+1<<MSG_IP_MOVE+1<<MSG_IP_R_UP);
msg_code=GetMsg(&arg1,&arg2,
1<<MSG_MS_L_UP+1<<MSG_MS_MOVE+1<<MSG_MS_R_UP);
dc->color=TRANSPARENT;
if (num)
GrLine3(dc,x1,y1,0,x2,y2,0);
x2=a1; y2=a2;
} while (msg_code!=MSG_IP_L_UP && msg_code!=MSG_IP_R_UP);
x2=arg1; y2=arg2;
} while (msg_code!=MSG_MS_L_UP && msg_code!=MSG_MS_R_UP);
dc->color=color&COLORROP_NO_ROP0_MASK;
if (msg_code==MSG_IP_L_UP) {
if (msg_code==MSG_MS_L_UP) {
if (num)
GrLine3(dc,x1,y1,0,x2,y2,0);
res=CAlloc(SpriteElemQuedBaseSize(SPT_PT));
@@ -431,7 +434,7 @@ CSprite *SMPolyLineFamily(I64 eletype,CDC *dc,I64 x,I64 y,I64 a1,I64 a2,
x1=x2;y1=y2;
num++;
}
} while (msg_code!=MSG_IP_R_UP);
} while (msg_code!=MSG_MS_R_UP);
switch (eletype) {
case SPT_POLYLINE:
@@ -489,22 +492,22 @@ CSprite *SMPolyLineFamily(I64 eletype,CDC *dc,I64 x,I64 y,I64 a1,I64 a2,
return res;
}
CSprite *SMPolyPoint(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
CSprite *SMPolyPoint(CDC *dc,I64 x,I64 y,I64 arg1,I64 arg2,CColorROPU32 color)
{
I64 i,num=0,msg_code,x1=a1,y1=a2,x2=a1,y2=a2,x3,y3;
I64 i,num=0,msg_code,x1=arg1,y1=arg2,x2=arg1,y2=arg2,x3,y3;
I32 *ptr;
CSprite *res,*tmpg,*tmpg1,head2;
QueInit(&head2);
x3=a1-x; y3=a2-y;
x3=arg1-x; y3=arg2-y;
dc->color=color&COLORROP_NO_ROP0_MASK;
do {
msg_code=GetMsg(&a1,&a2,1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
x2=a1; y2=a2;
msg_code=GetMsg(&arg1,&arg2,1<<MSG_MS_L_UP+1<<MSG_MS_MOVE);
x2=arg1; y2=arg2;
GrLine3(dc,x1,y1,0,x2,y2,0);
Line(&head2,x1-x,y1-y,0,x2-x,y2-y,0,&SpritePolyPtPlot);
x1=x2;y1=y2;
} while (msg_code!=MSG_IP_L_UP);
} while (msg_code!=MSG_MS_L_UP);
num=0;
res=head2.next;
@@ -545,7 +548,7 @@ CSprite *SMPolyPoint(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
}
U0 SMTextFamily(I64 eletype,CDoc *doc,CDocEntry *doc_ce,CSprite *head,CDC *dc,
I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color,I64 *_cur_elem_num,
I64 x,I64 y,I64 arg1,I64 arg2,CColorROPU32 color,I64 *_cur_elem_num,
I64 old_de_flags)
{
CSprite *tmpg,*insert_pt=SpriteSetSettings(,head,*_cur_elem_num);
@@ -563,10 +566,10 @@ U0 SMTextFamily(I64 eletype,CDoc *doc,CDocEntry *doc_ce,CSprite *head,CDC *dc,
case SPT_TEXT_BOX: GrTextBox3(dc,x1,y1,0,st); break;
case SPT_TEXT_DIAMOND: GrTextDiamond3(dc,x1,y1,0,st); break;
}
msg_code=GetMsg(&a1,&a2,1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
msg_code=GetMsg(&arg1,&arg2,1<<MSG_MS_L_UP+1<<MSG_MS_MOVE);
SpriteScrnInit(dc,x,y);
x1=a1; y1=a2;
} while (msg_code!=MSG_IP_L_UP);
x1=arg1; y1=arg2;
} while (msg_code!=MSG_MS_L_UP);
tmpg=CAlloc(SpriteElemQuedBaseSize(eletype)+StrLen(st)+1);
tmpg->type=eletype;
tmpg->ps.x1=x1-x;
@@ -580,10 +583,10 @@ U0 SMTextFamily(I64 eletype,CDoc *doc,CDocEntry *doc_ce,CSprite *head,CDC *dc,
}
I64 SMBitMap(I64 eletype,CDoc *doc,CDocEntry *doc_ce,CSprite *head,
CDC *dc,I64 xx,I64 yy,I64 a1,I64 a2,CColorROPU32 bm_bkcolor,
CDC *dc,I64 xx,I64 yy,I64 arg1,I64 arg2,CColorROPU32 bm_bkcolor,
Bool sel,I64 xx1=0,I64 yy1=0,I64 xx2=0,I64 yy2=0,I64 *_cur_elem_num)
{
I64 i,msg_code,x=xx,y=yy,x1=a1,y1=a2,x2=a1,y2=a2,old_width;
I64 i,msg_code,x=xx,y=yy,x1=arg1,y1=arg2,x2=arg1,y2=arg2,old_width;
CSprite *tmpg,*tmpg1,*insert_pt;
CDC *img;
@@ -591,16 +594,16 @@ I64 SMBitMap(I64 eletype,CDoc *doc,CDocEntry *doc_ce,CSprite *head,
x+=xx; y+=yy;
if (sel) {
xx1=a1; yy1=a2;
xx2=a1; yy2=a2;
xx1=arg1; yy1=arg2;
xx2=arg1; yy2=arg2;
old_width=dc->pen_width;
dc->pen_width=1;
do {
dc->color=ROPF_DITHER+WHITE<<16+BLACK;
GrBorder(dc,xx1,yy1,xx2,yy2);
msg_code=GetMsg(&a1,&a2,1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
msg_code=GetMsg(&arg1,&arg2,1<<MSG_MS_L_UP+1<<MSG_MS_MOVE);
SpriteScrnInit(dc,x,y);
x2=a1; y2=a2;
x2=arg1; y2=arg2;
if (x2<x1) {
xx1=x2; xx2=x1;
} else {
@@ -611,7 +614,7 @@ I64 SMBitMap(I64 eletype,CDoc *doc,CDocEntry *doc_ce,CSprite *head,
} else {
yy1=y1; yy2=y2;
}
} while (msg_code!=MSG_IP_L_UP);
} while (msg_code!=MSG_MS_L_UP);
dc->pen_width=old_width;
}
@@ -714,7 +717,7 @@ U0 SMMesh(CDoc *doc,CDocEntry *doc_ce,CSprite *head,I64 *_cur_elem_num)
}
U0 SMShiftableMesh(CDoc *doc,CDocEntry *doc_ce,CSprite *head,
I64 x,I64 y,I64 a1,I64 a2,I64 *_cur_elem_num)
I64 x,I64 y,I64 arg1,I64 arg2,I64 *_cur_elem_num)
{
CSprite *tmpg,*insert_pt=SpriteSetSettings(,head,*_cur_elem_num),
*tmpg1=insert_pt;
@@ -723,8 +726,8 @@ U0 SMShiftableMesh(CDoc *doc,CDocEntry *doc_ce,CSprite *head,
I32 *mesh,*old_mesh;
if (tmpg1!=head && tmpg1->type&SPG_TYPE_MASK==SPT_MESH) {
z=0;
x1=-(a1-x);
y1=-(a2-y);
x1=-(arg1-x);
y1=-(arg2-y);
z1=z;
p=&tmpg1->mu.u;
for (i=0;i<tmpg1->mu.vertex_cnt;i++,p++) {
@@ -735,8 +738,8 @@ U0 SMShiftableMesh(CDoc *doc,CDocEntry *doc_ce,CSprite *head,
old_mesh=&tmpg1->mu.vertex_cnt;
} else if (tmpg1!=head && tmpg1->type&SPG_TYPE_MASK==SPT_SHIFTABLE_MESH) {
z=-tmpg1->pmu.z;
x1=tmpg1->pmu.x-(a1-x);
y1=tmpg1->pmu.y-(a2-y);
x1=tmpg1->pmu.x-(arg1-x);
y1=tmpg1->pmu.y-(arg2-y);
z1=tmpg1->pmu.z+z;
p=&tmpg1->pmu.u;
for (i=0;i<tmpg1->pmu.vertex_cnt;i++,p++) {
@@ -754,8 +757,8 @@ U0 SMShiftableMesh(CDoc *doc,CDocEntry *doc_ce,CSprite *head,
tmpg->type=SPT_SHIFTABLE_MESH;
MemCpy(&tmpg->pmu.vertex_cnt,mesh,size);
Free(mesh);
tmpg->pmu.x=a1-x;
tmpg->pmu.y=a2-y;
tmpg->pmu.x=arg1-x;
tmpg->pmu.y=arg2-y;
tmpg->pmu.z=-z;
QueIns(tmpg,insert_pt->last);
SpriteEdUpdate(doc,doc_ce,head);
@@ -767,8 +770,8 @@ U0 SMShiftableMesh(CDoc *doc,CDocEntry *doc_ce,CSprite *head,
} else
*_cur_elem_num+=1;
} else if (old_mesh && tmpg1->type&SPG_TYPE_MASK==SPT_SHIFTABLE_MESH) {
x1=tmpg1->pmu.x-(a1-x);
y1=tmpg1->pmu.y-(a2-y);
x1=tmpg1->pmu.x-(arg1-x);
y1=tmpg1->pmu.y-(arg2-y);
z1=tmpg1->pmu.z+z;
p=&tmpg1->pmu.u;
for (i=0;i<tmpg1->pmu.vertex_cnt;i++,p++) {
@@ -777,8 +780,8 @@ U0 SMShiftableMesh(CDoc *doc,CDocEntry *doc_ce,CSprite *head,
p->z-=z1;
}
} else if (old_mesh && tmpg1->type&SPG_TYPE_MASK==SPT_MESH) {
x1=-(a1-x);
y1=-(a2-y);
x1=-(arg1-x);
y1=-(arg2-y);
z1= z;
p=&tmpg1->mu.u;
for (i=0;i<tmpg1->mu.vertex_cnt;i++,p++) {
@@ -809,7 +812,7 @@ U0 SMTaskTitleSet(I64 eletype)
I64 SpriteMainEd(CDoc *doc)
{
CDocEntry *doc_ce=doc->cur_entry;
I64 res,i,x,y,a1,a2,xx,yy,xx1,yy1,xx2,yy2,width,eletype=SPT_MENU,
I64 res,i,x,y,arg1,arg2,xx,yy,xx1,yy1,xx2,yy2,width,eletype=SPT_MENU,
cur_elem_num,old_border_src=Fs->border_src,old_title_src=Fs->title_src,
old_de_flags=doc_ce->de_flags;
CColorROPU32 bm_bkcolor,color;
@@ -914,21 +917,21 @@ I64 SpriteMainEd(CDoc *doc)
case SPT_SHIFTABLE_MESH:
doc_ce->de_flags|=DOCEF_DONT_DRAW;
if (PopUpNoYes("Study the $$LK,\"X-Caliber\","
"A=\"FF:::/PersonalMenu.DD.Z,X-Caliber\"$$ icon.\n\n"
"It has black rectangle background with stars. The\n"
"mesh is in front and rotates. To keep the background\n"
"rectangle from rotating, "
"$$GREEN$$TRANSFORM OFF$$FG$$ has been used.\n\n"
"The X-Caliber mesh has a different origin for rotation.\n"
"To avoid clipping, it also has also been moved in the\n"
"negative Z direction by editing the sprite as text\n"
"and changing the first vector.\n\n"
"For the mesh you are creating, use same origin as\n"
"the rest of the sprite? If $$GREEN$$YES$$FG$$, you can always\n"
"shift the mesh origin point in the sprite edit menu.\n")) {
"A=\"FF:::/PersonalMenu.DD.Z,X-Caliber\"$$ icon.\n\n"
"It has black rectangle background with stars. The\n"
"mesh is in front and rotates. To keep the background\n"
"rectangle from rotating, "
"$$GREEN$$TRANSFORM OFF$$FG$$ has been used.\n\n"
"The X-Caliber mesh has a different origin for rotation.\n"
"To avoid clipping, it also has also been moved in the\n"
"negative Z direction by editing the sprite as text\n"
"and changing the first vector.\n\n"
"For the mesh you are creating, use same origin as\n"
"the rest of the sprite? If $$GREEN$$YES$$FG$$, you can always\n"
"shift the mesh origin point in the sprite edit menu.\n")) {
doc_ce->de_flags=old_de_flags;
a1=x; a2=y;
SMShiftableMesh(doc,doc_ce,head,x,y,a1,a2,&cur_elem_num);
arg1=x; arg2=y;
SMShiftableMesh(doc,doc_ce,head,x,y,arg1,arg2,&cur_elem_num);
eletype=SPT_MENU;
} else
PopUpOk("Select Origin.\n");
@@ -938,7 +941,7 @@ I64 SpriteMainEd(CDoc *doc)
doc_ce->de_flags|=DOCEF_DONT_DRAW;
PopUpOk("Drag-out a rect for the extents of the\nbitmap.\n");
doc_ce->de_flags=old_de_flags;
Fs->win_inhibit=WIG_TASK_DFT|WIF_FOCUS_TASK_IP_L|WIF_FOCUS_TASK_IP_R|
Fs->win_inhibit=WIG_TASK_DFT|WIF_FOCUS_TASK_MS_L|WIF_FOCUS_TASK_MS_R|
WIF_FOCUS_TASK_BORDER-WIF_SELF_FOCUS-WIF_SELF_GRAB_SCROLL;
break;
case SPT_BITMAP:
@@ -956,7 +959,7 @@ I64 SpriteMainEd(CDoc *doc)
doc_ce->de_flags=old_de_flags;
xx1+=xx; yy1+=yy;
xx2+=xx; yy2+=yy;
if (SMBitMap(eletype,doc,doc_ce,head,dc,xx,yy,a1,a2,bm_bkcolor,
if (SMBitMap(eletype,doc,doc_ce,head,dc,xx,yy,arg1,arg2,bm_bkcolor,
FALSE,xx1,yy1,xx2,yy2,&cur_elem_num)==SPE_EXIT) {
res=SPE_EXIT;
goto ei_done;
@@ -976,7 +979,7 @@ I64 SpriteMainEd(CDoc *doc)
PopUpOk("Drag-out a rect for the extents of the\nbitmap.\n");
}
doc_ce->de_flags=old_de_flags;
Fs->win_inhibit=WIG_TASK_DFT|WIF_FOCUS_TASK_IP_L|WIF_FOCUS_TASK_IP_R|
Fs->win_inhibit=WIG_TASK_DFT|WIF_FOCUS_TASK_MS_L|WIF_FOCUS_TASK_MS_R|
WIF_FOCUS_TASK_BORDER-WIF_SELF_FOCUS-WIF_SELF_GRAB_SCROLL;
break;
case SPT_WIDTH:
@@ -1016,7 +1019,7 @@ I64 SpriteMainEd(CDoc *doc)
case SPT_TEXT:
case SPT_TEXT_BOX:
case SPT_TEXT_DIAMOND:
SMTextFamily(eletype,doc,doc_ce,head,dc,xx,yy,a1,a2,
SMTextFamily(eletype,doc,doc_ce,head,dc,xx,yy,arg1,arg2,
color,&cur_elem_num,old_de_flags);
eletype=SPT_MENU;
break;
@@ -1034,9 +1037,10 @@ I64 SpriteMainEd(CDoc *doc)
res=SPE_ABORT;
goto ei_done;
}
switch (GetMsg(&a1,&a2,1<<MSG_KEY_DOWN|1<<MSG_IP_R_UP|1<<MSG_IP_L_DOWN)) {
switch (GetMsg(&arg1,&arg2,
1<<MSG_KEY_DOWN|1<<MSG_MS_R_UP|1<<MSG_MS_L_DOWN)) {
case MSG_KEY_DOWN:
switch (a1) {
switch (arg1) {
case CH_ESC:
res=SPE_EXIT;
goto ei_done;
@@ -1045,7 +1049,7 @@ I64 SpriteMainEd(CDoc *doc)
goto ei_done;
case 'c': //eye-dropper
dc3=DCScrnCapture(FALSE);
color=GrPeek(dc3,ip.pos.x,ip.pos.y)^15;//Mouse cursor is XORed.
color=GrPeek(dc3,ms.pos.x,ms.pos.y)^15;//Mouse cursor is XORed.
DCDel(dc3);
tmpg=CAlloc(SpriteElemQuedBaseSize(SPT_COLOR));
tmpg->type=SPT_COLOR;
@@ -1064,7 +1068,7 @@ I64 SpriteMainEd(CDoc *doc)
break;
}
break;
case MSG_IP_R_UP:
case MSG_MS_R_UP:
if (eletype==SPT_PLANAR_SYMMETRY) {
tmpg=CAlloc(SpriteElemQuedBaseSize(SPT_PLANAR_SYMMETRY));
tmpg->type=SPT_PLANAR_SYMMETRY;
@@ -1075,35 +1079,35 @@ I64 SpriteMainEd(CDoc *doc)
} else
eletype=SPT_MENU;
break;
case MSG_IP_L_DOWN:
case MSG_MS_L_DOWN:
switch (eletype) {
start:
case SPT_LINE:
tmpg=SMLine(dc,x,y,a1,a2,color);
tmpg=SMLine(dc,x,y,arg1,arg2,color);
break;
case SPT_ARROW:
tmpg=SMArrow(dc,x,y,a1,a2,color);
tmpg=SMArrow(dc,x,y,arg1,arg2,color);
break;
case SPT_PLANAR_SYMMETRY:
tmpg=SMPlanarSymmetry(dc,x,y,a1,a2);
tmpg=SMPlanarSymmetry(dc,x,y,arg1,arg2);
eletype=SPT_MENU;
break;
case SPT_RECT:
tmpg=SMRect(dc,x,y,a1,a2,color);
tmpg=SMRect(dc,x,y,arg1,arg2,color);
break;
case SPT_INS_SCRN_BITMAP:
case SPT_INS_TRANSPARENT_SCRN_BITMAP:
tmpg=SMScrnBitMap(eletype,dc,dc2,x,y,a1,a2,bm_bkcolor);
tmpg=SMScrnBitMap(eletype,dc,dc2,x,y,arg1,arg2,bm_bkcolor);
eletype=SPT_MENU;
break;
case SPT_CIRCLE:
tmpg=SMCircle(dc,x,y,a1,a2,color);
tmpg=SMCircle(dc,x,y,arg1,arg2,color);
break;
case SPT_ELLIPSE:
tmpg=SMEllipse(dc,x,y,a1,a2,color);
tmpg=SMEllipse(dc,x,y,arg1,arg2,color);
break;
case SPT_POLYGON:
tmpg=SMPolygon(dc,x,y,a1,a2,i,color);
tmpg=SMPolygon(dc,x,y,arg1,arg2,i,color);
eletype=SPT_MENU;
break;
case SPT_PT:
@@ -1111,18 +1115,18 @@ I64 SpriteMainEd(CDoc *doc)
case SPT_FLOOD_FILL_NOT:
tmpg=CAlloc(SpriteElemQuedBaseSize(eletype));
tmpg->type=eletype;
tmpg->p.x1=a1-x;
tmpg->p.y1=a2-y;
tmpg->p.x1=arg1-x;
tmpg->p.y1=arg2-y;
break;
case SPT_POLYLINE:
case SPT_BSPLINE2:
case SPT_BSPLINE3:
case SPT_BSPLINE2_CLOSED:
case SPT_BSPLINE3_CLOSED:
tmpg=SMPolyLineFamily(eletype,dc,x,y,a1,a2,color);
tmpg=SMPolyLineFamily(eletype,dc,x,y,arg1,arg2,color);
break;
case SPT_POLYPT:
tmpg=SMPolyPoint(dc,x,y,a1,a2,color);
tmpg=SMPolyPoint(dc,x,y,arg1,arg2,color);
break;
end:
if (tmpg) {
@@ -1132,8 +1136,8 @@ I64 SpriteMainEd(CDoc *doc)
}
break;
case SPT_BITMAP:
if (SMBitMap(eletype,doc,doc_ce,head,dc,xx,yy,a1,a2,bm_bkcolor,
TRUE,,,,,&cur_elem_num)==SPE_EXIT) {
if (SMBitMap(eletype,doc,doc_ce,head,dc,xx,yy,
arg1,arg2,bm_bkcolor,TRUE,,,,,&cur_elem_num)==SPE_EXIT) {
res=SPE_EXIT;
goto ei_done;
}
@@ -1141,9 +1145,9 @@ I64 SpriteMainEd(CDoc *doc)
eletype=SPT_MENU;
break;
case SPT_SHIFTABLE_MESH:
GetMsg(NULL,NULL,1<<MSG_IP_L_UP);
GetMsg(NULL,NULL,1<<MSG_MS_L_UP);
doc_ce->de_flags|=DOCEF_DONT_DRAW;
SMShiftableMesh(doc,doc_ce,head,x,y,a1,a2,&cur_elem_num);
SMShiftableMesh(doc,doc_ce,head,x,y,arg1,arg2,&cur_elem_num);
doc_ce->de_flags=old_de_flags;
eletype=SPT_MENU;
break;
+80 -79
View File
@@ -10,7 +10,7 @@ class CMeshEdVertex
CMeshEdVertex *next,*last,*copy;
U0 start;
CD3I32 p; //World coordinates of the point.
CD3I32 p; //World coordinates of the point.
U0 end;
CD3I32 p0,
pt; //Transformed coordinates. (Scrn)
@@ -34,7 +34,7 @@ class CMeshEdTri
class CMeshFrame
{
I64 ip_z,thickness; //Input pointer (mouse) Z-coordinate
I64 ms_z,thickness; //Mouse Z-coordinate
I64 ed_mode,cx,cy;
CColorROPU32 cur_color;
Bool grid_on,flip_y,sel_rect,vertex_on,closed,pad[3];
@@ -80,7 +80,7 @@ CMeshEdVertex *MeshVertexFindScrPt(CMeshFrame *e,I64 x,I64 y)
while (tmpv!=&e->vertex_head) {
if (!(tmpv->flags&VF_IGNORE)) {
dd=SqrI64(x-tmpv->pt.x)+SqrI64(y-tmpv->pt.y);
dz=AbsI64(e->ip_z-tmpv->p.z);
dz=AbsI64(e->ms_z-tmpv->p.z);
if (dd<best_dd || dd==best_dd && dz<best_dz) {
res=tmpv;
best_dd=dd;
@@ -425,17 +425,17 @@ U0 MeshCurSnap(CMeshFrame *e)
Mat4x4MulXYZ(e->w2s,&x1,&y1,&z1);
x2=0; y2=e->cur_snap<<16; z2=0;
Mat4x4MulXYZ(e->w2s,&x2,&y2,&z2);
ip_grid.x=Max(1,MaxI64(x1,x2)>>16);
ip_grid.y=Max(1,MaxI64(y1,y2)>>16);
ip_grid.z=Min(ip_grid.x,ip_grid.y);
ms_grid.x=Max(1,MaxI64(x1,x2)>>16);
ms_grid.y=Max(1,MaxI64(y1,y2)>>16);
ms_grid.z=Min(ms_grid.x,ms_grid.y);
}
}
U0 MeshScaleZoom(CMeshFrame *e,F64 scale)
{
CTask *task=Fs;
I64 x=ip.pos.x-task->pix_left-task->scroll_x-task->pix_width/2,
y=ip.pos.y-task->pix_top-task->scroll_y-task->pix_height/2;
I64 x=ms.pos.x-task->pix_left-task->scroll_x-task->pix_width/2,
y=ms.pos.y-task->pix_top-task->scroll_y-task->pix_height/2;
task->horz_scroll.pos*=scale;
task->vert_scroll.pos*=scale;
task->horz_scroll.pos+=scale*x-x;
@@ -561,9 +561,9 @@ I64 *MeshSetW2S(CMeshFrame *e,CTask *task)
U0 MeshCursorW(CMeshFrame *e,CTask *task,I64 *_x,I64 *_y,I64 *_z)
{
I64 x_shadow,y_shadow,z_shadow,
xc=ip.pos.x-task->pix_left-task->scroll_x-e->cx,
yc=ip.pos.y-task->pix_top-task->scroll_y-e->cy,zc=0,
x=0,y=0,z=e->ip_z,
xc=ms.pos.x-task->pix_left-task->scroll_x-e->cx,
yc=ms.pos.y-task->pix_top-task->scroll_y-e->cy,zc=0,
x=0,y=0,z=e->ms_z,
i,x2,y2,z2;
Mat4x4MulXYZ(e->w2s,&x,&y,&z); //scrn of Z vect
@@ -584,7 +584,7 @@ U0 MeshCursorW(CMeshFrame *e,CTask *task,I64 *_x,I64 *_y,I64 *_z)
Mat4x4MulXYZ(e->s2w,&x,&y,&z);
x=RoundI64(x,e->cur_snap);
y=RoundI64(y,e->cur_snap);
z=RoundI64(e->ip_z,e->cur_snap);
z=RoundI64(e->ms_z,e->cur_snap);
*_x=x; *_y=y; *_z=z;
}
@@ -729,7 +729,7 @@ U0 DrawIt(CTask *task,CDC *dc)
//GR_Z_ALL is set to half of the Z-range which is an I32.
dc->z=GR_Z_ALL;
//Light source set to input pointer (mouse).
//Light source set to mouse.
MeshCursorW(e,task,&x,&y,&z);
dc->ls.x=x;
dc->ls.y=y;
@@ -785,7 +785,7 @@ U0 DrawIt(CTask *task,CDC *dc)
tmpv=tmpv->next;
}
if (CtrlInside(c,ip.presnap.x,ip.presnap.y)||winmgr.show_menu) {
if (CtrlInside(c,ms.presnap.x,ms.presnap.y)||winmgr.show_menu) {
GridInit;
task->win_inhibit=WIF_SELF_DOC;
} else {
@@ -828,7 +828,7 @@ U0 MeshInit(CMeshFrame *e,Bool flip_y)
e->ed_mode='v';
e->grid_on=TRUE;
e->vertex_on=TRUE;
e->ip_z=0;
e->ms_z=0;
e->thickness=25;
e->closed=TRUE;
e->view_scale=1.0;
@@ -971,7 +971,7 @@ See $LK,"::/Demo/Graphics/SpritePlot3D.HC"$.
$WW,0$*/
CCtrl *c=CtrlFindUnique(Fs,CTRLT_VIEWING_ANGLES);
CViewAngles *s,*old_s;
I64 i,msg_code,sel_mode,a1,a2,make_tri_vertex_num=0,x,y,z;
I64 i,msg_code,sel_mode,arg1,arg2,make_tri_vertex_num=0,x,y,z;
CD3I32 p0a,p0b;
CMeshEdVertex *va[3],*tmpv;
Bool adjusting_z=FALSE,moving,save_and_exit;
@@ -1077,33 +1077,34 @@ $WW,0$*/
try {//In case of <CTRL-ALT-c>
while (TRUE) {
MeshUpdateMenu(&e);
msg_code=GetMsg(&a1,&a2,1<<MSG_IP_MOVE|1<<MSG_KEY_DOWN|1<<MSG_IP_L_DOWN|
1<<MSG_IP_L_UP|1<<MSG_IP_R_DOWN|1<<MSG_IP_R_UP);
msg_code=GetMsg(&arg1,&arg2,
1<<MSG_MS_MOVE|1<<MSG_KEY_DOWN|1<<MSG_MS_L_DOWN|
1<<MSG_MS_L_UP|1<<MSG_MS_R_DOWN|1<<MSG_MS_R_UP);
me_restart:
switch (msg_code) {
case MSG_KEY_DOWN:
switch (a1) {
switch (arg1) {
case 0:
switch (a2.u8[0]) {
switch (arg2.u8[0]) {
case SC_DELETE:
if (a2&SCF_SHIFT)
if (arg2&SCF_SHIFT)
goto me_clipboard_cut;
else {
if (MeshSelCnt(&e))
MeshClipboardDel(&e);
else if (e.ed_mode!='t')
MeshVertexDel(&e,MeshVertexFindScrPt(&e,
ip.presnap.x-Fs->pix_left-Fs->scroll_x,
ip.presnap.y-Fs->pix_top-Fs->scroll_y));
ms.presnap.x-Fs->pix_left-Fs->scroll_x,
ms.presnap.y-Fs->pix_top-Fs->scroll_y));
MeshVertexSelAll(&e,FALSE);
MeshTriSelAll(&e,FALSE);
make_tri_vertex_num=0;
}
break;
case SC_INS:
if (a2&SCF_CTRL)
if (arg2&SCF_CTRL)
goto me_clipboard_copy;
else if (a2&SCF_SHIFT)
else if (arg2&SCF_SHIFT)
goto me_clipboard_paste;
}
break;
@@ -1129,7 +1130,7 @@ me_restart:
case 'p':
e.thickness=PopUpGetI64("Thickness (%d):",e.thickness);
case 'n':
if (a1=='n' || a1=='p')
if (arg1=='n' || arg1=='p')
e.closed=TRUE;
else
e.closed=PopUpNoYes("Closed?\n");
@@ -1143,9 +1144,9 @@ me_chain:
case 'M':
adjusting_z=FALSE;
moving=FALSE;
e.ed_mode=a1;
e.ed_mode=arg1;
make_tri_vertex_num=0;
Snd(0);
Snd;
break;
case 'T':
MeshTransformSel(&e);
@@ -1166,29 +1167,29 @@ me_chain:
case 'a':
case 'u':
case 'o':
if (a1=='a')
if (arg1=='a')
sel_mode=SEL_MESH_EQU;
else if (a1=='u')
else if (arg1=='u')
sel_mode=SEL_MESH_AND;
else
sel_mode=SEL_MESH_OR;
if ((msg_code=GetMsg(&a1,&a2,1<<MSG_KEY_DOWN|1<<MSG_IP_L_DOWN|
1<<MSG_IP_L_UP|1<<MSG_IP_R_DOWN|1<<MSG_IP_R_UP))
!=MSG_IP_L_DOWN) {
if ((msg_code=GetMsg(&arg1,&arg2,1<<MSG_KEY_DOWN|1<<MSG_MS_L_DOWN|
1<<MSG_MS_L_UP|1<<MSG_MS_R_DOWN|1<<MSG_MS_R_UP))
!=MSG_MS_L_DOWN) {
Beep; Beep;
goto me_restart;
}
e.x1=a1; e.y1=a2;
e.x2=a1; e.y2=a2;
e.x1=arg1; e.y1=arg2;
e.x2=arg1; e.y2=arg2;
e.sel_rect=TRUE;
while (TRUE) {
msg_code=GetMsg(&a1,&a2,1<<MSG_IP_MOVE|1<<MSG_KEY_DOWN|
1<<MSG_IP_L_DOWN|1<<MSG_IP_L_UP|1<<MSG_IP_R_DOWN|
1<<MSG_IP_R_UP);
if (msg_code==MSG_IP_MOVE) {
e.x2=a1; e.y2=a2;
} else if (msg_code==MSG_IP_L_UP) {
e.x2=a1; e.y2=a2;
msg_code=GetMsg(&arg1,&arg2,1<<MSG_MS_MOVE|1<<MSG_KEY_DOWN|
1<<MSG_MS_L_DOWN|1<<MSG_MS_L_UP|1<<MSG_MS_R_DOWN|
1<<MSG_MS_R_UP);
if (msg_code==MSG_MS_MOVE) {
e.x2=arg1; e.y2=arg2;
} else if (msg_code==MSG_MS_L_UP) {
e.x2=arg1; e.y2=arg2;
break;
} else {
e.sel_rect=FALSE;
@@ -1268,13 +1269,13 @@ me_clipboard_cut:
if (moving)
MeshVertexIgnoreSet(&e,TRUE);
if (tmpv=MeshVertexFindScrPt(&e,
ip.pos.x-Fs->pix_left-Fs->scroll_x,
ip.pos.y-Fs->pix_top-Fs->scroll_y)) {
Noise(25,2000,8000);
e.ip_z=RoundI64(tmpv->p.z,e.cur_snap);
ms.pos.x-Fs->pix_left-Fs->scroll_x,
ms.pos.y-Fs->pix_top-Fs->scroll_y)) {
Noise(25,86,110);
e.ms_z=RoundI64(tmpv->p.z,e.cur_snap);
} else {
Beep; Beep;
e.ip_z=0;
e.ms_z=0;
}
MeshVertexIgnoreSet(&e,FALSE);
if (moving) {
@@ -1319,14 +1320,14 @@ me_clipboard_cut:
break;
}
break;
case MSG_IP_L_DOWN:
case MSG_MS_L_DOWN:
switch (e.ed_mode) {
case 'm':
if (!moving) {
if (!MeshSelCnt(&e) &&
(tmpv=MeshVertexFindScrPt(&e,a1,a2))) {
(tmpv=MeshVertexFindScrPt(&e,arg1,arg2))) {
tmpv->flags|=VF_SEL;
e.ip_z=RoundI64(tmpv->p.z,e.cur_snap);
e.ms_z=RoundI64(tmpv->p.z,e.cur_snap);
}
if (MeshSelCnt(&e)) {
MeshCursorW(&e,Fs,&x,&y,&z);
@@ -1341,9 +1342,9 @@ me_clipboard_cut:
case 'M':
if (!adjusting_z && !moving) {
if (!MeshSelCnt(&e) &&
(tmpv=MeshVertexFindScrPt(&e,a1,a2))) {
(tmpv=MeshVertexFindScrPt(&e,arg1,arg2))) {
tmpv->flags|=VF_SEL;
e.ip_z=RoundI64(tmpv->p.z,e.cur_snap);
e.ms_z=RoundI64(tmpv->p.z,e.cur_snap);
}
if (MeshSelCnt(&e)) {
MeshCursorW(&e,Fs,&x,&y,&z);
@@ -1353,23 +1354,23 @@ me_clipboard_cut:
MeshP0Capture(&e);
moving=TRUE;
p0b.x=ip.presnap.x;
p0b.y=ip.presnap.y;
p0b.z=e.ip_z;
p0b.x=ms.presnap.x;
p0b.y=ms.presnap.y;
p0b.z=e.ms_z;
adjusting_z=TRUE;
Snd(ClampI64(3*e.ip_z+1500,0,15000));
Snd(ClampI64(Freq2Ona(3*e.ms_z+1500),0,MAX_I8));
}
}
break;
}
break;
case MSG_IP_L_UP:
case MSG_MS_L_UP:
switch (e.ed_mode) {
case 'n':
case 'f':
case 'p':
case 'v':
Noise(25,2000,8000);
Noise(25,86,110);
MeshCursorW(&e,Fs,&x,&y,&z);
e.cur_vertex=MeshVertexNew(&e,x,y,z);
break;
@@ -1377,10 +1378,10 @@ me_clipboard_cut:
case 'M':
if (moving) {
if (adjusting_z) {
e.ip_z=RoundI64(Sign(p0b.y-ip.presnap.y)
*Sqrt(Sqr(p0b.x-ip.presnap.x)+Sqr(p0b.y-ip.presnap.y))
e.ms_z=RoundI64(Sign(p0b.y-ms.presnap.y)
*Sqrt(Sqr(p0b.x-ms.presnap.x)+Sqr(p0b.y-ms.presnap.y))
+p0b.z,e.cur_snap);
Snd(0);
Snd;
adjusting_z=FALSE;
MeshCursorW(&e,Fs,&x,&y,&z);
MeshP0Offset(&e,0,0,z-p0a.z);
@@ -1394,14 +1395,14 @@ me_clipboard_cut:
}
break;
case 't':
if (tmpv=MeshVertexFindScrPt(&e,a1,a2)) {
if (tmpv=MeshVertexFindScrPt(&e,arg1,arg2)) {
for (i=0;i<make_tri_vertex_num;i++)
if (va[i]==tmpv) {
Beep; Beep;
break;
}
if (i==make_tri_vertex_num) {
Noise(25,2000,8000);
Noise(25,86,110);
va[make_tri_vertex_num++]=tmpv;
tmpv->flags|=VF_SEL;
if (make_tri_vertex_num==3) {
@@ -1415,7 +1416,7 @@ me_clipboard_cut:
break;
}
break;
case MSG_IP_R_DOWN:
case MSG_MS_R_DOWN:
if (!adjusting_z && e.ed_mode!='M' &&
(e.chain_pred==e.vertex_head.last ||
e.ed_mode!='n' && e.ed_mode!='f' && e.ed_mode!='p')) {
@@ -1427,19 +1428,19 @@ me_clipboard_cut:
p0a.z=z;
MeshP0Capture(&e);
}
p0b.x=ip.presnap.x;
p0b.y=ip.presnap.y;
p0b.z=e.ip_z;
p0b.x=ms.presnap.x;
p0b.y=ms.presnap.y;
p0b.z=e.ms_z;
adjusting_z=TRUE;
Snd(ClampI64(3*e.ip_z+1500,0,15000));
Snd(ClampI64(Freq2Ona(3*e.ms_z+1500),0,MAX_I8));
}
break;
case MSG_IP_R_UP:
case MSG_MS_R_UP:
if (adjusting_z) {
e.ip_z=RoundI64(Sign(p0b.y-ip.presnap.y)
*Sqrt(Sqr(p0b.x-ip.presnap.x)+Sqr(p0b.y-ip.presnap.y))
e.ms_z=RoundI64(Sign(p0b.y-ms.presnap.y)
*Sqrt(Sqr(p0b.x-ms.presnap.x)+Sqr(p0b.y-ms.presnap.y))
+p0b.z,e.cur_snap);
Snd(0);
Snd;
adjusting_z=FALSE;
if (moving) {
MeshCursorW(&e,Fs,&x,&y,&z);
@@ -1452,26 +1453,26 @@ me_clipboard_cut:
} else if (e.ed_mode=='n') {
if (e.chain_pred && e.chain_pred!=e.vertex_head.last)
MeshPolygon(&e,e.chain_pred->next,e.vertex_head.last,FALSE);
a1=e.ed_mode;
arg1=e.ed_mode;
goto me_chain;
} else if (e.ed_mode=='f') {
if (e.chain_pred && e.chain_pred!=e.vertex_head.last)
MeshFence(&e);
a1=e.ed_mode;
arg1=e.ed_mode;
goto me_chain;
} else if (e.ed_mode=='p') {
if (e.chain_pred && e.chain_pred!=e.vertex_head.last)
MeshPrism(&e);
a1=e.ed_mode;
arg1=e.ed_mode;
goto me_chain;
}
break;
case MSG_IP_MOVE:
case MSG_MS_MOVE:
if (adjusting_z) {
e.ip_z=RoundI64(Sign(p0b.y-ip.presnap.y)
*Sqrt(Sqr(p0b.x-ip.presnap.x)+Sqr(p0b.y-ip.presnap.y))
e.ms_z=RoundI64(Sign(p0b.y-ms.presnap.y)
*Sqrt(Sqr(p0b.x-ms.presnap.x)+Sqr(p0b.y-ms.presnap.y))
+p0b.z,e.cur_snap);
Snd(ClampI64(3*e.ip_z+1500,0,15000));
Snd(ClampI64(Freq2Ona(3*e.ms_z+1500),0,MAX_I8));
}
if (moving) {
MeshCursorW(&e,Fs,&x,&y,&z);
+9 -9
View File
@@ -15,20 +15,20 @@ I64 sprite_elem_base_sizes[SPT_NUM_TYPES]={
sizeof(CSpritePt), //SPT_PT
sizeof(CSpriteNumPtU8s), //SPT_POLYPT
sizeof(CSpritePtPt), //SPT_LINE
sizeof(CSpriteNumU8s), //SPT_POLYLINE
sizeof(CSpriteNumU8s), //SPT_POLYLINE
sizeof(CSpritePtPt), //SPT_RECT
sizeof(CSpritePtPtAng), //SPT_ROTATED_RECT
sizeof(CSpritePtPtAng), //SPT_ROTATED_RECT
sizeof(CSpritePtRad), //SPT_CIRCLE
sizeof(CSpritePtWHAng), //SPT_ELLIPSE
sizeof(CSpritePtWHAng), //SPT_ELLIPSE
sizeof(CSpritePtWHAngSides), //SPT_POLYGON
sizeof(CSpriteNumU8s), //SPT_BSPLINE2
sizeof(CSpriteNumU8s), //SPT_BSPLINE2_CLOSED
sizeof(CSpriteNumU8s), //SPT_BSPLINE3
sizeof(CSpriteNumU8s), //SPT_BSPLINE3_CLOSED
sizeof(CSpriteNumU8s), //SPT_BSPLINE2
sizeof(CSpriteNumU8s), //SPT_BSPLINE2_CLOSED
sizeof(CSpriteNumU8s), //SPT_BSPLINE3
sizeof(CSpriteNumU8s), //SPT_BSPLINE3_CLOSED
sizeof(CSpritePt), //SPT_FLOOD_FILL
sizeof(CSpritePt), //SPT_FLOOD_FILL_NOT
sizeof(CSpritePtWHU8s), //SPT_BITMAP
sizeof(CSpriteMeshU8s), //SPT_MESH
sizeof(CSpritePtWHU8s), //SPT_BITMAP
sizeof(CSpriteMeshU8s), //SPT_MESH
sizeof(CSpritePtMeshU8s), //SPT_SHIFTABLE_MESH
sizeof(CSpritePtPt), //SPT_ARROW
sizeof(CSpritePtStr), //SPT_TEXT
+70
View File
@@ -0,0 +1,70 @@
#help_index "Misc/Host"
public Bool HostChgDsk(U8 *iso_filename)
{//Help user change CD/DVD or ISO_file.
Bool res=FALSE;
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
try {
AutoComplete;
WinBorder;
WinMax;
DocClear;
"$$PURPLE$$$$TX+CX,\"Change CD/DVD\"$$$$FG$$\n\n\n\n";
switch (ins_reg.host_vm) {
case VM_VMWARE:
if (IsDotC(iso_filename))
"
Click CDROM Icon in bottom-right border of VMware window.
Click \"Settings\".
Set ISO image to \"%s\"$FG$.
When browsing, change the file mask from \"*.iso\" to \"All Files\".
",iso_filename;
else
"
Click CDROM Icon in bottom-right border of VMware window.
Click \"Settings\".
Set ISO image to \"$FG,2$%s$FG$\"$FG$.
",iso_filename;
break;
case VM_QEMU:
"
Change to QEMU monitor using $FG,2$<CTRL-ALT-2>$FG$
Get the CDROM designation.
>$FG,2$info block$FG$
Use the designation.
>$FG,2$eject ide1-cd0$FG$
Use the designation.
>$FG,2$change ide1-cd0 %s$FG$
Change back to QEMU using $FG,2$<CTRL-ALT-1>$FG$
",iso_filename;
break;
default:
"
Place the CDDVD %s in the drive.
",iso_filename;
}
if (PressAKey!=CH_SHIFT_ESC) {
">$FG,2$ChgDsk('T');$FG$\n\n";
ChgDsk('T');
res=TRUE;
}
} catch
PutExcept;
SettingsPop;
return res;
}
+14 -14
View File
@@ -23,13 +23,13 @@ public U0 InGetStr(U8 *st)
}
}
public U0 InPrint(I64 ms=100,U8 *fmt,...)
public U0 InPrint(I64 mS=100,U8 *fmt,...)
{//Print message with delay after each char.
U8 *buf=StrPrintJoin(NULL,fmt,argc,argv),*st=buf;
I64 ch;
while (ch=*st++) {
'' ch;
Sleep(ms);
Sleep(mS);
}
Free(buf);
}
@@ -112,29 +112,29 @@ public Bool InView()
return res;
}
#help_index "InFile;Help System/Training;Input Pointer"
#help_index "InFile;Help System/Training;Mouse"
I64 in_plot_l,in_plot_r;
Bool InSetIPPlot(I64 ms,I64 x,I64 y,I64 z)
Bool InSetMsPlot(I64 mS,I64 x,I64 y,I64 z)
{
IPSet(x,y,z,in_plot_l,in_plot_r);
Sleep(ms);
MsSet(x,y,z,in_plot_l,in_plot_r);
Sleep(mS);
return TRUE;
}
public U0 InSetIP(I64 ms=7,I64 x=MAX_I64,I64 y=MAX_I64,I64 z=MAX_I64,
public U0 InSetMs(I64 mS=7,I64 x=MAX_I64,I64 y=MAX_I64,I64 z=MAX_I64,
I64 l=MAX_I64,I64 r=MAX_I64)
{//Move input pointer (mouse) to spot at certain speed.
{//Move mouse to spot at certain speed.
if (!(0<=x<GR_WIDTH))
x=ip.pos.x;
x=ms.pos.x;
if (!(0<=y<GR_HEIGHT))
y=ip.pos.y;
y=ms.pos.y;
if (z==MAX_I64)
z=ip.pos.z;
z=ms.pos.z;
if (!(FALSE<=l<=TRUE))
l=ip.lb;
l=ms.lb;
if (!(FALSE<=r<=TRUE))
r=ip.rb;
r=ms.rb;
in_plot_l=l; in_plot_r=r;
Line(ms,ip.pos.x,ip.pos.y,ip.pos.z,x,y,z,&InSetIPPlot);
Line(mS,ms.pos.x,ms.pos.y,ms.pos.z,x,y,z,&InSetMsPlot);
}
+64
View File
@@ -0,0 +1,64 @@
#help_index "Misc/Install Registration"
public CInsReg ins_reg;
MemSet(&ins_reg,0,sizeof(CInsReg));
DefineLstLoad("ST_HOST_OSES","Other\0Native\0Linux\0Windows\0");
DefineLstLoad("ST_HOST_VMS","Other\0Native\0VMware\0QEMU\0VirtualBox\0");
#define RR_UNREGISTER -1
#define RR_REGISTER 0
#define RR_REREGISTER 1
public Bool InsReg(U8 drv_let=0,I64 action=RR_REGISTER)
{//Register this install in local $LK,"Registry.HC",A="FI:~/Registry.HC"$ file.
CInsReg r;
I64 old_drv_let;
Bool res=FALSE;
if (action==RR_UNREGISTER) {
MemSet(&r,0,sizeof(CInsReg));
res=TRUE;
} else if (action==RR_REREGISTER || !ins_reg.registered) {
MemCpy(&r,&ins_reg,sizeof(CInsReg));
r.registered=TRUE;
if (PopUpForm(&r))
res=TRUE;
}
if (res) {
old_drv_let=*sys_registry_doc->filename.name;
if (drv_let)
*sys_registry_doc->filename.name=drv_let;
RegWrite("Adam/InsReg",
"#help_index \"Misc/Install Registration\"\n"
"MemSet(&ins_reg,0,sizeof(CInsReg));\n"
"ins_reg.registered=%d;\n"
"ins_reg.host_os=%d;\n"
"ins_reg.host_vm=%d;\n"
"\n#define INS_REG_PERSONAL_INITIALS \"%s\"\n"
"StrCpy(ins_reg.initials,\"%s\");\n"
"HashPublic(\"INS_REG_PERSONAL_INITIALS\",HTT_DEFINE_STR);\n"
"\n#define INS_REG_MACHINE_NUM %d\n"
"ins_reg.machine_num=%d;\n"
"HashPublic(\"INS_REG_MACHINE_NUM\",HTT_DEFINE_STR);\n"
"\n\"InsReg:%%s:%%d\\n\","
"INS_REG_PERSONAL_INITIALS,INS_REG_MACHINE_NUM;\n"
"\n#help_index \"\"\n"
,r.registered,r.host_os,r.host_vm,
r.initials,r.initials,r.machine_num,r.machine_num);
*sys_registry_doc->filename.name=old_drv_let;
RegExe("Adam/InsReg");
}
return res;
}
public Bool InsRereg(U8 drv_let=0)
{//Reregister this install in local $LK,"Registry.HC",A="FI:~/Registry.HC"$ file.
return InsReg(drv_let,RR_REREGISTER);
}
public Bool InsUnreg(U8 drv_let=0)
{//Unregister this install in local $LK,"Registry.HC",A="FI:~/Registry.HC"$ file.
return InsReg(drv_let,RR_UNREGISTER);
}
+3 -1
View File
@@ -18,6 +18,7 @@ LBts(&sys_run_level,RLf_DOC);
#include "Ctrls/MakeCtrls"
#include "InFile"
#include "ARegistry"
#include "InsReg"
#include "AutoComplete/MakeAC"
#include "God/MakeGod"
#include "AHash"
@@ -26,5 +27,6 @@ LBts(&sys_run_level,RLf_DOC);
#include "DevInfo"
#include "ADefine"
#include "WallPaper"
#include "AInputPointer"
#include "AMouse"
#include "Host"
Cd("..");;
+6 -6
View File
@@ -56,11 +56,11 @@ CMenuEntry *MenuNewSub(CCmpCtrl *cc,CTask *task)
if (cc->token==',')
Lex(cc);
if (cc->token!=',' && cc->token!=')')
tmpme->a1=LexExpressionI64(cc);
tmpme->arg1=LexExpressionI64(cc);
if (cc->token==',')
Lex(cc);
if (cc->token!=',' && cc->token!=')')
tmpme->a2=LexExpressionI64(cc);
tmpme->arg2=LexExpressionI64(cc);
if (cc->token!=')')
LexExcept(cc,"Missing ')' at ");
if (Lex(cc)!=';')
@@ -177,7 +177,7 @@ U0 DrawMenu(CDC *dc)
CMenuEntry *tmpme,*tmpse,*cur_submenu=NULL;
U8 *st=NULL;
CTask *task=MenuTask;
I64 i,w,x0,y0,x1=ip.pos.x,y1=ip.pos.y;
I64 i,w,x0,y0,x1=ms.pos.x,y1=ms.pos.y;
if (!TaskValidate(task) || !(m=task->cur_menu)) {
sys_cur_submenu_entry=NULL;
return;
@@ -206,9 +206,9 @@ U0 DrawMenu(CDC *dc)
if (y0<=y1<y0+FONT_HEIGHT) {
if (tmpse->msg_code==MSG_KEY_DOWN||
tmpse->msg_code==MSG_KEY_DOWN_UP) {
if (!tmpse->a2)
tmpse->a2=Char2ScanCode(tmpse->a1);
st=ScanCode2KeyName(tmpse->a2);
if (!tmpse->arg2)
tmpse->arg2=Char2ScanCode(tmpse->arg1);
st=ScanCode2KeyName(tmpse->arg2);
}
sys_cur_submenu_entry=cur_submenu=tmpse;
dc->color=i&15;
+3 -3
View File
@@ -19,10 +19,10 @@ BDVD_START::
MOV SP,BOOT_STK_SIZE+DVD_BOOT_LOADER_SIZE
STI
CALL BDVD_GET_IP
BDVD_GET_IP:
CALL BDVD_GET_RIP
BDVD_GET_RIP:
POP BX
SUB BX,BDVD_GET_IP-BDVD_START
SUB BX,BDVD_GET_RIP-BDVD_START
SHR BX,4
//This copies this bootloader's code to 0x$TX,"00096600",D="DD_BOOT_HIGH_LOC_DVD"$
MOV AX,CS
+3 -3
View File
@@ -21,10 +21,10 @@ BHD_CODE::
MOV SP,BOOT_STK_SIZE+MODULE_SIZE
STI
CALL BHD_GET_IP
BHD_GET_IP:
CALL BHD_GET_RIP
BHD_GET_RIP:
POP BX
SUB BX,BHD_GET_IP-BHD_START
SUB BX,BHD_GET_RIP-BHD_START
SHR BX,4
//This copies this bootloader's code to 0x$TX,"00096C00",D="DD_BOOT_HIGH_LOC_HD"$
MOV AX,CS
+7 -7
View File
@@ -30,10 +30,10 @@ BMHD_CODE::
MOV ES,AX
CALL BMHD_GET_IP
BMHD_GET_IP:
CALL BMHD_GET_RIP
BMHD_GET_RIP:
POP BX
SUB BX,BMHD_GET_IP-BMHD_START
SUB BX,BMHD_GET_RIP-BMHD_START
MOV CX,BX
SHR BX,4
//This copies this bootloader's code to 0x$TX,"00096C00",D="DD_BOOT_HIGH_LOC_MHD"$
@@ -41,8 +41,8 @@ BMHD_GET_IP:
PUSH AX
ADD AX,BX
MOV DS,AX
MOV U16 [BMHD_OLD_CS_IP-BMHD_START],CX
POP U16 [BMHD_OLD_CS_IP+2-BMHD_START]
MOV U16 [BMHD_OLD_CS_RIP-BMHD_START],CX
POP U16 [BMHD_OLD_CS_RIP+2-BMHD_START]
MOV CX,MODULE_SIZE
XOR SI,SI
@@ -57,7 +57,7 @@ BMHD_GET_IP:
DU16 BMHD_HISTART-BMHD_START,BOOT_HIGH_LOC_MHD;
BMHD_BIOS_DRV_NUM: DU8 0;
BMHD_OLD_CS_IP: DU16 0,0;
BMHD_OLD_CS_RIP: DU16 0,0;
//Gets patched by $LK,"BootHDIns",A="MN:BootHDIns"$().
BMHD_BLK_CNT:: DU16 0;
@@ -97,7 +97,7 @@ BMHD_HISTART:
LOOP @@05
MOV DL,U8 [BMHD_BIOS_DRV_NUM-BMHD_START]
MOV EBX,U32 [BMHD_OLD_CS_IP-BMHD_START]
MOV EBX,U32 [BMHD_OLD_CS_RIP-BMHD_START]
//My assembler doesn't support 16-bit very well.
DU8 0xEA; //JMP BOOT_RAM_BASE:0000
DU16 0,BOOT_RAM_BASE/16;
+4 -4
View File
@@ -15,7 +15,7 @@ BMHD2_START::
//This copies this bootloader's code to 0x$TX,"00096A00",D="DD_BOOT_HIGH_LOC_MHD2"$
MOV AX,CS
MOV DS,AX
MOV U32 [BMHD2_OLD_CS_IP-BMHD2_START],EBX
MOV U32 [BMHD2_OLD_CS_RIP-BMHD2_START],EBX
MOV U8 [BMHD2_BIOS_DRV_NUM-BMHD2_START],DL
MOV CX,MODULE_SIZE
@@ -93,9 +93,9 @@ BMHD2_HISTART:
@@10: MOV U32 [BMHD2_DAP_BLK_LO-BMHD2_START],EBX
MOV U32 [BMHD2_DAP_BLK_HI-BMHD2_START],EAX
MOV AX,U16 [BMHD2_OLD_CS_IP-BMHD2_START]
MOV AX,U16 [BMHD2_OLD_CS_RIP-BMHD2_START]
SHR AX,4
ADD AX,U16 [BMHD2_OLD_CS_IP+2-BMHD2_START]
ADD AX,U16 [BMHD2_OLD_CS_RIP+2-BMHD2_START]
MOV U16 [BMHD2_DAP_BUF+2-BMHD2_START],AX //ES:0000
MOV SI,BMHD2_DAP-BMHD2_START //DS:SI=DAP
MOV DL,U8 [BMHD2_BIOS_DRV_NUM-BMHD2_START]
@@ -115,7 +115,7 @@ BMHD2_HISTART:
//My assembler doesn't support 16-bit very well.
DU8 0xEA; //JMP xxxx:yyyy
BMHD2_OLD_CS_IP:
BMHD2_OLD_CS_RIP:
DU16 0,0;
BMHD2_END::
//Continues here $LK,"::/Adam/Opt/Boot/BootHD.HC",A="FF:::/Adam/Opt/Boot/BootHD.HC,START"$
+5 -4
View File
@@ -30,12 +30,13 @@ _extern _HI_CALL I64 HiCall(U8 *machine_code);
_extern _HI_MEMCPY U8 *HiMemCpy(U8 *dst,U8 *src,I64 cnt);
#help_index "Boot"
public U0 BootRAM(U8 *filename)
{//Softboot Kernel Bin file. No hardware reset.
public U0 BootRAM(U8 *filename=NULL)
{//Softboot Kernel.BIN file. No hardware reset.
I64 size;
CKernel *hi_image,*lo_image=sys_boot_base-sizeof(CBinFile),
CKernel *hi_image,*lo_image=mem_boot_base-sizeof(CBinFile),
reg *sys_ram_reboot;
if (!filename)
filename="::/Kernel/" KERNEL_BIN_C;
do if (!(hi_image=FileRead(filename,&size))) return;
while (hi_image<0x100000); //If alloc from low 640K, just get another copy.
+25 -20
View File
@@ -25,7 +25,27 @@ class CElTorito
U8 zero2[20];
};
U0 RedSeaISO9660(U8 *iso_filename,U8 drv_let,I64 stage2_blk=0,I64 stage2_size=0)
U0 RedSeaISO9660Stage1(U8 *iso_filename,U8 *stage2_filename)
{
CDirEntry de;
CFile *out_file=NULL;
U8 *stage1_buf=CAlloc(DVD_BOOT_LOADER_SIZE);
if (FileFind(stage2_filename,&de) && (out_file=FOpen(iso_filename,"wc+"))) {
MemCpy(stage1_buf,BDVD_START,BDVD_END-BDVD_START);
*(BDVD_BLK_LO -BDVD_START+stage1_buf)(U32 *)=de.cluster>>2;
*(BDVD_BLK_CNT -BDVD_START+stage1_buf)(U16 *)=
(de.size+DVD_BLK_SIZE-1)>>(BLK_SIZE_BITS+2);
*(BDVD_SHIFT_BLKS -BDVD_START+stage1_buf)(U16 *)=de.cluster&3;
if (de.cluster&3)
*(BDVD_BLK_CNT -BDVD_START+stage1_buf)(U16 *)+=1;
FWBlks(out_file,stage1_buf,
20<<2+1<<2,DVD_BOOT_LOADER_SIZE/BLK_SIZE);
FClose(out_file);
}
Free(stage1_buf);
}
U0 RedSeaISO9660(U8 *iso_filename,U8 drv_let)
{
CDrv *dv=Let2Drv(drv_let);
CISO1PriDesc *iso_pri=CAlloc(DVD_BLK_SIZE),
@@ -35,8 +55,7 @@ U0 RedSeaISO9660(U8 *iso_filename,U8 drv_let,I64 stage2_blk=0,I64 stage2_size=0)
I64 iso_size=0,i,j;
U32 *d;
CElTorito *et=CAlloc(DVD_BLK_SIZE);
U8 *stage1_buf=CAlloc(DVD_BOOT_LOADER_SIZE),
*zero_buf=CAlloc(DVD_BLK_SIZE);
U8 *zero_buf=CAlloc(DVD_BLK_SIZE);
CFile *out_file=NULL;
if (out_file=FOpen(iso_filename,"wc+")) {
@@ -87,20 +106,9 @@ U0 RedSeaISO9660(U8 *iso_filename,U8 drv_let,I64 stage2_blk=0,I64 stage2_size=0)
et->sect_cnt=4; //5 seems like the limit, 4 is safer
et->load_rba=20<<2>>2+1;
FWBlks(out_file,et,20<<2,4);
MemCpy(stage1_buf,BDVD_START,BDVD_END-BDVD_START);
*(BDVD_BLK_LO -BDVD_START+stage1_buf)(U32 *)=stage2_blk>>2;
*(BDVD_BLK_CNT -BDVD_START+stage1_buf)(U16 *)=
(stage2_size+DVD_BLK_SIZE-1)>>(BLK_SIZE_BITS+2);
*(BDVD_SHIFT_BLKS -BDVD_START+stage1_buf)(U16 *)=stage2_blk&3;
if (stage2_blk&3)
*(BDVD_BLK_CNT -BDVD_START+stage1_buf)(U16 *)+=1;
FWBlks(out_file,stage1_buf,
20<<2+1<<2,DVD_BOOT_LOADER_SIZE/BLK_SIZE);
FClose(out_file);
}
Free(zero_buf);
Free(stage1_buf);
Free(et);
Free(iso_pri);
Free(iso_boot);
@@ -129,7 +137,7 @@ public I64 RedSeaISO(U8 *_iso_filename=NULL,U8 *_src_dir,
U8 *_stage2_filename=NULL)
{//See $LK,"::/Misc/DoDistro.HC"$. Must be ISO.C
I64 i,res,root_cnt,root_dir_blks,bitmap_blks,bitmap_blks1;
CDirEntry *tmpde,de;
CDirEntry *tmpde;
U8 buf[STR_LEN],*iso_filename,*src_dir,*stage2_filename;
CDrv *dv=DrvMakeFreeSlot(DrvNextFreeLet('Q')); //First $LK,"BDT_ISO_FILE_WRITE",A="MN:BDT_ISO_FILE_WRITE"$
CBlkDev *bd=BlkDevNextFreeSlot(dv->drv_let,BDT_ISO_FILE_WRITE);
@@ -162,13 +170,10 @@ public I64 RedSeaISO(U8 *_iso_filename=NULL,U8 *_src_dir,
bd->max_blk--; //Inclusive.
bd->file_dsk_name=AStrNew(iso_filename);
bd->init_root_dir_blks=root_dir_blks;
BlkDevAdd(bd,TRUE,TRUE);
BlkDevAdd(bd,,TRUE,TRUE);
StrPrint(buf,"%C:/",dv->drv_let);
CopyTree(src_dir,buf,TRUE);
if (FileFind(stage2_filename,&de))
RedSeaISO9660(iso_filename,dv->drv_let,de.cluster,de.size);
else
RedSeaISO9660(iso_filename,dv->drv_let);
RedSeaISO9660Stage1(iso_filename,stage2_filename);
DrvDel(dv);
BlkDevDel(bd);
}
@@ -1,4 +1,45 @@
#help_index "DolDoc"
#help_index "DolDoc/Cmd Line (Typically)"
U0 CursorRemFile(U8 *filename)
{//Rem ASCII 5 cursor from one file.
CDoc *doc=DocRead(filename,DOCF_PLAIN_TEXT|DOCF_NO_CURSOR);
DocWrite(doc);
DocDel(doc);
}
public U0 CursorRem(U8 *files_find_mask="*")
{//Rem ASCII 5 cursor.
I64 fuf_flags=0;
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+T+f+F+O");
CDirEntry *tmpde=FilesFind(files_find_mask,fuf_flags),*tmpde1=tmpde;
while (tmpde) {
CursorRemFile(tmpde->full_name);
Touch(tmpde->full_name,"",,tmpde->datetime);
tmpde=tmpde->next;
}
DirTreeDel(tmpde1);
}
U0 CollapseFile(U8 *filename,Bool collapse=TRUE)
{//Collapse $LK,"DolDoc",A="FI:::/Doc/DolDocOverview.DD"$ trees in one file.
CDoc *doc=DocRead(filename,DOCF_NO_CURSOR);
DocCollapse(collapse,doc);
DocWrite(doc);
DocDel(doc);
}
public U0 Collapse(U8 *files_find_mask="*",
Bool collapse=TRUE,U8 *fu_flags=NULL)
{//Collapse $LK,"DolDoc",A="FI:::/Doc/DolDocOverview.DD"$ trees.
I64 fuf_flags=0;
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+f+F+$$+O");
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
CDirEntry *tmpde=FilesFind(files_find_mask,fuf_flags),*tmpde1=tmpde;
while (tmpde && !Bt(&fuf_flags,FUf_CANCEL)) {
CollapseFile(tmpde->full_name,collapse);
Touch(tmpde->full_name,"",,tmpde->datetime);
tmpde=tmpde->next;
}
DirTreeDel(tmpde1);
}
I64 DocOptEntry(CDoc *,CDocEntry *doc_e,I64 fuf_flags)
{
@@ -48,7 +89,6 @@ I64 DocOptEntry(CDoc *,CDocEntry *doc_e,I64 fuf_flags)
}
return res;
}
I64 DocOptDoc(CDoc *doc,I64 fuf_flags)
{//Optimize Doc.
Bool unlock=DocLock(doc);
@@ -76,9 +116,8 @@ I64 DocOptDoc(CDoc *doc,I64 fuf_flags)
DocUnlock(doc);
return res;
}
I64 DocOptFile(U8 *filename,I64 fuf_flags)
{//Optimize File.
{//Optimize file.
I64 res;
CDoc *doc=DocRead(filename);
if (res=DocOptDoc(doc,fuf_flags)) {
@@ -107,7 +146,7 @@ I64 DocOptLst(CDirEntry *tmpde,I64 fuf_flags)
return res;
}
public I64 DocOpt(U8 *files_find_mask="*",U8 *fu_flags=NULL)
{//Optimize $LK,"DolDoc",A="FI:::/Doc/DolDocOverview.DD"$ Files, eliminating aux_str's and .Z's.
{//Optimize $LK,"DolDoc",A="FI:::/Doc/DolDocOverview.DD"$ files, eliminating aux_str's and .Z's.
//+R flag for aggressively risky.
I64 fuf_flags=0;
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+$$");
+18 -18
View File
@@ -35,10 +35,10 @@ U0 HeapLogMAlloc(U8 *addr)
i=addr>>3 &(HL_HASH_SIZE-1);
PUSHFD
CLI
while (LBts(&sys_semas[SYS_SEMA_HEAPLOG_LOCK],0))
while (LBts(&sys_semas[SEMA_HEAPLOG_LOCK],0))
PAUSE
QueIns(tmphl,heaplog_head[i].last);
LBtr(&sys_semas[SYS_SEMA_HEAPLOG_LOCK],0);
LBtr(&sys_semas[SEMA_HEAPLOG_LOCK],0);
POPFD
}
}
@@ -52,20 +52,20 @@ U0 HeapLogFree(U8 *addr)
i=addr>>3 &(HL_HASH_SIZE-1);
PUSHFD
CLI
while (LBts(&sys_semas[SYS_SEMA_HEAPLOG_LOCK],0))
while (LBts(&sys_semas[SEMA_HEAPLOG_LOCK],0))
PAUSE
tmphl=heaplog_head[i].next;
while (tmphl!=&heaplog_head[i]) {
if (addr==tmphl->addr) {
QueRem(tmphl);
LBtr(&sys_semas[SYS_SEMA_HEAPLOG_LOCK],0);
LBtr(&sys_semas[SEMA_HEAPLOG_LOCK],0);
POPFD
Free(tmphl);
return;
}
tmphl=tmphl->next;
}
LBtr(&sys_semas[SYS_SEMA_HEAPLOG_LOCK],0);
LBtr(&sys_semas[SEMA_HEAPLOG_LOCK],0);
POPFD
}
}
@@ -74,7 +74,7 @@ public Bool HeapLog(Bool val=ON,CTask *task=NULL)
{//Turn on. Collect data. Call $LK,"HeapLogAddrRep",A="MN:HeapLogAddrRep"$() or $LK,"HeapLogSizeRep",A="MN:HeapLogSizeRep"$().
I64 i;
if (val) {
if (Bt(&sys_semas[SYS_SEMA_HEAPLOG_ACTIVE],0)) {
if (Bt(&sys_semas[SEMA_HEAPLOG_ACTIVE],0)) {
"HeapLog Already Active\n";
return TRUE;
} else {
@@ -85,7 +85,7 @@ public Bool HeapLog(Bool val=ON,CTask *task=NULL)
heaplog_hc_watched=task;//Actually, not a task, must be a HeapCtrl.
PUSHFD
CLI
while (LBts(&sys_semas[SYS_SEMA_HEAPLOG_LOCK],0))
while (LBts(&sys_semas[SEMA_HEAPLOG_LOCK],0))
PAUSE
heaplog_hc=HeapCtrlInit(,,sys_data_bp);
ext[EXT_HEAPLOG_MALLOC]=&HeapLogMAlloc;
@@ -93,13 +93,13 @@ public Bool HeapLog(Bool val=ON,CTask *task=NULL)
heaplog_head=MAlloc(sizeof(CHeapLogHash)*HL_HASH_SIZE,heaplog_hc);
for (i=0;i<HL_HASH_SIZE;i++)
QueInit(&heaplog_head[i]);
LBtr(&sys_semas[SYS_SEMA_HEAPLOG_LOCK],0);
LBtr(&sys_semas[SEMA_HEAPLOG_LOCK],0);
POPFD
LBts(&sys_semas[SYS_SEMA_HEAPLOG_ACTIVE],0);
LBts(&sys_semas[SEMA_HEAPLOG_ACTIVE],0);
return FALSE;
}
} else {
if (!LBtr(&sys_semas[SYS_SEMA_HEAPLOG_ACTIVE],0)) {
if (!LBtr(&sys_semas[SEMA_HEAPLOG_ACTIVE],0)) {
"HeapLog Not Active\n";
return FALSE;
} else {
@@ -116,12 +116,12 @@ public U0 HeapLogAddrRep(Bool leave_it=OFF)
{//Call $LK,"HeapLog",A="MN:HeapLog"$() first and collect data.
I64 i,j,total=0;
CHeapLog *tmphl,hl;
if (!LBtr(&sys_semas[SYS_SEMA_HEAPLOG_ACTIVE],0)) {
if (!LBtr(&sys_semas[SEMA_HEAPLOG_ACTIVE],0)) {
"HeapLog Not Active\n";
return;
}
"$$WW,0$$";
while (LBts(&sys_semas[SYS_SEMA_HEAPLOG_LOCK],0))
while (LBts(&sys_semas[SEMA_HEAPLOG_LOCK],0))
PAUSE
for (i=0;i<HL_HASH_SIZE;i++) {
tmphl=heaplog_head[i].next;
@@ -136,9 +136,9 @@ public U0 HeapLogAddrRep(Bool leave_it=OFF)
tmphl=hl.next;
}
}
LBtr(&sys_semas[SYS_SEMA_HEAPLOG_LOCK],0);
LBtr(&sys_semas[SEMA_HEAPLOG_LOCK],0);
"\n$$LTRED$$Total:%08X$$FG$$\n",total;
LBts(&sys_semas[SYS_SEMA_HEAPLOG_ACTIVE],0);
LBts(&sys_semas[SEMA_HEAPLOG_ACTIVE],0);
if (!leave_it)
HeapLog(OFF);
}
@@ -148,7 +148,7 @@ public U0 HeapLogSizeRep(Bool leave_it=OFF)
I64 i,j,k,total=0;
CHeapLog *tmphla,hla,*tmphls,*tmphls1;
CHeapLogHash *size_head;
if (!LBtr(&sys_semas[SYS_SEMA_HEAPLOG_ACTIVE],0)) {
if (!LBtr(&sys_semas[SEMA_HEAPLOG_ACTIVE],0)) {
"HeapLog Not Active\n";
return;
}
@@ -158,7 +158,7 @@ public U0 HeapLogSizeRep(Bool leave_it=OFF)
QueInit(&size_head[i]);
"$$WW,0$$";
while (LBts(&sys_semas[SYS_SEMA_HEAPLOG_LOCK],0))
while (LBts(&sys_semas[SEMA_HEAPLOG_LOCK],0))
PAUSE
for (i=0;i<HL_HASH_SIZE;i++) {
tmphla=heaplog_head[i].next;
@@ -187,7 +187,7 @@ hl_found:
tmphla=hla.next;
}
}
LBtr(&sys_semas[SYS_SEMA_HEAPLOG_LOCK],0);
LBtr(&sys_semas[SEMA_HEAPLOG_LOCK],0);
for (i=0;i<HL_HASH_SIZE;i++) {
tmphls=size_head[i].next;
@@ -205,7 +205,7 @@ hl_found:
Free(size_head);
"\n$$LTRED$$Total:%08X$$FG$$\n",total;
LBts(&sys_semas[SYS_SEMA_HEAPLOG_ACTIVE],0);
LBts(&sys_semas[SEMA_HEAPLOG_ACTIVE],0);
if (!leave_it)
HeapLog(OFF);
}
+2
View File
@@ -9,6 +9,8 @@ Cd(__DIR__);;
#include "Merge"
#include "Profiler"
#include "StrUtils"
#include "DocUtils"
#include "ToDolDoc"
#include "ToTXT"
#include "TOS"
Cd("..");;
+12 -11
View File
@@ -35,11 +35,11 @@ I64 TaskStkSize(CTask *task)
I64 TaskQueSize(CTask *task)
{
CSrvCmd *tmpc,*tmpc1;
CJob *tmpc,*tmpc1;
I64 res=0;
PUSHFD
CLI
while (LBts(&task->srv_ctrl.flags,SVCRf_LOCKED))
while (LBts(&task->srv_ctrl.flags,JOBCf_LOCKED))
PAUSE
tmpc1=&task->srv_ctrl.next_waiting;
@@ -56,7 +56,7 @@ I64 TaskQueSize(CTask *task)
tmpc=tmpc->next;
}
LBtr(&task->srv_ctrl.flags,SVCRf_LOCKED);
LBtr(&task->srv_ctrl.flags,JOBCf_LOCKED);
POPFD
return res;
}
@@ -101,7 +101,7 @@ Bool MemRepTask(CTask *task,Bool override_validate=FALSE)
if (task==Fs)
task->rsp=GetRSP;
st=MStrUtil(task->task_title,SUF_REM_CTRL_CHARS|SUF_SAFE_DOLLAR);
"$$BLACK$$%-25ts %010X$$FG$$\n$$ID,2$$",st,task;
"$$BLACK$$%-27ts#%08X$$FG$$\n$$ID,2$$",st,task;
Free(st);
"Heap\t:%010X/%010X\n",TaskMemUsed(task,override_validate),
TaskMemAlloced(task,override_validate);
@@ -114,6 +114,8 @@ Bool MemRepTask(CTask *task,Bool override_validate=FALSE)
"Stk\t\t:$$RED$$$$BK,1$$Overflow$$BK,0$$$$FG$$/%010X\n",j;
"HashTable\t:%010X\n",HashTableSize2(task->hash_table);
"FPU\t\t:%010X\n",MSize2(task->fpu_mmx);
"CurDir\t:%010X\n",MSize2(task->cur_dir);
if (pdoc=DocPut(task))
"PutDoc\t:%010X\n",DocSize(pdoc);
@@ -124,7 +126,7 @@ Bool MemRepTask(CTask *task,Bool override_validate=FALSE)
cc=task->next_cc;
while (cc!=&task->next_cc) {
"Lex\t\t:%010X\n",CmpCtrlSize(cc);
"CmpCtrl\t:%010X\n",CmpCtrlSize(cc);
cc=cc->next;
}
@@ -136,7 +138,7 @@ Bool MemRepTask(CTask *task,Bool override_validate=FALSE)
if (task==sys_winmgr_task) {
"gr.pen_brushes\t:%010X\n",PenBrushesSize;
"gr_scrn_zoom_tbles:%010X\n",ScrnZoomTablesSize;
"gr.scrn_zoom_tbles\t:%010X\n",ScrnZoomTablesSize;
} else if (task==adam_task) {
j=0;k=0;m=0;n=0;
for (i=0;i<mp_cnt;i++) {
@@ -194,18 +196,17 @@ public U0 MemRep()
I64 i;
CTask *task;
CCPU *c;
CBinFile *bfh=sys_boot_base-sizeof(CBinFile);
CBinFile *bfh=mem_boot_base-sizeof(CBinFile);
bfh(I64)+=bfh->file_size-1;
"$$BLACK$$Low Memory\t:0000100000$$FG$$\n$$ID,2$$";
"Kernel\t:%010X-%010X\n",sys_boot_base-sizeof(CBinFile),bfh;
"Kernel\t:%010X-%010X\n",mem_boot_base-sizeof(CBinFile),bfh;
"VGA\t\t:00000A0000-00000BFFFF\n";
"$$ID,-2$$$$BLACK$$High Memory\t:0000100000-%010X$$FG$$\n",
sys_heap_limit;
"$$ID,2$$Fixed Area for page tables and misc\n\t\t:%010X-%010X\n",
mem_heap_limit;
"$LK,"SYS_FIXED_AREA",A="MN:CSysFixedArea"$\t:%010X-%010X\n",
SYS_FIXED_AREA,SYS_FIXED_AREA+sizeof(CSysFixedArea)-1;
"$$ID,-2$$";
if (sys_data_bp) {
"$$BLACK$$Code Heap\t:%010X/%010X$$FG$$\n",
+6 -6
View File
@@ -56,7 +56,7 @@ I64 ProfCompare(U8 *i1,U8 *i2)
public U0 ProfRep(I64 filter_cnt=1,Bool leave_it=OFF)
{//Profiler report. Call $LK,"Prof",A="MN:Prof"$() first and collect data.
I64 i,hits,ip,last_ip=0,routine_total=0;
I64 i,hits,rip,last_rip=0,routine_total=0;
F64 total_time;
U8 buf[256],buf2[256],last_buf[256];
if (!LBtr(&pf_prof_active,0))
@@ -69,12 +69,12 @@ public U0 ProfRep(I64 filter_cnt=1,Bool leave_it=OFF)
QSortI64(pf_array,pf_buf_in_ptr,&ProfCompare);
*last_buf=0;
for (i=0;i<pf_buf_in_ptr;i+=hits) {
ip=pf_array[i];
rip=pf_array[i];
hits=0;
do hits++;
while (i+hits<pf_buf_in_ptr && pf_array[i+hits]==ip);
while (i+hits<pf_buf_in_ptr && pf_array[i+hits]==rip);
StrPrint(buf,"%p",ip);
StrPrint(buf,"%p",rip);
StrFirstRem(buf,"+",buf2);
if (StrCmp(buf2,last_buf)) {
if (*last_buf && routine_total>=filter_cnt)
@@ -85,8 +85,8 @@ public U0 ProfRep(I64 filter_cnt=1,Bool leave_it=OFF)
}
routine_total+=hits;
if (hits>=filter_cnt) {
"%6.2f %08X:%P\n",100*hits/total_time,hits,ip;
last_ip=ip;
"%6.2f %08X:%P\n",100*hits/total_time,hits,rip;
last_rip=rip;
}
}
if (*last_buf && routine_total>=filter_cnt)
+5 -5
View File
@@ -69,7 +69,7 @@ public I64 Sort(U8 *_in_name,U8 *_out_name=NULL,
return res; //Num Entries
}
I64 DocWordsFile(CDoc *doc_out=NULL,U8 *filename,U32 *chars_bmp)
I64 DocWordsFile(CDoc *doc_out=NULL,U8 *filename,U32 *char_bmp)
{
U8 *ptr,*ptr2;
I64 res=0,ch;
@@ -79,11 +79,11 @@ I64 DocWordsFile(CDoc *doc_out=NULL,U8 *filename,U32 *chars_bmp)
if (doc_e->de_flags & DOCEF_TAG) {
ptr=doc_e->tag;
while (*ptr) {
while (*ptr && !Bt(chars_bmp,*ptr))
while (*ptr && !Bt(char_bmp,*ptr))
ptr++;
ptr2=ptr;
while (*ptr && Bt(chars_bmp,*ptr))
while (*ptr && Bt(char_bmp,*ptr))
ptr++;
ch=*ptr;
@@ -100,7 +100,7 @@ I64 DocWordsFile(CDoc *doc_out=NULL,U8 *filename,U32 *chars_bmp)
DocDel(doc_in);
return res;
}
public I64 Words(U8 *files_find_mask="*",U32 *chars_bmp=chars_bmp_alpha,
public I64 Words(U8 *files_find_mask="*",U32 *char_bmp=char_bmp_alpha,
U8 *fu_flags=NULL)
{//Break file into list of not-unique words.
I64 fuf_flags=0,res=0;
@@ -110,7 +110,7 @@ public I64 Words(U8 *files_find_mask="*",U32 *chars_bmp=chars_bmp_alpha,
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
tmpde=tmpde1=FilesFind(files_find_mask,fuf_flags);
while (tmpde) {
res+=DocWordsFile(doc_out,tmpde->full_name,chars_bmp);
res+=DocWordsFile(doc_out,tmpde->full_name,char_bmp);
tmpde=tmpde->next;
}
DirTreeDel(tmpde1);
+47
View File
@@ -0,0 +1,47 @@
#help_index "Misc/TOS"
public U0 TOSStaffIns()
{//Completes TOS install from TempleOSStaff.ISO
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
AutoComplete;
WinBorder;
WinMax;
DocClear;
"$$PURPLE$$$$TX+CX,\"Complete TOS install from TempleOSStaff.ISO\"$$$$FG$$\n\n\n\n";
InsRereg;
if (HostChgDsk("/home/tad/TAD/Site1/Wb/TempleOSSup1.ISO.C"))
CopyTree("T:/","~/Sup1");
if (HostChgDsk("/home/tad/TAD/Site1Stale/files/TempleOSBooks1.ISO.C"))
CopyTree("T:/","~/Books1");
if (HostChgDsk("/home/tad/TAD/Site1Stale/files/TempleOSBooks2.ISO.C"))
CopyTree("T:/","~/Books2");
SettingsPop;
Once("TOSBootHDIns;\"\n\nRun TOSRegen;\n\n\n\";");
if (PressAKey!=CH_SHIFT_ESC)
Reboot;
}
public U0 TOSStdIns()
{//Completes TOS install from TempleOSCD.ISO
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
AutoComplete;
WinBorder;
WinMax;
DocClear;
"$$PURPLE$$$$TX+CX,\"Complete TOS install from TempleOSCD.ISO\"$$$$FG$$\n\n\n\n";
InsRereg;
if (FileFind("/Demo/AcctExample"))
Copy("::/Demo/AcctExample/*","~");
if (HostChgDsk("/home/tad/Downloads/TempleOSSup1.ISO.C"))
CopyTree("T:/","~/Sup1");
if (HostChgDsk("/home/tad/Downloads/TempleOSWeb.ISO.C"))
CopyTree("T:/","~/Web");
if (HostChgDsk("/home/tad/Downloads/TempleOSBooks1.ISO.C"))
CopyTree("T:/","~/Books1");
if (HostChgDsk("/home/tad/Downloads/TempleOSBooks2.ISO.C"))
CopyTree("T:/","~/Books2");
SettingsPop;
Once("TOSBootHDIns;\"\n\nRun TOSRegen;\n\n\n\";");
if (PressAKey!=CH_SHIFT_ESC)
Reboot;
}
+1 -1
View File
@@ -10,7 +10,7 @@ class CSndWaveCtrl
public U0 SndTaskEndCB()
{//Will turn-off snd when a task gets killed.
Snd(0);
Snd;
Exit;
}
+32 -28
View File
@@ -5,8 +5,9 @@
class CSoundEffectFrame
{
I32 type;
F64 duration,freq1,freq2;
I32 type;
I8 ona1,ona2;
F64 duration;
};
U0 SoundEffectEndTaskCB()
@@ -18,57 +19,60 @@ U0 SoundEffectEndTaskCB()
U0 SoundEffectTask(CSoundEffectFrame *ns)
{
I64 i;
F64 f,t0=tS,t,timeout=t0+ns->duration;
I64 i,ona;
F64 t0=tS,t,timeout=t0+ns->duration;
FramePtrAdd("CSoundEffectFrame",ns);
Fs->task_end_cb=&SoundEffectEndTaskCB;
switch (ns->type) {
case SE_NOISE:
i=MaxI64(ns->freq2-ns->freq1,1);
while (tS<timeout)
if (f=RandU16%i+ns->freq1) {
Snd(f);
Sleep(ClampI64(3000/f,1,50));
} else
break;
i=MaxI64(ns->ona2-ns->ona1,1);
while (tS<timeout) {
ona=RandU16%i+ns->ona1;
Snd(ona);
t=Clamp(3000.0/Ona2Freq(ona),1.0,50.0);
if (t+tS>timeout)
t=timeout-tS;
Sleep(t);
}
break;
case SE_SWEEP:
while (tS<timeout) {
t=(tS-t0)/ns->duration;
if (f=(1.0-t)*ns->freq1+t*ns->freq2) {
Snd(f);
Sleep(ClampI64(3000/f,1,50));
} else
break;
ona=(1.0-t)*ns->ona1+t*ns->ona2;
Snd(ona);
t=Clamp(3000.0/Ona2Freq(ona),1.0,50.0);
if (t+tS>timeout)
t=timeout-tS;
Sleep(t);
}
break;
}
}
public CTask *Noise(I64 ms,F64 min_freq,F64 max_freq)
{//Make white noise for given number of ms.
public CTask *Noise(I64 mS,F64 min_ona,F64 max_ona)
{//Make white noise for given number of mS.
CSoundEffectFrame *ns;
if (ms>0) {
if (mS>0) {
ns=MAlloc(sizeof(CSoundEffectFrame));
ns->type=SE_NOISE;
ns->duration=ms/1000.0;
ns->freq1=min_freq;
ns->freq2=max_freq;
ns->duration=mS/1000.0;
ns->ona1=min_ona;
ns->ona2=max_ona;
music.mute++;
return Spawn(&SoundEffectTask,ns,"Noise",,Fs);
} else
return NULL;
}
public CTask *Sweep(I64 ms,F64 freq1,F64 freq2)
{//Sweep through freq range in given number of ms.
public CTask *Sweep(I64 mS,F64 ona1,F64 ona2)
{//Sweep through freq range in given number of mS.
CSoundEffectFrame *ns;
if (ms>0) {
if (mS>0) {
ns=MAlloc(sizeof(CSoundEffectFrame));
ns->type=SE_SWEEP;
ns->duration=ms/1000.0;
ns->freq1=freq1;
ns->freq2=freq2;
ns->duration=mS/1000.0;
ns->ona1=ona1;
ns->ona2=ona2;
music.mute++;
return Spawn(&SoundEffectTask,ns,"Noise",,Fs);
} else
+2 -1
View File
@@ -67,7 +67,8 @@ public I64 SndFileCreate(U8 *base_filename,F64 normalized_vol=1.0,
d1=d->next;
dt=d1->time-d->time;
cnt2=dt*SNDFILE_SAMPLE_RATE;
SndWaveAddBuf(swc,&s->body[k],cnt2,d->freq,waveform,normalized_vol);
SndWaveAddBuf(swc,&s->body[k],cnt2,
Ona2Freq(d->ona),waveform,normalized_vol);
k+=cnt2;
QueRem(d);
Free(d);
+21 -3
View File
@@ -77,9 +77,27 @@ public F64 FullTri(F64 t,F64 period)
}
#help_index "Snd/Math"
public F64 Note2Freq(I64 note,I64 octave=3)
{//Note number in octave to freq.
return 440.0*2.0`(octave-3+note/12.0);
public I8 Note2Ona(I64 note,I64 octave=4)
{//Note to ona. Mid C is ona=51, note=3 and octave=4.
if (note<3)
return (octave+1)*12+note;
else
return octave*12+note;
}
public I8 Ona2Note(I8 ona)
{//Ona to note in octave. Mid C is ona=51, note=3 and octave=4.
return ona%12;
}
public I8 Ona2Octave(I8 ona)
{//Ona to octave. Mid C is ona=51, note=3 and octave=4.
I64 note=ona%12,octave=ona/12;
if (note<3)
return octave-1;
else
return octave;
}
F64 SinPhaseCont(F64 last_y,F64 last_dydt,
+13 -13
View File
@@ -16,7 +16,7 @@ public class CMusicGlbls
I64 play_note_num;
F64 tM_correction,last_Beat,last_tM;
} music={NULL,NULL,3,1.0,{0,2,3,5,7,8,10},FALSE,4,4,2.5,0.9,0,0,0,0};
} music={NULL,NULL,4,1.0,{0,2,3,5,7,8,10},FALSE,4,4,2.5,0.9,0,0,0,0};
#help_index "Snd/Music;Time/Seconds"
public F64 tM()
@@ -30,7 +30,7 @@ public F64 Beat()
PUSHFD
CLI
if (mp_cnt>1)
while (LBts(&sys_semas[SYS_SEMA_TMBEAT],0))
while (LBts(&sys_semas[SEMA_TMBEAT],0))
PAUSE
cur_tM=tM;
res=music.last_Beat;
@@ -38,7 +38,7 @@ public F64 Beat()
res+=(cur_tM-music.last_tM)*music.tempo;
music.last_tM=cur_tM;
music.last_Beat=res;
LBtr(&sys_semas[SYS_SEMA_TMBEAT],0);
LBtr(&sys_semas[SEMA_TMBEAT],0);
POPFD
return res;
}
@@ -99,7 +99,7 @@ public U0 Play(U8 *st,U8 *words=NULL)
{/* Notes are entered with a capital letter.
Octaves are entered with a digit and
stay set until changed.
stay set until changed. Mid C is octave 4.
Durations are entered with
'w' whole note
@@ -127,9 +127,9 @@ per second. It defaults to
2.5 and gets faster when bigger.
*/
U8 *word,*last_st;
I64 note,i=0,timeout_val,timeout_val2;
I64 note,i=0,ona,timeout_val,timeout_val2;
Bool tie;
F64 f,d,on_jiffies,off_jiffies;
F64 d,on_jiffies,off_jiffies;
music.play_note_num=0;
while (*st) {
timeout_val=cnts.jiffies;
@@ -158,9 +158,9 @@ per second. It defaults to
note++;
st++;
}
f=Note2Freq(note,music.octave);
ona=Note2Ona(note,music.octave);
} else
f=0;
ona=ONA_REST;
if (words && (word=LstSub(i++,words)) && StrCmp(word," "))
"%s",word;
d=JIFFY_FREQ*music.note_len/music.tempo;
@@ -175,12 +175,12 @@ per second. It defaults to
timeout_val2=timeout_val+off_jiffies;
if (!music.mute)
Snd(f);
Snd(ona);
SleepUntil(timeout_val);
music.tM_correction+=on_jiffies-ToI64(on_jiffies);
if (!music.mute)
Snd(0);
Snd;
SleepUntil(timeout_val2);
music.tM_correction+=off_jiffies-ToI64(off_jiffies);
@@ -193,7 +193,7 @@ U0 MusicSettingsRst()
music.play_note_num=0;
music.stacatto_factor=0.9;
music.tempo=2.5;
music.octave=3;
music.octave=4;
music.note_len=1.0;
music.meter_top=4;
music.meter_bottom=4;
@@ -201,11 +201,11 @@ U0 MusicSettingsRst()
PUSHFD
CLI
if (mp_cnt>1)
while (LBts(&sys_semas[SYS_SEMA_TMBEAT],0))
while (LBts(&sys_semas[SEMA_TMBEAT],0))
PAUSE
music.last_tM=tM;
music.last_Beat=0.0;
LBtr(&sys_semas[SYS_SEMA_TMBEAT],0);
LBtr(&sys_semas[SEMA_TMBEAT],0);
POPFD
}
+1 -1
View File
@@ -23,7 +23,7 @@ public U0 TaskRep()
CLI
for (i=0;i<mp_cnt;i++) {
c=&cpu_structs[i];
"$$PURPLE$$CPU:%d$$FG$$\n",i;
"$$PURPLE$$CPU%02X$$FG$$\n",i;
TaskRepTask(c->seth_task,2);
}
POPFD
+2 -2
View File
@@ -18,7 +18,7 @@ public CTaskSettings *SettingsPush(CTask *task=NULL,I64 flags=0)
if (!(flags&TSF_SAME_SONG)) {
if (tmpse->song_task=task->song_task) {
Suspend(task->song_task);
Snd(0);
Snd;
}
task->song_task=NULL;
}
@@ -83,7 +83,7 @@ U0 SettingsPop2(CTask *task,CTaskSettings *tmpse)
StrCpy(task->task_title,tmpse->task_title);
AutoComplete(tmpse->autocomplete);
GrPaletteSet(tmpse->palette);
Snd(0);
Snd;
}
public U0 SettingsPop(CTask *task=NULL,I64 flags=0)
+11 -11
View File
@@ -1,6 +1,6 @@
#help_index "Help System"
U8 *KeyMapKeyMStrPrint(I64 sc,U0 (*fp_handler)(I64 sc),
U8 *KeyMapKeyMStrPrint(I64 sc,U0 (*fp_hndlr)(I64 sc),
U8 *desc,CTask *task=NULL)
{
I64 i=9,k,c;
@@ -12,7 +12,7 @@ U8 *KeyMapKeyMStrPrint(I64 sc,U0 (*fp_handler)(I64 sc),
if (sc&(SCF_SHIFT|SCF_NO_SHIFT)) i+=6;
if (TaskValidate(task))
Fs->hash_table=task->hash_table;
st2=SrcEdLink(fp_handler,256);
st2=SrcEdLink(fp_hndlr,256);
Fs->hash_table=old_hash;
k=*desc(U32 *);
@@ -36,9 +36,9 @@ 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_hndlr)(I64 sc),U8 *desc,CTask *task=NULL)
{
U8 *st=KeyMapKeyMStrPrint(sc,fp_handler,desc,task);
U8 *st=KeyMapKeyMStrPrint(sc,fp_hndlr,desc,task);
"%s",st;
Free(st);
}
@@ -98,22 +98,22 @@ I64 KMCompare(U8 *e1,U8 *e2)
U0 KeyMapFamily2(U8 **entries,CTask *task,I64 scf)
{
I64 i,a1,a2;
I64 i,arg1,arg2;
for (i=0;i<256;i++) {
a2=scf|i|SCF_KEY_DESC;
a1=ScanCode2Char(a2);
arg2=scf|i|SCF_KEY_DESC;
arg1=ScanCode2Char(arg2);
*keydev.desc=0;
keydev.handler=NULL;
keydev.hndlr=NULL;
if (TaskValidate(task) && !Bt(&task->win_inhibit,WIf_SELF_KEY_DESC)) {
if (task==Fs)
PutKey(a1,a2);
PutKey(arg1,arg2);
else
PostMsg(task,MSG_KEY_DOWN,a1,a2);
PostMsg(task,MSG_KEY_DOWN,arg1,arg2);
Refresh(0,TRUE);
Sleep(1); //Open loop because might be no response. TODO: Drops msgs.
}
if (*keydev.desc && StrNCmp(keydev.desc,"Char /",7))
entries[i]=KeyMapKeyMStrPrint(a2,keydev.handler,keydev.desc,task);
entries[i]=KeyMapKeyMStrPrint(arg2,keydev.hndlr,keydev.desc,task);
}
}
BIN
View File
Binary file not shown.
+61 -47
View File
@@ -1,9 +1,8 @@
#help_index "Windows"
#help_file "::/Doc/Windows"
CIPStateGlbls old_ip={IP_NULL,{-1000,-1000,0},{-1000,-1000,0},{-1000,-1000,0},
{0,0,0},{1.0,1.0,1.0},
0,(MAX_I32+1)>>3,0.0,GetTSC,0.350,0,0,
CMsStateGlbls old_ms={{-1000,-1000,0},{-1000,-1000,0},{-1000,-1000,0},
{0,0,0},{1.0,1.0,1.0},0.0,GetTSC,0.350,0,0,
FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE
};
@@ -11,9 +10,22 @@ public CWinMgrGlbls winmgr={0,0,0,WINMGR_FPS,tS,NULL,FALSE,FALSE,FALSE};
winmgr.t=CAlloc(sizeof(CWinMgrTimingGlbls));
winmgr.t->last_calc_idle_time=tS;
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);
}
}
#define PROGRESS_BAR_HEIGHT 20
#define PROGRESS_BAR_WIDTH (3*GR_WIDTH/4)
U0 DrawProgressBars(CDC *dc)
{
I64 i,j,k,n,m;
@@ -52,20 +64,24 @@ U0 DrawProgressBars(CDC *dc)
PROGRESS_BAR_HEIGHT)/2-4);
}
dc->color=WHITE;
dc->color=GREEN;
if (*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 %5.3f",st,tS-sys_progresses[i].t0);
st2=MStrPrint("%s %fs",st,tS-sys_progresses[i].t0);
Free(st);
} else
st2=st;
GrPrint(dc,(GR_WIDTH-FONT_WIDTH*StrLen(st2))/2,
(GR_HEIGHT-FONT_HEIGHT-
(NUM_PROGRESS_BARS*2-2-i*4)*PROGRESS_BAR_HEIGHT)/2,"%s",st2);
Free(st2);
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-
(NUM_PROGRESS_BARS*2-2-i*4)*PROGRESS_BAR_HEIGHT)/2,"%s",st);
Free(st);
}
}
}
@@ -75,24 +91,24 @@ U0 DrawWinGrid(CDC *dc)
F64 d;
dc->color=BLACK;
dc->pen_width=1;
for (d=ip_grid.x_offset;d<GR_WIDTH; d+=ip_grid.x)
for (d=ms_grid.x_offset;d<GR_WIDTH; d+=ms_grid.x)
GrLine(dc,d,0,d,GR_HEIGHT-1);
for (d=ip_grid.y_offset;d<GR_HEIGHT;d+=ip_grid.y)
for (d=ms_grid.y_offset;d<GR_HEIGHT;d+=ms_grid.y)
GrLine(dc,0,d,GR_WIDTH-1,d);
}
U0 WinGrid(Bool val)
{
CGridGlbls last_grid;
MemCpy(&last_grid,&ip_grid,sizeof(CGridGlbls));
if (!val || PopUpForm(&ip_grid)) {
MemCpy(&last_grid,&ms_grid,sizeof(CGridGlbls));
if (!val || PopUpForm(&ms_grid)) {
if (!val)
GridInit;
mouse.prescale.x*=last_grid.x_speed/ip_grid.x_speed;
mouse.prescale.y*=last_grid.y_speed/ip_grid.y_speed;
mouse.prescale.z*=last_grid.z_speed/ip_grid.z_speed;
ms_hard.prescale.x*=last_grid.x_speed/ms_grid.x_speed;
ms_hard.prescale.y*=last_grid.y_speed/ms_grid.y_speed;
ms_hard.prescale.z*=last_grid.z_speed/ms_grid.z_speed;
} else
MemCpy(&ip_grid,&last_grid,sizeof(CGridGlbls));
MemCpy(&ms_grid,&last_grid,sizeof(CGridGlbls));
}
U0 CtrlAltG(I64 sc)
{
@@ -155,29 +171,29 @@ public U0 WinScrollRestore(CTask *task,CD3I64 *s)
task->scroll_z=s->z;
}
U0 DrawInputPtr(CDC *dc)
U0 DrawMs(CDC *dc)
{
I64 x,y;
PUSHFD
CLI
x=ip.pos.x;
y=ip.pos.y;
x=ms.pos.x;
y=ms.pos.y;
POPFD
if (ip.show && ip.dev!=IP_NULL) {
if (ms.show && ms_hard.installed) {
if (!Bt(&sys_run_level,RLf_VGA)) //if text mode
gr.text_base[ip.pos_text.x+ip.pos_text.y*TEXT_COLS]^=0x7F00;
gr.text_base[ms.pos_text.x+ms.pos_text.y*TEXT_COLS]^=0x7F00;
else {
if (gr.fp_draw_input_ptr) {
if (ip.lb)
if (gr.fp_draw_ms) {
if (ms.lb)
dc->color=ROP_XOR+LTPURPLE^TRANSPARENT;
else if (ip.rb)
else if (ms.rb)
dc->color=ROP_XOR+LTCYAN^TRANSPARENT;
else
dc->color=ROP_XOR+BLACK^TRANSPARENT;
if (winmgr.grab_scroll && gr.fp_draw_grab_input_ptr)
(*gr.fp_draw_grab_input_ptr)(dc,x,y,winmgr.grab_scroll_closed);
if (winmgr.grab_scroll && gr.fp_draw_grab_ms)
(*gr.fp_draw_grab_ms)(dc,x,y,winmgr.grab_scroll_closed);
else
(*gr.fp_draw_input_ptr)(dc,x,y);
(*gr.fp_draw_ms)(dc,x,y);
}
}
}
@@ -185,50 +201,48 @@ U0 DrawInputPtr(CDC *dc)
U0 WinFinalUpdate(CDC *dc)
{
if (ip_grid.show)
if (ms_grid.show)
DrawWinGrid(dc);
DrawProgressBars(dc);
if (winmgr.show_menu)
DrawMenu(dc);
else
sys_cur_submenu_entry=NULL;
DrawInputPtr(dc);
DrawMs(dc);
}
gr.fp_final_scrn_update=&WinFinalUpdate;
U0 WinIPUpdate()
U0 WinMsUpdate()
{
I64 dd;
Bool set=FALSE;
if (ip.dev==IP_MOUSE) {
ip.has_wheel=mouse.has_wheel;
if (mouse.evt) {
ip.throttle+=ip.throttle_step*SignI64(mouse.pos.z-ip.pos.z);
IPVarsUpdate(mouse.pos.x,mouse.pos.y,mouse.pos.z,
mouse.buttons[0],mouse.buttons[1]);
mouse.evt=FALSE;
if (ms_hard.installed) {
ms.has_wheel=ms_hard.has_wheel;
if (ms_hard.evt) {
MsUpdate(ms_hard.pos.x,ms_hard.pos.y,ms_hard.pos.z,
ms_hard.bttns[0],ms_hard.bttns[1]);
ms_hard.evt=FALSE;
set=TRUE;
}
} else if (ip.dev==IP_NULL && mouse.installed)
ip.dev=IP_MOUSE;
}
if (set) {
if (ip.dev==IP_MOUSE) {
ip.speed=mouse.speed;
ip.timestamp=mouse.timestamp;
if (ms_hard.installed) {
ms.speed=ms_hard.speed;
ms.timestamp=ms_hard.timestamp;
}
} else
ip.speed*=0.95;
ms.speed*=0.95;
if (gr.scrn_zoom!=1) {
if (gr.continuous_scroll)
GrScaleZoom(1.0);
else {
dd=(ip.pos.x-gr.sx)*gr.scrn_zoom;
dd=(ms.pos.x-gr.sx)*gr.scrn_zoom;
if (!(8<=dd<GR_WIDTH-8))
GrScaleZoom(1.0);
else {
dd=(ip.pos.y-gr.sy)*gr.scrn_zoom;
dd=(ms.pos.y-gr.sy)*gr.scrn_zoom;
if (!(8<=dd<GR_HEIGHT-8))
GrScaleZoom(1.0);
}
+227 -227
View File
@@ -12,10 +12,10 @@ public U0 Refresh(I64 cnt=1,Bool force=FALSE)
CDoc *old_doc=DocPut;
I64 update_cnt;
if (!cnt&&force)
LBts(&sys_semas[SYS_SEMA_JUST_PUMP_MSGS],0);
while (Bt(&sys_semas[SYS_SEMA_REFRESH_IN_PROGRESS],0)) {
LBts(&sys_semas[SEMA_JUST_PUMP_MSGS],0);
while (Bt(&sys_semas[SEMA_REFRESH_IN_PROGRESS],0)) {
if (force) {
LBts(&sys_semas[SYS_SEMA_FORCE_WINMGR],0);
LBts(&sys_semas[SEMA_FORCE_WINMGR],0);
if (sys_winmgr_task) sys_winmgr_task->wake_jiffy=cnts.jiffies;
}
Yield;
@@ -25,7 +25,7 @@ public U0 Refresh(I64 cnt=1,Bool force=FALSE)
update_cnt=winmgr.updates+cnt;
while (winmgr.updates<update_cnt) {
if (force) {
LBts(&sys_semas[SYS_SEMA_FORCE_WINMGR],0);
LBts(&sys_semas[SEMA_FORCE_WINMGR],0);
if (sys_winmgr_task) sys_winmgr_task->wake_jiffy=cnts.jiffies;
}
Sleep(1);
@@ -39,153 +39,153 @@ public U0 Refresh(I64 cnt=1,Bool force=FALSE)
I64 WinQueIPMsgs(Bool que)
{
static CD3I64 single_ip={0,0,0};
static CD3I64 single_ms={0,0,0};
F64 time=tS;
I64 msg_code=0,a1,a2,single_a1,single_a2;
I64 msg_code=0,arg1,arg2,single_arg1,single_arg2;
CTask *task_focus=sys_focus_task;
if (task_focus && !winmgr.grab_scroll) {
a1=ip.pos.x-task_focus->pix_left-task_focus->scroll_x;
a2=ip.pos.y-task_focus->pix_top-task_focus->scroll_y;
single_a1=single_ip.x-task_focus->pix_left-task_focus->scroll_x;
single_a2=single_ip.y-task_focus->pix_top-task_focus->scroll_y;
if (old_ip.presnap.x!=ip.presnap.x || old_ip.presnap.y!=ip.presnap.y) {
arg1=ms.pos.x-task_focus->pix_left-task_focus->scroll_x;
arg2=ms.pos.y-task_focus->pix_top-task_focus->scroll_y;
single_arg1=single_ms.x-task_focus->pix_left-task_focus->scroll_x;
single_arg2=single_ms.y-task_focus->pix_top-task_focus->scroll_y;
if (old_ms.presnap.x!=ms.presnap.x || old_ms.presnap.y!=ms.presnap.y) {
if (que)
TaskMsg(task_focus,0,
MSG_IP_MOVE,a1,a2,0);
msg_code=MSG_IP_MOVE;
MSG_MS_MOVE,arg1,arg2,0);
msg_code=MSG_MS_MOVE;
}
//TODO que msg for ip.pos.z?
if (ip.left_dbl_time) {
if (time>ip.left_dbl_time) {
if (ip.left_dbl) {
if (!ip.left_down_sent) {
//TODO que msg for ms.pos.z?
if (ms.left_dbl_time) {
if (time>ms.left_dbl_time) {
if (ms.left_dbl) {
if (!ms.left_down_sent) {
if (que)
TaskMsg(task_focus,0,
MSG_IP_L_D_DOWN,a1,a2,0);
ip.left_down_sent=TRUE;
msg_code=MSG_IP_L_D_DOWN;
MSG_MS_L_D_DOWN,arg1,arg2,0);
ms.left_down_sent=TRUE;
msg_code=MSG_MS_L_D_DOWN;
}
if (!ip.lb) {
if (!ms.lb) {
if (que)
TaskMsg(task_focus,0,
MSG_IP_L_D_UP,a1,a2,0);
ip.left_dbl_time=0;
msg_code=MSG_IP_L_D_UP;
MSG_MS_L_D_UP,arg1,arg2,0);
ms.left_dbl_time=0;
msg_code=MSG_MS_L_D_UP;
}
} else {
if (!ip.left_down_sent) {
if (!ms.left_down_sent) {
if (que)
TaskMsg(task_focus,0,
MSG_IP_L_DOWN,single_a1,single_a2,0);
ip.left_down_sent=TRUE;
msg_code=MSG_IP_L_DOWN;
MSG_MS_L_DOWN,single_arg1,single_arg2,0);
ms.left_down_sent=TRUE;
msg_code=MSG_MS_L_DOWN;
}
if (!ip.lb) {
if (!ms.lb) {
if (que)
TaskMsg(task_focus,0,
MSG_IP_L_UP,a1,a2,0);
ip.left_dbl_time=0;
msg_code=MSG_IP_L_UP;
MSG_MS_L_UP,arg1,arg2,0);
ms.left_dbl_time=0;
msg_code=MSG_MS_L_UP;
}
}
} else {
if (ip.lb && !ip_last.lb) {
ip.left_dbl_time=time;
ip.left_dbl=TRUE;
if (ms.lb && !ms_last.lb) {
ms.left_dbl_time=time;
ms.left_dbl=TRUE;
}
}
} else {
if (TaskValidate(task_focus) &&
Bt(&task_focus->win_inhibit,WIf_FOCUS_TASK_IP_L_D)) {
if (ip.lb && !ip_last.lb) {
Bt(&task_focus->win_inhibit,WIf_FOCUS_TASK_MS_L_D)) {
if (ms.lb && !ms_last.lb) {
if (que)
TaskMsg(task_focus,0,
MSG_IP_L_DOWN,a1,a2,0);
msg_code=MSG_IP_L_DOWN;
} else if (!ip.lb && ip_last.lb) {
MSG_MS_L_DOWN,arg1,arg2,0);
msg_code=MSG_MS_L_DOWN;
} else if (!ms.lb && ms_last.lb) {
if (que)
TaskMsg(task_focus,0,
MSG_IP_L_UP,a1,a2,0);
msg_code=MSG_IP_L_UP;
MSG_MS_L_UP,arg1,arg2,0);
msg_code=MSG_MS_L_UP;
}
} else {
if (ip.lb && !ip_last.lb) {
ip.left_dbl=FALSE;
ip.left_down_sent=FALSE;
ip.left_dbl_time=time+ip.dbl_time;
single_ip.x=ip.pos.x;
single_ip.y=ip.pos.y;
if (ms.lb && !ms_last.lb) {
ms.left_dbl=FALSE;
ms.left_down_sent=FALSE;
ms.left_dbl_time=time+ms.dbl_time;
single_ms.x=ms.pos.x;
single_ms.y=ms.pos.y;
}
}
}
if (ip.right_dbl_time) {
if (time>ip.right_dbl_time) {
if (ip.right_dbl) {
if (!ip.right_down_sent) {
if (ms.right_dbl_time) {
if (time>ms.right_dbl_time) {
if (ms.right_dbl) {
if (!ms.right_down_sent) {
if (que)
TaskMsg(task_focus,0,
MSG_IP_R_D_DOWN,a1,a2,0);
ip.right_down_sent=TRUE;
msg_code=MSG_IP_R_D_DOWN;
MSG_MS_R_D_DOWN,arg1,arg2,0);
ms.right_down_sent=TRUE;
msg_code=MSG_MS_R_D_DOWN;
}
if (!ip.rb) {
if (!ms.rb) {
if (que)
TaskMsg(task_focus,0,
MSG_IP_R_D_UP,a1,a2,0);
ip.right_dbl_time=0;
msg_code=MSG_IP_R_D_UP;
MSG_MS_R_D_UP,arg1,arg2,0);
ms.right_dbl_time=0;
msg_code=MSG_MS_R_D_UP;
}
} else {
if (!ip.right_down_sent) {
if (!ms.right_down_sent) {
if (que)
TaskMsg(task_focus,0,
MSG_IP_R_DOWN,single_a1,single_a2,0);
ip.right_down_sent=TRUE;
msg_code=MSG_IP_R_DOWN;
MSG_MS_R_DOWN,single_arg1,single_arg2,0);
ms.right_down_sent=TRUE;
msg_code=MSG_MS_R_DOWN;
}
if (!ip.rb) {
if (!ms.rb) {
if (que)
TaskMsg(task_focus,0,
MSG_IP_R_UP,a1,a2,0);
ip.right_dbl_time=0;
msg_code=MSG_IP_R_UP;
MSG_MS_R_UP,arg1,arg2,0);
ms.right_dbl_time=0;
msg_code=MSG_MS_R_UP;
}
}
} else {
if (ip.rb && !ip_last.rb) {
ip.right_dbl_time=time;
ip.right_dbl=TRUE;
if (ms.rb && !ms_last.rb) {
ms.right_dbl_time=time;
ms.right_dbl=TRUE;
}
}
} else {
if (TaskValidate(task_focus) &&
Bt(&task_focus->win_inhibit,WIf_FOCUS_TASK_IP_R_D)) {
if (ip.rb && !ip_last.rb) {
Bt(&task_focus->win_inhibit,WIf_FOCUS_TASK_MS_R_D)) {
if (ms.rb && !ms_last.rb) {
if (que)
TaskMsg(task_focus,0,
MSG_IP_R_DOWN,a1,a2,0);
msg_code=MSG_IP_R_DOWN;
} else if (!ip.rb && ip_last.rb) {
MSG_MS_R_DOWN,arg1,arg2,0);
msg_code=MSG_MS_R_DOWN;
} else if (!ms.rb && ms_last.rb) {
if (que)
TaskMsg(task_focus,0,
MSG_IP_R_UP,a1,a2,0);
msg_code=MSG_IP_R_UP;
MSG_MS_R_UP,arg1,arg2,0);
msg_code=MSG_MS_R_UP;
}
} else {
if (ip.rb && !ip_last.rb) {
ip.right_dbl=FALSE;
ip.right_down_sent=FALSE;
ip.right_dbl_time=time+ip.dbl_time;
single_ip.x=ip.pos.x;
single_ip.y=ip.pos.y;
if (ms.rb && !ms_last.rb) {
ms.right_dbl=FALSE;
ms.right_down_sent=FALSE;
ms.right_dbl_time=time+ms.dbl_time;
single_ms.x=ms.pos.x;
single_ms.y=ms.pos.y;
}
}
}
MemCpy(&ip_last,&ip,sizeof(CIPStateGlbls));
MemCpy(&old_ip,&ip,sizeof(CIPStateGlbls));
MemCpy(&ms_last,&ms,sizeof(CMsStateGlbls));
MemCpy(&old_ms,&ms,sizeof(CMsStateGlbls));
}
return msg_code;
}
@@ -246,7 +246,7 @@ I64 WinMgrSleep(Bool flush_msgs=FALSE)
!Bt(&sys_focus_task->win_inhibit,WIf_FOCUS_TASK_CTRLS)) {
c=sys_focus_task->next_ctrl;
while (c!=&sys_focus_task->next_ctrl) {
if (CtrlInside(c,ip.pos.x,ip.pos.y)) {
if (CtrlInside(c,ms.pos.x,ms.pos.y)) {
que=FALSE;
break;
}
@@ -261,13 +261,13 @@ I64 WinMgrSleep(Bool flush_msgs=FALSE)
}
if (sys_focus_task)
LBtr(&sys_focus_task->task_flags,TASKf_HAS_SONG);
WinIPUpdate;
WinMsUpdate;
if (!LBtr(&sys_semas[SYS_SEMA_JUST_PUMP_MSGS],0)) {
if (!LBtr(&sys_semas[SEMA_JUST_PUMP_MSGS],0)) {
timeout_val=cnts.jiffies+JIFFY_FREQ/WINMGR_FPS;
LBts(&sys_semas[SYS_SEMA_REFRESH_IN_PROGRESS],0);
LBts(&sys_semas[SEMA_REFRESH_IN_PROGRESS],0);
GrUpdateScrn;
LBtr(&sys_semas[SYS_SEMA_REFRESH_IN_PROGRESS],0);
LBtr(&sys_semas[SEMA_REFRESH_IN_PROGRESS],0);
if (sys_focus_task && !Bt(&sys_focus_task->task_flags,TASKf_HAS_SONG)) {
Free(music.cur_song);
@@ -281,26 +281,26 @@ I64 WinMgrSleep(Bool flush_msgs=FALSE)
music.cur_song_task=NULL;
}
winmgr.updates++;
if (!mouse.install_attempts)
if (!ms_hard.install_attempts)
SleepUntil(timeout_val); //Just for before mouse install attempt at boot.
else
do {
KbdMouseHandler(FALSE,TRUE);
KbdMsHndlr(FALSE,TRUE);
SleepUntil(MinI64(timeout_val,cnts.jiffies+JIFFY_FREQ/500));
} while (cnts.jiffies<timeout_val &&
!Bt(&sys_semas[SYS_SEMA_FORCE_WINMGR],0));
!Bt(&sys_semas[SEMA_FORCE_WINMGR],0));
}
LBtr(&sys_semas[SYS_SEMA_FORCE_WINMGR],0);
LBtr(&sys_semas[SEMA_FORCE_WINMGR],0);
return msg_code;
}
CDoc *WinCursorPosSet(CTask *task,I64 ipx,I64 ipy,Bool set_cursor=TRUE)
CDoc *WinCursorPosSet(CTask *task,I64 msx,I64 msy,Bool set_cursor=TRUE)
{
CDoc *res=NULL;
Bool unlock;
I64 x0,y0;
if (!task) task=Fs;
if (WinInside(ipx,ipy,task)) {
if (WinInside(msx,msy,task)) {
if ((res=DocDisplay(task)) && res->flags&DOCF_DONT_SHOW)
res=NULL;
else if (set_cursor) {
@@ -311,8 +311,8 @@ CDoc *WinCursorPosSet(CTask *task,I64 ipx,I64 ipy,Bool set_cursor=TRUE)
x0=res->line_start_col;
y0=res->top_line_num;
DocRecalc(res,RECALCF_HAS_CURSOR);
res->x=(ipx-task->pix_left-task->scroll_x)/FONT_WIDTH +x0;
res->y=(ipy-task->pix_top -task->scroll_y)/FONT_HEIGHT+y0;
res->x=(msx-task->pix_left-task->scroll_x)/FONT_WIDTH +x0;
res->y=(msy-task->pix_top -task->scroll_y)/FONT_HEIGHT+y0;
DocRecalc(res,RECALCt_FIND_CURSOR);
task->scroll_x=0;
task->scroll_y=0;
@@ -336,8 +336,8 @@ Bool WinKeyNavMenu()
if (Bt(kbd.down_bitmap,SC_GUI) && focus && (m=focus->cur_menu)) {
winmgr.show_menu=TRUE;
sys_cur_submenu_entry=NULL;
old_pos.x=ip.pos.x; old_pos.y=ip.pos.y;
ip.pos.x=new_pos.x=ip.pos.y=new_pos.y=0;
old_pos.x=ms.pos.x; old_pos.y=ms.pos.y;
ms.pos.x=new_pos.x=ms.pos.y=new_pos.y=0;
while (Bt(kbd.down_bitmap,SC_GUI)) {
old_key_cnt=kbd.cnt;
if (Bt(kbd.down_bitmap,SC_CURSOR_LEFT)) {
@@ -382,16 +382,16 @@ Bool WinKeyNavMenu()
}
new_pos.x=ClampI64(new_pos.x,0,GR_WIDTH-1);
new_pos.y=ClampI64(new_pos.y,0,GR_HEIGHT-1);
ip.pos.x=new_pos.x; ip.pos.y=new_pos.y;
ms.pos.x=new_pos.x; ms.pos.y=new_pos.y;
WinMgrSleep(TRUE);
if (!sys_cur_submenu_entry)
ip.pos.y=new_pos.y=0;
ms.pos.y=new_pos.y=0;
}
if (sys_cur_submenu_entry)
TaskMsg(sys_focus_task,0,sys_cur_submenu_entry->msg_code,
sys_cur_submenu_entry->a1,sys_cur_submenu_entry->a2,0);
sys_cur_submenu_entry->arg1,sys_cur_submenu_entry->arg2,0);
winmgr.show_menu=FALSE;
ip.pos.x=old_pos.x; ip.pos.y=old_pos.y;
ms.pos.x=old_pos.x; ms.pos.y=old_pos.y;
return TRUE;
}
return FALSE;
@@ -403,7 +403,7 @@ U0 WinMgrTask(I64)
CDoc *doc;
CDocEntry *doc_e;
I64 x,y,z,msg_code,
my_ip_z=0,left,top,
my_ms_z=0,left,top,
old_flags=GetRFlags;
Bool has_border;
CCtrl *c;
@@ -445,7 +445,7 @@ wmt_start:
SetRFlags(old_flags);
goto wmt_start;
}
if (WinInside(ip.pos.x,ip.pos.y,task,FONT_WIDTH)) {
if (WinInside(ms.pos.x,ms.pos.y,task,FONT_WIDTH)) {
SetRFlags(old_flags);
break;
}
@@ -468,19 +468,19 @@ wmt_start:
!Bt(&sys_focus_task->win_inhibit,WIf_FOCUS_TASK_MENU)) {
if (WinKeyNavMenu)
goto wmt_start;
if (task==Fs && 0<=ip.pos.y<FONT_HEIGHT && ip.dev!=IP_NULL) {
if (task==Fs && 0<=ms.pos.y<FONT_HEIGHT && ms_hard.installed) {
winmgr.show_menu=TRUE;
if (ip.lb && !old_ip.lb) {
if (ms.lb && !old_ms.lb) {
winmgr.show_menu=TRUE;
while (ip.lb)
while (ms.lb)
WinMgrSleep(TRUE);
if (sys_cur_submenu_entry)
TaskMsg(sys_focus_task,0,
sys_cur_submenu_entry->msg_code,
sys_cur_submenu_entry->a1,
sys_cur_submenu_entry->a2,0);
sys_cur_submenu_entry->arg1,
sys_cur_submenu_entry->arg2,0);
winmgr.show_menu=FALSE;
old_ip.lb=FALSE;
old_ms.lb=FALSE;
goto wmt_start;
}
}
@@ -494,20 +494,20 @@ wmt_start:
winmgr.grab_scroll_closed=FALSE;
winmgr.grab_scroll=TRUE;
while (kbd.scan_code&SCF_CTRL && TaskValidate(task) && (!ac.task ||
!WinInside(ip.pos.x,ip.pos.y,ac.task,FONT_WIDTH))) {
if (ip.lb) {
!WinInside(ms.pos.x,ms.pos.y,ac.task,FONT_WIDTH))) {
if (ms.lb) {
winmgr.grab_scroll_closed=TRUE;
x=ip.pos.x-task->scroll_x;
y=ip.pos.y-task->scroll_y;
z=ip.pos.z-task->scroll_z;
while (ip.lb && kbd.scan_code&SCF_CTRL && TaskValidate(task)) {
task->scroll_x=(ip.pos.x-x)&~7;
task->scroll_y=(ip.pos.y-y)&~7;
task->scroll_z=ip.pos.z-z;
x=ms.pos.x-task->scroll_x;
y=ms.pos.y-task->scroll_y;
z=ms.pos.z-task->scroll_z;
while (ms.lb && kbd.scan_code&SCF_CTRL && TaskValidate(task)) {
task->scroll_x=(ms.pos.x-x)&~7;
task->scroll_y=(ms.pos.y-y)&~7;
task->scroll_z=ms.pos.z-z;
WinMgrSleep(TRUE);
}
winmgr.grab_scroll_closed=FALSE;
} else if (ip.rb) {
} else if (ms.rb) {
task->scroll_x=0;
task->scroll_y=0;
task->scroll_z=0;
@@ -523,40 +523,40 @@ wmt_start:
if (!Bt(&task->win_inhibit,WIf_SELF_CTRLS) &&
(!TaskValidate(sys_focus_task)||
!Bt(&sys_focus_task->win_inhibit,WIf_FOCUS_TASK_CTRLS))) {
if (ip.lb && !old_ip.lb) {
if (ms.lb && !old_ms.lb) {
c=task->next_ctrl;
while (c!=&task->next_ctrl) {
if (CtrlInside(c,ip.pos.x,ip.pos.y)) {
if (CtrlInside(c,ms.pos.x,ms.pos.y)) {
left=task->pix_left;
top =task->pix_top;
if (c->flags&CTRLF_BORDER) {
left-=FONT_WIDTH;
top -=FONT_HEIGHT;
}
if (c->flags&CTRLF_CAPTURE_LEFT_IP) {
while (ip.lb && TaskValidate(task)) {
if (c->flags&CTRLF_CAPTURE_LEFT_MS) {
while (ms.lb && TaskValidate(task)) {
if (c->left_click)
(*c->left_click)(c,ip.pos.x-left,ip.pos.y-top,TRUE);
(*c->left_click)(c,ms.pos.x-left,ms.pos.y-top,TRUE);
WinMgrSleep;
}
if (c->left_click)
(*c->left_click)(c,ip.pos.x-left,ip.pos.y-top,FALSE);
old_ip.lb=FALSE;
(*c->left_click)(c,ms.pos.x-left,ms.pos.y-top,FALSE);
old_ms.lb=FALSE;
goto wmt_start;
} else {
if (c->left_click)
(*c->left_click)(c,ip.pos.x-left,ip.pos.y-top,TRUE);
old_ip.lb=TRUE;
(*c->left_click)(c,ms.pos.x-left,ms.pos.y-top,TRUE);
old_ms.lb=TRUE;
goto wmt_start;
}
}
c=c->next;
}
}
if (old_ip.lb && !ip.lb) {
if (old_ms.lb && !ms.lb) {
c=task->next_ctrl;
while (c!=&task->next_ctrl) {
if (CtrlInside(c,ip.pos.x,ip.pos.y)) {
if (CtrlInside(c,ms.pos.x,ms.pos.y)) {
left=task->pix_left;
top =task->pix_top;
if (c->flags&CTRLF_BORDER) {
@@ -564,47 +564,47 @@ wmt_start:
top -=FONT_HEIGHT;
}
if (c->left_click)
(*c->left_click)(c,ip.pos.x-left,ip.pos.y-top,FALSE);
old_ip.lb=FALSE;
(*c->left_click)(c,ms.pos.x-left,ms.pos.y-top,FALSE);
old_ms.lb=FALSE;
goto wmt_start;
}
c=c->next;
}
}
if (ip.rb && !old_ip.rb) {
if (ms.rb && !old_ms.rb) {
c=task->next_ctrl;
while (c!=&task->next_ctrl) {
if (CtrlInside(c,ip.pos.x,ip.pos.y)) {
if (CtrlInside(c,ms.pos.x,ms.pos.y)) {
left=task->pix_left;
top =task->pix_top;
if (c->flags&CTRLF_BORDER) {
left-=FONT_WIDTH;
top -=FONT_HEIGHT;
}
if (c->flags&CTRLF_CAPTURE_RIGHT_IP) {
while (ip.rb && TaskValidate(task)) {
if (c->flags&CTRLF_CAPTURE_RIGHT_MS) {
while (ms.rb && TaskValidate(task)) {
if (c->right_click)
(*c->right_click)(c,ip.pos.x-left,ip.pos.y-top,TRUE);
(*c->right_click)(c,ms.pos.x-left,ms.pos.y-top,TRUE);
WinMgrSleep;
}
if (c->right_click)
(*c->right_click)(c,ip.pos.x-left,ip.pos.y-top,FALSE);
old_ip.rb=FALSE;
(*c->right_click)(c,ms.pos.x-left,ms.pos.y-top,FALSE);
old_ms.rb=FALSE;
goto wmt_start;
} else {
if (c->right_click)
(*c->right_click)(c,ip.pos.x-left,ip.pos.y-top,TRUE);
old_ip.rb=TRUE;
(*c->right_click)(c,ms.pos.x-left,ms.pos.y-top,TRUE);
old_ms.rb=TRUE;
goto wmt_start;
}
}
c=c->next;
}
}
if (old_ip.rb && !ip.rb) {
if (old_ms.rb && !ms.rb) {
c=task->next_ctrl;
while (c!=&task->next_ctrl) {
if (CtrlInside(c,ip.pos.x,ip.pos.y)) {
if (CtrlInside(c,ms.pos.x,ms.pos.y)) {
left=task->pix_left;
top =task->pix_top;
if (c->flags&CTRLF_BORDER) {
@@ -612,38 +612,38 @@ wmt_start:
top -=FONT_HEIGHT;
}
if (c->right_click)
(*c->right_click)(c,ip.pos.x-left,ip.pos.y-top,FALSE);
old_ip.rb=FALSE;
(*c->right_click)(c,ms.pos.x-left,ms.pos.y-top,FALSE);
old_ms.rb=FALSE;
goto wmt_start;
}
c=c->next;
}
}
if (ip.has_wheel && my_ip_z!=ip.pos.z) {
if (ms.has_wheel && my_ms_z!=ms.pos.z) {
if (task==sys_focus_task) {
c=task->next_ctrl;
while (c!=&task->next_ctrl) {
if (c->wheel_chg) {
(*c->wheel_chg)(c,ip.pos.z-my_ip_z);
my_ip_z=ip.pos.z;
(*c->wheel_chg)(c,ms.pos.z-my_ms_z);
my_ms_z=ms.pos.z;
goto wmt_start;
}
c=c->next;
}
my_ip_z=ip.pos.z;
my_ms_z=ms.pos.z;
} else if (!sys_focus_task)
my_ip_z=ip.pos.z;
my_ms_z=ms.pos.z;
}
}
if (task==Fs)
goto wmt_start;
if (!Bt(&task->win_inhibit,WIf_SELF_IP_L)&&
if (!Bt(&task->win_inhibit,WIf_SELF_MS_L)&&
(!TaskValidate(sys_focus_task)||
!Bt(&sys_focus_task->win_inhibit,WIf_FOCUS_TASK_IP_L))) {
if (!old_ip.lb && ip.lb) {
if (doc=WinCursorPosSet(task,ip.pos.x,ip.pos.y)) {
!Bt(&sys_focus_task->win_inhibit,WIf_FOCUS_TASK_MS_L))) {
if (!old_ms.lb && ms.lb) {
if (doc=WinCursorPosSet(task,ms.pos.x,ms.pos.y)) {
DocLock(doc);
if (doc->doc_signature==DOC_SIGNATURE_VAL) {
doc_e=doc->cur_entry;
@@ -653,17 +653,17 @@ wmt_start:
}
}
DocUnlock(doc);
old_ip.lb=TRUE;
old_ms.lb=TRUE;
goto wmt_start;
}
}
}
if (!Bt(&task->win_inhibit,WIf_SELF_IP_R)&&
if (!Bt(&task->win_inhibit,WIf_SELF_MS_R)&&
(!TaskValidate(sys_focus_task)||
!Bt(&sys_focus_task->win_inhibit,WIf_FOCUS_TASK_IP_R))) {
if (!old_ip.rb && ip.rb) {
if (WinCursorPosSet(task,ip.pos.x,ip.pos.y)) {
old_ip.rb=TRUE;
!Bt(&sys_focus_task->win_inhibit,WIf_FOCUS_TASK_MS_R))) {
if (!old_ms.rb && ms.rb) {
if (WinCursorPosSet(task,ms.pos.x,ms.pos.y)) {
old_ms.rb=TRUE;
goto wmt_start;
}
}
@@ -671,32 +671,32 @@ wmt_start:
if (!Bt(&task->win_inhibit,WIf_SELF_BORDER) && has_border &&
(!TaskValidate(sys_focus_task)||
!Bt(&sys_focus_task->win_inhibit,WIf_FOCUS_TASK_BORDER))) {
if (old_ip.lb && !ip.lb) {
if (ip.pos_text.y==task->win_top-1) {
if (task->win_left<=ip.pos_text.x<task->win_left+4) {
if (old_ms.lb && !ms.lb) {
if (ms.pos_text.y==task->win_top-1) {
if (task->win_left<=ms.pos_text.x<task->win_left+4) {
TaskMsg(task,0,MSG_KEY_DOWN,CH_CTRLM,0x43200000432,0);
old_ip.lb=FALSE;
old_ms.lb=FALSE;
goto wmt_start;
} else if (task->win_right-2<=ip.pos_text.x<=task->win_right) {
} else if (task->win_right-2<=ms.pos_text.x<=task->win_right) {
if (DocPut(task))
TaskMsg(task,0,MSG_KEY_DOWN,CH_SHIFT_ESC,0,0);
else
Kill(task,FALSE);
old_ip.lb=FALSE;
old_ms.lb=FALSE;
goto wmt_start;
}
}
}
}
if (!Bt(&task->win_inhibit,WIf_SELF_IP_L)&&
if (!Bt(&task->win_inhibit,WIf_SELF_MS_L)&&
(!TaskValidate(sys_focus_task)||
!Bt(&sys_focus_task->win_inhibit,WIf_FOCUS_TASK_IP_L))) {
if (old_ip.lb && !ip.lb) {
if (doc=WinCursorPosSet(task,ip.pos.x,ip.pos.y,FALSE)) {
!Bt(&sys_focus_task->win_inhibit,WIf_FOCUS_TASK_MS_L))) {
if (old_ms.lb && !ms.lb) {
if (doc=WinCursorPosSet(task,ms.pos.x,ms.pos.y,FALSE)) {
do msg_code=WinMgrSleep;
while (TaskValidate(task) && (ip.lb || ip.left_dbl_time));
while (TaskValidate(task) && (ms.lb || ms.left_dbl_time));
if (TaskValidate(task)) {
if (msg_code==MSG_IP_L_UP) {
if (msg_code==MSG_MS_L_UP) {
if (doc->doc_signature==DOC_SIGNATURE_VAL) {
DocLock(doc);
if (TaskValidate(task)) {
@@ -714,24 +714,24 @@ wmt_start:
DocUnlock(doc);
}
}
} else if (msg_code==MSG_IP_L_D_UP)
} else if (msg_code==MSG_MS_L_D_UP)
TaskMsg(task,0,MSG_KEY_DOWN,CH_ESC,0,0);
}
old_ip.lb=FALSE;
old_ms.lb=FALSE;
goto wmt_start;
}
}
}
if (!Bt(&task->win_inhibit,WIf_SELF_IP_R)&&
if (!Bt(&task->win_inhibit,WIf_SELF_MS_R)&&
(!TaskValidate(sys_focus_task)||
!Bt(&sys_focus_task->win_inhibit,WIf_FOCUS_TASK_IP_R))) {
if (old_ip.rb && !ip.rb) {
if (doc=WinCursorPosSet(task,ip.pos.x,ip.pos.y,FALSE)) {
!Bt(&sys_focus_task->win_inhibit,WIf_FOCUS_TASK_MS_R))) {
if (old_ms.rb && !ms.rb) {
if (doc=WinCursorPosSet(task,ms.pos.x,ms.pos.y,FALSE)) {
do msg_code=WinMgrSleep;
while (TaskValidate(task) && (ip.rb || ip.right_dbl_time));
while (TaskValidate(task) && (ms.rb || ms.right_dbl_time));
if (TaskValidate(task)) {
if (msg_code==MSG_IP_R_UP) {
if (msg_code==MSG_MS_R_UP) {
if (doc->doc_signature==DOC_SIGNATURE_VAL) {
DocLock(doc);
if (TaskValidate(task)) {
@@ -746,10 +746,10 @@ wmt_start:
DocUnlock(doc);
}
}
} else if (msg_code==MSG_IP_R_D_UP)
} else if (msg_code==MSG_MS_R_D_UP)
TaskMsg(task,0,MSG_KEY_DOWN,CH_SHIFT_ESC,0,0);
}
old_ip.rb=FALSE;
old_ms.rb=FALSE;
goto wmt_start;
}
}
@@ -758,79 +758,79 @@ wmt_start:
if (!Bt(&task->win_inhibit,WIf_SELF_BORDER) && has_border &&
(!TaskValidate(sys_focus_task)||
!Bt(&sys_focus_task->win_inhibit,WIf_FOCUS_TASK_BORDER))) {
if (ip.lb && !old_ip.lb) {
if (task->win_top==ip.pos_text.y+1 &&
task->win_left-1<=ip.pos_text.x<=task->win_right+1) {
if (task->win_left<=ip.pos_text.x<task->win_left+4) {
old_ip.lb=TRUE;
if (ms.lb && !old_ms.lb) {
if (task->win_top==ms.pos_text.y+1 &&
task->win_left-1<=ms.pos_text.x<=task->win_right+1) {
if (task->win_left<=ms.pos_text.x<task->win_left+4) {
old_ms.lb=TRUE;
goto wmt_start;
}
if (task->win_right-2<=ip.pos_text.x<=task->win_right) {
old_ip.lb=TRUE;
if (task->win_right-2<=ms.pos_text.x<=task->win_right) {
old_ms.lb=TRUE;
goto wmt_start;
}
x=ip.pos_text.x-task->win_left;
if (ip.lb) {
x=ms.pos_text.x-task->win_left;
if (ms.lb) {
WinToTop(task);
while (ip.lb && TaskValidate(task)) {
WinHorz(ip.pos_text.x-x,task->win_width-1+ip.pos_text.x-x,task);
WinVert(ip.pos_text.y+1,task->win_height+ip.pos_text.y,task);
while (ms.lb && TaskValidate(task)) {
WinHorz(ms.pos_text.x-x,task->win_width-1+ms.pos_text.x-x,task);
WinVert(ms.pos_text.y+1,task->win_height+ms.pos_text.y,task);
WinMgrSleep;
}
}
old_ip.lb=FALSE;
old_ms.lb=FALSE;
goto wmt_start;
}
if (task->win_left==ip.pos_text.x+1 &&
task->win_top-1<=ip.pos_text.y<=task->win_bottom+1) {
y=ip.pos_text.y-task->win_top;
if (ip.lb) {
if (task->win_left==ms.pos_text.x+1 &&
task->win_top-1<=ms.pos_text.y<=task->win_bottom+1) {
y=ms.pos_text.y-task->win_top;
if (ms.lb) {
WinToTop(task);
while (ip.lb && TaskValidate(task)) {
WinHorz(ip.pos_text.x+1,task->win_width+ip.pos_text.x,task);
WinVert(ip.pos_text.y-y,
task->win_height-1+ip.pos_text.y-y,task);
while (ms.lb && TaskValidate(task)) {
WinHorz(ms.pos_text.x+1,task->win_width+ms.pos_text.x,task);
WinVert(ms.pos_text.y-y,
task->win_height-1+ms.pos_text.y-y,task);
WinMgrSleep;
}
}
old_ip.lb=FALSE;
old_ms.lb=FALSE;
goto wmt_start;
}
if (task->win_right+1==ip.pos_text.x &&
task->win_bottom+1==ip.pos_text.y) {
if (ip.lb) {
if (task->win_right+1==ms.pos_text.x &&
task->win_bottom+1==ms.pos_text.y) {
if (ms.lb) {
WinToTop(task);
while (ip.lb && TaskValidate(task)) {
WinHorz(task->win_left,ip.pos_text.x-1,task);
WinVert(task->win_top,ip.pos_text.y-1,task);
while (ms.lb && TaskValidate(task)) {
WinHorz(task->win_left,ms.pos_text.x-1,task);
WinVert(task->win_top,ms.pos_text.y-1,task);
WinMgrSleep;
}
}
old_ip.lb=FALSE;
old_ms.lb=FALSE;
goto wmt_start;
}
if (task->win_bottom==ip.pos_text.y-1 &&
task->win_left<=ip.pos_text.x<=task->win_right) {
if (ip.lb) {
if (task->win_bottom==ms.pos_text.y-1 &&
task->win_left<=ms.pos_text.x<=task->win_right) {
if (ms.lb) {
WinToTop(task);
while (ip.lb && TaskValidate(task)) {
WinVert(task->win_top,ip.pos_text.y-1,task);
while (ms.lb && TaskValidate(task)) {
WinVert(task->win_top,ms.pos_text.y-1,task);
WinMgrSleep;
}
}
old_ip.lb=FALSE;
old_ms.lb=FALSE;
goto wmt_start;
}
if (task->win_right==ip.pos_text.x-1 &&
task->win_top<=ip.pos_text.y<=task->win_bottom) {
if (ip.lb) {
if (task->win_right==ms.pos_text.x-1 &&
task->win_top<=ms.pos_text.y<=task->win_bottom) {
if (ms.lb) {
WinToTop(task);
while (ip.lb && TaskValidate(task)) {
WinHorz(task->win_left,ip.pos_text.x-1,task);
while (ms.lb && TaskValidate(task)) {
WinHorz(task->win_left,ms.pos_text.x-1,task);
WinMgrSleep;
}
}
old_ip.lb=FALSE;
old_ms.lb=FALSE;
goto wmt_start;
}
}
Binary file not shown.
-194
View File
@@ -1,194 +0,0 @@
I64 num_people=100;
U0 SongTask(I64)
{//Song by the Holy Spirit
Fs->task_end_cb=&SndTaskEndCB;
MusicSettingsRst;
while (TRUE) {
Play("3eGFqGetBEFeBEEFetBDCeCFqF");
Play("eGFqGetBEFeBEEFetBDCeCFqF");
Play("AetDAAqBDeBEqEetECDGBG");
Play("qAetDAAqBDeBEqEetECDGBG");
}
}
U0 HoldCourt()
{
I64 accused,crime,victim;
Bool old_form=LBts(&(DocPut)->flags,DOCf_FORM);
DocDblBufStart;
'\n';
accused=RandU32%3;
"%s",LstSub(accused,
"A man \0A woman \0A child \0");
crime=RandU32&3;
"%s",LstSub(crime,
"commits murder\0commits adultery\0"
"commits blasphemy\0commits idolatry\0");
if (crime<=1) {
'' CH_SPACE;
victim=RandU32%3;
"%s",LstSub(victim,"to a man\0to a woman\0to a child\0to an animal\0");
}
if (!(RandU32%5))
", again!";
else
'.';
"\n\n\n\n"
"$$LM,4$$"
"\n\n$$BT,\"Show Mercy\",LE=0$$\n\n"
"\n\n$$BT,\"Punish\",LE=1$$\n\n"
"\n\n$$BT,\"Really Punish\",LE=2$$\n\n"
"$$LM,0$$";
DocDblBufEnd;
DocMenu(DocPut);
LBEqu(&(DocPut)->flags,DOCf_FORM,old_form);
DocBottom;
}
#define T_BREAK_CAMP 0
#define T_TALK_WITH_GOD 1
#define T_VIEW_CLOUDS 2
#define T_HOLD_COURT 3
#define T_VIEW_MAP 4
#define T_WATER_ROCK 5
#define T_BATTLE 6
#define T_QUAIL 7
#define T_MOSES_COMICS 8
#define T_HELP 9
#define T_QUIT 10
Bool TakeTurn()
{
I64 i;
Bool res,old_form=LBts(&(DocPut)->flags,DOCf_FORM);
num_people*=1.0+0.01*((RandU16%100)-30);
if (num_people>MAX_PEOPLE)
num_people=MAX_PEOPLE;
if (!Fs->song_task)
Fs->song_task=Spawn(&SongTask,NULL,"Song",,Fs);
Camp(num_people);
Kill(Fs->song_task);
DocDblBufStart;
"$$LM,4$$"
"\n\n$$BT,\"Break Camp\",LE=T_BREAK_CAMP$$\n\n"
"\n\n$$BT,\"Talk with God\",LE=T_TALK_WITH_GOD$$\n\n"
"\n\n$$BT,\"View Clouds\",LE=T_VIEW_CLOUDS$$\n\n"
"\n\n$$BT,\"Hold Court\",LE=T_HOLD_COURT$$\n\n"
"\n\n$$BT,\"View Map\",LE=T_VIEW_MAP$$\n\n"
"\n\n$$BT,\"Make Water\",LE=T_WATER_ROCK$$\n\n"
"\n\n$$BT,\"Battle\",LE=T_BATTLE$$\n\n"
"\n\n$$BT,\"Beg for Meat\",LE=T_QUAIL$$\n\n"
"\n\n$$BT,\"Moses Comics\",LE=T_MOSES_COMICS$$\n\n"
"\n\n$$BT,\"Help\",LE=T_HELP$$\n\n"
"\n\n$$BT,\"Quit\",LE=T_QUIT$$\n\n"
"$$LM,0$$";
DocDblBufEnd;
i=DocMenu(DocPut,DOF_DONT_TEXT_ATTR);
LBEqu(&(DocPut)->flags,DOCf_FORM,old_form);
DocBottom;
if (!(0<=i<T_QUIT))
res=FALSE;
else {
switch (i) {
case T_BREAK_CAMP:
break;
case T_TALK_WITH_GOD:
UpTheMountain;
break;
case T_VIEW_CLOUDS:
CloudScene;
break;
case T_HOLD_COURT:
HoldCourt;
break;
case T_VIEW_MAP:
AEMap;
break;
case T_WATER_ROCK:
WaterRock;
break;
case T_BATTLE:
Battle;
break;
case T_QUAIL:
Quail;
break;
case T_MOSES_COMICS:
ViewComics;
break;
case T_HELP:
PopUpEd("::/Adam/God/HSNotes.DD.Z",Fs);
PopUpOk("Add your own story-line...\nLike old school toys.\n");
break;
}
res=TRUE;
}
Refresh;
Fs->song_task=NULL;
return res;
}
U0 TMsg(CDC *dc,U8 *msg)
{
F64 t0=tS;
while (tS-t0<1.5) {
if (Blink(5))
dc->color=BLACK;
else
dc->color=RED;
GrRect(dc,0,GR_HEIGHT-FONT_HEIGHT*3,GR_WIDTH,FONT_HEIGHT*2);
dc->color=BLACK;
GrRect(dc,2,GR_HEIGHT-FONT_HEIGHT*3+2,GR_WIDTH-4,FONT_HEIGHT*2-4);
dc->color=YELLOW;
GrPrint(dc,(GR_WIDTH-StrLen(msg)*FONT_WIDTH)/2,
GR_HEIGHT-5*FONT_HEIGHT/2,"%s",msg);
Refresh;
if (ScanChar)
throw;
}
}
U0 Trailer()
{
CDC *dc=DCAlias;
WinBorder;
WinMax;
Cd(Fs->parent_task->cur_dir);
Type("AESplash.DD");
Sleep(500);
try {
TMsg(dc,"Leaving all behind, they fled.");
TMsg(dc,"Found themselves in a desert.");
TMsg(dc,"God! We're gonna die!");
TMsg(dc,"\"Trust Me!\"");
} catch
Fs->catch_except=TRUE;
DCFill;
DCDel(dc);
}
U0 AfterEgypt()
{
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
Fs->song_task=Spawn(&SongTask,NULL,"Song",,Fs);
AutoComplete;
WinBorder;
WinMax;
DocClear;
PopUp("Trailer;",Fs);
try //Catch <CTRL-ALT-c>.
while (TakeTurn);
catch
PutExcept;
DocClear;
SettingsPop;
}
Binary file not shown.
-26
View File
@@ -1,26 +0,0 @@
U0 ViewComics()
{
I64 i=0;
U8 *st;
CDirEntry *tmpde=FilesFind("Comics/*.DD*"),*tmpde1=tmpde;
CDoc *doc=DocNew;
DocPrint(doc,"$$LTBLUE$$");
while (tmpde) {
st=StrNew(tmpde->name);
FileExtRem(st);
tmpde->user_data=DocPrint(doc,"$$MU-UL,\"%-10ts\",LE=%d$$ ",st,tmpde);
Free(st);
tmpde=tmpde->next;
if ((i++&3)==3)
DocPrint(doc,"\n");
}
while (TRUE) {
if ((tmpde=PopUpMenu(doc))>0)
Ed(tmpde->full_name);
else
break;
}
DocDel(doc);
DirTreeDel(tmpde1);
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
-97
View File
@@ -1,97 +0,0 @@
I64 type_weights[OT_NUM_TYPES]={0,30,30,15,30,30,1,1,1};
I64 mp_not_done_flags;
U0 MPDrawHoreb(CDC *dc2)
{
CTask *task=dc2->win_task;
CDC *dc=DCAlias(dc2,task);
I64 i,j,dx,dy,dz,w=task->pix_width,h=task->pix_height,r[16],cx=w>>1;
F64 s,m,a,x1,y1,x2,y2;
Obj *tmpo;
Mat4x4IdentEqu(r);
Mat4x4RotY(r,-é);
Mat4x4RotX(r,77*ã/180);
for (i=Gs->num;i<O_NUM_OBJS+O_NUM_PEBBLES;i+=mp_cnt) {
tmpo=&objs[i];
tmpo->x1=tmpo->x+vx; tmpo->y1=tmpo->y; tmpo->z1=tmpo->z+vz;
Mat4x4MulXYZ(r,&tmpo->x1,&tmpo->y1,&tmpo->z1);
if (tmpo->type==OT_SHEEP ||
tmpo->type==OT_GOAT1 || tmpo->type==OT_GOAT2) {
dx=100*tmpo->dx; dy=100*tmpo->dy; dz=100*tmpo->dz;
Mat4x4MulXYZ(r,&dx,&dy,&dz);
if (dx<0)
tmpo->sym=TRUE;
else
tmpo->sym=FALSE;
}
if (tmpo->z1>=0) {
s=100.0/(AbsI64(tmpo->z1)+50);
if (tmpo->type) {
Mat4x4IdentEqu(dc->r);
Mat4x4Scale(dc->r,s*2);
DCMat4x4Set(dc,dc->r);
dc->flags|=DCF_TRANSFORMATION;
if (tmpo->sym) {
dc->flags|=DCF_SYMMETRY|DCF_JUST_MIRROR;
DCSymmetrySet(dc,s*tmpo->x1+cx,s*tmpo->y1+h,
s*tmpo->x1+cx,s*tmpo->y1+h+10);
}
Sprite3B(dc,s*tmpo->x1+cx,s*tmpo->y1+h,tmpo->z1,imgs[tmpo->type]);
} else {
dc->flags&=~DCF_TRANSFORMATION;
dc->color=pebble_colors[tmpo->num&3];
GrPlot3(dc,s*tmpo->x1+cx,s*tmpo->y1+h,tmpo->z1);
}
dc->flags&=~(DCF_SYMMETRY|DCF_JUST_MIRROR);
if (tmpo==&objs[O_BURNING_BUSH]) {//draw burning bush
dc->x=s*tmpo->x1+cx;
dc->y=s*tmpo->y1+h;
dc->z=tmpo->z1;
dc->pen_width=1;
dc->color=winmgr.updates&15;
for (j=0;j<45;j++) {
m=Sqr(Rand); a=2*ã*Rand;
P2R(&x1,&y1,m,a);
m=Sqr(Rand); a=2*ã*Rand;
P2R(&x2,&y2,m,a);
GrLine3(dc,20*x1,20*y1-25,0,20*x2,20*y2-25,0);
}
if (SqrI64(s*tmpo->x1)+SqrI64(s*tmpo->y1)<300*300)
horeb_done=TRUE;
}
}
}
dc->depth_buf=NULL;
DCDel(dc);
LBtr(&mp_not_done_flags,Gs->num);
}
U0 DrawHoreb(CTask *task,CDC *dc)
{
I64 i,x,y,z,w=task->pix_width,h=task->pix_height,r[16],cx=w>>1,cy=h>>1;
F64 s;
Mat4x4IdentEqu(r);
Mat4x4RotY(r,-é);
Mat4x4RotX(r,77*ã/180);
//Sun
x=vx; y=0; z=1000000+vz;
Mat4x4MulXYZ(r,&x,&y,&z);
s=100.0/(AbsI64(z)+50);
if (y<0) {
dc->color=BROWN;
GrCircle(dc,s*x+cx,15,15);
dc->color=YELLOW;
GrFloodFill(dc,s*x+cx,15);
}
DCDepthBufAlloc(dc);
mp_not_done_flags=1<<mp_cnt-1;
for (i=0;i<mp_cnt;i++)
JobQue(&MPDrawHoreb,dc,i);
while (mp_not_done_flags)
Yield;
if (Blink) {
dc->color=LTRED;
GrPrint(dc,cx-21*FONT_WIDTH/2,cy-FONT_HEIGHT/2,"Find the Burning Bush.");
}
}
-94
View File
@@ -1,94 +0,0 @@
I64 type_weights[OT_NUM_TYPES]={0,30,30,15,30,3,1,1,1};
I64 ObjCompare(Obj *o1,Obj *o2)
{
return o2->z1-o1->z1;
}
U0 DrawHoreb(CTask *task,CDC *dc)
{
I64 i,j,x,y,z,dx,dy,dz,
w=task->pix_width,
h=task->pix_height,r[16],
cx=w>>1,cy=h>>1;
F64 s,m,a,x1,y1,x2,y2;
Obj *o_sort[O_NUM_OBJS+O_NUM_PEBBLES],*tmpo;
Mat4x4IdentEqu(r);
Mat4x4RotY(r,-é);
Mat4x4RotX(r,77*ã/180);
//Sun
x=vx; y=0; z=1000000+vz;
Mat4x4MulXYZ(r,&x,&y,&z);
s=100.0/(AbsI64(z)+50);
if (y<0) {
dc->color=BROWN;
GrCircle(dc,s*x+cx,15,15);
dc->color=YELLOW;
GrFloodFill(dc,s*x+cx,15);
}
for (i=0;i<O_NUM_OBJS+O_NUM_PEBBLES;i++) {
tmpo=&objs[i];
o_sort[i]=tmpo;
tmpo->x1=tmpo->x+vx; tmpo->y1=tmpo->y; tmpo->z1=tmpo->z+vz;
Mat4x4MulXYZ(r,&tmpo->x1,&tmpo->y1,&tmpo->z1);
if (tmpo->type==OT_SHEEP ||
tmpo->type==OT_GOAT1 || tmpo->type==OT_GOAT2) {
dx=100*tmpo->dx; dy=100*tmpo->dy; dz=100*tmpo->dz;
Mat4x4MulXYZ(r,&dx,&dy,&dz);
if (dx<0)
tmpo->sym=TRUE;
else
tmpo->sym=FALSE;
}
}
QSortI64(o_sort,O_NUM_OBJS+O_NUM_PEBBLES,&ObjCompare);
for (i=0;i<O_NUM_OBJS+O_NUM_PEBBLES;i++) {
tmpo=o_sort[i];
if (tmpo->z1<0) break;
s=100.0/(AbsI64(tmpo->z1)+50);
if (tmpo->type) {
Mat4x4IdentEqu(dc->r);
Mat4x4Scale(dc->r,s*2);
DCMat4x4Set(dc,dc->r);
dc->flags|=DCF_TRANSFORMATION;
if (tmpo->sym) {
dc->flags|=DCF_SYMMETRY|DCF_JUST_MIRROR;
DCSymmetrySet(dc,s*tmpo->x1+cx,s*tmpo->y1+h,
s*tmpo->x1+cx,s*tmpo->y1+h+10);
}
Sprite3B(dc,s*tmpo->x1+cx,s*tmpo->y1+h,0,imgs[tmpo->type]);
} else {
dc->flags&=~DCF_TRANSFORMATION;
dc->color=pebble_colors[tmpo->num&3];
GrPlot3(dc,s*tmpo->x1+cx,s*tmpo->y1+h,tmpo->z1);
}
dc->flags&=~(DCF_SYMMETRY|DCF_JUST_MIRROR);
if (o_sort[i]==&objs[O_BURNING_BUSH]) {//draw burning bush
dc->x=s*tmpo->x1+cx;
dc->y=s*tmpo->y1+h;
dc->z=0;
dc->pen_width=1;
dc->color=winmgr.updates&15;
for (j=0;j<45;j++) {
m=Sqr(Rand); a=2*ã*Rand;
P2R(&x1,&y1,m,a);
m=Sqr(Rand); a=2*ã*Rand;
P2R(&x2,&y2,m,a);
GrLine3(dc,20*x1,20*y1-25,0,20*x2,20*y2-25,0);
}
if (SqrI64(s*tmpo->x1)+SqrI64(s*tmpo->y1)<300*300)
horeb_done=TRUE;
}
}
if (Blink) {
dc->color=LTRED;
GrPrint(dc,cx-21*FONT_WIDTH/2,cy-FONT_HEIGHT/2,"Find the Burning Bush.");
}
}
-144
View File
@@ -1,144 +0,0 @@
U0 AnimateTask(I64)
{
I64 i;
F64 t;
Obj *tmpo;
while (TRUE) {
t=tS;
for (i=0;i<O_NUM_OBJS+O_NUM_PEBBLES;i++) {
tmpo=&objs[i];
if (tmpo->type==OT_SHEEP ||
tmpo->type==OT_GOAT1 || tmpo->type==OT_GOAT2) {
tmpo->x+=tmpo->dx;
tmpo->y+=tmpo->dy;
tmpo->z+=tmpo->dz;
tmpo->dx=5*Cos(0.5*t+tmpo->é);
tmpo->dz=5*Sin(0.5*t+tmpo->é);
}
}
Sleep(20);
}
}
U0 Init()
{
Obj *tmpo;
I64 i,j,k,total=0;
for (i=0;i<OT_NUM_TYPES;i++)
total+=type_weights[i];
MemSet(objs,0,sizeof(objs));
for (i=0;i<O_NUM_OBJS+O_NUM_PEBBLES;i++) {
tmpo=&objs[i];
tmpo->num=i;
tmpo->x=RandU32&0x1FFF-0x1000;
tmpo->y=0;
tmpo->z=RandU32&0x1FFF-0x1000;
tmpo->é=2*ã*Rand;
tmpo->sym=RandU16&1;
if (i<O_NUM_OBJS) {
k=0;
j=RandU32%total;
while (TRUE) {
j-=type_weights[k];
if (j<0)
break;
else
k++;
}
tmpo->type=k;
} else
tmpo->type=OT_PEBBLE;
}
objs[O_BURNING_BUSH].type=OT_BUSH1;
vx=0; vz=0; é=0;
horeb_done=FALSE;
}
#define ANIMATE_STEPS 5
U0 AnimateéTask(F64 a)
{
I64 i;
for (i=0;i<ANIMATE_STEPS;i++) {
é+=a/ANIMATE_STEPS;
Sleep(20);
}
}
U0 AnimateVTask(F64 v)
{
I64 i;
for (i=0;i<ANIMATE_STEPS;i++) {
vx+=v/ANIMATE_STEPS*Sin(é);
vz+=v/ANIMATE_STEPS*Cos(é);
Sleep(20);
}
}
U0 Horeb()
{
I64 sc;
MenuPush(
"File {"
" Abort(,CH_SHIFT_ESC);"
" Exit(,CH_ESC);"
"}"
"Play {"
" Restart(,'\n');"
" Fwd(,,SC_CURSOR_UP);"
" Bwd(,,SC_CURSOR_DOWN);"
" Left(,,SC_CURSOR_LEFT);"
" Right(,,SC_CURSOR_RIGHT);"
"}"
);
SettingsPush(Fs,TSF_SAME_SONG); //See $LK,"SettingsPush",A="MN:SettingsPush"$
try {
Fs->text_attr=YELLOW<<4+BLUE;
Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_FOCUS
-WIF_SELF_GRAB_SCROLL-WIF_FOCUS_TASK_MENU;
AutoComplete;
WinBorder;
WinMax;
DocClear;
"$$BG,LTCYAN$$%h6c",'\n';
"$$BG,YELLOW$$%h30c",'\n';
BibleVerse(,"Exodus,3:1",21);
Init;
Fs->animate_task=Spawn(&AnimateTask,NULL,"Animate",,Fs);
Fs->draw_it=&DrawHoreb;
while (!horeb_done)
switch (GetKey(&sc)) {
case 0:
switch (sc.u8[0]) {
case SC_CURSOR_LEFT:
Spawn(&AnimateéTask,(-ã/100)(I64),"Animate é",,Fs);
break;
case SC_CURSOR_RIGHT:
Spawn(&AnimateéTask,( ã/100)(I64),"Animate é",,Fs);
break;
case SC_CURSOR_UP:
Spawn(&AnimateVTask,(-40.0 )(I64),"Animate V",,Fs);
break;
case SC_CURSOR_DOWN:
Spawn(&AnimateVTask,( 40.0 )(I64),"Animate V",,Fs);
break;
}
break;
case '\n':
Init;
break;
case CH_SHIFT_ESC:
case CH_ESC:
goto hr_done;
}
hr_done: //Don't goto out of try
} catch
Fs->catch_except=TRUE;
DocClear;
SettingsPop(Fs,TSF_SAME_SONG);
MenuPop;
}
-24
View File
@@ -1,24 +0,0 @@
#help_index "Games"
Cd(__DIR__);;
#include "Comics"
#include "/Demo/Graphics/Camp"
#include "/Demo/MultiCore/Clouds"
#include "/Demo/Graphics/Mountain"
#include "Map"
#include "Battle"
#include "WaterRock"
#include "Quail"
#include "HorebA"
#if mp_cnt>=4
#include "HorebBMP"
#else
#include "HorebBSP"
#endif
#include "HorebC"
#include "GodTalking"
#include "AfterEgypt"
#help_index ""
-77
View File
@@ -1,77 +0,0 @@
I64 x=0,y=0;
U0 DrawMap(CTask *,CDC *dc)
{
static I64 last_x;
static Bool last_left;
if (x<last_x)
last_left=TRUE;
else if (x>last_x)
last_left=FALSE;
dc->pen_width=1;
if (last_left)
Sprite3(dc,x,y,0,left_imgs [ToI64(6.0*tS)&3]);
else
Sprite3(dc,x,y,0,right_imgs[ToI64(6.0*tS)&3]);
last_x=x;
}
#define AE1_MIN 0.02
#define AE1_MAX 0.05
#define AE2_MIN 0.15
#define AE2_MAX 0.30
U0 AEMap()
{
I64 i=0,
cx=Fs->pix_width>>1,
cy=Fs->pix_height>>1,
c_min=MinI64(cx,cy),
*r=NULL,
x1=0,y1=0,z1=0,
x_last=x1,y_last=y1;
F64 a,a1=(AE1_MAX+AE1_MIN)/2,a2=(AE2_MAX+AE2_MIN)/2,a2_total=a2,
x_scale=ToF64(cx)/c_min,y_scale=ToF64(cy)/c_min;
CDC *dc=DCAlias;
SettingsPush(Fs,TSF_SAME_SONG); //See $LK,"SettingsPush",A="MN:SettingsPush"$
Fs->text_attr=YELLOW<<4+BLUE;
DocClear;
"$$BG,YELLOW$$%h*c",TEXT_ROWS,'\n';
BibleVerse(,"Exodus,16:35",3);
Fs->draw_it=&DrawMap;
try {
while (!ScanChar) {
dc->color=BLACK;
a1=Clamp(Wrap(a1+(AE1_MAX+AE1_MIN)/5.0*(Rand-0.5)),-AE1_MAX,AE1_MAX);
a=a1;
if ( 0.0<=a<=AE1_MIN) a=AE1_MIN;
if (-AE1_MIN<=a<=0.0) a=-AE1_MIN;
Free(r);
r=Mat4x4IdentNew;
Mat4x4RotZ(r,a);
Mat4x4MulXYZ(r,&x1,&y1,&z1);
a2=Clamp(Wrap(a2+(AE2_MAX+AE2_MIN)/5.0*(Rand-0.5)),-AE2_MAX,AE2_MAX);
a=a2;
if ( 0.0<=a<=AE2_MIN) a=AE2_MIN;
if (-AE2_MIN<=a<=0.0) a=-AE2_MIN;
a2_total+=a;
x1=ClampI64(x1+6.0*Cos(a2_total),-c_min+10,c_min-10);
y1=ClampI64(y1+6.0*Sin(a2_total),-c_min+10,c_min-10);
x=x_scale*x1+cx; y=y_scale*y1+cy;
if (i++&1)
GrLine(dc,x_last,y_last,x,y);
x_last=x; y_last=y;
Sleep(15);
}
} catch
Fs->catch_except=TRUE;
DocClear;
SettingsPop(Fs,TSF_SAME_SONG);
Free(r);
DCFill(dc);
DCDel(dc);
}

Some files were not shown because too many files have changed in this diff Show More