TempleOSCD_150720.ISO
This commit is contained in:
1 parent
401601816c
commit
f8c05f98f4
554 files changed
+25980
-24787
No files matched your search
Binary file not shown.
@@ -23,7 +23,7 @@ HashTablePurge(adam_task->hash_table);
|
||||
|
||||
//Use Dbg("Type 'G;'"); to debug before window mgr is running.
|
||||
|
||||
public F64 os_version=3.03;//Operating system version.
|
||||
public F64 os_version=3.07;//Operating system version.
|
||||
|
||||
#include "AExts.HPP"
|
||||
#include "AMath"
|
||||
@@ -56,7 +56,7 @@ Cd("::/Adam/Ctrls");;
|
||||
|
||||
Cd("::/Adam");;
|
||||
#include "AutoFile"
|
||||
#include "Acct"
|
||||
#include "ARegistry"
|
||||
|
||||
Cd("::/Adam/AutoComplete");;
|
||||
#include "AutoComplete"
|
||||
@@ -75,16 +75,17 @@ DocTermNew;
|
||||
WinVert(2,10);
|
||||
|
||||
sys_winmgr_task=Spawn(&WinMgrTask,NULL,"Window Mgr");
|
||||
Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_BORDER-WIF_SELF_GRAB_SCROLL-WIF_SELF_CTRLS;
|
||||
Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_BORDER
|
||||
-WIF_SELF_GRAB_SCROLL-WIF_SELF_CTRLS;
|
||||
LBts(&Fs->display_flags,DISPLAYf_CHILDREN_NOT_ON_TOP);
|
||||
LBts(&Fs->display_flags,DISPLAYf_SHOW);
|
||||
RegistryInit;
|
||||
RegInit;
|
||||
LBts(&sys_run_level,RLf_REGISTRY);
|
||||
|
||||
Cd("::/Adam");;
|
||||
#include "WallPaper"
|
||||
|
||||
if (IsDrvWritable)
|
||||
if (DrvIsWritable)
|
||||
MkDir("/Temp"); //Good to have a Temp
|
||||
|
||||
#exe {OptOff(OPTf_WARN_PAREN);};
|
||||
|
||||
+13
-8
@@ -1,5 +1,6 @@
|
||||
#help_index "Debugging/Dump"
|
||||
Bool ClassRep2(CDoc *doc,U8 *_d,U8 *class_name=lastclass,I64 depth,I64 max_depth,Bool dynamic,I64 types=HTT_CLASS,I64 offset=0)
|
||||
Bool ClassRep2(CDoc *doc,U8 *_d,U8 *class_name=lastclass,
|
||||
I64 depth,I64 max_depth,Bool dynamic,I64 types=HTT_CLASS,I64 offset=0)
|
||||
{//See $LK,"::/Demo/LastClass.CPP"$.
|
||||
I64 i,j,stars,*ptr;
|
||||
CMemberLst *ml;
|
||||
@@ -15,7 +16,8 @@ Bool ClassRep2(CDoc *doc,U8 *_d,U8 *class_name=lastclass,I64 depth,I64 max_depth
|
||||
DocPrint(doc,"Bad Ptr:%016X\n",_d);
|
||||
return FALSE;
|
||||
}
|
||||
if (tempc->base_class && !ClassRep2(doc,_d,tempc->base_class->str,depth,max_depth,dynamic,types,offset))
|
||||
if (tempc->base_class && !ClassRep2(doc,_d,tempc->base_class->str,
|
||||
depth,max_depth,dynamic,types,offset))
|
||||
return FALSE;
|
||||
unlock=DocLock(doc);
|
||||
DocPrint(doc,"Class:\"%s\"\n",class_name);
|
||||
@@ -149,7 +151,8 @@ Bool ClassRep2(CDoc *doc,U8 *_d,U8 *class_name=lastclass,I64 depth,I64 max_depth
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
public U0 ClassRep(U8 *_d,U8 *class_name=lastclass,I64 max_depth=2,Bool fun=FALSE,I64 offset=0)
|
||||
public U0 ClassRep(U8 *_d,U8 *class_name=lastclass,
|
||||
I64 max_depth=2,Bool fun=FALSE,I64 offset=0)
|
||||
{//Displays members of a record by using the compiler's info.
|
||||
CDoc *doc;
|
||||
Bool old_preempt;
|
||||
@@ -157,7 +160,7 @@ public U0 ClassRep(U8 *_d,U8 *class_name=lastclass,I64 max_depth=2,Bool fun=FALS
|
||||
doc=DocNew;
|
||||
} else {
|
||||
DocMax;
|
||||
old_preempt=Preempt(OFF);
|
||||
old_preempt=Preempt;
|
||||
doc=DocPut;
|
||||
}
|
||||
if (fun)
|
||||
@@ -173,7 +176,8 @@ public U0 ClassRep(U8 *_d,U8 *class_name=lastclass,I64 max_depth=2,Bool fun=FALS
|
||||
Preempt(old_preempt);
|
||||
}
|
||||
|
||||
public U0 ClassRepD(U8 *_d,U8 *class_name=lastclass,I64 max_depth=2,Bool fun=FALSE,I64 offset=0)
|
||||
public U0 ClassRepD(U8 *_d,U8 *class_name=lastclass,
|
||||
I64 max_depth=2,Bool fun=FALSE,I64 offset=0)
|
||||
{//Dynamic ClassRep. Uses hex_ed widgit for live changes.
|
||||
CDoc *doc;
|
||||
Bool old_preempt;
|
||||
@@ -181,7 +185,7 @@ public U0 ClassRepD(U8 *_d,U8 *class_name=lastclass,I64 max_depth=2,Bool fun=FAL
|
||||
doc=DocNew;
|
||||
} else {
|
||||
DocMax;
|
||||
old_preempt=Preempt(OFF);
|
||||
old_preempt=Preempt;
|
||||
doc=DocPut;
|
||||
}
|
||||
if (fun)
|
||||
@@ -220,7 +224,7 @@ public U0 FunRep(U8 *st,U8 *rbp=NULL,I64 max_depth=2,CTask *task=NULL)
|
||||
if (tempf) {
|
||||
if (rbp) {
|
||||
if (task) {
|
||||
//tempf->size is negative. It's the bottom
|
||||
//tempf->size is negative. It's the bottom
|
||||
//of the fun local var space relative to RBP .
|
||||
size=tempf->arg_cnt*8-tempf->size+16;
|
||||
|
||||
@@ -255,7 +259,8 @@ public U0 Uf(U8 *st)
|
||||
if (tempf->type&HTT_FUN)
|
||||
FunRep(st);
|
||||
if (dbg_info=tempf->dbg_info) {
|
||||
i=dbg_info->body[dbg_info->max_line+1-dbg_info->min_line]-dbg_info->body[0];
|
||||
i=dbg_info->body[dbg_info->max_line+1-dbg_info->min_line]
|
||||
-dbg_info->body[0];
|
||||
Un(dbg_info->body[0],i);
|
||||
"Code Size:%04X\n",i;
|
||||
} else
|
||||
|
||||
+20
-32
@@ -4,48 +4,36 @@ U0 LoadDocDefines()
|
||||
{
|
||||
CBinFile *bfh=sys_boot_base-sizeof(CBinFile);
|
||||
|
||||
DefinePrint(
|
||||
"DD_OS_NAME_VERSION","TempleOS V%0.2f",os_version);
|
||||
DefinePrint(
|
||||
"DD_TEMPLEOS_AGE","%0.1f",(Now-Str2Date("8/1/2003"))/ToF64(1<<32)/CDATE_YEAR_DAYS);
|
||||
DefinePrint("DD_OS_NAME_VERSION","TempleOS V%0.2f",os_version);
|
||||
DefinePrint("DD_TEMPLEOS_AGE","%0.1f",
|
||||
(Now-Str2Date("8/1/2003"))/ToF64(1<<32)/CDATE_YEAR_DAYS);
|
||||
|
||||
//This is cut and replaced when I generate a distro.
|
||||
//See $LK,"DD_TEMPLEOS_LOC",A="FF:::/Demo/AcctExample/TOSDistro.CPP,DD_TEMPLEOS_LOC"$.
|
||||
$TR-C,"LineRep"$
|
||||
$ID,4$DefinePrint("DD_TEMPLEOS_LOC","120,789");
|
||||
DefinePrint("DD_TEMPLEOS_LOC_OFFICIAL","79,959");
|
||||
$ID,4$DefinePrint("DD_TEMPLEOS_LOC","122,918");
|
||||
DefinePrint("DD_TEMPLEOS_LOC_OFFICIAL","80,950");
|
||||
$ID,-4$
|
||||
DefinePrint(
|
||||
"DD_KERNEL","%08X",bfh);
|
||||
DefinePrint("DD_KERNEL","%08X",bfh);
|
||||
bfh(I64)+=bfh->file_size-1;
|
||||
DefinePrint(
|
||||
"DD_KERNEL_END","%08X",bfh);
|
||||
DefinePrint(
|
||||
"DD_PROTECTED_LOW","%08X",MEM_PROTECTED_LOW_LIMIT);
|
||||
DefinePrint("DD_KERNEL_END","%08X",bfh);
|
||||
DefinePrint("DD_PROTECTED_LOW","%08X",MEM_PROTECTED_LOW_LIMIT);
|
||||
|
||||
//$LK,"DD_BOOT_HIGH_LOC_CD",A="FF:::/Adam/Boot/BootCD.CPP,DD_BOOT_HIGH_LOC_CD"$
|
||||
|
||||
DefinePrint(
|
||||
"DD_MP_VECT","%08X",MP_VECT_ADDR);
|
||||
DefinePrint(
|
||||
"DD_MP_VECT_END","%08X",MP_VECT_ADDR+AP_16BIT_INIT_END-AP_16BIT_INIT-1);
|
||||
DefinePrint("DD_MP_VECT","%08X",MP_VECT_ADDR);
|
||||
DefinePrint("DD_MP_VECT_END","%08X",
|
||||
MP_VECT_ADDR+AP_16BIT_INIT_END-AP_16BIT_INIT-1);
|
||||
|
||||
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_MIN_MEG","%d Meg",MEM_MIN_MEG);
|
||||
DefinePrint(
|
||||
"DD_MEM_MAPPED_SPACE_GIG","%d Gig",MEM_MAPPED_SPACE/0x40000000);
|
||||
DefinePrint(
|
||||
"DD_MEM_MAPPED_SPACE_END","%010X",MEM_MAPPED_SPACE-1);
|
||||
DefinePrint(
|
||||
"DD_JIFFY_HZ","%d Hz",JIFFY_FREQ);
|
||||
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_MIN_MEG","%d Meg",MEM_MIN_MEG);
|
||||
DefinePrint("DD_MEM_MAPPED_SPACE_GIG","%d Gig",MEM_MAPPED_SPACE/0x40000000);
|
||||
DefinePrint("DD_MEM_MAPPED_SPACE_END","%010X",MEM_MAPPED_SPACE-1);
|
||||
DefinePrint("DD_JIFFY_HZ","%d Hz",JIFFY_FREQ);
|
||||
}
|
||||
|
||||
LoadDocDefines;
|
||||
+18
-12
@@ -4,17 +4,15 @@ extern U0 ACDFillin(I64 n);
|
||||
extern U0 ACFillIn(I64 n);
|
||||
extern U0 ACFindMisspelled(CDoc *doc);
|
||||
extern U0 ACMan(I64 n,CTask *parent=NULL);
|
||||
extern U0 AcctOneTimePopUp(I64 flag_num,U8 *msg);
|
||||
extern I64 AdamFile(U8 *filename,Bool warn_ext=TRUE);
|
||||
extern Bool AutoComplete(Bool val=OFF);
|
||||
extern I64 BMPWrite(U8 *filename,CDC *dc,I64 bits=4);
|
||||
extern I64 CDFileCreate(U8 *_filename=NULL,U8 *src_files_find_mask,U8 *fu_flags=NULL,
|
||||
U8 *_stage2_filename=NULL);
|
||||
extern U0 ClipboardDel();
|
||||
extern CCtrl *CtrlFindUnique(CTask *haystack_task,I64 needle_type);
|
||||
extern Bool CtrlInside(CCtrl *c,I64 x,I64 y);
|
||||
extern U8 *DC2Sprite(CDC *tempb);
|
||||
extern U0 DocBMP(CDoc *doc=NULL,U8 *filename,Bool dither_probability=FALSE,Bool use_ms_paint_palette=FALSE);
|
||||
extern U0 DocBMP(CDoc *doc=NULL,U8 *filename,
|
||||
Bool dither_probability=FALSE,Bool use_ms_paint_palette=FALSE);
|
||||
extern U0 DocBinDel(CDoc *doc,CDocBin *b);
|
||||
extern U0 DocBinsValidate(CDoc *doc);
|
||||
extern U0 DocBottom(CDoc *doc=NULL);
|
||||
@@ -27,7 +25,8 @@ extern U0 DocDel(CDoc *doc);
|
||||
extern CDoc *DocDisplay(CTask *task=NULL);
|
||||
extern U0 DocDump(CDoc *doc,I64 uS_delay=0);
|
||||
extern CDocEntry *DocEntryCopy(CDoc *doc,CDocEntry *doc_e);
|
||||
extern Bool DocFormDo(U8 *_d,U8 *class_name=lastclass,I64 dof_flags=0,U8 *header=NULL,U8 *footer=NULL);
|
||||
extern Bool DocForm(U8 *_d,U8 *class_name=lastclass,
|
||||
I64 dof_flags=0,U8 *header=NULL,U8 *footer=NULL);
|
||||
extern U0 DocHelpIndex(CDoc *doc,U8 *index);
|
||||
extern U0 DocInsDoc(CDoc *doc,CDoc *doc2);
|
||||
extern U0 DocInsEntry(CDoc *doc,CDocEntry *doc_e);
|
||||
@@ -51,9 +50,11 @@ extern I64 EdCurU8(CDoc *doc);
|
||||
extern U0 EdCursorLeft(CDoc *doc,I64 sc=MIN_I64);
|
||||
extern U0 EdCursorRight(CDoc *doc,I64 sc=MIN_I64);
|
||||
extern U8 *EdSprite(I64 bin_num);
|
||||
extern I64 FindWiz();
|
||||
extern I64 GetI64(U8 *msg,I64 dft,I64 lo=MIN_I64,I64 hi=MAX_I64);
|
||||
extern U0 GrPlot0(CDC *dc,I64 x,I64 y);
|
||||
extern I64 GrepWiz();
|
||||
extern I64 ISOFileCreate(U8 *_filename=NULL,U8 *src_files_find_mask,
|
||||
U8 *fu_flags=NULL,U8 *_stage2_filename=NULL);
|
||||
extern CMenuEntry *MenuEntryFind(CMenu *m,U8 *full_name);
|
||||
extern CMenu *MenuFilePush(U8 *filename);
|
||||
extern U0 MenuPop();
|
||||
@@ -61,18 +62,22 @@ extern CMenu *MenuPush(U8 *st);
|
||||
extern CTask *Noise(I64 mS,I64 min_freq,I64 max_freq);
|
||||
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,Bool allow_transpant=TRUE,Bool allow_dft=TRUE);
|
||||
extern I64 PopUpColor(U8 *header=NULL,
|
||||
Bool allow_transpant=TRUE,Bool allow_dft=TRUE);
|
||||
extern I64 PopUpColorDither(U8 *header=NULL);
|
||||
extern I64 PopUpColorLighting(U8 *header=NULL);
|
||||
extern I64 PopUpFile(U8 *filename,Bool warn_ext=TRUE,CTask *parent=NULL,CTask **_pu_task=NULL);
|
||||
extern Bool PopUpForm(U8 *_d,U8 *class_name=lastclass,I64 dof_flags=DOF_MIN_SIZE,
|
||||
U8 *header=NULL,U8 *footer=NULL);
|
||||
extern I64 PopUpFile(U8 *filename,
|
||||
Bool warn_ext=TRUE,CTask *parent=NULL,CTask **_pu_task=NULL);
|
||||
extern Bool PopUpForm(U8 *_d,U8 *class_name=lastclass,
|
||||
I64 dof_flags=DOF_MIN_SIZE,U8 *header=NULL,U8 *footer=NULL);
|
||||
extern U8 *PopUpGetStr(U8 *header=NULL);
|
||||
extern I64 PopUpMenu(CDoc *doc,I64 dof_flags=0);
|
||||
extern Bool PopUpNoYes(U8 *header=NULL,U8 *footer=NULL);
|
||||
extern Bool PopUpOk(U8 *header=NULL,U8 *footer=NULL);
|
||||
extern I64 PopUpRangeI64(I64 lo,I64 hi,I64 step=1,U8 *header=NULL,U8 *footer=NULL);
|
||||
extern I64 PopUpRangeI64(
|
||||
I64 lo,I64 hi,I64 step=1,U8 *header=NULL,U8 *footer=NULL);
|
||||
extern Bool PopUpTransform(I64 *r);
|
||||
extern U0 RegOneTimePopUp(I64 flag_num,U8 *msg);
|
||||
extern U0 SettingsPop(CTask *task=NULL,I64 flags=0);
|
||||
extern CTaskSettings *SettingsPush(CTask *task=NULL,I64 flags=0);
|
||||
extern U0 TemplateCtrlSlider(CDoc *doc);
|
||||
@@ -80,7 +85,8 @@ extern Bool View();
|
||||
extern U0 ViewAnglesDel(CTask *task=NULL);
|
||||
extern CCtrl *ViewAnglesNew(CTask *task=NULL);
|
||||
extern Bool WinBorder(Bool val,CTask *task=NULL);
|
||||
extern CDoc *WinCursorPosSet(CTask *task,I64 ip_text_x,I64 ip_text_y,Bool set_cursor=TRUE);
|
||||
extern CDoc *WinCursorPosSet(
|
||||
CTask *task,I64 ip_text_x,I64 ip_text_y,Bool set_cursor=TRUE);
|
||||
extern Bool WinHorz(I64 left,I64 right,CTask *task=NULL);
|
||||
extern U0 WinMax(CTask *task=NULL);
|
||||
extern U0 WinMgrSync(I64 cnt=1,Bool force=FALSE);
|
||||
|
||||
+33
-74
@@ -1,4 +1,4 @@
|
||||
#help_index "Info;Hash;Cmd Line (Typically)"
|
||||
#help_index "Info;Hash/System;Cmd Line (Typically)"
|
||||
class CWho
|
||||
{
|
||||
CHashGeneric *h;
|
||||
@@ -80,11 +80,17 @@ U8 *HelpComment(CTask *task,CHash *temph,U8 *_src_link)
|
||||
|
||||
doc=DocPut(task);
|
||||
doc_e=doc->cur_entry;
|
||||
if (temph->type&HTT_FUN && !Bt(&temph(CHashFun *)->flags,Ff__EXTERN) &&
|
||||
!Bt(&temph(CHashFun *)->flags,Ff_INTERNAL))
|
||||
while (doc_e!=doc &&
|
||||
(!(doc_e->de_flags&DOCEF_TAG)||!StrOcc(doc_e->tag,'{')))
|
||||
doc_e=doc_e->next;
|
||||
if (temph->type&HTT_FUN) {
|
||||
if (Bt(&temph(CHashFun *)->flags,Ff__EXTERN) ||
|
||||
Bt(&temph(CHashFun *)->flags,Ff_INTERNAL))
|
||||
while (doc_e!=doc &&
|
||||
(!(doc_e->de_flags&DOCEF_TAG)||!StrOcc(doc_e->tag,';')))
|
||||
doc_e=doc_e->next;
|
||||
else
|
||||
while (doc_e!=doc &&
|
||||
(!(doc_e->de_flags&DOCEF_TAG)||!StrOcc(doc_e->tag,'{')))
|
||||
doc_e=doc_e->next;
|
||||
}
|
||||
if (doc_e!=doc) {
|
||||
if (doc_e->de_flags&DOCEF_TAG) {
|
||||
ptr=doc_e->tag;
|
||||
@@ -141,7 +147,7 @@ I64 HashEntriesCompare3(CWho *h1,CWho *h2)
|
||||
}
|
||||
|
||||
public U0 Who(U8 *fu_flags=NULL,CHashTable *h=NULL,
|
||||
U8 *outname=NULL,U8 mapfile_drv=0,U8 *index=NULL,CDoc *_doc=NULL)
|
||||
U8 *index=NULL,CDoc *doc=NULL)
|
||||
{//Dump hash symbol table.
|
||||
// "+p" for only public symbols
|
||||
// "+m" to order by number (normally alphabetical)
|
||||
@@ -150,12 +156,9 @@ public U0 Who(U8 *fu_flags=NULL,CHashTable *h=NULL,
|
||||
CHashSrcSym *temph;
|
||||
CHashGeneric *ptr;
|
||||
CWho *lst;
|
||||
I64 cnt,i,j,k,size,f=0,dbg_bin_num;
|
||||
U8 buf[512],*st,*src_link,*last_index=StrNew(""),*cur_index,*comment;
|
||||
CDoc *doc;
|
||||
Bool recurse,publics,map,old_preempt=Preempt(OFF);
|
||||
CDocBin *tempb;
|
||||
CDbgInfo *dbg_info;
|
||||
I64 cnt,i,j,k,f=0;
|
||||
U8 buf[512],*st,*last_index=StrNew(""),*cur_index,*comment;
|
||||
Bool recurse,publics,map,old_preempt=Preempt;
|
||||
CTask *task;
|
||||
|
||||
ScanFlags(&f,Define("ST_FILE_UTIL_FLAGS"),"+r");
|
||||
@@ -168,14 +171,6 @@ public U0 Who(U8 *fu_flags=NULL,CHashTable *h=NULL,
|
||||
|
||||
if (!h) h=Fs->hash_table;
|
||||
|
||||
if (_doc)
|
||||
doc=_doc;
|
||||
else if (outname) {
|
||||
doc=DocNew(outname);
|
||||
doc->flags|=DOCF_NO_CURSOR;
|
||||
} else
|
||||
doc=NULL;
|
||||
|
||||
if (index) {
|
||||
task=User;
|
||||
TaskWait(task);
|
||||
@@ -247,7 +242,6 @@ public U0 Who(U8 *fu_flags=NULL,CHashTable *h=NULL,
|
||||
for (i=0;i<cnt;i++) {
|
||||
comment=NULL;
|
||||
ptr=lst[i].h;
|
||||
dbg_info=NULL;
|
||||
if (index)
|
||||
if (cur_index=lst[i].index) {
|
||||
if (StrCmp(cur_index,last_index)) {
|
||||
@@ -265,38 +259,10 @@ public U0 Who(U8 *fu_flags=NULL,CHashTable *h=NULL,
|
||||
DocPrint(doc,"$$WW,0$$");
|
||||
} else {
|
||||
if (ptr->type&HTG_SRC_SYM && ptr(CHashSrcSym *)->src_link) {
|
||||
src_link=StrNew(ptr(CHashSrcSym *)->src_link);
|
||||
if (mapfile_drv && StrLen(src_link)>4 && buf[1]==':' && src_link[4]==':')
|
||||
src_link[3]=mapfile_drv;
|
||||
dbg_info=NULL;
|
||||
if (outname && doc && ptr->type & HTT_FUN) {
|
||||
if (dbg_info=ptr(CHashFun *)->dbg_info) {
|
||||
size=offset(CDbgInfo.body)+sizeof(U32)*(dbg_info->max_line+2-dbg_info->min_line);
|
||||
if (size>MSize(dbg_info)) {
|
||||
"Corrupt Map Entry\n";
|
||||
dbg_info=NULL;
|
||||
} else {
|
||||
if (dbg_info->min_line<=dbg_info->max_line) {
|
||||
tempb=CAlloc(sizeof(CDocBin));
|
||||
tempb->size=size;
|
||||
tempb->data=MAlloc(size);
|
||||
MemCpy(tempb->data,dbg_info,size);
|
||||
dbg_bin_num=tempb->num=doc->cur_bin_num++;
|
||||
tempb->use_cnt=1;
|
||||
QueIns(tempb,doc->bin_root.last);
|
||||
} else
|
||||
dbg_info=NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (dbg_info)
|
||||
DocPrint(doc,"$$LK,\"%-20s\",A=\"%s\",BI=%d$$",ptr->str,src_link,dbg_bin_num);
|
||||
else {
|
||||
DocPrint(doc,"$$LK,\"%-20s\",A=\"%s\"$$",ptr->str,src_link);
|
||||
if (index)
|
||||
comment=HelpComment(task,ptr,src_link);
|
||||
}
|
||||
Free(src_link);
|
||||
DocPrint(doc,"$$LK,\"%-20s\",A=\"%s\"$$",
|
||||
ptr->str,ptr(CHashSrcSym *)->src_link);
|
||||
if (index)
|
||||
comment=HelpComment(task,ptr,ptr(CHashSrcSym *)->src_link);
|
||||
} else
|
||||
DocPrint(doc,"%-20s",ptr->str);
|
||||
|
||||
@@ -309,12 +275,9 @@ public U0 Who(U8 *fu_flags=NULL,CHashTable *h=NULL,
|
||||
else
|
||||
StrPrint(buf,"%-10tQ %02X",st,j);
|
||||
Free(st);
|
||||
} else if (ptr->type & HTT_GLBL_VAR) {
|
||||
if (outname)
|
||||
StrPrint(buf,"%010X ",ptr(CHashGlblVar *)->data_addr_ip);
|
||||
else
|
||||
StrPrint(buf,"%010X ",ptr(CHashGlblVar *)->data_addr);
|
||||
} else
|
||||
} else if (ptr->type & HTT_GLBL_VAR)
|
||||
StrPrint(buf,"%010X ",ptr(CHashGlblVar *)->data_addr);
|
||||
else
|
||||
StrPrint(buf,"%010X ",HashVal(ptr));
|
||||
j=HashEntrySize(ptr);
|
||||
if (j==-1)
|
||||
@@ -354,21 +317,17 @@ public U0 Who(U8 *fu_flags=NULL,CHashTable *h=NULL,
|
||||
wh_done:
|
||||
Preempt(old_preempt);
|
||||
if (doc) {
|
||||
DocBinsValidate(doc);
|
||||
if (!_doc) {
|
||||
DocWrite(doc);
|
||||
DocDel(doc);
|
||||
} else {
|
||||
if (doc->root.next==doc)
|
||||
DocPrint(doc,"No Match");
|
||||
else
|
||||
DocRecalc(doc);
|
||||
}
|
||||
if (doc->root.next==doc)
|
||||
DocPrint(doc,"No Match");
|
||||
else
|
||||
DocRecalc(doc);
|
||||
}
|
||||
Free(last_index);
|
||||
Kill(task);
|
||||
}
|
||||
|
||||
#help_index "Info;Hash;Cmd Line (Typically)"
|
||||
|
||||
#define HDR_MAX 16
|
||||
public I64 HashDepthRep(CHashTable *table=NULL)
|
||||
{//Hash table linked-list chain depth report.
|
||||
@@ -393,16 +352,16 @@ public I64 HashDepthRep(CHashTable *table=NULL)
|
||||
if (a[i])
|
||||
"%02d:%d\n",i,a[i];
|
||||
"Size:%d Count:%d Longest:%d\n",
|
||||
table->mask+1,cnt,longest;
|
||||
table->mask+1,cnt,longest;
|
||||
return longest;
|
||||
}
|
||||
|
||||
#help_index "Help System;Training"
|
||||
#help_index "Help System"
|
||||
#help_file "::/Doc/HelpSystem"
|
||||
|
||||
public U0 DocHelpIndex(CDoc *doc,U8 *index)
|
||||
{//Put to doc report for given help index.
|
||||
Who("+p",,,,index,doc);
|
||||
Who("+p",,index,doc);
|
||||
}
|
||||
|
||||
public U0 PopUpHelpIndex(U8 *index,CTask *parent=NULL)
|
||||
@@ -413,7 +372,7 @@ public U0 PopUpHelpIndex(U8 *index,CTask *parent=NULL)
|
||||
Free(buf);
|
||||
}
|
||||
|
||||
#help_index "Hash"
|
||||
#help_index "Hash/System"
|
||||
public U0 MapFileLoad(U8 *filename)
|
||||
{//Load map file so we have src line info.
|
||||
U8 *st,*ptr,*name=DftExt(filename,"MAP.Z"),
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
#help_index "Math"
|
||||
public U0 R2P(F64 *_mag=NULL,F64 *_arg=NULL,F64 x,F64 y)
|
||||
{//Rect to polar
|
||||
//Returns angle in range (-ã,ã]
|
||||
//Returns angle in range (-ã,ã]
|
||||
if (_arg)
|
||||
*_arg=Arg(x,y);
|
||||
if (_mag)
|
||||
@@ -64,7 +64,7 @@ public F64 Cosh(F64 x)
|
||||
return 0.5*(Exp(x)+Exp(-x));
|
||||
}
|
||||
|
||||
#help_index "Math/Complex"
|
||||
#help_index "Math/Complex;Data Types/Complex"
|
||||
public Complex *CAdd(Complex *n1,Complex *n2,Complex *sum)
|
||||
{//n1 + n2 -->sum
|
||||
sum->x=n1->x+n2->x;
|
||||
|
||||
+32
-30
@@ -30,10 +30,10 @@ U0 ODERstPtrs(CMathODE *ode)
|
||||
public CMathODE *ODENew(I64 n,F64 max_tolerance=1e-6,I64 flags=0)
|
||||
{//Make differential equation ctrl struct. See $LK,"flags",A="MN:ODEF_HAS_MASSES"$.
|
||||
|
||||
//The tolerance is not precise.
|
||||
//You can min_tolerance and it will
|
||||
//dynamically adjust tolerance to utilize
|
||||
//the CPU.
|
||||
//The tolerance is not precise.
|
||||
//You can min_tolerance and it will
|
||||
//dynamically adjust tolerance to utilize
|
||||
//the CPU.
|
||||
|
||||
I64 s=n*sizeof(F64);
|
||||
CMathODE *ode=MAlloc(sizeof(CMathODE));
|
||||
@@ -78,7 +78,7 @@ public I64 ODESize(CMathODE *ode)
|
||||
U0 ODESetMassesPtrs(CMathODE *ode,F64 *state,F64 *DstateDt)
|
||||
{
|
||||
COrder2D3 *ptr1=state(F64 *)+ode->n,
|
||||
*ptr2=DstateDt(F64 *)+ode->n;
|
||||
*ptr2=DstateDt(F64 *)+ode->n;
|
||||
CMass *tempm=ode->next_mass;
|
||||
while (tempm!=&ode->next_mass) {
|
||||
tempm->state=ptr1++;
|
||||
@@ -178,8 +178,8 @@ public CSpring *SpringFind(CMathODE *ode,F64 x,F64 y,F64 z=0)
|
||||
temps=ode->next_spring;
|
||||
while (temps!=&ode->next_spring) {
|
||||
dd=Sqr((temps->end1->x+temps->end2->x)/2-x)+
|
||||
Sqr((temps->end1->y+temps->end2->y)/2-y)+
|
||||
Sqr((temps->end1->z+temps->end2->z)/2-z);
|
||||
Sqr((temps->end1->y+temps->end2->y)/2-y)+
|
||||
Sqr((temps->end1->z+temps->end2->z)/2-z);
|
||||
if (dd<best_dd) {
|
||||
best_dd=dd;
|
||||
best_spring=temps;
|
||||
@@ -189,8 +189,9 @@ public CSpring *SpringFind(CMathODE *ode,F64 x,F64 y,F64 z=0)
|
||||
return best_spring;
|
||||
}
|
||||
|
||||
public U0 MassOrSpringFind(CMathODE *ode,CMass **result_mass,CSpring **result_spring,
|
||||
F64 x,F64 y,F64 z=0)
|
||||
public U0 MassOrSpringFind(
|
||||
CMathODE *ode,CMass **result_mass,CSpring **result_spring,
|
||||
F64 x,F64 y,F64 z=0)
|
||||
{//Find spring or mass nearest x,y,z.
|
||||
CMass *tempm,*best_mass=NULL;
|
||||
CSpring *temps,*best_spring=NULL;
|
||||
@@ -209,8 +210,8 @@ public U0 MassOrSpringFind(CMathODE *ode,CMass **result_mass,CSpring **result_sp
|
||||
temps=ode->next_spring;
|
||||
while (temps!=&ode->next_spring) {
|
||||
dd=Sqr((temps->end1->x+temps->end2->x)/2-x)+
|
||||
Sqr((temps->end1->y+temps->end2->y)/2-y)+
|
||||
Sqr((temps->end1->z+temps->end2->z)/2-z);
|
||||
Sqr((temps->end1->y+temps->end2->y)/2-y)+
|
||||
Sqr((temps->end1->z+temps->end2->z)/2-z);
|
||||
if (dd<best_dd) {
|
||||
best_dd=dd;
|
||||
best_spring=temps;
|
||||
@@ -288,15 +289,15 @@ U0 ODECalcDrag(CMathODE *ode)
|
||||
tempm=ode->next_mass;
|
||||
while (tempm!=&ode->next_mass) {
|
||||
if (!(tempm->flags & MSF_INACTIVE) &&
|
||||
tempm->drag_profile_factor &&
|
||||
(dd=D3NormSqr(&tempm->state->DxDt))) {
|
||||
tempm->drag_profile_factor &&
|
||||
(dd=D3NormSqr(&tempm->state->DxDt))) {
|
||||
d=ode->drag_v;
|
||||
if (ode->drag_v2)
|
||||
d+=ode->drag_v2*Sqrt(dd);
|
||||
if (ode->drag_v3)
|
||||
d+=dd*ode->drag_v3;
|
||||
D3SubEqu(&tempm->DstateDt->DxDt,
|
||||
D3Mul(d*tempm->drag_profile_factor,&tempm->state->DxDt,&p));
|
||||
D3Mul(d*tempm->drag_profile_factor,&tempm->state->DxDt,&p));
|
||||
}
|
||||
tempm=tempm->next;
|
||||
}
|
||||
@@ -311,7 +312,7 @@ U0 ODEApplyAccelerationLimit(CMathODE *ode)
|
||||
tempm=ode->next_mass;
|
||||
while (tempm!=&ode->next_mass) {
|
||||
if (!(tempm->flags & MSF_INACTIVE) &&
|
||||
(d=D3Norm(&tempm->DstateDt->DxDt))>ode->acceleration_limit)
|
||||
(d=D3Norm(&tempm->DstateDt->DxDt))>ode->acceleration_limit)
|
||||
D3MulEqu(&tempm->DstateDt->DxDt,ode->acceleration_limit/d);
|
||||
tempm=tempm->next;
|
||||
}
|
||||
@@ -422,7 +423,9 @@ U0 ODERK4OneStep(CMathODE *ode)
|
||||
U0 ODECashKarp(CMathODE *ode)
|
||||
{
|
||||
I64 i,n=ode->n_internal;
|
||||
F64 h=ode->h,*state=ode->state_internal,*DstateDt=ode->DstateDt,*ak2,*ak3,*ak4,*ak5,*ak6,*tempstate,*stateerr,*outstate;
|
||||
F64 h=ode->h,*state=ode->state_internal,
|
||||
*DstateDt=ode->DstateDt,*ak2,*ak3,*ak4,*ak5,*ak6,
|
||||
*tempstate,*stateerr,*outstate;
|
||||
|
||||
ak2=ode->temp0;
|
||||
ak3=ode->temp1;
|
||||
@@ -443,15 +446,19 @@ U0 ODECashKarp(CMathODE *ode)
|
||||
tempstate[i]=state[i]+h*(ODEb41*DstateDt[i]+ODEb42*ak2[i]+ODEb43*ak3[i]);
|
||||
ODECallDerivative(ode,ode->t+ODEa4*h,tempstate,ak4);
|
||||
for (i=0;i<n;i++)
|
||||
tempstate[i]=state[i]+h*(ODEb51*DstateDt[i]+ODEb52*ak2[i]+ODEb53*ak3[i]+ODEb54*ak4[i]);
|
||||
tempstate[i]=state[i]+h*(ODEb51*DstateDt[i]+
|
||||
ODEb52*ak2[i]+ODEb53*ak3[i]+ODEb54*ak4[i]);
|
||||
ODECallDerivative(ode,ode->t+ODEa5*h,tempstate,ak5);
|
||||
for (i=0;i<n;i++)
|
||||
tempstate[i]=state[i]+h*(ODEb61*DstateDt[i]+ODEb62*ak2[i]+ODEb63*ak3[i]+ODEb64*ak4[i]+ODEb65*ak5[i]);
|
||||
tempstate[i]=state[i]+h*(ODEb61*DstateDt[i]+
|
||||
ODEb62*ak2[i]+ODEb63*ak3[i]+ODEb64*ak4[i]+ODEb65*ak5[i]);
|
||||
ODECallDerivative(ode,ode->t+ODEa6*h,tempstate,ak6);
|
||||
for (i=0;i<n;i++)
|
||||
outstate[i]=state[i]+h*(ODEc1*DstateDt[i]+ODEc3*ak3[i]+ODEc4*ak4[i]+ODEc6*ak6[i]);
|
||||
outstate[i]=state[i]+h*(ODEc1*DstateDt[i]+
|
||||
ODEc3*ak3[i]+ODEc4*ak4[i]+ODEc6*ak6[i]);
|
||||
for (i=0;i<n;i++)
|
||||
stateerr[i]=h*(ODEdc1*DstateDt[i]+ODEdc3*ak3[i]+ODEdc4*ak4[i]+ODEdc5*ak5[i]+ODEdc6*ak6[i]);
|
||||
stateerr[i]=h*(ODEdc1*DstateDt[i]+ODEdc3*ak3[i]+
|
||||
ODEdc4*ak4[i]+ODEdc5*ak5[i]+ODEdc6*ak6[i]);
|
||||
}
|
||||
|
||||
#define SAFETY 0.9
|
||||
@@ -504,15 +511,11 @@ it has a timeout.
|
||||
I64 i;
|
||||
F64 d,start_time,timeout_time,t_desired,t_initial,interpolation;
|
||||
CMathODE *ode;
|
||||
Bool old_suspend;
|
||||
|
||||
if (task->next_ode==&task->next_ode)
|
||||
task->last_ode_time=0;
|
||||
else if (!Bt(&task->win_inhibit,WIf_SELF_ODE)) {
|
||||
//See $LK,"GrUpdateWins",A="MN:GrUpdateWins"$()
|
||||
//TODO: Being preempted here woulds be bad
|
||||
if (task!=Fs)
|
||||
old_suspend=Suspend(task);
|
||||
//See $LK,"GrUpdateTasks",A="MN:GrUpdateTasks"$() and $LK,"GrUpdateTaskODEs",A="MN:GrUpdateTaskODEs"$().
|
||||
//We will not pick a time limit based on
|
||||
//how busy the CPU is, what percent of the
|
||||
//last refresh cycle was spent on ODE's
|
||||
@@ -536,7 +539,8 @@ it has a timeout.
|
||||
ode->base_t+=t_desired-ode->t; //Slip
|
||||
else if (ode->derivative) {
|
||||
ODEState2Internal(ode);
|
||||
MemCpy(ode->initial_state,ode->state_internal,ode->n_internal*sizeof(F64));
|
||||
MemCpy(ode->initial_state,ode->state_internal,
|
||||
ode->n_internal*sizeof(F64));
|
||||
while (ode->t<t_desired) {
|
||||
ode->h_max=t_desired-ode->t;
|
||||
ODECallDerivative(ode,ode->t,ode->state_internal,ode->DstateDt);
|
||||
@@ -595,13 +599,11 @@ ode_done:
|
||||
else
|
||||
ode->tolerance_internal*=2.0`d;
|
||||
}
|
||||
ode->tolerance_internal=Clamp(ode->tolerance_internal,ode->min_tolerance,ode->max_tolerance);
|
||||
ode->tolerance_internal=Clamp(ode->tolerance_internal,
|
||||
ode->min_tolerance,ode->max_tolerance);
|
||||
}
|
||||
ode=ode->next;
|
||||
}
|
||||
winmgr.ode_time+=task->last_ode_time=tS-start_time;
|
||||
//See $LK,"GrUpdateWins",A="MN:GrUpdateWins"$()
|
||||
if (task!=Fs)
|
||||
Suspend(task,old_suspend);
|
||||
}
|
||||
}
|
||||
@@ -1,25 +1,25 @@
|
||||
#help_index "Misc/Accts"
|
||||
#define ACCT_REGISTRY_FILENAME "::/Home/Registry.CPP.Z"
|
||||
#help_index "Misc/Registry"
|
||||
#define REGISTRY_FILENAME "::/Home/Registry.CPP.Z"
|
||||
CDoc *sys_registry_doc=NULL;
|
||||
I64 sys_msg_flags[1]={0};
|
||||
F64 registry_version;
|
||||
|
||||
Bool AcctCacheRegistry()
|
||||
Bool RegCache()
|
||||
{
|
||||
Bool old_silent;
|
||||
if (!sys_registry_doc) {
|
||||
old_silent=Silent;
|
||||
sys_registry_doc=DocRead(ACCT_REGISTRY_FILENAME);
|
||||
sys_registry_doc=DocRead(REGISTRY_FILENAME);
|
||||
Silent(old_silent);
|
||||
return FALSE;
|
||||
} else
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
public Bool AcctRegSetDftEntry(U8 *path,U8 *val,Bool is_adam_entry=FALSE)
|
||||
public Bool RegSetDftEntry(U8 *path,U8 *val,Bool is_adam_entry=FALSE)
|
||||
{//Add code doc tree branch to registry.
|
||||
Bool result,unlock_doc;
|
||||
AcctCacheRegistry;
|
||||
RegCache;
|
||||
unlock_doc=DocLock(sys_registry_doc);
|
||||
if (!DocTreeFind(sys_registry_doc,path)) {
|
||||
DocTreeMake(sys_registry_doc,path);
|
||||
@@ -30,7 +30,7 @@ public Bool AcctRegSetDftEntry(U8 *path,U8 *val,Bool is_adam_entry=FALSE)
|
||||
else
|
||||
Adam("%s",val);
|
||||
}
|
||||
if (IsDrvWritable(':'))
|
||||
if (DrvIsWritable(':'))
|
||||
DocWrite(sys_registry_doc);
|
||||
result=FALSE;
|
||||
} else
|
||||
@@ -40,24 +40,25 @@ public Bool AcctRegSetDftEntry(U8 *path,U8 *val,Bool is_adam_entry=FALSE)
|
||||
return result;
|
||||
}
|
||||
|
||||
public I64 AcctRegExeBranch(U8 *path)
|
||||
public I64 RegExeBranch(U8 *path)
|
||||
{//Execute doc tree branch in registry.
|
||||
AcctCacheRegistry;
|
||||
RegCache;
|
||||
return DocTreeBranchExe(sys_registry_doc,path);
|
||||
}
|
||||
|
||||
public Bool AcctRegWriteBranch(U8 *path,U8 *fmt,...)
|
||||
public Bool RegWriteBranch(U8 *path,U8 *fmt,...)
|
||||
{//Rewrite doc tree branch in registry.
|
||||
Bool result,unlock_doc;
|
||||
CDocEntry *tree_branch,*start_indent,*end_indent;
|
||||
U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
|
||||
AcctCacheRegistry;
|
||||
RegCache;
|
||||
unlock_doc=DocLock(sys_registry_doc);
|
||||
if (result=DocTreeFind(sys_registry_doc,path,&tree_branch,&start_indent,&end_indent))
|
||||
if (result=DocTreeFind(sys_registry_doc,path,
|
||||
&tree_branch,&start_indent,&end_indent))
|
||||
DocCut(sys_registry_doc,tree_branch,end_indent);
|
||||
DocTreeMake(sys_registry_doc,path);
|
||||
DocPrint(sys_registry_doc,"%s",buf);
|
||||
if (IsDrvWritable(':'))
|
||||
if (DrvIsWritable(':'))
|
||||
DocWrite(sys_registry_doc);
|
||||
if (unlock_doc)
|
||||
DocUnlock(sys_registry_doc);
|
||||
@@ -83,23 +84,23 @@ public Bool OneTimePopUp(U8 *_flags,I64 flag_num,U8 *msg)
|
||||
return result;
|
||||
}
|
||||
|
||||
U0 AcctOneTimePopUp(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))
|
||||
AcctRegWriteBranch("Adam/SysMsgFlags","sys_msg_flags[0]=0x%X;\n",
|
||||
sys_msg_flags[0]);
|
||||
RegWriteBranch("Adam/SysMsgFlags","sys_msg_flags[0]=0x%X;\n",
|
||||
sys_msg_flags[0]);
|
||||
}
|
||||
|
||||
U0 RegistryInit()
|
||||
U0 RegInit()
|
||||
{
|
||||
U8 buf[136];
|
||||
U8 buf[STR_LEN];
|
||||
Bool version_present;
|
||||
AcctRegSetDftEntry("Adam/SysMsgFlags","sys_msg_flags[0]=0;\n",TRUE);
|
||||
RegSetDftEntry("Adam/SysMsgFlags","sys_msg_flags[0]=0;\n",TRUE);
|
||||
StrPrint(buf,"registry_version=%4.3f;\n",os_version);
|
||||
version_present=AcctRegSetDftEntry("Adam/SysRegVer",buf,TRUE);
|
||||
AcctRegExeBranch("Adam");
|
||||
version_present=RegSetDftEntry("Adam/SysRegVer",buf,TRUE);
|
||||
RegExeBranch("Adam");
|
||||
if (registry_version!=os_version) {
|
||||
AcctRegWriteBranch("Adam/SysRegVer",buf);
|
||||
AcctRegExeBranch("Adam");
|
||||
RegWriteBranch("Adam/SysRegVer",buf);
|
||||
RegExeBranch("Adam");
|
||||
}
|
||||
}
|
||||
+13
-10
@@ -25,6 +25,7 @@ public I64 TaskMemUsed(CTask *task=NULL,Bool override_validate=FALSE)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#help_index "Memory/Task;Debugging/Heap"
|
||||
public Bool HeapRep(CTask *task)
|
||||
{//Report status of task's heap.
|
||||
I64 i,cnt;
|
||||
@@ -86,7 +87,7 @@ public Bool HeapRep(CTask *task)
|
||||
|
||||
#help_index "Memory/HeapCtrl;Debugging/Heap"
|
||||
public Bool IsInHeapCtrl(U8 *a,CHeapCtrl *hc,Bool lock=TRUE)
|
||||
{//Check addr if on heap.
|
||||
{//Check addr if in HeapCtrl.
|
||||
CMemBlk *m;
|
||||
PUSHFD
|
||||
CLI
|
||||
@@ -134,7 +135,7 @@ public Bool HeapCtrlWalk(CHeapCtrl *hc)
|
||||
uum=uum->next;
|
||||
}
|
||||
|
||||
#if _CFG_HEAP_DBG
|
||||
#if _CFG_HEAP_DBG
|
||||
CMemUsed *um,*um1;
|
||||
um1=(&hc->next_um)(U8 *)-offset(CMemUsed.next);
|
||||
um=um1->next;
|
||||
@@ -149,7 +150,7 @@ public Bool HeapCtrlWalk(CHeapCtrl *hc)
|
||||
POPFD
|
||||
return TRUE;
|
||||
|
||||
hc_false:
|
||||
hc_false:
|
||||
LBtr(&hc->locked_flags,HClf_LOCKED);
|
||||
POPFD
|
||||
return FALSE;
|
||||
@@ -157,10 +158,11 @@ hc_false:
|
||||
|
||||
#help_index "Memory/Task;Debugging/Heap"
|
||||
public Bool IsInHeap(U8 *a,CTask *task=NULL,Bool lock=TRUE)
|
||||
{//Check addr if on heap.
|
||||
{//Check addr if in task's heaps.
|
||||
if (!task) task=Fs;
|
||||
if (TaskValidate(task) && (IsInHeapCtrl(a,task->code_heap,lock)||
|
||||
task->data_heap!=task->code_heap && IsInHeapCtrl(a,task->data_heap,lock)))
|
||||
task->data_heap!=task->code_heap &&
|
||||
IsInHeapCtrl(a,task->data_heap,lock)))
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
@@ -170,7 +172,7 @@ public Bool HeapWalk(CTask *task=NULL)
|
||||
{//Check integrity of task's heaps.
|
||||
if (!task) task=Fs;
|
||||
if (!TaskValidate(task) || !HeapCtrlWalk(task->code_heap) ||
|
||||
task->data_heap!=task->code_heap && !HeapCtrlWalk(task->data_heap))
|
||||
task->data_heap!=task->code_heap && !HeapCtrlWalk(task->data_heap))
|
||||
return FALSE;
|
||||
else
|
||||
return TRUE;
|
||||
@@ -183,14 +185,15 @@ U0 TaskRepTask(CTask *task,I64 indent)
|
||||
U8 *st,*desc=MStrUtil(task->task_title,SUF_SAFE_DOLLAR);
|
||||
st=MStrPrint("$$MA,T=\"%08X\",LM=\"Kill(0x%X);\n\",$$",task,task,task);
|
||||
"%h*c%s $$TX,\"%Q...\",SCX=16$$ Mem:%08X\n",indent,CH_SPACE,
|
||||
st,desc,TaskMemAlloced(task);
|
||||
st,desc,TaskMemAlloced(task);
|
||||
"%h*cFlags:%04X:%04X Time:%0.2fm\n",indent+2,CH_SPACE,
|
||||
task->task_flags,task->display_flags,
|
||||
task->total_time/60.0/cnts.time_stamp_freq_initial;
|
||||
task->task_flags,task->display_flags,
|
||||
task->total_time/60.0/cnts.time_stamp_freq_initial;
|
||||
Free(st);
|
||||
Free(desc);
|
||||
task1=task->next_child_task;
|
||||
while (task1!=(&task->next_child_task)(U8 *)-offset(CTask.next_sibling_task)) {
|
||||
while (task1!=(&task->next_child_task)(U8 *)
|
||||
-offset(CTask.next_sibling_task)) {
|
||||
TaskRepTask(task1,indent+2);
|
||||
task1=task1->next_sibling_task;
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -43,14 +43,15 @@ public U8 *ACDDefGet(U8 *st,I64 def_num=1)
|
||||
CFile *f;
|
||||
CHashGeneric *temph;
|
||||
U8 *result=NULL,*buf,*in_ptr,
|
||||
*st2=MStrUtil(st,SUF_TO_UPPER);
|
||||
*st2=MStrUtil(st,SUF_TO_UPPER);
|
||||
temph=HashFind(st2,ac.hash_table,HTT_DICT_WORD);
|
||||
Free(st2);
|
||||
if (temph) {
|
||||
if (f=FOpen(ACD_DEF_FILENAME,"r")) {
|
||||
buf=MAlloc(ACD_BLK_SIZE*2+1);
|
||||
buf[ACD_BLK_SIZE*2]=0; //terminate
|
||||
FRBlks(f,buf,temph->user_data0*ACD_BLK_SIZE/BLK_SIZE,ACD_BLK_SIZE*2/BLK_SIZE);
|
||||
FRBlks(f,buf,temph->user_data0*ACD_BLK_SIZE/BLK_SIZE,
|
||||
ACD_BLK_SIZE*2/BLK_SIZE);
|
||||
FClose(f);
|
||||
in_ptr=buf;
|
||||
while (in_ptr<buf+ACD_BLK_SIZE*2) {
|
||||
@@ -59,7 +60,7 @@ public U8 *ACDDefGet(U8 *st,I64 def_num=1)
|
||||
if (*in_ptr++==ACD_WORD_CHAR) {
|
||||
if (!StrICmp(st,in_ptr)) {
|
||||
while (def_num && *in_ptr!=ACD_WORD_CHAR
|
||||
&& in_ptr<buf+ACD_BLK_SIZE*2) {
|
||||
&& in_ptr<buf+ACD_BLK_SIZE*2) {
|
||||
if (*in_ptr==ACD_DEF_CHAR) {
|
||||
if (!--def_num)
|
||||
break;
|
||||
@@ -86,14 +87,15 @@ public U8 *ACDDefsGet(U8 *st)
|
||||
CFile *f;
|
||||
CHashGeneric *temph;
|
||||
U8 *result=NULL,*buf,*in_ptr,*in_ptr2,
|
||||
*st2=MStrUtil(st,SUF_TO_UPPER);
|
||||
*st2=MStrUtil(st,SUF_TO_UPPER);
|
||||
temph=HashFind(st2,ac.hash_table,HTT_DICT_WORD);
|
||||
Free(st2);
|
||||
if (temph) {
|
||||
if (f=FOpen(ACD_DEF_FILENAME,"r")) {
|
||||
buf=MAlloc(ACD_BLK_SIZE*2+1);
|
||||
buf[ACD_BLK_SIZE*2]=0; //terminate
|
||||
FRBlks(f,buf,temph->user_data0*ACD_BLK_SIZE/BLK_SIZE,ACD_BLK_SIZE*2/BLK_SIZE);
|
||||
FRBlks(f,buf,temph->user_data0*ACD_BLK_SIZE/BLK_SIZE,
|
||||
ACD_BLK_SIZE*2/BLK_SIZE);
|
||||
FClose(f);
|
||||
in_ptr=buf;
|
||||
while (in_ptr<buf+ACD_BLK_SIZE*2) {
|
||||
@@ -104,7 +106,7 @@ public U8 *ACDDefsGet(U8 *st)
|
||||
in_ptr2=in_ptr;
|
||||
in_ptr--;
|
||||
while (*in_ptr2!=ACD_WORD_CHAR
|
||||
&& in_ptr2<buf+ACD_BLK_SIZE*2) {
|
||||
&& in_ptr2<buf+ACD_BLK_SIZE*2) {
|
||||
in_ptr2++;
|
||||
}
|
||||
result=MAlloc(in_ptr2+1-in_ptr);
|
||||
@@ -129,7 +131,7 @@ public U8 *ACDWordPtAt(U8 *st)
|
||||
{//Point to word in word list.
|
||||
I64 i;
|
||||
U8 *start=acd.word_lst,*r=start,
|
||||
*end=acd.word_lst+acd.word_lst_size;
|
||||
*end=acd.word_lst+acd.word_lst_size;
|
||||
if (!st || !*st)
|
||||
return acd.word_lst;
|
||||
if (acd.word_lst_size) {
|
||||
@@ -219,7 +221,7 @@ public U0 ACDDefsPut(CDoc *doc=NULL,U8 *st,I64 num=-1)
|
||||
break;
|
||||
case ACD_DEF_CHAR:
|
||||
DocPrint(doc,"$$GREEN$$(%d)$$FG$$ %s\n",
|
||||
++i,st2);
|
||||
++i,st2);
|
||||
break;
|
||||
case ACD_PRONUNCIATION_CHAR:
|
||||
DocPrint(doc,"$$LTGREEN$$%s$$FG$$\n",st2);
|
||||
@@ -239,7 +241,7 @@ public U0 ACDDefsPut(CDoc *doc=NULL,U8 *st,I64 num=-1)
|
||||
while (st2=ACDDefGet(st,++i)) {
|
||||
if (i==num)
|
||||
DocPrint(doc,"$$GREEN$$(%d)$$FG$$ %s\n",
|
||||
i,st2);
|
||||
i,st2);
|
||||
Free(st2);
|
||||
}
|
||||
}
|
||||
@@ -263,22 +265,22 @@ U0 ACFindMisspelled(CDoc *doc)
|
||||
{
|
||||
Bool unlock=DocLock(doc);
|
||||
CDocEntry *doc_e=doc->cur_entry;
|
||||
I64 col=doc->cur_data_col,col2,ch;
|
||||
I64 col=doc->cur_col,col2,ch;
|
||||
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_bitmap_word,doc_e->tag[col]))
|
||||
while (col<doc_e->max_col && !Bt(chars_bmp_word,doc_e->tag[col]))
|
||||
col++;
|
||||
if (col<doc_e->max_col) {
|
||||
col2=col;
|
||||
while (col2<doc_e->max_col && Bt(chars_bitmap_word,doc_e->tag[col2]))
|
||||
while (col2<doc_e->max_col && Bt(chars_bmp_word,doc_e->tag[col2]))
|
||||
col2++;
|
||||
ch=doc_e->tag[col2];
|
||||
doc_e->tag[col2]=0;
|
||||
if (StrICmp(&doc_e->tag[col],ACDWordPtAt(&doc_e->tag[col])+1)) {
|
||||
doc_e->tag[col2]=ch;
|
||||
doc->cur_entry=doc_e;
|
||||
doc->cur_data_col=col;
|
||||
doc->cur_col=col;
|
||||
goto fm_done;
|
||||
}
|
||||
doc_e->tag[col2]=ch;
|
||||
|
||||
@@ -4,19 +4,59 @@ which will regenerate processed dictionary
|
||||
files from a raw Project Gutenberg
|
||||
dictionary file.
|
||||
|
||||
Supply the raw dictionary filename in
|
||||
the call at the bottom of this file
|
||||
and #include this file.
|
||||
|
||||
I ran $LK,"::/Misc/ToDolDoc.CPP"$ on it, first.
|
||||
$TX,"http://www.templeos.org/files/DICTIONARY.TXT",HTML="http://www.templeos.org/files/DICTIONARY.TXT"$
|
||||
|
||||
See $LK,"::/Doc/Credits.TXT"$.
|
||||
*/
|
||||
|
||||
U0 ACDPreprocess(U8 *in_name,U8 *out_name)
|
||||
{/*
|
||||
<cr><nl>--> <nl>
|
||||
$$ --> $$$$
|
||||
\'89 --> ‰
|
||||
*/
|
||||
I64 ch,i;
|
||||
U8 *src,*dst;
|
||||
CDoc *doc;
|
||||
CDocEntry *doc_e;
|
||||
if (doc=DocRead(in_name,DOCF_PLAIN_TEXT_WITH_TABS|DOCF_DBL_DOLLARS)) {
|
||||
doc_e=doc->root.next;
|
||||
while (doc_e!=doc) {
|
||||
if (doc_e->type_u8==DOCT_TEXT) {
|
||||
src=dst=doc_e->tag;
|
||||
while (ch=*src++) {
|
||||
if (ch=='\\' && *src=='\'') {
|
||||
src++;
|
||||
i=0;
|
||||
ch=ToUpper(*src++);
|
||||
if ('0'<=ch<='9')
|
||||
i+=ch-'0';
|
||||
else if ('A'<=ch<='F')
|
||||
i+=ch-'A'+10;
|
||||
i<<=4;
|
||||
ch=ToUpper(*src++);
|
||||
if ('0'<=ch<='9')
|
||||
i+=ch-'0';
|
||||
else if ('A'<=ch<='F')
|
||||
i+=ch-'A'+10;
|
||||
*dst++=i;
|
||||
} else
|
||||
*dst++=ch;
|
||||
}
|
||||
*dst=0;
|
||||
}
|
||||
doc_e=doc_e->next;
|
||||
}
|
||||
StrCpy(doc->filename.name,out_name);
|
||||
DocWrite(doc);
|
||||
DocDel(doc);
|
||||
}
|
||||
}
|
||||
|
||||
I64 ACDNextCmd(U8 **_ptr)
|
||||
{
|
||||
U8 ch,*ptr=*_ptr,*ptr2;
|
||||
I64 result=-1;
|
||||
U8 *ptr=*_ptr,*ptr2;
|
||||
I64 ch,result=-1;
|
||||
do {
|
||||
do {
|
||||
if (!(ch=*ptr++)) goto ncmd_done;
|
||||
@@ -28,21 +68,22 @@ I64 ACDNextCmd(U8 **_ptr)
|
||||
} while (ch!='>');
|
||||
*--ptr2=0;
|
||||
result=LstMatch(ptr,"h1\0/h1\0def\0/def\0hw\0/hw\0tt\0/tt\0"
|
||||
"ety\0@fld\0@cd\0@blockquote\0@wordforms\0@note\0@altname\0@chform\0@cref\0@syn\0"
|
||||
"/ety\0@/fld\0@/cd\0@/blockquote\0@/wordforms\0@/note\0@/altname\0@/chform\0@/cref\0@/syn\0");
|
||||
"ety\0@fld\0@cd\0@blockquote\0@wordforms\0@note\0@altname\0@chform\0"
|
||||
"@cref\0@syn\0/ety\0@/fld\0@/cd\0@/blockquote\0@/wordforms\0@/note\0"
|
||||
"@/altname\0@/chform\0@/cref\0@/syn\0");
|
||||
*ptr2++='>';
|
||||
ptr=ptr2;
|
||||
} while (result<0);
|
||||
|
||||
ncmd_done:
|
||||
ncmd_done:
|
||||
*_ptr=ptr;
|
||||
return result;
|
||||
}
|
||||
|
||||
U8 *ACDNextEntry(U8 **_ptr)
|
||||
{
|
||||
U8 *result,*ignore,ch,*ptr=*_ptr,buf[ACD_BLK_SIZE],*out_ptr=buf;
|
||||
I64 l;
|
||||
U8 *result,*ignore,*ptr=*_ptr,buf[ACD_BLK_SIZE],*out_ptr=buf;
|
||||
I64 ch,l;
|
||||
while (TRUE) {
|
||||
while (TRUE) {
|
||||
if (!(ch=*ptr++)) goto nentry_done;
|
||||
@@ -54,9 +95,9 @@ U8 *ACDNextEntry(U8 **_ptr)
|
||||
break;
|
||||
}
|
||||
ignore="b>\0i>\0ppp>\0/b>\0/i>\0/p>\0"
|
||||
"ets>\0col>\0spn>\0/ets>\0/col>\0/spn>\0er>\0as>\0cs>\0cd>\0ex>\0"
|
||||
"/er>\0/as>\0/cs>\0/cd>\0/ex>\0"
|
||||
"note>\0/note>\0blockquote>\0/blockquote>\0";
|
||||
"ets>\0col>\0spn>\0/ets>\0/col>\0/spn>\0er>\0as>\0cs>\0cd>\0ex>\0"
|
||||
"/er>\0/as>\0/cs>\0/cd>\0/ex>\0"
|
||||
"note>\0/note>\0blockquote>\0/blockquote>\0";
|
||||
while (*ignore) {
|
||||
l=StrLen(ignore);
|
||||
if (!StrNCmp(ptr,ignore,l)) {
|
||||
@@ -83,8 +124,8 @@ I64 ACDCompareWords(U8 *e1,U8 *e2)
|
||||
U8 *ACDSortWords(U8 *start,I64 size,I64 word_cnt)
|
||||
{
|
||||
U8 **ptr_array=MAlloc(sizeof(U8 *)*word_cnt),
|
||||
*out_start=MAlloc(size),
|
||||
*ptr=start,*ptr2;
|
||||
*out_start=MAlloc(size),
|
||||
*ptr=start,*ptr2;
|
||||
I64 i=0;
|
||||
while (*ptr) {
|
||||
ptr_array[i++]=ptr;
|
||||
@@ -107,14 +148,14 @@ U8 *ACDSortWords(U8 *start,I64 size,I64 word_cnt)
|
||||
return out_start;
|
||||
}
|
||||
|
||||
U0 ACDGen(U8 *raw_dict_filename)
|
||||
U0 ACDGen(U8 *in_file)
|
||||
{
|
||||
I64 cmd,size,word_cnt=0,largest_entry=0;
|
||||
U8 *st,*in_ptr=FileRead(raw_dict_filename,&size),*in_start=in_ptr,
|
||||
*out_ptr=MAlloc(size),*out_start=out_ptr,
|
||||
*word_ptr=MAlloc(size),*word_start=word_ptr,
|
||||
*last_word="",*def_word_start=out_ptr,
|
||||
*sorted_word_start;
|
||||
U8 *st,*in_ptr=FileRead(in_file,&size),*in_start=in_ptr,
|
||||
*out_ptr=MAlloc(size),*out_start=out_ptr,
|
||||
*word_ptr=MAlloc(size),*word_start=word_ptr,
|
||||
*last_word="",*def_word_start=out_ptr,
|
||||
*sorted_word_start;
|
||||
U16 *d;
|
||||
if (!in_ptr) return;
|
||||
do {
|
||||
@@ -149,7 +190,8 @@ next_word:
|
||||
cmd=ACDNextCmd(&in_ptr);
|
||||
if (cmd==ACD_H1)
|
||||
goto next_word;
|
||||
} while (cmd>=0 && !(cmd==ACD_DEF||cmd==ACD_PRONUNCIATION||cmd==ACD_POS||cmd==ACD_EXTRA));
|
||||
} while (cmd>=0 && !(cmd==ACD_DEF||cmd==ACD_PRONUNCIATION||
|
||||
cmd==ACD_POS||cmd==ACD_EXTRA));
|
||||
if (cmd==ACD_DEF) {
|
||||
if(st=ACDNextEntry(&in_ptr)) {
|
||||
if (*st) {
|
||||
@@ -187,7 +229,8 @@ next_word:
|
||||
Free(st);
|
||||
}
|
||||
}
|
||||
} while (cmd==ACD_DEF||cmd==ACD_PRONUNCIATION||cmd==ACD_POS||cmd==ACD_EXTRA);
|
||||
} while (cmd==ACD_DEF||cmd==ACD_PRONUNCIATION||
|
||||
cmd==ACD_POS||cmd==ACD_EXTRA);
|
||||
} else
|
||||
Free(st);
|
||||
}
|
||||
@@ -215,4 +258,6 @@ next_word:
|
||||
Free(sorted_word_start);
|
||||
}
|
||||
|
||||
ACDGen("DICTIONARY.TXT");
|
||||
Cd(__DIR__);
|
||||
ACDPreprocess("DICTIONARY.TXT","DICTIONARY2.TXT");
|
||||
ACDGen("DICTIONARY2.TXT");
|
||||
@@ -24,7 +24,7 @@ U0 ACSingleFileAdd(U8 *buf)
|
||||
while (TRUE) {
|
||||
while (TRUE) {
|
||||
if (ch=*ptr++) {
|
||||
if (Bt(chars_bitmap_alpha_numeric,ch))
|
||||
if (Bt(chars_bmp_alpha_numeric,ch))
|
||||
break;
|
||||
} else
|
||||
return;
|
||||
@@ -34,7 +34,7 @@ U0 ACSingleFileAdd(U8 *buf)
|
||||
ptr--;
|
||||
while (TRUE) {
|
||||
if (ch=*ptr2++) {
|
||||
if (Bt(chars_bitmap_alpha_numeric,ch))
|
||||
if (Bt(chars_bmp_alpha_numeric,ch))
|
||||
*ptr3++=ch;
|
||||
else if (ch!=CH_CURSOR)
|
||||
break;
|
||||
@@ -54,7 +54,7 @@ I64 ACSkipCrap(U8 *src,I64 len)
|
||||
I64 j;
|
||||
j=len-1;
|
||||
while (j>=0) {
|
||||
if (Bt(chars_bitmap_alpha_numeric,src[j]))
|
||||
if (Bt(chars_bmp_alpha_numeric,src[j]))
|
||||
break;
|
||||
else
|
||||
j--;
|
||||
@@ -67,7 +67,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_bitmap_alpha_numeric,src[i]))
|
||||
if (!Bt(chars_bmp_alpha_numeric,src[i]))
|
||||
break;
|
||||
else
|
||||
i--;
|
||||
@@ -92,7 +92,7 @@ U0 ACMan(I64 n,CTask *parent_task=NULL)
|
||||
{
|
||||
CHashAC *tempw;
|
||||
CHashSrcSym *temph;
|
||||
Bool old_preempt=Preempt(OFF);
|
||||
Bool old_preempt=Preempt;
|
||||
if (0<=--n<ac.num_fillins && (tempw=ac.fillin_matches[n]) &&
|
||||
(temph=HashFind(tempw->str,Fs->hash_table,HTG_SRC_SYM)) &&
|
||||
temph->src_link) {
|
||||
@@ -105,7 +105,8 @@ U0 ACMan(I64 n,CTask *parent_task=NULL)
|
||||
U0 ACFillInAdd(CHashAC *tempw)
|
||||
{
|
||||
I64 k;
|
||||
if (ac.num_fillins<AC_MAX_FILLINS || tempw->hits>ac.fillin_hits[ac.num_fillins-1]) {
|
||||
if (ac.num_fillins<AC_MAX_FILLINS ||
|
||||
tempw->hits>ac.fillin_hits[ac.num_fillins-1]) {
|
||||
for (k=ac.num_fillins-1;k>=0;k--) {
|
||||
if (tempw->hits<=ac.fillin_hits[k])
|
||||
break;
|
||||
@@ -149,15 +150,15 @@ U0 ACPutChoices(CDoc *focus_l,CDocEntry *doc_e,CTask *focus_task)
|
||||
ac.num_fillins=0;
|
||||
if (*ac.cur_word) {
|
||||
Preempt(ON);
|
||||
for (i=0;i<=ac.hash_table->mask;i++) {
|
||||
for (i=0;i<=ac.hash_table->mask && tS<timeout_time;i++) {
|
||||
tempw=ac.hash_table->body[i];
|
||||
while (tempw && tS<timeout_time) {
|
||||
while (tempw) {
|
||||
if (!MemCmp(ac.cur_word,tempw->str,StrLen(ac.cur_word)))
|
||||
ACFillInAdd(tempw);
|
||||
tempw=tempw->next;
|
||||
}
|
||||
}
|
||||
Preempt(OFF);
|
||||
Preempt;
|
||||
}
|
||||
DocRst(doc,TRUE);
|
||||
doc->flags|=DOCF_MIN_SIZE;
|
||||
@@ -203,12 +204,14 @@ U0 ACTask(I64)
|
||||
DocTermNew;
|
||||
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;
|
||||
Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_BORDER
|
||||
-WIF_SELF_IP_L-WIF_SELF_IP_R-WIG_DBL_CLICK;
|
||||
Free(ac.cur_word);
|
||||
ac.cur_word=NULL;
|
||||
while (TRUE) {
|
||||
original_focus_task=focus_task=sys_focus_task;
|
||||
while (TaskValidate(focus_task) && Bt(&focus_task->task_flags,TASKf_INPUT_FILTER_TASK))
|
||||
while (TaskValidate(focus_task) &&
|
||||
Bt(&focus_task->task_flags,TASKf_INPUT_FILTER_TASK))
|
||||
focus_task=focus_task->parent_task;
|
||||
if (TaskValidate(focus_task) && (doc=DocPut(focus_task)) &&
|
||||
focus_task!=Fs && Bt(&focus_task->display_flags,DISPLAYf_SHOW)) {
|
||||
@@ -244,7 +247,8 @@ U0 ACMainFileLstTraverse(U8 *files_find_mask)
|
||||
U8 *buf;
|
||||
CDirEntry *tempde,*tempde1;
|
||||
try {
|
||||
tempde=tempde1=FilesFind(files_find_mask,FUF_RECURSE|FUF_JUST_TXT|FUF_JUST_FILES|FUF_CLUSTER_ORDER);
|
||||
tempde=tempde1=FilesFind(files_find_mask,
|
||||
FUF_RECURSE|FUF_JUST_TXT|FUF_JUST_FILES|FUF_CLUSTER_ORDER);
|
||||
while (tempde) {
|
||||
"%s\n",tempde->full_name;
|
||||
buf=FileRead(tempde->full_name);
|
||||
@@ -260,7 +264,7 @@ U0 ACMainFileLstTraverse(U8 *files_find_mask)
|
||||
public Bool AutoComplete(Bool val=OFF)
|
||||
{//Turn AutoComplete OFF (or ON).
|
||||
Bool old_autocomplete=FALSE,
|
||||
old_preempt=Preempt(OFF);
|
||||
old_preempt=Preempt;
|
||||
if (val) {
|
||||
while (Bt(&ac.flags,ACf_INIT_IN_PROGRESS))
|
||||
Sleep(10);
|
||||
@@ -308,7 +312,8 @@ public U0 ACInit(U8 *mask=NULL)
|
||||
Yield;
|
||||
AutoComplete;
|
||||
|
||||
if (IsDrvWritable && FileFind(ACD_DEF_FILENAME_Z) && !FileFind(ACD_DEF_FILENAME)) {
|
||||
if (DrvIsWritable && FileFind(ACD_DEF_FILENAME_Z) &&
|
||||
!FileFind(ACD_DEF_FILENAME)) {
|
||||
if (bd->type!=BDT_RAM) {
|
||||
start_flag=FALSE;
|
||||
Spawn(&ACProgressTask,&start_flag);
|
||||
|
||||
Binary file not shown.
@@ -19,8 +19,8 @@ public class CAutoCompleteGlbls
|
||||
CHashAC *fillin_matches[AC_MAX_FILLINS+1];
|
||||
|
||||
} ac={0,NULL,NULL,0,NULL,0,0,
|
||||
{0,0,0,0,0,0,0,0,0,0,0},
|
||||
{NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}};
|
||||
{0,0,0,0,0,0,0,0,0,0,0},
|
||||
{NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}};
|
||||
|
||||
//Dictionary Stuff
|
||||
#help_index "AutoComplete/Dictionary"
|
||||
|
||||
+9
-8
@@ -1,4 +1,4 @@
|
||||
#help_index "AutoFile;Training"
|
||||
#help_index "AutoFile;Help System/Training"
|
||||
|
||||
public U0 AFGetStr(U8 *st)
|
||||
{//Wait for user to type certain str.
|
||||
@@ -7,8 +7,8 @@ public U0 AFGetStr(U8 *st)
|
||||
while (*st) {
|
||||
ch=GetKey(&sc,FALSE);
|
||||
if (sc.u8[0]!=SC_SHIFT &&
|
||||
sc.u8[0]!=SC_ALT &&
|
||||
sc.u8[0]!=SC_CTRL) {
|
||||
sc.u8[0]!=SC_ALT &&
|
||||
sc.u8[0]!=SC_CTRL) {
|
||||
if (ch==*st) {
|
||||
'' ch;
|
||||
st++;
|
||||
@@ -36,13 +36,13 @@ public U0 AFPrint(I64 mS=100,U8 *fmt,...)
|
||||
public U0 AFGetKey(I64 scan_code,I64 sc_mask=0xFF|SCF_SHIFT|SCF_CTRL|SCF_ALT)
|
||||
{//Wait for user to press certain key.
|
||||
I64 sc,ch;
|
||||
U8 buf[128],*st;
|
||||
U8 buf[STR_LEN],*st;
|
||||
do {
|
||||
ch=GetKey(&sc);
|
||||
if (sc.u8[0]!=SC_PRTSCRN1 &&
|
||||
!(sc.u8[0]==SC_SHIFT && scan_code&SCF_SHIFT) &&
|
||||
!(sc.u8[0]==SC_CTRL && scan_code&SCF_CTRL) &&
|
||||
!(sc.u8[0]==SC_ALT && scan_code&SCF_ALT) ) {
|
||||
!(sc.u8[0]==SC_SHIFT && scan_code&SCF_SHIFT) &&
|
||||
!(sc.u8[0]==SC_CTRL && scan_code&SCF_CTRL) &&
|
||||
!(sc.u8[0]==SC_ALT && scan_code&SCF_ALT) ) {
|
||||
if (sc&sc_mask!=scan_code&sc_mask) {
|
||||
st=ScanCode2KeyName(scan_code);
|
||||
StrPrint(buf,"Press the $$GREEN$$<%s>$$FG$$ key",st);
|
||||
@@ -113,7 +113,8 @@ Bool AFSetIPPlot(I64 mS,I64 x,I64 y,I64 z)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
public U0 AFSetIP(I64 mS=7,I64 x=MAX_I64,I64 y=MAX_I64,I64 z=MAX_I64,I64 l=MAX_I64,I64 r=MAX_I64)
|
||||
public U0 AFSetIP(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.
|
||||
if (!(0<=x<GR_WIDTH))
|
||||
x=ip.pos.x;
|
||||
|
||||
+6
-5
@@ -2,12 +2,11 @@
|
||||
#include "BootHD"
|
||||
#include "BootMHD"
|
||||
#include "BootMHD2"
|
||||
#include "DskCDDVD"
|
||||
#include "DskISOFile"
|
||||
#include "BootIns"
|
||||
|
||||
#help_index "Call"
|
||||
asm {
|
||||
USE64
|
||||
_HI_CALL::
|
||||
PUSH RBP
|
||||
MOV RBP,RSP
|
||||
@@ -34,14 +33,15 @@ _HI_MEMCPY::
|
||||
POP RBP
|
||||
RET1 24
|
||||
}
|
||||
_extern _HI_CALL I64 HiCall(U8 *s);
|
||||
_extern _HI_CALL I64 HiCall(U8 *machine_code);
|
||||
_extern _HI_MEMCPY U8 *HiMemCpy(U8 *dst,U8 *src,I64 cnt);
|
||||
|
||||
#help_index "Boot"
|
||||
public U0 RAMReboot(U8 *filename)
|
||||
{//Softboot Kernel Bin file. No hardware reset.
|
||||
I64 size;
|
||||
CKernel *hi_image,*lo_image=sys_boot_base-sizeof(CBinFile),reg *sys_ram_reboot;
|
||||
CKernel *hi_image,*lo_image=sys_boot_base-sizeof(CBinFile),
|
||||
reg *sys_ram_reboot;
|
||||
|
||||
do if (!(hi_image=FileRead(filename,&size))) return;
|
||||
while (hi_image<0x100000);
|
||||
@@ -52,7 +52,8 @@ public U0 RAMReboot(U8 *filename)
|
||||
hi_image->boot_src=BOOT_SRC_RAM;
|
||||
hi_image->boot_patch_table_base=lo_image(U8 *)+hi_image->h.patch_table_offset;
|
||||
hi_image->sys_run_level =lo_image->sys_run_level&(RLF_VGA|RLF_16BIT);
|
||||
MemCpy(&hi_image->start,&lo_image->start,sizeof(CKernel)-offset(CKernel.start));
|
||||
MemCpy(&hi_image->start,&lo_image->start,
|
||||
sizeof(CKernel)-offset(CKernel.start));
|
||||
|
||||
CLI
|
||||
if (mp_cnt>1)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#define CD_BOOT_LOADER_SIZE CD_BLK_SIZE*1 //Max CD_BLK_SIZE*4, I think
|
||||
#define BOOT_HIGH_LOC_CD ((BOOT_RAM_LIMIT-(BOOT_STK_SIZE+CD_BOOT_LOADER_SIZE))>>4)
|
||||
#define BOOT_HIGH_LOC_CD ((BOOT_RAM_LIMIT-\
|
||||
(BOOT_STK_SIZE+CD_BOOT_LOADER_SIZE))>>4)
|
||||
|
||||
DefinePrint(
|
||||
"DD_BOOT_HIGH_LOC_CD","%08X",BOOT_HIGH_LOC_CD<<4);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#define MODULE_SIZE 1*BLK_SIZE
|
||||
#define BOOT_HIGH_LOC_HD ((BOOT_RAM_LIMIT-(BOOT_STK_SIZE+MODULE_SIZE))>>4)
|
||||
#define BOOT_HIGH_LOC_HD ((BOOT_RAM_LIMIT-\
|
||||
(BOOT_STK_SIZE+MODULE_SIZE))>>4)
|
||||
|
||||
DefinePrint(
|
||||
"DD_BOOT_HIGH_LOC_HD","%08X",BOOT_HIGH_LOC_HD<<4);
|
||||
|
||||
+22
-22
@@ -13,8 +13,8 @@
|
||||
public U0 MakeAll()
|
||||
{//Use $LK,"MakeOSDrvBootInstall",A="MN:MakeOSDrvBootInstall"$. Loader must be patched.
|
||||
//These 2 modules (and bootloaders at top) are the only AOT
|
||||
//compiled code in TempleOS. Everything else is JIT.
|
||||
//You are doing it wrong if you make AOT compiled code.
|
||||
//compiled code in TempleOS. Everything else is JIT.
|
||||
//You are doing it wrong if you make AOT compiled code.
|
||||
if (Cmp("/Compiler/Compiler","Compiler",,':'))
|
||||
throw;
|
||||
if (Cmp("/Kernel/Kernel","Kernel",,':'))
|
||||
@@ -24,15 +24,15 @@ public U0 MakeAll()
|
||||
public Bool MakeOSDrvBootInstall(U8 src_drv=0,U8 dst_drv=0)
|
||||
{// Does $LK,"MakeAll",A="MN:MakeAll"$ and installs new boot-loader.
|
||||
|
||||
//Normally, you just supply a src_drv. It will compile
|
||||
//the code on that drive and update the boot sect.
|
||||
//Normally, you just supply a src_drv. It will compile
|
||||
//the code on that drive and update the boot sect.
|
||||
|
||||
//If you are making a bootable CD-ROM, you supply a dst_drv.
|
||||
//See $LK,"::/Misc/MakeDistro.CPP"$
|
||||
//If you are making a bootable CD-ROM, you supply a dst_drv.
|
||||
//See $LK,"::/Misc/MakeDistro.CPP"$
|
||||
|
||||
//See $LK,"Install Documentation",A="FI:::/Doc/Install.TXT"$
|
||||
//See $LK,"Install Documentation",A="FI:::/Doc/Install.TXT"$
|
||||
|
||||
//Study my account examples my technique: $LK,"Cfg Strs",A="FL:::/Demo/AcctExample/TOSCfg.CPP,1"$, $LK,"Update Funs",A="FL:::/Demo/AcctExample/TOSDistro.CPP,1"$
|
||||
//Study my account examples my technique: $LK,"Cfg Strs",A="FL:::/Demo/AcctExample/TOSCfg.CPP,1"$, $LK,"Update Funs",A="FL:::/Demo/AcctExample/TOSDistro.CPP,1"$
|
||||
|
||||
CBlkDev *bd;
|
||||
CDrv *dv;
|
||||
@@ -87,7 +87,7 @@ public Bool MakeOSDrvBootInstall(U8 src_drv=0,U8 dst_drv=0)
|
||||
|
||||
public U0 MasterBootOldRead(U8 src_drv,U8 dst_drv)
|
||||
{//Reads MBR from disk drive containing src partition.
|
||||
//Writes a single blk file to dst /0000Boot directory.
|
||||
//Writes a single blk file to dst BOOT_DIR.
|
||||
CBlkDev *bd=Let2BlkDev(src_drv);
|
||||
CDrv *dv;
|
||||
CMasterBoot mbr;
|
||||
@@ -96,7 +96,7 @@ public U0 MasterBootOldRead(U8 src_drv,U8 dst_drv)
|
||||
if (dv->type!=DVT_REDSEA && dv->type!=DVT_FAT32)
|
||||
PrintErr("Not RedSea Drv\n");
|
||||
else {
|
||||
//Bypass partition bounds-checking
|
||||
//Bypass partition bounds-checking
|
||||
BlkDevLock(bd);
|
||||
ATAReadBlks(bd,&mbr,0,1);
|
||||
BlkDevUnlock(bd);
|
||||
@@ -108,13 +108,13 @@ public U0 MasterBootOldRead(U8 src_drv,U8 dst_drv)
|
||||
}
|
||||
|
||||
public U0 MasterBootOldWrite(U8 src_drv,U8 dst_drv)
|
||||
{//Reads OldMBR from src drive /0000Boot directory
|
||||
//writes it to the MBR of the drive with dst partition.
|
||||
{//Reads OldMBR from src drive BOOT_DIR.
|
||||
//writes it to the MBR of the drive with dst partition.
|
||||
CBlkDev *bd=Let2BlkDev(dst_drv);
|
||||
CMasterBoot *mbr;
|
||||
Drv(src_drv);
|
||||
if (mbr=FileRead(BOOT_DIR_OLDMBR_BIN_C)) {
|
||||
//Bypass partition bounds-checking
|
||||
//Bypass partition bounds-checking
|
||||
BlkDevLock(bd);
|
||||
ATAWriteBlks(bd,mbr,0,1);
|
||||
BlkDevUnlock(bd);
|
||||
@@ -125,15 +125,15 @@ public U0 MasterBootOldWrite(U8 src_drv,U8 dst_drv)
|
||||
public U0 MasterBootZero(U8 dst_drv)
|
||||
{//Set MBR of disk with dst partition to zero.
|
||||
|
||||
//This is dangerous!!
|
||||
//The TempleOS partitioner doesn't play well
|
||||
//with other operating systems at this time and you need
|
||||
//to do this on a drive partitioned by TempleOS
|
||||
//if you wish to partition with another operating system.
|
||||
//This is dangerous!!
|
||||
//The TempleOS partitioner doesn't play well
|
||||
//with other operating systems at this time and you need
|
||||
//to do this on a drive partitioned by TempleOS
|
||||
//if you wish to partition with another operating system.
|
||||
CBlkDev *bd=Let2BlkDev(dst_drv);
|
||||
CMasterBoot mbr;
|
||||
MemSet(&mbr,0,BLK_SIZE);
|
||||
//Bypass partition bounds-checking
|
||||
//Bypass partition bounds-checking
|
||||
BlkDevLock(bd);
|
||||
ATAWriteBlks(bd,&mbr,0,1);
|
||||
BlkDevUnlock(bd);
|
||||
@@ -141,13 +141,13 @@ public U0 MasterBootZero(U8 dst_drv)
|
||||
|
||||
public Bool MasterBootIntall(U8 drv_let,U8 *drv_lst=NULL)
|
||||
{//Create new MBR on the disk that has drv_let as a partition.
|
||||
//Puts stage 2 in /0000Boot dir of drv_let.
|
||||
//Puts stage 2 in BOOT_DIR of drv_let.
|
||||
CBlkDev *bd,*bd1;
|
||||
CDrv *dv,*p1;
|
||||
CMasterBoot mbr;
|
||||
CDirEntry de;
|
||||
I64 i,j,size,*_q;
|
||||
U8 *menu_ptr,*ptr,ch,buf[128];
|
||||
U8 *menu_ptr,*ptr,ch,buf[STR_LEN];
|
||||
Bool result=FALSE;
|
||||
|
||||
try {
|
||||
@@ -209,7 +209,7 @@ public Bool MasterBootIntall(U8 drv_let,U8 *drv_lst=NULL)
|
||||
Free(de.full_name);
|
||||
*BMHD_BLK_CNT(U16 *)=(size+BLK_SIZE-1)>>BLK_SIZE_BITS;
|
||||
*BMHD_DAP_BLK(I64 *)=Cluster2Blk(dv,de.cluster);
|
||||
//Bypass partition bounds-checking
|
||||
//Bypass partition bounds-checking
|
||||
BlkDevLock(bd);
|
||||
ATAReadBlks(bd,&mbr,0,1);
|
||||
for (i=0;i<BMHD_END-BMHD_CODE;i++)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#define MODULE_SIZE 1*BLK_SIZE
|
||||
#define BOOT_HIGH_LOC_MHD ((BOOT_RAM_LIMIT-(BOOT_STK_SIZE+MODULE_SIZE))>>4)
|
||||
#define BOOT_HIGH_LOC_MHD ((BOOT_RAM_LIMIT-\
|
||||
(BOOT_STK_SIZE+MODULE_SIZE))>>4)
|
||||
|
||||
DefinePrint(
|
||||
"DD_BOOT_HIGH_LOC_MHD","%08X",BOOT_HIGH_LOC_MHD<<4);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#define MODULE_SIZE 2*BLK_SIZE
|
||||
#define BOOT_HIGH_LOC_MHD2 ((BOOT_RAM_LIMIT-(BOOT_STK_SIZE+MODULE_SIZE))>>4)
|
||||
#define BOOT_HIGH_LOC_MHD2 ((BOOT_RAM_LIMIT-\
|
||||
(BOOT_STK_SIZE+MODULE_SIZE))>>4)
|
||||
|
||||
DefinePrint(
|
||||
"DD_BOOT_HIGH_LOC_MHD2","%08X",BOOT_HIGH_LOC_MHD2<<4);
|
||||
|
||||
@@ -29,9 +29,9 @@ I64 CDFileCreate2(CFile *out_file,CDirEntry *tempde,
|
||||
CFile *in_file;
|
||||
U8 *buf=MAlloc(CD_BLK_SIZE),*ptr1,*ptr2;
|
||||
CISO1DirEntry *dir_blk_buf =CAlloc(CD_BLK_SIZE*128),
|
||||
*de =dir_blk_buf, *de1,
|
||||
*dir_blk_buf2=CAlloc(CD_BLK_SIZE*128),
|
||||
*de2=dir_blk_buf2,*de12;
|
||||
*de =dir_blk_buf, *de1,
|
||||
*dir_blk_buf2=CAlloc(CD_BLK_SIZE*128),
|
||||
*de2=dir_blk_buf2,*de12;
|
||||
I64 i,n;
|
||||
|
||||
tempc=parent->user_data;
|
||||
@@ -87,7 +87,8 @@ I64 CDFileCreate2(CFile *out_file,CDirEntry *tempde,
|
||||
de1=de;
|
||||
de12=de2;
|
||||
if (tempde1->attr & RS_ATTR_DIR) {
|
||||
n=CDFileCreate2(out_file,tempde1,de,de2,_cur_blk,tempde,write,stage2_filename,_stage2_blk);
|
||||
n=CDFileCreate2(out_file,tempde1,de,de2,_cur_blk,
|
||||
tempde,write,stage2_filename,_stage2_blk);
|
||||
de(U8 *)+=sizeof(CISO1DirEntry)-1+n;
|
||||
de2(U8 *)+=sizeof(CISO1DirEntry)-1+n<<1;
|
||||
} else {
|
||||
@@ -145,20 +146,22 @@ I64 CDFileCreate2(CFile *out_file,CDirEntry *tempde,
|
||||
FClose(in_file);
|
||||
}
|
||||
if ((de1(U8 *)-dir_blk_buf(U8 *))/CD_BLK_SIZE!=
|
||||
(de(U8 *) -dir_blk_buf(U8 *))/CD_BLK_SIZE) {
|
||||
(de(U8 *) -dir_blk_buf(U8 *))/CD_BLK_SIZE) {
|
||||
i=de1->len;
|
||||
MemCpy(buf,de1,i);
|
||||
MemSet(de1,0,i);
|
||||
de=dir_blk_buf(U8 *)+(de(U8 *)-dir_blk_buf(U8 *))/CD_BLK_SIZE*CD_BLK_SIZE;
|
||||
de=dir_blk_buf(U8 *)+(de(U8 *)
|
||||
-dir_blk_buf(U8 *))/CD_BLK_SIZE*CD_BLK_SIZE;
|
||||
MemCpy(de,buf,i);
|
||||
de(U8 *)+=i;
|
||||
}
|
||||
if ((de12(U8 *)-dir_blk_buf2(U8 *))/CD_BLK_SIZE!=
|
||||
(de2(U8 *) -dir_blk_buf2(U8 *))/CD_BLK_SIZE) {
|
||||
(de2(U8 *) -dir_blk_buf2(U8 *))/CD_BLK_SIZE) {
|
||||
i=de12->len;
|
||||
MemCpy(buf,de12,i);
|
||||
MemSet(de12,0,i);
|
||||
de2(U8 *)=dir_blk_buf2(U8 *)+(de2(U8 *)-dir_blk_buf2(U8 *))/CD_BLK_SIZE*CD_BLK_SIZE;
|
||||
de2(U8 *)=dir_blk_buf2(U8 *)+(de2(U8 *)
|
||||
-dir_blk_buf2(U8 *))/CD_BLK_SIZE*CD_BLK_SIZE;
|
||||
MemCpy(de2,buf,i);
|
||||
de2(U8 *)+=i;
|
||||
}
|
||||
@@ -250,7 +253,8 @@ I64 CDTableLen(CDirEntry *tempde,I64 *size1,I64 *size2,I64 cur_depth)
|
||||
|
||||
U0 CDFillPathTable(CDirEntry *tempde,
|
||||
CISO1PathEntry **_itabbuf,CISO1PathEntry **_itabbuf2,
|
||||
I64 parent_entry_num,Bool big_endian,I64 *first_free,I64 cur_level,I64 output_level)
|
||||
I64 parent_entry_num,Bool big_endian,I64 *first_free,
|
||||
I64 cur_level,I64 output_level)
|
||||
{
|
||||
U8 *ptr1,*ptr2;
|
||||
I64 i;
|
||||
@@ -273,7 +277,8 @@ U0 CDFillPathTable(CDirEntry *tempde,
|
||||
}
|
||||
StrCpy(&tabbuf->name,tempde1->name);
|
||||
|
||||
tabbuf(U8 *)+=sizeof(CISO1PathEntry)-2+(StrLen(tempde1->name)+1) & -0x2;
|
||||
tabbuf(U8 *)+=sizeof(CISO1PathEntry)-2+
|
||||
(StrLen(tempde1->name)+1) & -0x2;
|
||||
|
||||
tabbuf2->name_len=StrLen(tempde1->name)<<1;
|
||||
if (big_endian) {
|
||||
@@ -290,7 +295,7 @@ U0 CDFillPathTable(CDirEntry *tempde,
|
||||
*ptr1++=*ptr2++;
|
||||
}
|
||||
tabbuf2(U8 *)+=sizeof(CISO1PathEntry)-2+
|
||||
StrLen(tempde1->name)<<1;
|
||||
StrLen(tempde1->name)<<1;
|
||||
*first_free+=1;
|
||||
}
|
||||
tempde1=tempde1->next;
|
||||
@@ -304,7 +309,7 @@ U0 CDFillPathTable(CDirEntry *tempde,
|
||||
if (tempde1->attr & RS_ATTR_DIR) {
|
||||
tempc=tempde1->user_data;
|
||||
CDFillPathTable(tempde1,_itabbuf,_itabbuf2,tempc->path_entry_num,
|
||||
big_endian,first_free,cur_level+1,output_level);
|
||||
big_endian,first_free,cur_level+1,output_level);
|
||||
}
|
||||
tempde1=tempde2;
|
||||
}
|
||||
@@ -323,24 +328,23 @@ class CElTorito
|
||||
U8 zero2[20];
|
||||
};
|
||||
|
||||
public I64 CDFileCreate(U8 *_filename=NULL,U8 *src_files_find_mask,U8 *fu_flags=NULL,
|
||||
U8 *_stage2_filename=NULL)
|
||||
public I64 ISOFileCreate(U8 *_filename=NULL,U8 *src_files_find_mask,
|
||||
U8 *fu_flags=NULL,U8 *_stage2_filename=NULL)
|
||||
{//See $LK,"::/Misc/MakeDistro.CPP"$
|
||||
//Use "C:/Distro/*" if you want all files in the C:/Distro directory.
|
||||
//Default flags are "+r" recurse.
|
||||
//Default flags are "+r" recurse.
|
||||
CISO1PriDesc *iso_pri=CAlloc(CD_BLK_SIZE),
|
||||
*iso_boot=CAlloc(CD_BLK_SIZE),
|
||||
*iso_sup=CAlloc(CD_BLK_SIZE),
|
||||
*iso_term=CAlloc(CD_BLK_SIZE);
|
||||
*iso_boot=CAlloc(CD_BLK_SIZE),
|
||||
*iso_sup=CAlloc(CD_BLK_SIZE),
|
||||
*iso_term=CAlloc(CD_BLK_SIZE);
|
||||
CDirEntry *rootdir=CAlloc(sizeof(CDirEntry));
|
||||
I64 i,j,stage2_blk=(CD_FILE_OFFSET+1<<2+CD_BOOT_LOADER_SIZE/BLK_SIZE)>>2,stage2_size,
|
||||
cur_blk=0,tabsize,tabsize2,first_free,max_depth,
|
||||
fuf_flags=0;
|
||||
I64 i,j,stage2_blk=(CD_FILE_OFFSET+1<<2+CD_BOOT_LOADER_SIZE/BLK_SIZE)>>2,
|
||||
stage2_size,cur_blk=0,tabsize,tabsize2,first_free,max_depth,fuf_flags=0;
|
||||
U32 *d;
|
||||
CElTorito *et=CAlloc(CD_BLK_SIZE);
|
||||
U8 *filename,*stage2_filename,
|
||||
*stage1_buf=CAlloc(CD_BOOT_LOADER_SIZE),
|
||||
*zero_buf=CAlloc(CD_BLK_SIZE);
|
||||
*stage1_buf=CAlloc(CD_BOOT_LOADER_SIZE),
|
||||
*zero_buf=CAlloc(CD_BLK_SIZE);
|
||||
CISO1PathEntry *tabbuf=NULL,*tabbuf2=NULL,*itabbuf,*itabbuf2;
|
||||
CFile *out_file=NULL;
|
||||
CISO1DirEntry *tempi;
|
||||
@@ -369,9 +373,9 @@ public I64 CDFileCreate(U8 *_filename=NULL,U8 *src_files_find_mask,U8 *fu_flags=
|
||||
if (stage2_filename) //preboot and bootloader
|
||||
cur_blk+=1+CD_BOOT_LOADER_SIZE/CD_BLK_SIZE;
|
||||
CDFileCreate2(out_file,rootdir,
|
||||
&iso_pri->root_dir_record,
|
||||
&iso_sup->root_dir_record,
|
||||
&cur_blk,rootdir,FALSE,stage2_filename,&stage2_blk);
|
||||
&iso_pri->root_dir_record,
|
||||
&iso_sup->root_dir_record,
|
||||
&cur_blk,rootdir,FALSE,stage2_filename,&stage2_blk);
|
||||
tabsize=sizeof(CISO1PathEntry);
|
||||
tabsize2=sizeof(CISO1PathEntry);
|
||||
max_depth=CDTableLen(rootdir,&tabsize,&tabsize2,1);
|
||||
@@ -437,7 +441,8 @@ public I64 CDFileCreate(U8 *_filename=NULL,U8 *src_files_find_mask,U8 *fu_flags=
|
||||
}
|
||||
|
||||
CDFileCreate2(out_file,rootdir,&iso_pri->root_dir_record,
|
||||
&iso_sup->root_dir_record,&cur_blk,rootdir,TRUE,stage2_filename,&stage2_blk);
|
||||
&iso_sup->root_dir_record,&cur_blk,rootdir,TRUE,
|
||||
stage2_filename,&stage2_blk);
|
||||
|
||||
tabbuf=CAlloc(tabsize*CD_BLK_SIZE);
|
||||
iso_pri->type_l_path_table=cur_blk;
|
||||
@@ -503,15 +508,16 @@ public I64 CDFileCreate(U8 *_filename=NULL,U8 *src_files_find_mask,U8 *fu_flags=
|
||||
MemCpy(stage1_buf,BCD_START,BCD_END-BCD_START);
|
||||
*(BCD_BLK_CNT-BCD_START+stage1_buf)(U16 *)=stage2_size;
|
||||
*(BCD_BLK_LO -BCD_START+stage1_buf)(U32 *)=stage2_blk;
|
||||
"$$RED$$!!! Boot Stage 2 !!! %X-%X$$FG$$\n",stage2_blk,stage2_blk+stage2_size-1;
|
||||
"$$RED$$!!! Boot Stage 2 !!! %X-%X$$FG$$\n",
|
||||
stage2_blk,stage2_blk+stage2_size-1;
|
||||
FWBlks(out_file,stage1_buf,
|
||||
CD_FILE_OFFSET+1<<2,CD_BOOT_LOADER_SIZE/BLK_SIZE);
|
||||
CD_FILE_OFFSET+1<<2,CD_BOOT_LOADER_SIZE/BLK_SIZE);
|
||||
} else {
|
||||
FWBlks(out_file,iso_sup,17<<2,4);
|
||||
FWBlks(out_file,iso_term,18<<2,4);
|
||||
}
|
||||
|
||||
cf_done:
|
||||
cf_done:
|
||||
FClose(out_file);
|
||||
Free(tabbuf);
|
||||
Free(tabbuf2);
|
||||
+49
-33
@@ -1,7 +1,7 @@
|
||||
public CCtrl *CtrlFindUnique(CTask *haystack_task,I64 needle_type)
|
||||
{//Find task ctrl givin $LK,"ctrl_type",A="MN:CTRLT_VIEWING_ANGLES"$.
|
||||
{//Find task ctrl given $LK,"ctrl_type",A="MN:CTRLT_VIEWING_ANGLES"$.
|
||||
CCtrl *c;
|
||||
Bool old_preempt=Preempt(OFF);
|
||||
Bool old_preempt=Preempt;
|
||||
c=haystack_task->next_ctrl;
|
||||
while (c!=&haystack_task->next_ctrl) {
|
||||
if (c->type==needle_type) {
|
||||
@@ -17,7 +17,7 @@ public CCtrl *CtrlFindUnique(CTask *haystack_task,I64 needle_type)
|
||||
U0 CtrlsUpdate(CTask *task)
|
||||
{
|
||||
CCtrl *c;
|
||||
Bool old_preempt=Preempt(OFF);
|
||||
Bool old_preempt=Preempt;
|
||||
c=task->next_ctrl;
|
||||
while (c!=&task->next_ctrl) {
|
||||
if (c->update_derived_vals)
|
||||
@@ -43,7 +43,7 @@ fp_update_ctrls=&CtrlsUpdate;
|
||||
Bool CtrlInsideRect(CCtrl *c,I64 x,I64 y)
|
||||
{//screen coordinates
|
||||
if (c->screen_left<=x<=c->screen_right &&
|
||||
c->screen_top<=y<=c->screen_bottom)
|
||||
c->screen_top<=y<=c->screen_bottom)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
@@ -64,7 +64,7 @@ U0 DrawCtrls(CTask *task)
|
||||
{
|
||||
CCtrl *c;
|
||||
CDC *dc=DCAlias(gr.dc2,task);
|
||||
Bool old_preempt=Preempt(OFF);
|
||||
Bool old_preempt=Preempt;
|
||||
c=task->next_ctrl;
|
||||
while (c!=&task->next_ctrl) {
|
||||
if (c->flags&CTRLF_SHOW) {
|
||||
@@ -116,7 +116,7 @@ U0 DrawCtrls(CTask *task)
|
||||
U0 DrawWinScroll(CDC *dc,CCtrl *c)
|
||||
{
|
||||
CWinScroll *s=c->state;
|
||||
Bool old_preempt=Preempt(OFF);
|
||||
Bool old_preempt=Preempt;
|
||||
|
||||
if (c->flags&CTRLF_CLICKED)
|
||||
dc->color=s->color>>4;
|
||||
@@ -140,20 +140,26 @@ U0 WinDerivedScrollValsUpdate(CCtrl *c)
|
||||
if (s->pos<s->min) s->pos=s->min;
|
||||
if (s->pos>s->max) s->pos=s->max;
|
||||
s->color=c->win_task->border_attr&0xF^0xF+
|
||||
(c->win_task->border_attr&0xF)<<4;
|
||||
(c->win_task->border_attr&0xF)<<4;
|
||||
range=s->max-s->min;
|
||||
if (!range) range=1;
|
||||
switch (c->type) {
|
||||
case CTRLT_WIN_HSCROLL:
|
||||
c->left =gr.pan_text_x+FONT_WIDTH-WIN_SCROLL_BORDER_BONUS+(s->pos-s->min)*(c->win_task->pix_width+2*WIN_SCROLL_BORDER_BONUS-WIN_SCROLL_SIZE)/range;
|
||||
c->left =gr.pan_text_x+FONT_WIDTH-WIN_SCROLL_BORDER_BONUS+
|
||||
(s->pos-s->min)*(c->win_task->pix_width+2*WIN_SCROLL_BORDER_BONUS
|
||||
-WIN_SCROLL_SIZE)/range;
|
||||
c->right =c->left+WIN_SCROLL_SIZE-1;
|
||||
c->top =gr.pan_text_y+FONT_HEIGHT+(FONT_WIDTH-WIN_SCROLL_SIZE)/2+c->win_task->pix_height;
|
||||
c->top =gr.pan_text_y+FONT_HEIGHT+
|
||||
(FONT_WIDTH-WIN_SCROLL_SIZE)/2+c->win_task->pix_height;
|
||||
c->bottom=c->top+WIN_SCROLL_SIZE-1;
|
||||
break;
|
||||
case CTRLT_WIN_VSCROLL:
|
||||
c->left =gr.pan_text_x+FONT_WIDTH+(FONT_WIDTH-WIN_SCROLL_SIZE)/2+c->win_task->pix_width;
|
||||
c->left =gr.pan_text_x+FONT_WIDTH+
|
||||
(FONT_WIDTH-WIN_SCROLL_SIZE)/2+c->win_task->pix_width;
|
||||
c->right =c->left+WIN_SCROLL_SIZE-1;
|
||||
c->top =gr.pan_text_y+FONT_HEIGHT-WIN_SCROLL_BORDER_BONUS+(s->pos-s->min)*(c->win_task->pix_height+2*WIN_SCROLL_BORDER_BONUS-WIN_SCROLL_SIZE)/range;
|
||||
c->top =gr.pan_text_y+FONT_HEIGHT-WIN_SCROLL_BORDER_BONUS+
|
||||
(s->pos-s->min)*(c->win_task->pix_height+
|
||||
2*WIN_SCROLL_BORDER_BONUS-WIN_SCROLL_SIZE)/range;
|
||||
c->bottom=c->top+WIN_SCROLL_SIZE-1;
|
||||
break;
|
||||
}
|
||||
@@ -165,7 +171,8 @@ U0 LeftClickHWinScroll(CCtrl *c,I64 x,I64,Bool down)
|
||||
CWinScroll *s=c->state;
|
||||
I64 range=task->pix_width+2*WIN_SCROLL_BORDER_BONUS-WIN_SCROLL_SIZE;
|
||||
LBts(&s->flags,WSSf_SET_TO_POS);
|
||||
s->pos=((x-(FONT_WIDTH-WIN_SCROLL_BORDER_BONUS))*(s->max-s->min+1)+range/2)/range+s->min;
|
||||
s->pos=((x-(FONT_WIDTH-WIN_SCROLL_BORDER_BONUS))
|
||||
*(s->max-s->min+1)+range/2)/range+s->min;
|
||||
if (down)
|
||||
c->flags|=CTRLF_CLICKED;
|
||||
else
|
||||
@@ -180,7 +187,8 @@ U0 LeftClickVWinScroll(CCtrl *c,I64,I64 y,Bool down)
|
||||
CWinScroll *s=c->state;
|
||||
I64 range=task->pix_height+2*WIN_SCROLL_BORDER_BONUS-WIN_SCROLL_SIZE;
|
||||
LBts(&s->flags,WSSf_SET_TO_POS);
|
||||
s->pos=((y-(FONT_HEIGHT-WIN_SCROLL_BORDER_BONUS))*(s->max-s->min+1)+range/2)/range+s->min;
|
||||
s->pos=((y-(FONT_HEIGHT-WIN_SCROLL_BORDER_BONUS))
|
||||
*(s->max-s->min+1)+range/2)/range+s->min;
|
||||
if (down)
|
||||
c->flags|=CTRLF_CLICKED;
|
||||
else
|
||||
@@ -200,7 +208,7 @@ U0 WheelChangeWinScroll(CCtrl *c,I64 delta)
|
||||
|
||||
U0 WinScrollsInit(CTask *task)
|
||||
{
|
||||
Bool old_preempt=Preempt(OFF);
|
||||
Bool old_preempt=Preempt;
|
||||
CCtrl *c;
|
||||
|
||||
if (!CtrlFindUnique(task,CTRLT_WIN_HSCROLL)) {
|
||||
@@ -241,33 +249,41 @@ U0 DrawViewAnglesCtrl(CDC *dc,CCtrl *c)
|
||||
CViewAngles *s=c->state;
|
||||
|
||||
dc->color=s->cbd;
|
||||
GrRect(dc, c->left,c->top,VIEWANGLES_SPACING*4+3,VIEWANGLES_SPACING*2+VIEWANGLES_RANGE);
|
||||
GrRect(dc, c->left,c->top,VIEWANGLES_SPACING*4+3,
|
||||
VIEWANGLES_SPACING*2+VIEWANGLES_RANGE);
|
||||
dc->color=s->cbg;
|
||||
GrRect(dc, c->left+VIEWANGLES_BORDER,c->top+VIEWANGLES_BORDER,
|
||||
VIEWANGLES_SPACING*4+3-2*VIEWANGLES_BORDER,VIEWANGLES_SPACING*2+VIEWANGLES_RANGE-2*VIEWANGLES_BORDER);
|
||||
VIEWANGLES_SPACING*4+3-2*VIEWANGLES_BORDER,
|
||||
VIEWANGLES_SPACING*2+VIEWANGLES_RANGE-2*VIEWANGLES_BORDER);
|
||||
dc->color=s->cfg;
|
||||
GrLine(dc,c->left+VIEWANGLES_SPACING,c->top+VIEWANGLES_SPACING,
|
||||
c->left+VIEWANGLES_SPACING,c->top+VIEWANGLES_SPACING+VIEWANGLES_RANGE-1);
|
||||
c->left+VIEWANGLES_SPACING,c->top+VIEWANGLES_SPACING+
|
||||
VIEWANGLES_RANGE-1);
|
||||
GrLine(dc,c->left+2*VIEWANGLES_SPACING+1,c->top+VIEWANGLES_SPACING,
|
||||
c->left+2*VIEWANGLES_SPACING+1,c->top+VIEWANGLES_SPACING+VIEWANGLES_RANGE-1);
|
||||
c->left+2*VIEWANGLES_SPACING+1,c->top+VIEWANGLES_SPACING+
|
||||
VIEWANGLES_RANGE-1);
|
||||
GrLine(dc,c->left+3*VIEWANGLES_SPACING+2,c->top+VIEWANGLES_SPACING,
|
||||
c->left+3*VIEWANGLES_SPACING+2,c->top+VIEWANGLES_SPACING+VIEWANGLES_RANGE-1);
|
||||
c->left+3*VIEWANGLES_SPACING+2,c->top+VIEWANGLES_SPACING+
|
||||
VIEWANGLES_RANGE-1);
|
||||
for (i=1;i<VIEWANGLES_RANGE+1;i+=2*VIEWANGLES_SNAP) {
|
||||
j=2-i/3&1;
|
||||
GrLine(dc,c->left+VIEWANGLES_SPACING-j,c->bottom-VIEWANGLES_SPACING-i,
|
||||
c->left+VIEWANGLES_SPACING+j,c->bottom-VIEWANGLES_SPACING-i);
|
||||
c->left+VIEWANGLES_SPACING+j,c->bottom
|
||||
-VIEWANGLES_SPACING-i);
|
||||
GrLine(dc,c->left+2*VIEWANGLES_SPACING+1-j,c->bottom-VIEWANGLES_SPACING-i,
|
||||
c->left+2*VIEWANGLES_SPACING+1+j,c->bottom-VIEWANGLES_SPACING-i);
|
||||
c->left+2*VIEWANGLES_SPACING+1+j,c->bottom
|
||||
-VIEWANGLES_SPACING-i);
|
||||
GrLine(dc,c->left+3*VIEWANGLES_SPACING+2-j,c->bottom-VIEWANGLES_SPACING-i,
|
||||
c->left+3*VIEWANGLES_SPACING+2+j,c->bottom-VIEWANGLES_SPACING-i);
|
||||
c->left+3*VIEWANGLES_SPACING+2+j,c->bottom
|
||||
-VIEWANGLES_SPACING-i);
|
||||
}
|
||||
|
||||
dc->color=s->cx;
|
||||
GrPrint(dc,c->left+VIEWANGLES_SPACING-FONT_WIDTH/2,
|
||||
c->top+VIEWANGLES_SPACING-(1+FONT_HEIGHT),"X");
|
||||
c->top+VIEWANGLES_SPACING-(1+FONT_HEIGHT),"X");
|
||||
GrPrint(dc,c->left+VIEWANGLES_SPACING-3*FONT_WIDTH/2,
|
||||
c->top+VIEWANGLES_SPACING+VIEWANGLES_RANGE+3,
|
||||
"%3d",s->sx*360/VIEWANGLES_RANGE);
|
||||
c->top+VIEWANGLES_SPACING+VIEWANGLES_RANGE+3,
|
||||
"%3d",s->sx*360/VIEWANGLES_RANGE);
|
||||
i=c->left+VIEWANGLES_SPACING;
|
||||
if (s->sx>VIEWANGLES_RANGE/2)
|
||||
j=-VIEWANGLES_RANGE/2+s->sx;
|
||||
@@ -280,10 +296,10 @@ U0 DrawViewAnglesCtrl(CDC *dc,CCtrl *c)
|
||||
|
||||
dc->color=s->cy;
|
||||
GrPrint(dc,c->left+2*VIEWANGLES_SPACING+1-FONT_WIDTH/2,
|
||||
c->top+VIEWANGLES_SPACING-(1+FONT_HEIGHT),"Y");
|
||||
c->top+VIEWANGLES_SPACING-(1+FONT_HEIGHT),"Y");
|
||||
GrPrint(dc,c->left+2*VIEWANGLES_SPACING+1-3*FONT_WIDTH/2,
|
||||
c->top+VIEWANGLES_SPACING+VIEWANGLES_RANGE+3,
|
||||
"%3d",s->sy*360/VIEWANGLES_RANGE);
|
||||
c->top+VIEWANGLES_SPACING+VIEWANGLES_RANGE+3,
|
||||
"%3d",s->sy*360/VIEWANGLES_RANGE);
|
||||
i=c->left+2*VIEWANGLES_SPACING+1;
|
||||
if (s->sy>VIEWANGLES_RANGE/2)
|
||||
j=-VIEWANGLES_RANGE/2+s->sy;
|
||||
@@ -296,10 +312,10 @@ U0 DrawViewAnglesCtrl(CDC *dc,CCtrl *c)
|
||||
|
||||
dc->color=s->cz;
|
||||
GrPrint(dc,c->left+3*VIEWANGLES_SPACING+2-FONT_WIDTH/2,
|
||||
c->top+VIEWANGLES_SPACING-(1+FONT_HEIGHT),"Z");
|
||||
c->top+VIEWANGLES_SPACING-(1+FONT_HEIGHT),"Z");
|
||||
GrPrint(dc,c->left+3*VIEWANGLES_SPACING+2-3*FONT_WIDTH/2,
|
||||
c->top+VIEWANGLES_SPACING+VIEWANGLES_RANGE+3,
|
||||
"%3d",s->sz*360/VIEWANGLES_RANGE);
|
||||
c->top+VIEWANGLES_SPACING+VIEWANGLES_RANGE+3,
|
||||
"%3d",s->sz*360/VIEWANGLES_RANGE);
|
||||
i=c->left+3*VIEWANGLES_SPACING+2;
|
||||
if (s->sz>VIEWANGLES_RANGE/2)
|
||||
j=-VIEWANGLES_RANGE/2+s->sz;
|
||||
@@ -367,7 +383,7 @@ public CCtrl *ViewAnglesNew(CTask *task=NULL)
|
||||
c->draw_it=&DrawViewAnglesCtrl;
|
||||
c->left_click=&LeftClickViewAngles;
|
||||
c->update_derived_vals=&UpdateDerivedViewAnglesCtrl;
|
||||
old_preempt=Preempt(OFF);
|
||||
old_preempt=Preempt;
|
||||
QueIns(c,task->last_ctrl);
|
||||
TaskDerivedValsUpdate(task);
|
||||
Preempt(old_preempt);
|
||||
@@ -378,7 +394,7 @@ public CCtrl *ViewAnglesNew(CTask *task=NULL)
|
||||
public U0 ViewAnglesDel(CTask *task=NULL)
|
||||
{//Free view angle ctrl.
|
||||
CCtrl *c;
|
||||
Bool old_preempt=Preempt(OFF);
|
||||
Bool old_preempt=Preempt;
|
||||
if (!task) task=Fs;
|
||||
if (c=CtrlFindUnique(task,CTRLT_VIEWING_ANGLES)) {
|
||||
QueRem(c);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#define BUTTBORDER 2
|
||||
#define BUTTON_BORDER 2
|
||||
|
||||
#define BTF_DONT_FREE 1
|
||||
|
||||
@@ -21,11 +21,12 @@ U0 DrawCtrlButton(CDC *dc,CCtrl *c)
|
||||
st=s->state_texts;
|
||||
dc->color=s->state_colors[s->state];
|
||||
l=StrLen(st);
|
||||
GrRect(dc,c->left+BUTTBORDER,c->top+BUTTBORDER,
|
||||
c->right-c->left+1-BUTTBORDER*2,c->bottom-c->top+1-BUTTBORDER*2);
|
||||
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);
|
||||
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);
|
||||
(c->top+c->bottom+1-FONT_HEIGHT)>>1,"%s",st);
|
||||
}
|
||||
|
||||
U0 LeftClickCtrlButton(CCtrl *c,I64,I64,Bool down)
|
||||
@@ -39,7 +40,8 @@ U0 LeftClickCtrlButton(CCtrl *c,I64,I64,Bool down)
|
||||
}
|
||||
|
||||
public CCtrl *CtrlButtonNew(I64 x,I64 y,I64 width=-1,I64 height=-1,
|
||||
I64 num_states=1,U8 *state_texts,I32 state_colors[],CCtrlButtonState *_s=NULL)
|
||||
I64 num_states=1,U8 *state_texts,
|
||||
I32 state_colors[],CCtrlButtonState *_s=NULL)
|
||||
{//Create button ctrl. See $LK,"::/Apps/Strut/Strut.CPP"$.
|
||||
Bool old_preempt;
|
||||
CCtrl *result;
|
||||
@@ -53,9 +55,9 @@ public CCtrl *CtrlButtonNew(I64 x,I64 y,I64 width=-1,I64 height=-1,
|
||||
j=StrLen(st);
|
||||
if (j>l) l=j;
|
||||
}
|
||||
width=BUTTBORDER*4+l*FONT_WIDTH;
|
||||
width=BUTTON_BORDER*4+l*FONT_WIDTH;
|
||||
}
|
||||
if (height<0) height=BUTTBORDER*4+FONT_HEIGHT;
|
||||
if (height<0) height=BUTTON_BORDER*4+FONT_HEIGHT;
|
||||
result=CAlloc(sizeof(CCtrl));
|
||||
if (_s) {
|
||||
s=_s;
|
||||
@@ -77,7 +79,7 @@ public CCtrl *CtrlButtonNew(I64 x,I64 y,I64 width=-1,I64 height=-1,
|
||||
result->top=y;
|
||||
result->right=result->left+width-1;
|
||||
result->bottom=result->top+height-1;
|
||||
old_preempt=Preempt(OFF);
|
||||
old_preempt=Preempt;
|
||||
QueIns(result,Fs->last_ctrl);
|
||||
Preempt(old_preempt);
|
||||
return result;
|
||||
@@ -85,7 +87,7 @@ public CCtrl *CtrlButtonNew(I64 x,I64 y,I64 width=-1,I64 height=-1,
|
||||
|
||||
public U0 CtrlButtonDel(CCtrl *c)
|
||||
{//Free button ctrl.
|
||||
Bool old_preempt=Preempt(OFF);
|
||||
Bool old_preempt=Preempt;
|
||||
QueRem(c);
|
||||
Preempt(old_preempt);
|
||||
if (!(c->flags&BTF_DONT_FREE))
|
||||
|
||||
+15
-10
@@ -15,7 +15,7 @@ class CTemplateCS
|
||||
CTemplateCS *CtrlSliderGet()
|
||||
{
|
||||
CTemplateCSSlider *temps;
|
||||
U8 *st,pmt[136];
|
||||
U8 *st,pmt[STR_LEN];
|
||||
CTemplateCS *result=CAlloc(sizeof(CTemplateCS));
|
||||
|
||||
"$$PURPLE$$Ctrl Slider$$FG$$\n\n";
|
||||
@@ -85,14 +85,15 @@ U0 DrawCtrlSlider(CDC *dc,CCtrl *c)
|
||||
GrRect(dc, c->left,c->top,%d*SLIDER_SPACING+%d,SLIDER_SPACING*2+SLIDER_RANGE);
|
||||
dc->color=BLUE;
|
||||
GrRect(dc, c->left+SLIDER_BORDER,c->top+SLIDER_BORDER,
|
||||
%d*SLIDER_SPACING+%d-2*SLIDER_BORDER,SLIDER_SPACING*2+SLIDER_RANGE-2*SLIDER_BORDER);
|
||||
%d*SLIDER_SPACING+%d-2*SLIDER_BORDER,SLIDER_SPACING*2
|
||||
+SLIDER_RANGE-2*SLIDER_BORDER);
|
||||
dc->color=BLACK;
|
||||
",m->num_sliders+1,m->num_sliders,m->num_sliders+1,m->num_sliders);
|
||||
|
||||
for (i=0;i<m->num_sliders;i++)
|
||||
DocPrint(doc,
|
||||
" GrLine(dc,c->left+%d*SLIDER_SPACING+%d,c->top+SLIDER_SPACING,
|
||||
c->left+%d*SLIDER_SPACING+%d,c->top+SLIDER_SPACING+SLIDER_RANGE-1);
|
||||
c->left+%d*SLIDER_SPACING+%d,c->top+SLIDER_SPACING+SLIDER_RANGE-1);
|
||||
",i+1,i,i+1,i);
|
||||
|
||||
DocPrint(doc," dc->color=LTRED;\n");
|
||||
@@ -109,7 +110,9 @@ U0 DrawCtrlSlider(CDC *dc,CCtrl *c)
|
||||
|
||||
temps=m->next_slider;
|
||||
while (temps!=&m->next_slider) {
|
||||
DocPrint(doc," GrRect(dc,c->left+%d*SLIDER_SPACING+%d-3,c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->%s-2,7,5);\n",
|
||||
DocPrint(doc,
|
||||
" GrRect(dc,c->left+%d*SLIDER_SPACING+%d-3,"
|
||||
"c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->%s-2,7,5);\n",
|
||||
temps->num+1,temps->num,temps->name);
|
||||
temps=temps->next;
|
||||
}
|
||||
@@ -117,7 +120,8 @@ U0 DrawCtrlSlider(CDC *dc,CCtrl *c)
|
||||
|
||||
temps=m->next_slider;
|
||||
while (temps!=&m->next_slider) {
|
||||
DocPrint(doc," GrRect(dc,c->left+%d*SLIDER_SPACING+%d-2,c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->%s-1,5,3);\n",
|
||||
DocPrint(doc," GrRect(dc,c->left+%d*SLIDER_SPACING+%d-2,"
|
||||
"c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->%s-1,5,3);\n",
|
||||
temps->num+1,temps->num,temps->name);
|
||||
temps=temps->next;
|
||||
}
|
||||
@@ -135,7 +139,8 @@ U0 UpdateDerivedCtrlSlider(CCtrl *c)
|
||||
|
||||
temps=m->next_slider;
|
||||
while (temps!=&m->next_slider) {
|
||||
DocPrint(doc," s->%s=ClampI64(s->%s,0,SLIDER_RANGE-1);\n",temps->name,temps->name);
|
||||
DocPrint(doc," s->%s=ClampI64(s->%s,0,SLIDER_RANGE-1);\n",
|
||||
temps->name,temps->name);
|
||||
temps=temps->next;
|
||||
}
|
||||
DocPrint(doc,
|
||||
@@ -177,14 +182,14 @@ CCtrl *SliderNew()
|
||||
");
|
||||
if (*m->glbl_name)
|
||||
DocPrint(doc," c->state=&%s;\n"
|
||||
" MemSet(&%s,0,sizeof(CSliderState));\n",m->glbl_name,m->glbl_name);
|
||||
" MemSet(&%s,0,sizeof(CSliderState));\n",m->glbl_name,m->glbl_name);
|
||||
else
|
||||
DocPrint(doc, " c->state=CAlloc(sizeof(CSliderState));\n");
|
||||
DocPrint(doc,
|
||||
" c->draw_it=&DrawCtrlSlider;
|
||||
c->left_click=&LeftClickSlider;
|
||||
c->update_derived_vals=&UpdateDerivedCtrlSlider;
|
||||
old_preempt=Preempt(OFF);
|
||||
old_preempt=Preempt;
|
||||
QueIns(c,Fs->last_ctrl);
|
||||
TaskDerivedValsUpdate;
|
||||
Preempt(old_preempt);
|
||||
@@ -193,7 +198,7 @@ CCtrl *SliderNew()
|
||||
|
||||
U0 SliderDel(CCtrl *c)
|
||||
{
|
||||
Bool old_preempt=Preempt(OFF);
|
||||
Bool old_preempt=Preempt;
|
||||
QueRem(c);
|
||||
Preempt(old_preempt);
|
||||
");
|
||||
@@ -206,7 +211,7 @@ U0 SliderDel(CCtrl *c)
|
||||
|
||||
Kill(task); //This frees memory.
|
||||
|
||||
AcctOneTimePopUp(ARf_MANAGE_SLIDER,
|
||||
RegOneTimePopUp(ARf_MANAGE_SLIDER,
|
||||
"Modify the code to your heart's content.\n"
|
||||
"The code is no longer managed.\n");
|
||||
|
||||
|
||||
+10
-8
@@ -26,7 +26,7 @@ public U0 PCIDevFileGen()
|
||||
first=FALSE;
|
||||
}
|
||||
if (doc_e->type_u8==DOCT_TEXT && doc_e->tag[StrLen(doc_e->tag)-1]=='=' &&
|
||||
doc_e2->type_u8==DOCT_NEW_LINE) {
|
||||
doc_e2->type_u8==DOCT_NEW_LINE) {
|
||||
doc_e->tag[StrLen(doc_e->tag)-1]=CH_SPACE;
|
||||
cont=TRUE;
|
||||
}
|
||||
@@ -57,7 +57,8 @@ U0 PCILookUpSingle(CDoc *doc,I64 m,I64 d,U8 **_vendor,U8 **_dev)
|
||||
CDocEntry *doc_e=doc->root.next;
|
||||
while (doc_e!=doc) {
|
||||
if (first) {
|
||||
if (doc_e->type_u8==DOCT_TEXT && doc_e->tag[0]!=';' && StrLen(doc_e->tag)>=4) {
|
||||
if (doc_e->type_u8==DOCT_TEXT && doc_e->tag[0]!=';' &&
|
||||
StrLen(doc_e->tag)>=4) {
|
||||
buf[0](U16)='0x';
|
||||
buf[2](U32)=doc_e->tag(U32 *)[0];
|
||||
buf[6]=0;
|
||||
@@ -158,9 +159,9 @@ public U0 PCIRep()
|
||||
temppci=dev.pci_root.next;
|
||||
while (temppci!=&dev.pci_root) {
|
||||
"%02X:%02X:%01X %02X%02X $$GREEN$$%s $$CYAN$$%s$$FG$$\n",
|
||||
temppci->bus,temppci->dev,temppci->fun,
|
||||
temppci->base_code,temppci->sub_code,
|
||||
temppci->vendor_str,temppci->dev_id_str;
|
||||
temppci->bus,temppci->dev,temppci->fun,
|
||||
temppci->base_code,temppci->sub_code,
|
||||
temppci->vendor_str,temppci->dev_id_str;
|
||||
temppci=temppci->next;
|
||||
}
|
||||
}
|
||||
@@ -177,7 +178,7 @@ public U0 MemBIOSRep()
|
||||
U16 *m01=SYS_MEM_E801;
|
||||
CMemE820 *m20=SYS_MEM_E820;
|
||||
CMemRange *tempmr;
|
||||
"Standard Addresses\n"
|
||||
"Standard Addresses\n"
|
||||
"0x000A0000-0x000BFFFF VGA\n"
|
||||
"0xFEE00000-0xFEE00FFF See $$LK,\"APIC\",A=\"MN:LAPIC_BASE\"$$\n\n"
|
||||
"32 Bit Device Mem\n";
|
||||
@@ -185,13 +186,14 @@ public U0 MemBIOSRep()
|
||||
Yield;
|
||||
tempmr=dev.mem32_root.next;
|
||||
while (tempmr!=&dev.mem32_root) {
|
||||
"%02X:0x%016X-0x%016X\n",tempmr->type,tempmr->base,tempmr->base+tempmr->size-1;
|
||||
"%02X:0x%016X-0x%016X\n",
|
||||
tempmr->type,tempmr->base,tempmr->base+tempmr->size-1;
|
||||
tempmr=tempmr->next;
|
||||
}
|
||||
LBtr(&sys_semas[SYS_SEMA_DEV_MEM],0);
|
||||
|
||||
"\nBIOS Memory Report 15:E801\n"
|
||||
"01:0x0000000000000000-0x%016X\n",0x100000+m01[0]<<10-1;
|
||||
"01:0x0000000000000000-0x%016X\n",0x100000+m01[0]<<10-1;
|
||||
"01:0x0000000001000000-0x%016X\n",0x1000000+m01[1]<<16-1;
|
||||
|
||||
if (m20->type) {
|
||||
|
||||
+27
-23
@@ -22,41 +22,45 @@ extern U8 *PopUpPickLst(U8 *lst);
|
||||
#define DHT_DOC_FLAG 2
|
||||
#define DHT_COLOR 4
|
||||
|
||||
//--TEMPLEOS LINK TYPES--
|
||||
// "filename"
|
||||
// "FI:filename"
|
||||
// "FA:haystack_filename,needle_anchor_str"
|
||||
// "FF:haystack_filename,needle_str"
|
||||
// "FF:haystack_filename,needle_str:occurnum"
|
||||
// "FL:filename,linenum"
|
||||
/* See $LK,"TempleOS Link Types",A="MN:ST_LINK_TYPES"$.
|
||||
|
||||
"filename"
|
||||
"FI:filename"
|
||||
"FA:haystack_filename,needle_anchor_str"
|
||||
"FF:haystack_filename,needle_str"
|
||||
"FF:haystack_filename,needle_str:occurnum"
|
||||
"FL:filename,linenum"
|
||||
"MN:SymName"
|
||||
"PI:filename"
|
||||
"PF:haystack_filename,needle_str"
|
||||
"PF:haystack_filename,needle_str:occurnum"
|
||||
"PL:filename,linenum"
|
||||
"BF:haystack_bible_book,needle_str"
|
||||
"DF:word"
|
||||
"DF:word,defnum"
|
||||
"HI:index"
|
||||
"AD:code_address_number"
|
||||
|
||||
To edit a doc structure already in memory. See $LK,"SpriteEdText",A="MN:SpriteEdText"$().
|
||||
"AI:doc_address"
|
||||
"AA:haystack_doc_address,needle_anchor_str"
|
||||
"AF:haystack_doc_address,needle_str"
|
||||
"AF:haystack_doc_address,needle_str:occurnum"
|
||||
"AL:doc_address,linenum"
|
||||
|
||||
*/
|
||||
#define LK_FILE 0
|
||||
#define LK_FILE_ANCHOR 1
|
||||
#define LK_FILE_FIND 2
|
||||
#define LK_FILE_LINE 3
|
||||
// "MN:SymName"
|
||||
#define LK_MAN_PAGE 4
|
||||
// "PI:filename"
|
||||
// "PF:haystack_filename,needle_str"
|
||||
// "PF:haystack_filename,needle_str:occurnum"
|
||||
// "PL:filename,linenum"
|
||||
#define LK_PLAIN 5
|
||||
#define LK_PLAIN_FIND 6
|
||||
#define LK_PLAIN_LINE 7
|
||||
// "BF:haystack_bible_book,needle_str"
|
||||
#define LK_BIBLE_FIND 8
|
||||
// "DF:word"
|
||||
// "DF:word,defnum"
|
||||
#define LK_DEF 9
|
||||
// "HI:index"
|
||||
#define LK_HELP_INDEX 10
|
||||
// "AD:code_address_number"
|
||||
#define LK_ADDR 11
|
||||
//These are to edit a doc structure already in memory.
|
||||
// "AI:doc_address"
|
||||
// "AA:haystack_doc_address,needle_anchor_str"
|
||||
// "AF:haystack_doc_address,needle_str"
|
||||
// "AF:haystack_doc_address,needle_str:occurnum"
|
||||
// "AL:doc_address,linenum"
|
||||
#define LK_DOC 12 //See $LK,"SpriteEdText",A="MN:SpriteEdText"$()
|
||||
#define LK_DOC_ANCHOR 13
|
||||
#define LK_DOC_FIND 14
|
||||
|
||||
+138
-78
@@ -1,5 +1,31 @@
|
||||
#help_index "DolDoc/Misc"
|
||||
|
||||
U0 EdReplaceTroubleOne(CDoc *doc,U8 *st_original,U8 *st_safe,I64 num,
|
||||
Bool to_safe,Bool select)
|
||||
{
|
||||
U8 buf[STR_LEN];
|
||||
StrPrint(buf,st_safe,num);
|
||||
if (to_safe)
|
||||
EdReplace(doc,st_original,buf,select);
|
||||
else
|
||||
EdReplace(doc,buf,st_original,select);
|
||||
}
|
||||
|
||||
U0 EdReplaceTroubleAll(CDoc *doc,Bool to_safe,Bool select)
|
||||
{
|
||||
I64 i=0;
|
||||
EdReplaceTroubleOne(doc,"#assert" ,"//<@%d@>" ,i++,to_safe,select);
|
||||
EdReplaceTroubleOne(doc,"#define" ,"//<@%d@>" ,i++,to_safe,select);
|
||||
EdReplaceTroubleOne(doc,"#include","//<@%d@>" ,i++,to_safe,select);
|
||||
//#if will match #if,#ifdef,#ifndef,#ifaot and #ifjit
|
||||
EdReplaceTroubleOne(doc,"#if" ,"//<@%d@>" ,i++,to_safe,select);
|
||||
EdReplaceTroubleOne(doc,"#endif" ,"//<@%d@>" ,i++,to_safe,select);
|
||||
//Convert #exe to union because we want that indent pattern.
|
||||
EdReplaceTroubleOne(doc,"#exe" ,"union @%d@",i++,to_safe,select);
|
||||
EdReplaceTroubleOne(doc,"'{'" ,"'<@%d@>'" ,i++,to_safe,select);
|
||||
EdReplaceTroubleOne(doc,"'}'" ,"'<@%d@>'" ,i++,to_safe,select);
|
||||
}
|
||||
|
||||
#define C_INDENT_SPACES 2
|
||||
#define ASM_RENUM_SPACING 5
|
||||
|
||||
@@ -14,10 +40,12 @@ I64 PopUpEdFmt()
|
||||
I64 i;
|
||||
CDoc *doc=DocNew;
|
||||
DocPrint(doc,"$$LTBLUE$$$$MU,\"Check Compile\",LE=EF_CHK_COMPILE$$\n"
|
||||
"$$MU,\"Reindent CPP.Z Fun\",LE=EF_REINDENT$$\n"
|
||||
"$$MU,\"Reindent CPP.Z Fun (Beware braces in strings.)\","
|
||||
"LE=EF_REINDENT$$\n"
|
||||
"$$MU,\"Renum Asm Local @@ Labels for Fun\",LE=EF_RENUM_ASM$$\n"
|
||||
"$$MU,\"Insert Template Code: Ctrl Slider\",LE=EF_CTRL_SLIDER$$\n"
|
||||
"$$MU,\"Insert ASCII/Scan Code Hex Codes for key pressed\",LE=EF_CH_SC$$\n\n"
|
||||
"$$MU,\"Insert ASCII/Scan Code Hex Codes for key pressed\","
|
||||
"LE=EF_CH_SC$$\n\n"
|
||||
"$$MU,\"CANCEL\",LE=DOCM_CANCEL$$\n\n"
|
||||
"$$GREEN$$<ALT-BACKSPACE>$$FG$$ to undo if not happy\n"
|
||||
"with the results.\n");
|
||||
@@ -28,7 +56,7 @@ I64 PopUpEdFmt()
|
||||
|
||||
class CRILex
|
||||
{
|
||||
CLex *lx1,*lx2;
|
||||
CCmpCtrl *cc1,*cc2;
|
||||
CQueVectU8 *indent;
|
||||
I64 depth,exp_depth,one_shot;
|
||||
Bool was_new_line,is_not_cont;
|
||||
@@ -38,34 +66,38 @@ I64 EdRILex(CRILex *rx)
|
||||
{
|
||||
rx->is_not_cont=FALSE;
|
||||
I64 i;
|
||||
CLexFile *tempf;
|
||||
do {
|
||||
Lex(rx->lx1);
|
||||
Lex(rx->lx2);
|
||||
i=PrsKeyWord(rx->lx2);
|
||||
if (rx->lx1->token=='\n' && rx->lx2->token==';' || rx->lx2->token=='{' ||
|
||||
rx->lx2->token=='}' || rx->lx2->token==':' || rx->lx2->token==')' &&
|
||||
!rx->exp_depth || i==KW_ELSE || i==KW_CATCH || i==KW_DO)
|
||||
rx->is_not_cont=TRUE;
|
||||
if (rx->was_new_line && (rx->lx1->token!=':' ||
|
||||
i==KW_DFT || i==KW_SUB_SWITCH_START || i==KW_SUB_SWITCH_END)) {
|
||||
QueVectU8Put(rx->indent,rx->lx2->lfns[0].cur_entry->y,rx->depth+rx->one_shot);
|
||||
Lex(rx->cc1);
|
||||
Lex(rx->cc2);
|
||||
i=PrsKeyWord(rx->cc2);
|
||||
if (rx->cc1->token=='\n' && rx->cc2->token==';' || rx->cc2->token=='{' ||
|
||||
rx->cc2->token=='}' || rx->cc2->token==':' || rx->cc2->token==')' &&
|
||||
!rx->exp_depth || i==KW_ELSE || i==KW_CATCH || i==KW_DO)
|
||||
rx->is_not_cont=TRUE;
|
||||
if (rx->was_new_line && (rx->cc1->token!=':' ||
|
||||
i==KW_DFT || i==KW_SUB_SWITCH_START || i==KW_SUB_SWITCH_END)) {
|
||||
tempf=rx->cc2->lex_include_stk;
|
||||
while (tempf->next)
|
||||
tempf=tempf->next;
|
||||
QueVectU8Put(rx->indent,tempf->cur_entry->y,rx->depth+rx->one_shot);
|
||||
rx->one_shot=0;
|
||||
}
|
||||
if (rx->lx2->token=='\n')
|
||||
if (rx->cc2->token=='\n')
|
||||
rx->was_new_line=TRUE;
|
||||
else
|
||||
rx->was_new_line=FALSE;
|
||||
} while (rx->lx1->token=='\n');
|
||||
return rx->lx1->token;
|
||||
} while (rx->cc1->token=='\n');
|
||||
return rx->cc1->token;
|
||||
}
|
||||
|
||||
U0 EdRIExp(CRILex *rx)
|
||||
{
|
||||
if (rx->lx1->token=='(') {
|
||||
if (rx->cc1->token=='(') {
|
||||
if (!rx->exp_depth++)
|
||||
rx->depth+=3;
|
||||
EdRILex(rx);
|
||||
while (rx->lx1->token && rx->lx1->token!=')')
|
||||
while (rx->cc1->token && rx->cc1->token!=')')
|
||||
EdRIExp(rx);
|
||||
if (!--rx->exp_depth) {
|
||||
rx->depth-=3;
|
||||
@@ -79,10 +111,10 @@ U0 EdRIStmt(CRILex *rx,Bool indent)
|
||||
{
|
||||
I64 i;
|
||||
Bool cont;
|
||||
if (rx->lx1->token=='{') {
|
||||
if (rx->cc1->token=='{') {
|
||||
rx->depth++;
|
||||
EdRILex(rx);
|
||||
while (rx->lx1->token && rx->lx1->token!='}')
|
||||
while (rx->cc1->token && rx->cc1->token!='}')
|
||||
EdRIStmt(rx,FALSE);
|
||||
if (--rx->depth<0) rx->depth=0;
|
||||
EdRILex(rx);
|
||||
@@ -90,14 +122,14 @@ U0 EdRIStmt(CRILex *rx,Bool indent)
|
||||
if (indent) rx->depth++;
|
||||
do {
|
||||
cont=FALSE;
|
||||
switch (PrsKeyWord(rx->lx1)) {
|
||||
switch (PrsKeyWord(rx->cc1)) {
|
||||
case KW_IF:
|
||||
EdRILex(rx);
|
||||
EdRIExp(rx);
|
||||
EdRIStmt(rx,TRUE);
|
||||
if (PrsKeyWord(rx->lx1)==KW_ELSE) {
|
||||
if (PrsKeyWord(rx->cc1)==KW_ELSE) {
|
||||
EdRILex(rx);
|
||||
if (PrsKeyWord(rx->lx1)==KW_IF && rx->lx2->token!='\n')
|
||||
if (PrsKeyWord(rx->cc1)==KW_IF && rx->cc2->token!='\n')
|
||||
EdRIStmt(rx,FALSE);
|
||||
else
|
||||
EdRIStmt(rx,TRUE);
|
||||
@@ -106,11 +138,15 @@ U0 EdRIStmt(CRILex *rx,Bool indent)
|
||||
case KW_TRY:
|
||||
EdRILex(rx);
|
||||
EdRIStmt(rx,TRUE);
|
||||
if (PrsKeyWord(rx->lx1)==KW_CATCH) {
|
||||
if (PrsKeyWord(rx->cc1)==KW_CATCH) {
|
||||
EdRILex(rx);
|
||||
EdRIStmt(rx,TRUE);
|
||||
}
|
||||
break;
|
||||
case KW_LOCK:
|
||||
EdRILex(rx);
|
||||
EdRIStmt(rx,TRUE);
|
||||
break;
|
||||
case KW_FOR:
|
||||
case KW_WHILE:
|
||||
EdRILex(rx);
|
||||
@@ -118,49 +154,52 @@ U0 EdRIStmt(CRILex *rx,Bool indent)
|
||||
EdRIStmt(rx,TRUE);
|
||||
break;
|
||||
case KW_ASM:
|
||||
EdRILex(rx);
|
||||
case KW_CLASS:
|
||||
case KW_UNION:
|
||||
if (EdRILex(rx)==TK_IDENT)
|
||||
EdRILex(rx);
|
||||
EdRIStmt(rx,TRUE);
|
||||
break;
|
||||
case KW_DO:
|
||||
EdRILex(rx);
|
||||
EdRIStmt(rx,TRUE);
|
||||
if (PrsKeyWord(rx->lx1)==KW_WHILE) {
|
||||
if (PrsKeyWord(rx->cc1)==KW_WHILE) {
|
||||
EdRILex(rx);
|
||||
EdRIExp(rx);
|
||||
}
|
||||
if (rx->lx1->token==';')
|
||||
if (rx->cc1->token==';')
|
||||
EdRILex(rx);
|
||||
break;
|
||||
case KW_SWITCH:
|
||||
case KW_NOBOUND_SWITCH:
|
||||
EdRILex(rx);
|
||||
EdRIExp(rx);
|
||||
if (rx->lx1->token=='{') {
|
||||
if (rx->cc1->token=='{') {
|
||||
rx->depth++;
|
||||
EdRILex(rx);
|
||||
i=0;
|
||||
while (rx->lx1->token && rx->lx1->token!='}') {
|
||||
switch (PrsKeyWord(rx->lx1)) {
|
||||
while (rx->cc1->token && rx->cc1->token!='}') {
|
||||
switch (PrsKeyWord(rx->cc1)) {
|
||||
case KW_SUB_SWITCH_START:
|
||||
rx->depth+=i; i=0;
|
||||
while (EdRILex(rx) && rx->lx1->token!=':');
|
||||
while (EdRILex(rx) && rx->cc1->token!=':');
|
||||
EdRILex(rx);
|
||||
i++;
|
||||
break;
|
||||
case KW_SUB_SWITCH_END:
|
||||
rx->depth+=i; i=0;
|
||||
if (--rx->depth<0) rx->depth=0;
|
||||
while (EdRILex(rx) && rx->lx1->token!=':');
|
||||
while (EdRILex(rx) && rx->cc1->token!=':');
|
||||
EdRILex(rx);
|
||||
break;
|
||||
case KW_CASE:
|
||||
case KW_DFT:
|
||||
rx->depth+=i; i=0;
|
||||
while (EdRILex(rx) && rx->lx1->token!=':');
|
||||
while (EdRILex(rx) && rx->cc1->token!=':');
|
||||
EdRILex(rx);
|
||||
break;
|
||||
default:
|
||||
if (rx->lx1->token)
|
||||
if (rx->cc1->token)
|
||||
EdRIStmt(rx,TRUE);
|
||||
}
|
||||
}
|
||||
@@ -169,24 +208,25 @@ U0 EdRIStmt(CRILex *rx,Bool indent)
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (rx->lx1->token==TK_IDENT && rx->lx1->hash_entry &&
|
||||
rx->lx1->hash_entry->type&(HTT_OPCODE|HTT_ASM_KEYWORD)) {
|
||||
rx->one_shot=4-rx->depth;
|
||||
if (rx->cc1->token==TK_IDENT && rx->cc1->hash_entry &&
|
||||
rx->cc1->hash_entry->type&(HTT_OPCODE|HTT_ASM_KEYWORD)) {
|
||||
// rx->one_shot=4-rx->depth;
|
||||
do EdRILex(rx);
|
||||
while (rx->lx2->token && rx->lx2->token!='\n');
|
||||
while (rx->cc2->token && rx->cc2->token!='\n');
|
||||
rx->is_not_cont=TRUE;
|
||||
} else {
|
||||
while (rx->lx1->token && rx->lx1->token!=';' && rx->lx1->token!=':') {
|
||||
if (rx->lx2->token=='\n' && !rx->is_not_cont)
|
||||
while (rx->cc1->token && rx->cc1->token!=';' &&
|
||||
rx->cc1->token!=':') {
|
||||
if (rx->cc2->token=='\n' && !rx->is_not_cont)
|
||||
rx->one_shot=3;
|
||||
EdRILex(rx);
|
||||
}
|
||||
if (rx->lx1->token==':')
|
||||
if (rx->cc1->token==':')
|
||||
cont=TRUE;
|
||||
EdRILex(rx);
|
||||
}
|
||||
}
|
||||
} while (cont && rx->lx1->token!='}');
|
||||
} while (cont && rx->cc1->token!='}');
|
||||
if (indent && --rx->depth<0)
|
||||
rx->depth=0;
|
||||
}
|
||||
@@ -197,21 +237,23 @@ CQueVectU8 *EdRICode(CDoc *doc)
|
||||
CQueVectU8 *result;
|
||||
CRILex *rx=CAlloc(sizeof(CRILex));
|
||||
|
||||
rx->lx1=LexNew(,LF_KEEP_NEW_LINES|LF_DONT_FREE_BUF,doc->filename.name);
|
||||
Free(rx->lx1->lfns[0].full_name);
|
||||
LexAttachDoc(rx->lx1,&rx->lx1->lfns[0],doc,,doc->cur_entry,doc->cur_data_col);
|
||||
rx->cc1=CmpCtrlNew(,CCF_KEEP_NEW_LINES|CCF_DONT_FREE_BUF,doc->filename.name);
|
||||
Free(rx->cc1->lex_include_stk->full_name);
|
||||
LexAttachDoc(rx->cc1,rx->cc1->lex_include_stk,doc,,
|
||||
doc->cur_entry,doc->cur_col);
|
||||
|
||||
rx->lx2=LexNew(,LF_KEEP_NEW_LINES|LF_DONT_FREE_BUF,doc->filename.name);
|
||||
Free(rx->lx2->lfns[0].full_name);
|
||||
LexAttachDoc(rx->lx2,&rx->lx2->lfns[0],doc,,doc->cur_entry,doc->cur_data_col);
|
||||
rx->cc2=CmpCtrlNew(,CCF_KEEP_NEW_LINES|CCF_DONT_FREE_BUF,doc->filename.name);
|
||||
Free(rx->cc2->lex_include_stk->full_name);
|
||||
LexAttachDoc(rx->cc2,rx->cc2->lex_include_stk,doc,,
|
||||
doc->cur_entry,doc->cur_col);
|
||||
|
||||
rx->indent=QueVectU8New(doc->cur_entry->y);
|
||||
|
||||
Lex(rx->lx1);
|
||||
Lex(rx->cc1);
|
||||
EdRIStmt(rx,FALSE);
|
||||
|
||||
LexDel(rx->lx1);
|
||||
LexDel(rx->lx2);
|
||||
CmpCtrlDel(rx->cc1);
|
||||
CmpCtrlDel(rx->cc2);
|
||||
result=rx->indent;
|
||||
Free(rx);
|
||||
return result;
|
||||
@@ -284,7 +326,8 @@ class CRenum
|
||||
I64 EdRAGetU8(CDoc *doc)
|
||||
{
|
||||
I64 result=-1;
|
||||
while (doc->cur_entry!=doc && doc->cur_entry->type&DOCET_SELECTED && result<0) {
|
||||
while (doc->cur_entry!=doc &&
|
||||
doc->cur_entry->type&DOCET_SELECTED && result<0) {
|
||||
result=EdCurU8(doc);
|
||||
EdCursorRight(doc);
|
||||
}
|
||||
@@ -307,7 +350,7 @@ U0 EdRACollect(CDoc *doc,CRenum *root)
|
||||
StrCpy(buf,"@@");
|
||||
i=2;
|
||||
while (ch>=0 && i<sizeof(CEdFindText.find_text)) {
|
||||
if (Bt(chars_bitmap_alpha_numeric,ch))
|
||||
if (Bt(chars_bmp_alpha_numeric,ch))
|
||||
buf[i++]=ch;
|
||||
else
|
||||
break;
|
||||
@@ -315,7 +358,7 @@ U0 EdRACollect(CDoc *doc,CRenum *root)
|
||||
}
|
||||
if (i<sizeof(CEdFindText.find_text)) {
|
||||
buf[i++]=0;
|
||||
while (ch>=0 && Bt(chars_bitmap_white_space,ch))
|
||||
while (ch>=0 && Bt(chars_bmp_white_space,ch))
|
||||
ch=EdRAGetU8(doc);
|
||||
if (ch==':') {
|
||||
ch=EdRAGetU8(doc);
|
||||
@@ -327,7 +370,7 @@ U0 EdRACollect(CDoc *doc,CRenum *root)
|
||||
}
|
||||
}
|
||||
}
|
||||
//This is needed because we moved the
|
||||
//This is needed because we moved the
|
||||
//cursor and it didn't recalc.
|
||||
DocRecalc(doc);
|
||||
}
|
||||
@@ -337,7 +380,7 @@ U0 EdRenumAsm(CDoc *doc)
|
||||
Bool unlock=DocLock(doc);
|
||||
I64 num=0;
|
||||
CRenum root,*tempr,*tempr1;
|
||||
U8 buf[sizeof(CEdFindText.find_text)],
|
||||
U8 buf[sizeof(CEdFindText.find_text)],
|
||||
buf2[sizeof(CEdFindText.find_text)];
|
||||
|
||||
QueInit(&root);
|
||||
@@ -367,7 +410,7 @@ U0 EdRenumAsm(CDoc *doc)
|
||||
DocUnlock(doc);
|
||||
}
|
||||
|
||||
U0 EdCodeTools2(CDoc *doc,I64 tool_action)
|
||||
U0 EdCodeTools2(CDoc *doc,I64 tool_action,Bool beep=TRUE)
|
||||
{
|
||||
Bool okay,unlock=DocLock(doc),start_of_line=TRUE;
|
||||
CDocEntry *doc_e,*doc_ne;
|
||||
@@ -395,28 +438,32 @@ U0 EdCodeTools2(CDoc *doc,I64 tool_action)
|
||||
Free(st);
|
||||
WinHorz(Fs->win_left,Fs->win_right, task);
|
||||
WinVert(Fs->win_top, Fs->win_bottom,task);
|
||||
if (ScanResult(tempc,&r)) {
|
||||
if (JobResultScan(tempc,&r)) {
|
||||
st=DirFile(doc->filename.name,,"PRJ.Z");
|
||||
prj_file=FileNameAbs(st,FUF_Z_OR_NOT_Z);
|
||||
Free(st);
|
||||
if (FileFind(prj_file)) {
|
||||
st2=DirFile(prj_file),
|
||||
st=MStrPrint("Cd(\"%s\");",st2);
|
||||
st=MStrPrint("Cd(\"%s\");",st2);
|
||||
Free(st2);
|
||||
tempc=TaskExe(task,Fs,st,1<<SVCf_WAKE_MASTER|1<<SVCf_FOCUS_MASTER|1<<SVCf_FREE_ON_COMPLETE);
|
||||
tempc=TaskExe(task,Fs,st,1<<SVCf_WAKE_MASTER|
|
||||
1<<SVCf_FOCUS_MASTER|1<<SVCf_FREE_ON_COMPLETE);
|
||||
Free(st);
|
||||
st=MStrPrint("\"$$WW,1$$\";Cmp(\"%s\",\"SysTemp\",\"SysTemp\");",prj_file);
|
||||
st=MStrPrint("\"$$WW,1$$\";Cmp(\"%s\",\"SysTemp\",\"SysTemp\");",
|
||||
prj_file);
|
||||
tempc=TaskExe(task,Fs,st,1<<SVCf_WAKE_MASTER|1<<SVCf_FOCUS_MASTER);
|
||||
Free(st);
|
||||
if (ScanResult(tempc,&r))
|
||||
if (JobResultScan(tempc,&r))
|
||||
if (!r) {
|
||||
tempc=TaskExe(task,Fs,
|
||||
"Load(\"SysTemp\",LDF_JUST_LOAD);",1<<SVCf_WAKE_MASTER|1<<SVCf_FOCUS_MASTER);
|
||||
if (ScanResult(tempc,&r))
|
||||
"Load(\"SysTemp\",LDF_JUST_LOAD);",
|
||||
1<<SVCf_WAKE_MASTER|1<<SVCf_FOCUS_MASTER);
|
||||
if (JobResultScan(tempc,&r))
|
||||
okay=TRUE;
|
||||
}
|
||||
tempc=TaskExe(task,Fs,"Del(\"SysTemp.*\");",1<<SVCf_WAKE_MASTER|1<<SVCf_FOCUS_MASTER);
|
||||
ScanResult(tempc,&r);
|
||||
tempc=TaskExe(task,Fs,"Del(\"SysTemp.*\");",
|
||||
1<<SVCf_WAKE_MASTER|1<<SVCf_FOCUS_MASTER);
|
||||
JobResultScan(tempc,&r);
|
||||
} else {
|
||||
Free(prj_file);
|
||||
st=DirFile(doc->filename.name,"Load","CPP.Z");
|
||||
@@ -428,7 +475,7 @@ U0 EdCodeTools2(CDoc *doc,I64 tool_action)
|
||||
st=MStrPrint("\"$$WW,1$$\";ExeFile(\"%s\",TRUE);",doc->filename.name);
|
||||
tempc=TaskExe(task,Fs,st,1<<SVCf_WAKE_MASTER|1<<SVCf_FOCUS_MASTER);
|
||||
Free(st);
|
||||
if (ScanResult(tempc,&r) && r)
|
||||
if (JobResultScan(tempc,&r) && r)
|
||||
okay=TRUE;
|
||||
}
|
||||
Free(prj_file);
|
||||
@@ -445,13 +492,18 @@ U0 EdCodeTools2(CDoc *doc,I64 tool_action)
|
||||
}
|
||||
break;
|
||||
case EF_REINDENT:
|
||||
start_y=doc->cur_entry->y;
|
||||
EdReplaceTroubleAll(doc,TRUE,FALSE);
|
||||
DocLineNumGoTo(doc,start_y+1);
|
||||
if (EdGoToFun(doc,FALSE,FALSE)) {
|
||||
start_y=doc->cur_entry->y;
|
||||
indent=EdRICode(doc);
|
||||
DocUnlock(doc);
|
||||
Snd(2000); Sleep(150); Snd(0);
|
||||
Sleep(100);
|
||||
Snd(2000); Sleep(150); Snd(0);
|
||||
if (beep) {
|
||||
Snd(2000); Sleep(150); Snd(0);
|
||||
Sleep(100);
|
||||
Snd(2000); Sleep(150); Snd(0);
|
||||
}
|
||||
DocLock(doc);
|
||||
EdRemFunLeadingSpace(doc);
|
||||
DocLineNumGoTo(doc,start_y+1);
|
||||
@@ -460,7 +512,8 @@ U0 EdCodeTools2(CDoc *doc,I64 tool_action)
|
||||
while (start_y<=doc_e->y<end_y) {
|
||||
if (doc_e!=doc && doc_e!=doc->cur_entry &&
|
||||
!(doc_e->de_flags&(DOCEG1_DONT_EDIT-DOCEF_SCROLLING_X))) {
|
||||
if (doc_e->type_u8==DOCT_NEW_LINE||doc_e->type_u8==DOCT_SOFT_NEW_LINE)
|
||||
if (doc_e->type_u8==DOCT_NEW_LINE||
|
||||
doc_e->type_u8==DOCT_SOFT_NEW_LINE)
|
||||
start_of_line=TRUE;
|
||||
else {
|
||||
if (start_of_line) {
|
||||
@@ -473,7 +526,8 @@ U0 EdCodeTools2(CDoc *doc,I64 tool_action)
|
||||
doc_ne->x=x;
|
||||
doc_ne->y=doc_e->y;
|
||||
doc_ne->page_line_num=doc_e->page_line_num;
|
||||
MemCpy(&doc_ne->settings,&doc_e->settings,sizeof(CDocSettings));
|
||||
MemCpy(&doc_ne->settings,
|
||||
&doc_e->settings,sizeof(CDocSettings));
|
||||
QueIns(doc_ne,doc_e->last);
|
||||
i-=8;
|
||||
x+=8;
|
||||
@@ -490,7 +544,8 @@ U0 EdCodeTools2(CDoc *doc,I64 tool_action)
|
||||
doc_ne->x=x;
|
||||
doc_ne->y=doc_e->y;
|
||||
doc_ne->page_line_num=doc_e->page_line_num;
|
||||
MemCpy(&doc_ne->settings,&doc_e->settings,sizeof(CDocSettings));
|
||||
MemCpy(&doc_ne->settings,
|
||||
&doc_e->settings,sizeof(CDocSettings));
|
||||
QueIns(doc_ne,doc_e->last);
|
||||
}
|
||||
}
|
||||
@@ -501,6 +556,9 @@ U0 EdCodeTools2(CDoc *doc,I64 tool_action)
|
||||
}
|
||||
QueVectU8Del(indent);
|
||||
}
|
||||
start_y=doc->cur_entry->y;
|
||||
EdReplaceTroubleAll(doc,FALSE,FALSE);
|
||||
DocLineNumGoTo(doc,start_y+1);
|
||||
break;
|
||||
case EF_RENUM_ASM:
|
||||
if (EdGoToFun(doc,FALSE,TRUE)) {
|
||||
@@ -514,9 +572,11 @@ U0 EdCodeTools2(CDoc *doc,I64 tool_action)
|
||||
DocRecalc(doc);
|
||||
}
|
||||
DocUnlock(doc);
|
||||
Snd(2000); Sleep(150); Snd(0);
|
||||
Sleep(100);
|
||||
Snd(2000); Sleep(150); Snd(0);
|
||||
if (beep) {
|
||||
Snd(2000); Sleep(150); Snd(0);
|
||||
Sleep(100);
|
||||
Snd(2000); Sleep(150); Snd(0);
|
||||
}
|
||||
DocLock(doc);
|
||||
EdRenumAsm(doc);
|
||||
}
|
||||
@@ -546,7 +606,7 @@ U0 EdPopUpChSC(I64 *_ch,I64 *_sc)
|
||||
U0 EdChSC(CDoc *doc)
|
||||
{
|
||||
I64 ch,sc;
|
||||
U8 buf[136];
|
||||
U8 buf[STR_LEN];
|
||||
StrPrint(buf,"EdPopUpChSC(%d,%d);",&ch,&sc);
|
||||
PopUp(buf,Fs);
|
||||
if (ch==CH_BACKSPACE)
|
||||
@@ -569,7 +629,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_bitmap_displayable,ch))
|
||||
else if (Bt(chars_bmp_displayable,ch))
|
||||
DocPrint(doc,"'%c',0x%X",ch,sc);
|
||||
else
|
||||
DocPrint(doc,"0x%X,0x%X",ch,sc);
|
||||
|
||||
+86
-73
@@ -151,7 +151,8 @@ class CEdProject
|
||||
hide;
|
||||
};
|
||||
|
||||
Bool GetLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,Bool *_quote,U8 **_html_link)
|
||||
Bool GetLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,
|
||||
Bool *_quote,U8 **_html_link)
|
||||
{
|
||||
I64 i;
|
||||
CEdFileLink *e=CAlloc(sizeof(CEdFileLink));
|
||||
@@ -160,7 +161,7 @@ Bool GetLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,Bool *_quote,U8 **_html
|
||||
e->num=1;
|
||||
switch (type) {
|
||||
case LK_FILE:
|
||||
if (DocFormDo(e,,,,ctrl_L_footer)) {
|
||||
if (DocForm(e,,,,ctrl_L_footer)) {
|
||||
result=TRUE;
|
||||
if (!*e->tag)
|
||||
*_tag=StrNew(e->file);
|
||||
@@ -170,7 +171,7 @@ Bool GetLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,Bool *_quote,U8 **_html
|
||||
}
|
||||
break;
|
||||
case LK_PLAIN:
|
||||
if (DocFormDo(e,,,,ctrl_L_footer)) {
|
||||
if (DocForm(e,,,,ctrl_L_footer)) {
|
||||
result=TRUE;
|
||||
if (!*e->tag)
|
||||
*_tag=StrNew(e->file);
|
||||
@@ -180,7 +181,7 @@ Bool GetLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,Bool *_quote,U8 **_html
|
||||
}
|
||||
break;
|
||||
case LK_FILE_ANCHOR:
|
||||
if (DocFormDo(e,"CEdFileAnchorLink",,,ctrl_L_footer)) {
|
||||
if (DocForm(e,"CEdFileAnchorLink",,,ctrl_L_footer)) {
|
||||
result=TRUE;
|
||||
if (!*e->tag)
|
||||
*_tag=StrNew(e->aux);
|
||||
@@ -190,7 +191,7 @@ Bool GetLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,Bool *_quote,U8 **_html
|
||||
}
|
||||
break;
|
||||
case LK_FILE_FIND:
|
||||
if (DocFormDo(e,"CEdFileFindLink",,,ctrl_L_footer)) {
|
||||
if (DocForm(e,"CEdFileFindLink",,,ctrl_L_footer)) {
|
||||
result=TRUE;
|
||||
if (e->num==1) {
|
||||
if (!*e->tag)
|
||||
@@ -208,7 +209,7 @@ Bool GetLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,Bool *_quote,U8 **_html
|
||||
}
|
||||
break;
|
||||
case LK_PLAIN_FIND:
|
||||
if (DocFormDo(e,"CEdFileFindLink",,,ctrl_L_footer)) {
|
||||
if (DocForm(e,"CEdFileFindLink",,,ctrl_L_footer)) {
|
||||
result=TRUE;
|
||||
if (e->num==1) {
|
||||
if (!*e->tag)
|
||||
@@ -226,7 +227,7 @@ Bool GetLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,Bool *_quote,U8 **_html
|
||||
}
|
||||
break;
|
||||
case LK_FILE_LINE:
|
||||
if (DocFormDo(e,"CEdFileLineLink",,,ctrl_L_footer)) {
|
||||
if (DocForm(e,"CEdFileLineLink",,,ctrl_L_footer)) {
|
||||
result=TRUE;
|
||||
if (!*e->tag)
|
||||
*_tag=StrNew(e->file);
|
||||
@@ -236,7 +237,7 @@ Bool GetLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,Bool *_quote,U8 **_html
|
||||
}
|
||||
break;
|
||||
case LK_PLAIN_LINE:
|
||||
if (DocFormDo(e,"CEdFileLineLink",,,ctrl_L_footer)) {
|
||||
if (DocForm(e,"CEdFileLineLink",,,ctrl_L_footer)) {
|
||||
result=TRUE;
|
||||
if (!*e->tag)
|
||||
*_tag=StrNew(e->file);
|
||||
@@ -246,7 +247,7 @@ Bool GetLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,Bool *_quote,U8 **_html
|
||||
}
|
||||
break;
|
||||
case LK_MAN_PAGE:
|
||||
if (DocFormDo(e,"CEdManPageLink",,,ctrl_L_footer)) {
|
||||
if (DocForm(e,"CEdManPageLink",,,ctrl_L_footer)) {
|
||||
result=TRUE;
|
||||
if (!*e->tag)
|
||||
*_tag=StrNew(e->aux);
|
||||
@@ -256,7 +257,7 @@ Bool GetLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,Bool *_quote,U8 **_html
|
||||
}
|
||||
break;
|
||||
case LK_PLACE_ANCHOR:
|
||||
if (DocFormDo(e,"CEdPlaceAnchor",,,ctrl_L_footer)) {
|
||||
if (DocForm(e,"CEdPlaceAnchor",,,ctrl_L_footer)) {
|
||||
result=TRUE;
|
||||
if (!*e->tag) {
|
||||
if (e->hide)
|
||||
@@ -271,7 +272,7 @@ Bool GetLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,Bool *_quote,U8 **_html
|
||||
case LK_BIBLE_FIND: //TODO
|
||||
i=PopUpPickDefineSub("ST_BIBLE_BOOKS");
|
||||
if (i>=0) {
|
||||
if (DocFormDo(e,"CEdBibleLink",,,ctrl_L_footer)) {
|
||||
if (DocForm(e,"CEdBibleLink",,,ctrl_L_footer)) {
|
||||
result=TRUE;
|
||||
if (!*e->tag)
|
||||
*_tag=MStrPrint("%Z,%s",i,"ST_BIBLE_BOOKS",e->aux);
|
||||
@@ -283,7 +284,7 @@ Bool GetLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,Bool *_quote,U8 **_html
|
||||
break;
|
||||
case LK_DEF:
|
||||
e->num=-1;
|
||||
if (DocFormDo(e,"CEdDefLink",,,ctrl_L_footer)) {
|
||||
if (DocForm(e,"CEdDefLink",,,ctrl_L_footer)) {
|
||||
result=TRUE;
|
||||
if (!*e->tag)
|
||||
*_tag=StrNew(e->aux);
|
||||
@@ -297,7 +298,7 @@ Bool GetLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,Bool *_quote,U8 **_html
|
||||
}
|
||||
break;
|
||||
case LK_HELP_INDEX:
|
||||
if (DocFormDo(e,"CEdManPageLink",,,ctrl_L_footer)) {
|
||||
if (DocForm(e,"CEdManPageLink",,,ctrl_L_footer)) {
|
||||
result=TRUE;
|
||||
if (!*e->tag)
|
||||
*_tag=StrNew(e->aux);
|
||||
@@ -308,7 +309,7 @@ Bool GetLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,Bool *_quote,U8 **_html
|
||||
break;
|
||||
case LK_ADDR:
|
||||
e->num=DFT_ADDR_LINK_BIN_SIZE;
|
||||
if (DocFormDo(e,"CEdAddrLink",,,ctrl_L_footer)) {
|
||||
if (DocForm(e,"CEdAddrLink",,,ctrl_L_footer)) {
|
||||
result=TRUE;
|
||||
if (e->num==DFT_ADDR_LINK_BIN_SIZE) {
|
||||
if (!*e->tag)
|
||||
@@ -363,7 +364,8 @@ U0 EdInsLink()
|
||||
break;
|
||||
default:
|
||||
if (html_link)
|
||||
st=MStrPrint("$$LK%s,\"%Q\",A=\"%Q\",HTML=\"%Q\"$$",pop_up_st,tag,link,html_link);
|
||||
st=MStrPrint("$$LK%s,\"%Q\",A=\"%Q\",HTML=\"%Q\"$$",
|
||||
pop_up_st,tag,link,html_link);
|
||||
else
|
||||
st=MStrPrint("$$LK%s,\"%Q\",A=\"%Q\"$$",pop_up_st,tag,link);
|
||||
}
|
||||
@@ -442,7 +444,7 @@ U0 EdInsPageSetting()
|
||||
CEdPageSetting1 *e=CAlloc(sizeof(CEdPageSetting1));
|
||||
if (type>=0) {
|
||||
if (type==DOCT_RIGHT_MARGIN||type==DOCT_PAGE_LEN) {
|
||||
if (DocFormDo(e(CEdPageSetting2 *))) {
|
||||
if (DocForm(e(CEdPageSetting2 *))) {
|
||||
if (e->winrel) {
|
||||
if (*e->val)
|
||||
"$$%Z+WR,%s$$",type,"ST_DOC_CMDS",e->val;
|
||||
@@ -456,7 +458,7 @@ U0 EdInsPageSetting()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (DocFormDo(e)) {
|
||||
if (DocForm(e)) {
|
||||
if (*e->val)
|
||||
"$$%Z,%s$$",type,"ST_DOC_CMDS",e->val;
|
||||
else
|
||||
@@ -506,18 +508,23 @@ class CEdDollarText
|
||||
underline fmtstr "$$CB,\"Underline\"$$\n",
|
||||
tree fmtstr "$$CB,\"Tree\"$$\n",
|
||||
collapsed fmtstr "$$CB,\"Collapsed\"$$\n";
|
||||
U8 scroll_x [512] fmtstr "$$DA-P,511,A=\"Scroll X Length Expression:%s\"$$\n",
|
||||
shift_x [512] fmtstr "$$DA-P,511,A=\"X Offset Expression :%s\"$$\n",
|
||||
shift_y [512] fmtstr "$$DA-P,511,A=\"Y Offset Expression :%s\"$$\n",
|
||||
define_str[512] fmtstr "$$DA-P,511,A=\"Define Str :%s\"$$\n",
|
||||
html_link[512] fmtstr "$$DA-P,511,A=\"Html Link :%s\"$$\n";
|
||||
U8 scroll_x [512]
|
||||
fmtstr "$$DA-P,511,A=\"Scroll X Length Expression:%s\"$$\n",
|
||||
shift_x [512]
|
||||
fmtstr "$$DA-P,511,A=\"X Offset Expression :%s\"$$\n",
|
||||
shift_y [512]
|
||||
fmtstr "$$DA-P,511,A=\"Y Offset Expression :%s\"$$\n",
|
||||
define_str[512]
|
||||
fmtstr "$$DA-P,511,A=\"Define Str :%s\"$$\n",
|
||||
html_link[512]
|
||||
fmtstr "$$DA-P,511,A=\"Html Link :%s\"$$\n";
|
||||
};
|
||||
|
||||
U0 EdInsDollarText()
|
||||
{
|
||||
U8 *st,buf[512];
|
||||
CEdDollarText *e=CAlloc(sizeof(CEdDollarText));
|
||||
if (DocFormDo(e,,,,ctrl_L_footer)) {
|
||||
if (DocForm(e,,,,ctrl_L_footer)) {
|
||||
*buf=0;
|
||||
if (e->left_x ) CatPrint(buf,"+LX");
|
||||
if (e->center_x) CatPrint(buf,"+CX");
|
||||
@@ -561,7 +568,7 @@ class CEdSong
|
||||
U0 EdInsSong()
|
||||
{
|
||||
CEdSong *e=CAlloc(sizeof(CEdSong));
|
||||
if (DocFormDo(e,,,,ctrl_L_footer))
|
||||
if (DocForm(e,,,,ctrl_L_footer))
|
||||
"$$SO,\"%Q\",A=\"%s\"$$",e->tag,e->song;
|
||||
Free(e);
|
||||
}
|
||||
@@ -574,7 +581,7 @@ class CEdHighlight
|
||||
U0 EdInsHighlight()
|
||||
{
|
||||
CEdHighlight *e=CAlloc(sizeof(CEdHighlight));
|
||||
if (DocFormDo(e,,,,ctrl_L_footer))
|
||||
if (DocForm(e,,,,ctrl_L_footer))
|
||||
"$$HL,%d$$",e->highlight_on;
|
||||
Free(e);
|
||||
}
|
||||
@@ -587,16 +594,19 @@ class CEdHtmlCode
|
||||
U0 EdInsHtml()
|
||||
{
|
||||
CEdHtmlCode *e=CAlloc(sizeof(CEdHtmlCode));
|
||||
if (DocFormDo(e,,,,ctrl_L_footer))
|
||||
if (DocForm(e,,,,ctrl_L_footer))
|
||||
"$$HC,\"%Q\"$$",e->tag;
|
||||
Free(e);
|
||||
}
|
||||
|
||||
class CEdMacroMenu
|
||||
{
|
||||
U8 tag[512] fmtstr "$$DA-P,511,A=\"Tag Text :%s\"$$\n",
|
||||
left_macro[512] fmtstr "$$DA-P,511,A=\"Left Click Macro :%s\"$$\n",
|
||||
left_exp[512] fmtstr "$$DA-P,511,A=\"Left Click Expression :%s\"$$\n";
|
||||
U8 tag[512]
|
||||
fmtstr "$$DA-P,511,A=\"Tag Text :%s\"$$\n",
|
||||
left_macro[512]
|
||||
fmtstr "$$DA-P,511,A=\"Left Click Macro :%s\"$$\n",
|
||||
left_exp[512]
|
||||
fmtstr "$$DA-P,511,A=\"Left Click Expression :%s\"$$\n";
|
||||
Bool popup fmtstr "$$CB,\"PopUp\"$$\n",
|
||||
left_is_auto fmtstr "$$CB,\"Left is AutoStr\"$$\n",
|
||||
left_x fmtstr "$$CB,\"Left X \"$$\n",
|
||||
@@ -607,9 +617,12 @@ class CEdMacroMenu
|
||||
invert fmtstr "$$CB,\"Invert\"$$\n",
|
||||
underline fmtstr "$$CB,\"Underline\"$$\n",
|
||||
escape fmtstr "$$CB,\"Escape\"$$\n";
|
||||
U8 scroll_x[512] fmtstr "$$DA-P,511,A=\"Scroll X Length Expression:%s\"$$\n",
|
||||
shift_x[512] fmtstr "$$DA-P,511,A=\"X Offset Expression :%s\"$$\n",
|
||||
shift_y[512] fmtstr "$$DA-P,511,A=\"Y Offset Expression :%s\"$$\n";
|
||||
U8 scroll_x[512]
|
||||
fmtstr "$$DA-P,511,A=\"Scroll X Length Expression:%s\"$$\n",
|
||||
shift_x[512]
|
||||
fmtstr "$$DA-P,511,A=\"X Offset Expression :%s\"$$\n",
|
||||
shift_y[512]
|
||||
fmtstr "$$DA-P,511,A=\"Y Offset Expression :%s\"$$\n";
|
||||
};
|
||||
|
||||
U0 EdInsMacroMenu(Bool is_macro)
|
||||
@@ -618,7 +631,7 @@ U0 EdInsMacroMenu(Bool is_macro)
|
||||
CEdMacroMenu *e=CAlloc(sizeof(CEdMacroMenu));
|
||||
e->underline=TRUE;
|
||||
e->escape=TRUE;
|
||||
if (DocFormDo(e,,,,ctrl_L_footer)) {
|
||||
if (DocForm(e,,,,ctrl_L_footer)) {
|
||||
*buf=0;
|
||||
if (e->popup) CatPrint(buf,"+PU-X");
|
||||
if (e->left_x ) CatPrint(buf,"+LX");
|
||||
@@ -682,7 +695,7 @@ U0 EdInsButton()
|
||||
U8 *st,buf[512];
|
||||
CEdButton *e=CAlloc(sizeof(CEdButton));
|
||||
e->escape=TRUE;
|
||||
if (DocFormDo(e,,,,ctrl_L_footer)) {
|
||||
if (DocForm(e,,,,ctrl_L_footer)) {
|
||||
*buf=0;
|
||||
if (e->popup) CatPrint(buf,"+PU-X");
|
||||
if (e->left_x ) CatPrint(buf,"+LX");
|
||||
@@ -741,7 +754,7 @@ U0 EdInsCursorMovement()
|
||||
{
|
||||
U8 buf[512];
|
||||
CEdCursorMovement *e=CAlloc(sizeof(CEdCursorMovement));
|
||||
if (DocFormDo(e,,,,ctrl_L_footer)) {
|
||||
if (DocForm(e,,,,ctrl_L_footer)) {
|
||||
*buf=0;
|
||||
if (e->left_x ) CatPrint(buf,"+LX");
|
||||
if (e->center_x) CatPrint(buf,"+CX");
|
||||
@@ -785,7 +798,7 @@ U0 EdInsData()
|
||||
e->term=TRUE;
|
||||
e->len=512;
|
||||
e->type=RT_I64;
|
||||
if (DocFormDo(e,,,,ctrl_L_footer)) {
|
||||
if (DocForm(e,,,,ctrl_L_footer)) {
|
||||
*buf=0;
|
||||
if (e->type==RT_I64)
|
||||
*raw_type=0;
|
||||
@@ -815,7 +828,7 @@ U0 EdInsCheckBox()
|
||||
U8 *st,buf[512],raw_type[16];
|
||||
CEdCheckBox *e=CAlloc(sizeof(CEdCheckBox));
|
||||
e->type=RT_I8;
|
||||
if (DocFormDo(e,,,,ctrl_L_footer)) {
|
||||
if (DocForm(e,,,,ctrl_L_footer)) {
|
||||
*buf=0;
|
||||
if (e->type==RT_I8)
|
||||
*raw_type=0;
|
||||
@@ -842,7 +855,7 @@ U0 EdInsLst()
|
||||
U8 *st1,*st2,buf[512],raw_type[16];
|
||||
CEdLst *e=CAlloc(sizeof(CEdLst));
|
||||
e->type=RT_I64;
|
||||
if (DocFormDo(e,,,,ctrl_L_footer)) {
|
||||
if (DocForm(e,,,,ctrl_L_footer)) {
|
||||
*buf=0;
|
||||
if (e->type==RT_I64)
|
||||
*raw_type=0;
|
||||
@@ -879,7 +892,7 @@ U0 EdInsHexEd()
|
||||
e->cnt=128;
|
||||
e->cols=4;
|
||||
e->zero=TRUE;
|
||||
if (DocFormDo(e,,,,ctrl_L_footer)) {
|
||||
if (DocForm(e,,,,ctrl_L_footer)) {
|
||||
*buf=0;
|
||||
if (!e->zero) CatPrint(buf,"-Z");
|
||||
if (e->refresh) CatPrint(buf,"+RD");
|
||||
@@ -903,18 +916,18 @@ U0 EdInsBinary(I64 bin_num,I64 type)
|
||||
StrPrint(e->tag,"<%d>",bin_num);
|
||||
e->bin_num=bin_num;
|
||||
e->bin_ptr_link_bin_num=1;
|
||||
if (DocFormDo(e,,,
|
||||
"Note: Normally, you enter no file,\n"
|
||||
"just a bin num. If You enter a\n"
|
||||
"file, enter a file bin num or a file\n"
|
||||
"bin tag.\n\n",ctrl_L_footer)) {
|
||||
if (DocForm(e,,,
|
||||
"Note: Normally, you enter no file,\n"
|
||||
"just a bin num. If You enter a\n"
|
||||
"file, enter a file bin num or a file\n"
|
||||
"bin tag.\n\n",ctrl_L_footer)) {
|
||||
if (*e->bin_ptr_link_file) {
|
||||
if (*e->bin_ptr_link_tag)
|
||||
"$$%Z,\"%Q\",BI=%d,BP=\"%s,%s\"$$",type,"ST_DOC_CMDS",e->tag,e->bin_num,
|
||||
e->bin_ptr_link_file,e->bin_ptr_link_tag;
|
||||
e->bin_ptr_link_file,e->bin_ptr_link_tag;
|
||||
else
|
||||
"$$%Z,\"%Q\",BI=%d,BP=\"%s,%d\"$$",type,"ST_DOC_CMDS",e->tag,e->bin_num,
|
||||
e->bin_ptr_link_file,e->bin_ptr_link_bin_num;
|
||||
e->bin_ptr_link_file,e->bin_ptr_link_bin_num;
|
||||
} else {
|
||||
if (DocBinFindNum(DocPut,e->bin_num))
|
||||
"$$%Z,\"%Q\",BI=%d$$",type,"ST_DOC_CMDS",e->tag,e->bin_num;
|
||||
@@ -938,12 +951,12 @@ U0 EdInsTree()
|
||||
CEdTree *e=CAlloc(sizeof(CEdTree));
|
||||
e->collapsed=TRUE;
|
||||
e->indent=2;
|
||||
if (DocFormDo(e,,,,ctrl_L_footer)) {
|
||||
if (DocForm(e,,,,ctrl_L_footer)) {
|
||||
*buf=0;
|
||||
if (!e->collapsed) CatPrint(buf,"-C");
|
||||
st1=MStrPrint("%q",e->tag);
|
||||
st2=MStrPrint("$$TR%s,\"%Q\"$$\n$$ID,%d$$*\n$$ID,%d$$",
|
||||
buf,st1,e->indent,-e->indent);
|
||||
buf,st1,e->indent,-e->indent);
|
||||
DocPrintAtomic(DocPut,"%s",st2);
|
||||
Free(st1);
|
||||
Free(st2);
|
||||
@@ -1002,16 +1015,16 @@ U0 EdInsDollarCmd()
|
||||
break;
|
||||
case DOCT_HTML_CODE:
|
||||
EdInsHtml;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define DVT_SPRITE 0
|
||||
#define DVT_SPRITE_PTR 1
|
||||
#define DVT_DUP_SPRITE 2
|
||||
#define DVT_SPRITE_SIZE 3
|
||||
#define DVT_SPRITE_MACRO 4
|
||||
#define DVT_SPRITE_MENU 5
|
||||
#define DVT_SPRITE_LINK 6
|
||||
#define EST_SPRITE 0
|
||||
#define EST_SPRITE_PTR 1
|
||||
#define EST_DUP_SPRITE 2
|
||||
#define EST_SPRITE_SIZE 3
|
||||
#define EST_SPRITE_MACRO 4
|
||||
#define EST_SPRITE_MENU 5
|
||||
#define EST_SPRITE_LINK 6
|
||||
|
||||
I64 PopUpSpriteType()
|
||||
{
|
||||
@@ -1019,13 +1032,13 @@ I64 PopUpSpriteType()
|
||||
CDoc *doc=DocNew;
|
||||
DocPrint(doc,"$$PURPLE$$$$TX+CX,\"Graphic Resource Menu\"$$\n"
|
||||
"$$LK+PU+CX,\"Click for Help\",A=\"FI:::/Doc/Resource.TXT.Z\"$$\n"
|
||||
"\n$$LTBLUE$$$$MU,\"Make Sprite\",LE=DVT_SPRITE$$\n"
|
||||
"$$MU,\"Pointer to Sprite\",LE=DVT_SPRITE_PTR$$\n"
|
||||
"$$MU,\"Duplicate Sprite\",LE=DVT_DUP_SPRITE$$\n"
|
||||
"$$MU,\"Sprite Size (not really needed)\",LE=DVT_SPRITE_SIZE$$\n"
|
||||
"$$MU,\"Sprite Macro (Icon)\",LE=DVT_SPRITE_MACRO$$\n"
|
||||
"$$MU,\"Sprite Menu Item\",LE=DVT_SPRITE_MENU$$\n"
|
||||
"$$MU,\"Sprite Link\",LE=DVT_SPRITE_LINK$$\n"
|
||||
"\n$$LTBLUE$$$$MU,\"Make Sprite\",LE=EST_SPRITE$$\n"
|
||||
"$$MU,\"Pointer to Sprite\",LE=EST_SPRITE_PTR$$\n"
|
||||
"$$MU,\"Duplicate Sprite\",LE=EST_DUP_SPRITE$$\n"
|
||||
"$$MU,\"Sprite Size (not really needed)\",LE=EST_SPRITE_SIZE$$\n"
|
||||
"$$MU,\"Sprite Macro (Icon)\",LE=EST_SPRITE_MACRO$$\n"
|
||||
"$$MU,\"Sprite Menu Item\",LE=EST_SPRITE_MENU$$\n"
|
||||
"$$MU,\"Sprite Link\",LE=EST_SPRITE_LINK$$\n"
|
||||
"\n$$MU,\"Abort\",LE=DOCM_CANCEL$$\n\n");
|
||||
i=PopUpMenu(doc);
|
||||
DocDel(doc);
|
||||
@@ -1074,14 +1087,14 @@ U8 *EdSprite(I64 bin_num)
|
||||
CEdMacroSprite *e=CAlloc(sizeof(CEdMacroSprite));
|
||||
*buf=0;
|
||||
switch (type) {
|
||||
case DVT_SPRITE:
|
||||
case EST_SPRITE:
|
||||
StrPrint(e->tag,"<%d>",bin_num);
|
||||
if (DocFormDo(e,"CEdJustSprite",,,ctrl_L_footer))
|
||||
if (DocForm(e,"CEdJustSprite",,,ctrl_L_footer))
|
||||
st1=MStrPrint("\"%Q\"",e->tag);
|
||||
break;
|
||||
case DVT_SPRITE_MACRO:
|
||||
case EST_SPRITE_MACRO:
|
||||
e->escape=TRUE;
|
||||
if (DocFormDo(e,,,,ctrl_L_footer)) {
|
||||
if (DocForm(e,,,,ctrl_L_footer)) {
|
||||
CatPrint(buf,"+UL");
|
||||
if (e->is_auto)CatPrint(buf,"+LA");
|
||||
if (e->popup) CatPrint(buf,"+PU");
|
||||
@@ -1091,26 +1104,26 @@ U8 *EdSprite(I64 bin_num)
|
||||
Free(st);
|
||||
}
|
||||
break;
|
||||
case DVT_SPRITE_MENU:
|
||||
case EST_SPRITE_MENU:
|
||||
e->escape=TRUE;
|
||||
if (DocFormDo(e,"CEdMenuSprite",,,ctrl_L_footer)) {
|
||||
if (DocForm(e,"CEdMenuSprite",,,ctrl_L_footer)) {
|
||||
if (e->escape) CatPrint(buf,"+X");
|
||||
st1=MStrPrint("\"%Q\",LE=%s",e->tag,e->exp);
|
||||
}
|
||||
break;
|
||||
case DVT_SPRITE_LINK:
|
||||
case EST_SPRITE_LINK:
|
||||
CatPrint(buf,"+L");
|
||||
st1=EdSpriteLink(&pop_up,&html_link);
|
||||
if (pop_up)
|
||||
CatPrint(buf,"+PU");
|
||||
break;
|
||||
case DVT_SPRITE_PTR:
|
||||
case EST_SPRITE_PTR:
|
||||
EdInsBinary(--bin_num,DOCT_INS_BINARY);
|
||||
break;
|
||||
case DVT_SPRITE_SIZE:
|
||||
case EST_SPRITE_SIZE:
|
||||
EdInsBinary(--bin_num,DOCT_INS_BINARY_SIZE);
|
||||
break;
|
||||
case DVT_DUP_SPRITE:
|
||||
case EST_DUP_SPRITE:
|
||||
EdInsBinary(--bin_num,DOCT_SPRITE);
|
||||
break;
|
||||
}
|
||||
|
||||
+163
-161
@@ -5,11 +5,13 @@ public I64 EdCurU8(CDoc *doc)
|
||||
Bool unlock=DocLock(doc);
|
||||
CDocEntry *doc_ce=doc->cur_entry;
|
||||
I64 result=-1;
|
||||
if (doc_ce->type_u8==DOCT_TEXT && doc_ce->min_col<=doc->cur_data_col<doc_ce->max_col)
|
||||
result=doc_ce->tag[doc->cur_data_col];
|
||||
if (doc_ce->type_u8==DOCT_TEXT &&
|
||||
doc_ce->min_col<=doc->cur_col<doc_ce->max_col)
|
||||
result=doc_ce->tag[doc->cur_col];
|
||||
else if (doc_ce->type_u8==DOCT_TAB)
|
||||
result='\t';
|
||||
else if (doc_ce->type_u8==DOCT_NEW_LINE || doc_ce->type_u8==DOCT_SOFT_NEW_LINE)
|
||||
else if (doc_ce->type_u8==DOCT_NEW_LINE ||
|
||||
doc_ce->type_u8==DOCT_SOFT_NEW_LINE)
|
||||
result='\n';
|
||||
if (unlock)
|
||||
DocUnlock(doc);
|
||||
@@ -22,11 +24,11 @@ public U0 EdCursorLeft(CDoc *doc,I64 sc=MIN_I64)
|
||||
U8 *dst;
|
||||
Bool unlock=DocLock(doc);
|
||||
CDocEntry *doc_ce=doc->cur_entry,*original_ce=doc_ce,*doc_ne;
|
||||
I64 cc=doc->cur_data_col,y=doc_ce->y;
|
||||
I64 cc=doc->cur_col,y=doc_ce->y;
|
||||
if (sc!=MIN_I64) sc=sc.u32[0];
|
||||
if (sc>=0 && sc&SCF_CTRL) {
|
||||
while (doc_ce->last!=doc && (doc_ce->last->y==y ||
|
||||
doc_ce->de_flags & (DOCEF_SKIP|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP)))
|
||||
doc_ce->de_flags & (DOCEF_SKIP|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP)))
|
||||
doc_ce=doc_ce->last; //TODO: select? recurse?
|
||||
cc=doc_ce->min_col;
|
||||
} else {
|
||||
@@ -53,8 +55,10 @@ public U0 EdCursorLeft(CDoc *doc,I64 sc=MIN_I64)
|
||||
} else {
|
||||
cc=doc_ce->min_col;
|
||||
while (doc_ce->last!=doc &&
|
||||
(doc_ce->last->type_u8==DOCT_SOFT_NEW_LINE || doc_ce->last->type_u8==DOCT_INDENT ||
|
||||
doc_ce->last->de_flags & (DOCEF_SKIP|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP))) {
|
||||
(doc_ce->last->type_u8==DOCT_SOFT_NEW_LINE ||
|
||||
doc_ce->last->type_u8==DOCT_INDENT ||
|
||||
doc_ce->last->de_flags
|
||||
&(DOCEF_SKIP|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP))) {
|
||||
doc_ce=doc_ce->last;
|
||||
if (sc>=0)
|
||||
BEqu(&doc_ce->type,DOCEt_SELECTED,sc&SCF_SHIFT);
|
||||
@@ -79,7 +83,7 @@ public U0 EdCursorLeft(CDoc *doc,I64 sc=MIN_I64)
|
||||
}
|
||||
}
|
||||
}
|
||||
doc->cur_data_col=cc;
|
||||
doc->cur_col=cc;
|
||||
doc->cur_entry=doc_ce;
|
||||
if (doc_ce!=original_ce)
|
||||
DocFormBwd(doc);
|
||||
@@ -93,12 +97,13 @@ public U0 EdCursorRight(CDoc *doc,I64 sc=MIN_I64)
|
||||
Bool unlock=DocLock(doc);
|
||||
U8 *dst;
|
||||
CDocEntry *doc_ce=doc->cur_entry,*original_ce=doc_ce,*doc_ne;
|
||||
I64 cc=doc->cur_data_col,y=doc_ce->y,old_de_flags,old_color;
|
||||
I64 cc=doc->cur_col,y=doc_ce->y,old_de_flags,old_color;
|
||||
if (sc!=MIN_I64) sc=sc.u32[0];
|
||||
if (sc>=0 && sc&SCF_CTRL) {
|
||||
while (doc_ce!=doc && doc_ce->next->y==y &&
|
||||
doc_ce->next->type_u8!=DOCT_SOFT_NEW_LINE && doc_ce->next!=doc && (doc_ce->next->type_u8!=DOCT_NEW_LINE || !(doc->flags & DOCF_FORM)) ||
|
||||
doc_ce->de_flags & (DOCEF_SKIP|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP))
|
||||
doc_ce->next->type_u8!=DOCT_SOFT_NEW_LINE && doc_ce->next!=doc &&
|
||||
(doc_ce->next->type_u8!=DOCT_NEW_LINE || !(doc->flags & DOCF_FORM)) ||
|
||||
doc_ce->de_flags & (DOCEF_SKIP|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP))
|
||||
doc_ce=doc_ce->next;
|
||||
if (doc_ce->max_col>doc_ce->min_col)
|
||||
cc=doc_ce->max_col-1;
|
||||
@@ -139,7 +144,8 @@ public U0 EdCursorRight(CDoc *doc,I64 sc=MIN_I64)
|
||||
if (cc<=doc_ce->min_col && sc>=0)
|
||||
BEqu(&doc_ce->type,DOCEt_SELECTED,sc&SCF_SHIFT);
|
||||
doc_ce=doc_ce->next;
|
||||
while (doc_ce!=doc && doc_ce->de_flags & (DOCEF_SKIP|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP)) {
|
||||
while (doc_ce!=doc && doc_ce->de_flags
|
||||
&(DOCEF_SKIP|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP)) {
|
||||
if (sc>=0)
|
||||
BEqu(&doc_ce->type,DOCEt_SELECTED,sc&SCF_SHIFT);
|
||||
doc_ce=doc_ce->next;
|
||||
@@ -154,7 +160,7 @@ public U0 EdCursorRight(CDoc *doc,I64 sc=MIN_I64)
|
||||
}
|
||||
}
|
||||
}
|
||||
doc->cur_data_col=cc;
|
||||
doc->cur_col=cc;
|
||||
doc->cur_entry=doc_ce;
|
||||
if (doc_ce!=original_ce)
|
||||
DocFormFwd(doc);
|
||||
@@ -172,42 +178,42 @@ public U0 EdLineUp(CDoc *doc,I64 sc=MIN_I64)
|
||||
|
||||
if (sc!=MIN_I64) sc=sc.u32[0];
|
||||
if (doc_ce->type_u8==DOCT_HEX_ED) {
|
||||
doc->cur_data_col=doc->cur_data_col-doc_ce->hex_ed_width*3;
|
||||
if (doc->cur_data_col>=0) {
|
||||
doc->cur_col=doc->cur_col-doc_ce->hex_ed_width*3;
|
||||
if (doc->cur_col>=0) {
|
||||
if (unlock)
|
||||
DocUnlock(doc);
|
||||
return;
|
||||
} else
|
||||
doc->cur_data_col=0;
|
||||
doc->cur_col=0;
|
||||
}
|
||||
x=doc->x; y=doc->y;
|
||||
if (IsEditableText(doc_ce)) {
|
||||
if (doc_ce->min_col<doc->cur_data_col<doc_ce->max_col-1) {
|
||||
dst=doc_ce->tag+doc->cur_data_col;
|
||||
if (doc_ce->min_col<doc->cur_col<doc_ce->max_col-1) {
|
||||
dst=doc_ce->tag+doc->cur_col;
|
||||
doc_ne=DocEntryNew(doc,doc_ce,StrNew(dst,doc->mem_task));
|
||||
*dst=0;
|
||||
doc_ne->x=doc_ce->x+doc->cur_data_col;
|
||||
doc_ce->max_col=doc->cur_data_col;
|
||||
doc_ne->x=doc_ce->x+doc->cur_col;
|
||||
doc_ce->max_col=doc->cur_col;
|
||||
QueIns(doc_ne,doc_ce);
|
||||
} else
|
||||
if (doc->cur_data_col==doc_ce->min_col && doc_ce->last!=doc)
|
||||
doc_ce=doc_ce->last;
|
||||
} else
|
||||
if (doc_ce->last!=doc)
|
||||
} else if (doc->cur_col==doc_ce->min_col && doc_ce->last!=doc)
|
||||
doc_ce=doc_ce->last;
|
||||
} else if (doc_ce->last!=doc)
|
||||
doc_ce=doc_ce->last;
|
||||
if (sc>=0)
|
||||
BEqu(&doc_ce->type,DOCEt_SELECTED,sc&SCF_SHIFT);
|
||||
doc->cur_entry=doc_ce;
|
||||
DocFormBwd(doc);
|
||||
doc_ce=doc->cur_entry;
|
||||
while (doc_ce->last!=doc && (doc_ce->y>=y || doc_ce->de_flags & (DOCEF_SKIP|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP))) {
|
||||
while (doc_ce->last!=doc && (doc_ce->y>=y ||
|
||||
doc_ce->de_flags & (DOCEF_SKIP|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP))) {
|
||||
doc_ce=doc_ce->last;
|
||||
if (sc>=0)
|
||||
BEqu(&doc_ce->type,DOCEt_SELECTED,sc&SCF_SHIFT);
|
||||
}
|
||||
y=doc_ce->y;
|
||||
doc->y=y;
|
||||
while (doc_ce!=doc && (doc_ce->y>=y && doc_ce->x>=x || doc_ce->de_flags & (DOCEF_SKIP|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP))) {
|
||||
while (doc_ce!=doc && (doc_ce->y>=y && doc_ce->x>=x ||
|
||||
doc_ce->de_flags & (DOCEF_SKIP|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP))) {
|
||||
if (sc>=0)
|
||||
BEqu(&doc_ce->type,DOCEt_SELECTED,sc&SCF_SHIFT);
|
||||
doc_ce=doc_ce->last;
|
||||
@@ -222,38 +228,35 @@ public U0 EdLineUp(CDoc *doc,I64 sc=MIN_I64)
|
||||
} else {
|
||||
if (doc_ce->next->x==x) {
|
||||
doc_ce=doc_ce->next;
|
||||
if (doc->flags & DOCF_FORM) {
|
||||
if (doc->flags & DOCF_FORM)
|
||||
while (doc_ce->next->x==x &&
|
||||
(!Bt(doldoc.type_flags_form,doc_ce->type_u8) &&
|
||||
!(doc_ce->de_flags&DOCEF_LINK)||
|
||||
doc_ce->de_flags&DOCEF_SKIP_IN_FORM))
|
||||
(!Bt(doldoc.type_flags_form,doc_ce->type_u8) &&
|
||||
!(doc_ce->de_flags&DOCEF_LINK)||
|
||||
doc_ce->de_flags&DOCEF_SKIP_IN_FORM))
|
||||
doc_ce=doc_ce->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (doc_ce->de_flags&DOCEF_TAG) {
|
||||
doc->cur_data_col=x-doc_ce->x;
|
||||
doc->cur_col=x-doc_ce->x;
|
||||
if (IsEditableText(doc_ce)) {
|
||||
if (doc->cur_data_col>doc_ce->max_col)
|
||||
doc->cur_data_col=doc_ce->max_col;
|
||||
} else {
|
||||
if (doc->cur_data_col>=doc_ce->max_col)
|
||||
doc->cur_data_col=doc_ce->max_col-1;
|
||||
}
|
||||
if (doc->cur_data_col<doc_ce->min_col)
|
||||
doc->cur_data_col=doc_ce->min_col;
|
||||
if (doc->cur_col>doc_ce->max_col)
|
||||
doc->cur_col=doc_ce->max_col;
|
||||
} else if (doc->cur_col>=doc_ce->max_col)
|
||||
doc->cur_col=doc_ce->max_col-1;
|
||||
if (doc->cur_col<doc_ce->min_col)
|
||||
doc->cur_col=doc_ce->min_col;
|
||||
} else {
|
||||
if (doc_ce->type_u8==DOCT_HEX_ED) {
|
||||
doc->cur_data_col=RoundI64((doc_ce->len-1)*3,doc_ce->hex_ed_width*3);
|
||||
if (doc->cur_data_col<0)
|
||||
doc->cur_data_col=0;
|
||||
doc->cur_col=RoundI64((doc_ce->len-1)*3,doc_ce->hex_ed_width*3);
|
||||
if (doc->cur_col<0)
|
||||
doc->cur_col=0;
|
||||
} else
|
||||
doc->cur_data_col=doc_ce->min_col;
|
||||
doc->cur_col=doc_ce->min_col;
|
||||
}
|
||||
if (IsEditableText(doc_ce) && doc_ce->x<x) {
|
||||
if (doc->cur_data_col<doc_ce->max_col-1) {
|
||||
dst=doc_ce->tag+doc->cur_data_col;
|
||||
if (doc->cur_col<doc_ce->max_col-1) {
|
||||
dst=doc_ce->tag+doc->cur_col;
|
||||
doc_ne=DocEntryNew(doc,doc_ce,StrNew(dst,doc->mem_task));
|
||||
*dst=0;
|
||||
if (sc>=0) {
|
||||
@@ -262,16 +265,16 @@ public U0 EdLineUp(CDoc *doc,I64 sc=MIN_I64)
|
||||
else
|
||||
doc_ne->type=doc_ce->type & ~DOCET_SELECTED;
|
||||
}
|
||||
doc_ne->x=doc_ce->x+doc->cur_data_col;
|
||||
doc_ce->max_col=doc->cur_data_col;
|
||||
doc_ne->x=doc_ce->x+doc->cur_col;
|
||||
doc_ce->max_col=doc->cur_col;
|
||||
QueIns(doc_ne,doc_ce);
|
||||
doc_ce=doc_ne;
|
||||
doc->cur_data_col=doc_ce->min_col;
|
||||
doc->cur_col=doc_ce->min_col;
|
||||
}
|
||||
}
|
||||
doc->cur_entry=doc_ce;
|
||||
DocFormFwd(doc);
|
||||
doc->x=doc->cur_entry->x+doc->cur_data_col;
|
||||
doc->x=doc->cur_entry->x+doc->cur_col;
|
||||
if (unlock)
|
||||
DocUnlock(doc);
|
||||
}
|
||||
@@ -285,11 +288,11 @@ public U0 EdLineDown(CDoc *doc,I64 sc=MIN_I64)
|
||||
CDocEntry *doc_ce=doc->cur_entry,*doc_ne,*doc_ce2;
|
||||
if (sc!=MIN_I64) sc=sc.u32[0];
|
||||
if (doc_ce->type_u8==DOCT_HEX_ED) {
|
||||
doc->cur_data_col=doc->cur_data_col+doc_ce->hex_ed_width*3;
|
||||
if (doc->cur_data_col>=doc_ce->len*3) {
|
||||
doc->cur_col=doc->cur_col+doc_ce->hex_ed_width*3;
|
||||
if (doc->cur_col>=doc_ce->len*3) {
|
||||
doc->cur_entry=doc_ce=doc_ce->next;
|
||||
doc->cur_data_col=doc_ce->min_col;
|
||||
doc->x=doc_ce->x+doc->cur_data_col;
|
||||
doc->cur_col=doc_ce->min_col;
|
||||
doc->x=doc_ce->x+doc->cur_col;
|
||||
doc->y=doc_ce->y;
|
||||
}
|
||||
if (unlock)
|
||||
@@ -298,8 +301,8 @@ public U0 EdLineDown(CDoc *doc,I64 sc=MIN_I64)
|
||||
}
|
||||
x=doc->x; y=doc->y;
|
||||
if (IsEditableText(doc_ce)) {
|
||||
if (doc->cur_data_col>doc_ce->min_col && doc->cur_data_col<doc_ce->max_col-1) {
|
||||
dst=doc_ce->tag+doc->cur_data_col;
|
||||
if (doc->cur_col>doc_ce->min_col && doc->cur_col<doc_ce->max_col-1) {
|
||||
dst=doc_ce->tag+doc->cur_col;
|
||||
doc_ne=DocEntryNew(doc,doc_ce,StrNew(dst,doc->mem_task));
|
||||
*dst=0;
|
||||
if (sc>=0) {
|
||||
@@ -308,67 +311,68 @@ public U0 EdLineDown(CDoc *doc,I64 sc=MIN_I64)
|
||||
else
|
||||
doc_ne->type=doc_ce->type & ~DOCET_SELECTED;
|
||||
}
|
||||
doc_ne->x=doc_ce->x+doc->cur_data_col;
|
||||
doc_ce->max_col=doc->cur_data_col;
|
||||
doc_ne->x=doc_ce->x+doc->cur_col;
|
||||
doc_ce->max_col=doc->cur_col;
|
||||
QueIns(doc_ne,doc_ce);
|
||||
doc_ce=doc_ne;
|
||||
doc->cur_data_col=doc_ce->min_col;
|
||||
doc->cur_col=doc_ce->min_col;
|
||||
}
|
||||
}
|
||||
doc_ce2=doc_ce;
|
||||
while (doc_ce!=doc && (doc_ce->y<=y || doc_ce->de_flags & (DOCEF_SKIP|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP)))
|
||||
while (doc_ce!=doc && (doc_ce->y<=y ||
|
||||
doc_ce->de_flags & (DOCEF_SKIP|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP)))
|
||||
doc_ce=doc_ce->next;
|
||||
y=doc_ce->y;
|
||||
doc->y=y;
|
||||
while (doc_ce!=doc && (doc_ce->y<=y && doc_ce->x<=x || doc_ce->de_flags & (DOCEF_SKIP|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP))) {
|
||||
while (doc_ce!=doc && (doc_ce->y<=y && doc_ce->x<=x ||
|
||||
doc_ce->de_flags & (DOCEF_SKIP|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP))) {
|
||||
old_de_flags=doc_ce->de_flags;
|
||||
old_color=doc_ce->type;
|
||||
doc_ce=doc_ce->next;
|
||||
}
|
||||
if (doc_ce->last!=doc && (doc_ce->x>x || doc_ce->y>y)) {
|
||||
if (doc_ce->last!=doc && (doc_ce->x>x && doc_ce->last->y>=y || doc_ce->y>y)) {
|
||||
doc_ce=doc_ce->last;
|
||||
doc->cur_entry=doc_ce;
|
||||
if (!((doc_ce->type_u8==DOCT_NEW_LINE || doc_ce->type_u8==DOCT_SOFT_NEW_LINE || doc_ce->type_u8==DOCT_INDENT) &&
|
||||
(doc_ce->last->type_u8==DOCT_NEW_LINE || doc_ce->last->type_u8==DOCT_SOFT_NEW_LINE || doc_ce->last->type_u8==DOCT_INDENT)))
|
||||
if (!((doc_ce->type_u8==DOCT_NEW_LINE ||
|
||||
doc_ce->type_u8==DOCT_SOFT_NEW_LINE ||
|
||||
doc_ce->type_u8==DOCT_INDENT) &&
|
||||
(doc_ce->last->type_u8==DOCT_NEW_LINE ||
|
||||
doc_ce->last->type_u8==DOCT_SOFT_NEW_LINE ||
|
||||
doc_ce->last->type_u8==DOCT_INDENT)))
|
||||
DocFormBwd(doc);
|
||||
doc_ce=doc->cur_entry;
|
||||
}
|
||||
while (doc_ce2!=doc && (doc_ce2!=doc_ce || IsEditableText(doc_ce))) {
|
||||
if (doc_ce2->y<y || doc_ce2->x<x || doc_ce2->de_flags & (DOCEF_SKIP|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP) ||
|
||||
doc_ce2->x==x && !doc_ce2->max_col &&
|
||||
Bt(doldoc.type_flags_nontag_invisible,doc_ce2->type_u8)) {
|
||||
if (sc>=0)
|
||||
BEqu(&doc_ce2->type,DOCEt_SELECTED,sc&SCF_SHIFT);
|
||||
}
|
||||
if ((doc_ce2->y<y || doc_ce2->x<x ||
|
||||
doc_ce2->de_flags & (DOCEF_SKIP|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP) ||
|
||||
doc_ce2->x==x && !doc_ce2->max_col &&
|
||||
Bt(doldoc.type_flags_nontag_invisible,doc_ce2->type_u8)) && sc>=0)
|
||||
BEqu(&doc_ce2->type,DOCEt_SELECTED,sc&SCF_SHIFT);
|
||||
if (doc_ce2==doc_ce) break;
|
||||
doc_ce2=doc_ce2->next;
|
||||
}
|
||||
if (doc_ce->de_flags&DOCEF_TAG) {
|
||||
doc->cur_data_col=x-doc_ce->x;
|
||||
doc->cur_col=x-doc_ce->x;
|
||||
if (IsEditableText(doc_ce)) {
|
||||
if (doc->cur_data_col>doc_ce->max_col)
|
||||
doc->cur_data_col=doc_ce->max_col;
|
||||
} else {
|
||||
if (doc->cur_data_col>=doc_ce->max_col)
|
||||
doc->cur_data_col=doc_ce->max_col-1;
|
||||
}
|
||||
if (doc->cur_data_col<doc_ce->min_col)
|
||||
doc->cur_data_col=doc_ce->min_col;
|
||||
if (doc->cur_col>doc_ce->max_col)
|
||||
doc->cur_col=doc_ce->max_col;
|
||||
} else if (doc->cur_col>=doc_ce->max_col)
|
||||
doc->cur_col=doc_ce->max_col-1;
|
||||
if (doc->cur_col<doc_ce->min_col)
|
||||
doc->cur_col=doc_ce->min_col;
|
||||
} else
|
||||
doc->cur_data_col=doc_ce->min_col;
|
||||
if (IsEditableText(doc_ce)) {
|
||||
if (doc_ce->min_col<doc->cur_data_col<doc_ce->max_col-1) {
|
||||
dst=doc_ce->tag+doc->cur_data_col;
|
||||
doc_ne=DocEntryNew(doc,doc_ce,StrNew(dst,doc->mem_task));
|
||||
*dst=0;
|
||||
doc_ne->type=DOCT_TEXT | old_color & -0x100;
|
||||
doc_ne->de_flags=old_de_flags|doldoc.dft_de_flags[DOCT_TEXT];
|
||||
doc_ce->max_col=doc->cur_data_col;
|
||||
doc_ne->x=doc_ce->x+doc->cur_data_col;
|
||||
QueIns(doc_ne,doc_ce);
|
||||
doc_ce=doc_ne;
|
||||
doc->cur_data_col=doc_ce->min_col;
|
||||
}
|
||||
doc->cur_col=doc_ce->min_col;
|
||||
if (IsEditableText(doc_ce)&&doc_ce->min_col<doc->cur_col<doc_ce->max_col-1) {
|
||||
dst=doc_ce->tag+doc->cur_col;
|
||||
doc_ne=DocEntryNew(doc,doc_ce,StrNew(dst,doc->mem_task));
|
||||
*dst=0;
|
||||
doc_ne->type=DOCT_TEXT | old_color & -0x100;
|
||||
doc_ne->de_flags=old_de_flags|doldoc.dft_de_flags[DOCT_TEXT];
|
||||
doc_ce->max_col=doc->cur_col;
|
||||
doc_ne->x=doc_ce->x+doc->cur_col;
|
||||
QueIns(doc_ne,doc_ce);
|
||||
doc_ce=doc_ne;
|
||||
doc->cur_col=doc_ce->min_col;
|
||||
}
|
||||
doc->cur_entry=doc_ce;
|
||||
DocFormFwd(doc);
|
||||
@@ -378,7 +382,7 @@ public U0 EdLineDown(CDoc *doc,I64 sc=MIN_I64)
|
||||
BEqu(&doc_ce->type,DOCEt_SELECTED,sc&SCF_SHIFT);
|
||||
doc_ce=doc_ce->next;
|
||||
}
|
||||
doc->x=doc->cur_entry->x+doc->cur_data_col;
|
||||
doc->x=doc->cur_entry->x+doc->cur_col;
|
||||
if (unlock)
|
||||
DocUnlock(doc);
|
||||
}
|
||||
@@ -393,19 +397,19 @@ U0 EdDelChar(CDoc *doc)
|
||||
DocUnlock(doc);
|
||||
return;
|
||||
}
|
||||
if (doc_ce->max_col!=0 && (IsEditableText(doc_ce)||doc_ce->type_u8==DOCT_DATA)) {
|
||||
if (doc_ce->type_u8==DOCT_DATA) {
|
||||
if (doc_ce->de_flags & DOCEF_HAS_TERMINATOR && doc->cur_data_col==doc_ce->max_col-1) {
|
||||
if (unlock)
|
||||
DocUnlock(doc);
|
||||
return;
|
||||
}
|
||||
if (doc_ce->max_col!=0 &&
|
||||
(IsEditableText(doc_ce)||doc_ce->type_u8==DOCT_DATA)) {
|
||||
if (doc_ce->type_u8==DOCT_DATA && doc_ce->de_flags & DOCEF_HAS_TERMINATOR &&
|
||||
doc->cur_col==doc_ce->max_col-1) {
|
||||
if (unlock)
|
||||
DocUnlock(doc);
|
||||
return;
|
||||
}
|
||||
if (doc->cur_data_col<doc_ce->max_col)
|
||||
StrCpy(doc_ce->tag+doc->cur_data_col,doc_ce->tag+doc->cur_data_col+1);
|
||||
if (doc->cur_data_col>=doc_ce->max_col-1) {
|
||||
if (doc->cur_col<doc_ce->max_col)
|
||||
StrCpy(doc_ce->tag+doc->cur_col,doc_ce->tag+doc->cur_col+1);
|
||||
if (doc->cur_col>=doc_ce->max_col-1) {
|
||||
doc->cur_entry=doc_ce->next;
|
||||
doc->cur_data_col=doc->cur_entry->min_col;
|
||||
doc->cur_col=doc->cur_entry->min_col;
|
||||
}
|
||||
DocRemSoftNewLines(doc,doc->cur_entry);
|
||||
if (unlock)
|
||||
@@ -413,7 +417,7 @@ U0 EdDelChar(CDoc *doc)
|
||||
return;
|
||||
}
|
||||
doc->cur_entry=doc_ce->next;
|
||||
doc->cur_data_col=doc->cur_entry->min_col;
|
||||
doc->cur_col=doc->cur_entry->min_col;
|
||||
if (!(doc_ce->de_flags&DOCEF_FILTER_SKIP))
|
||||
DocEntryDel(doc,doc_ce);
|
||||
DocRemSoftNewLines(doc,doc->cur_entry);
|
||||
@@ -441,7 +445,7 @@ U0 EdInsChar(I64 ch,I64 sc,CDoc *doc)
|
||||
I64 i,j,m,y=doc_ce->y;
|
||||
|
||||
if (doc->flags & DOCF_IN_DOLLAR) {
|
||||
if (!Bt(chars_bitmap_getkey,ch))
|
||||
if (!Bt(chars_bmp_getkey,ch))
|
||||
goto ic_done;
|
||||
ChkDollarBufSize(doc);
|
||||
doc->dollar_buf[doc->dollar_buf_ptr++]=ch;
|
||||
@@ -460,22 +464,21 @@ U0 EdInsChar(I64 ch,I64 sc,CDoc *doc)
|
||||
} else
|
||||
goto ic_done;
|
||||
}
|
||||
if (ch=='$$') {
|
||||
if (!(doc->flags & (DOCF_PLAIN_TEXT | DOCF_PLAIN_TEXT_WITH_TABS))) {
|
||||
doc->flags|=DOCF_IN_DOLLAR;
|
||||
doc->dollar_buf_ptr=0;
|
||||
doc->dollar_buf[doc->dollar_buf_ptr++]=ch;
|
||||
goto ic_done;
|
||||
}
|
||||
if (ch=='$$' && !(doc->flags & (DOCF_PLAIN_TEXT|DOCF_PLAIN_TEXT_WITH_TABS))) {
|
||||
doc->flags|=DOCF_IN_DOLLAR;
|
||||
doc->dollar_buf_ptr=0;
|
||||
doc->dollar_buf[doc->dollar_buf_ptr++]=ch;
|
||||
goto ic_done;
|
||||
}
|
||||
if (ch=='\r') goto ic_done;
|
||||
|
||||
ic_cont:
|
||||
if ((ch==CH_SPACE || ch=='\n') &&
|
||||
!(sc & (SCF_CTRL|SCF_SHIFT)) &&
|
||||
doc_ce->de_flags & (DOCEF_LINK|DOCEF_TREE|DOCEF_LST|DOCEF_CHECK_COLLAPSABLE|
|
||||
DOCEF_LEFT_MACRO|DOCEF_LEFT_EXP|DOCEF_LEFT_CB|DOCEF_LEFT_AUTO |
|
||||
DOCEF_RIGHT_MACRO|DOCEF_RIGHT_EXP|DOCEF_RIGHT_CB|DOCEF_RIGHT_AUTO)) {
|
||||
!(sc & (SCF_CTRL|SCF_SHIFT)) &&
|
||||
doc_ce->de_flags &
|
||||
(DOCEF_LINK|DOCEF_TREE|DOCEF_LST|DOCEF_CHECK_COLLAPSABLE|
|
||||
DOCEF_LEFT_MACRO|DOCEF_LEFT_EXP|DOCEF_LEFT_CB|DOCEF_LEFT_AUTO |
|
||||
DOCEF_RIGHT_MACRO|DOCEF_RIGHT_EXP|DOCEF_RIGHT_CB|DOCEF_RIGHT_AUTO)) {
|
||||
doc->cmd_U8=ch;
|
||||
DocEntryRun(doc,doc_ce,FALSE);
|
||||
DocLock(doc);
|
||||
@@ -486,7 +489,7 @@ ic_cont:
|
||||
b=doc_ce->data;
|
||||
else
|
||||
b=&doc_ce->data;
|
||||
i=doc->cur_data_col;
|
||||
i=doc->cur_col;
|
||||
j=i%(doc_ce->hex_ed_width*3);
|
||||
m=i/(doc_ce->hex_ed_width*3)*doc_ce->hex_ed_width;
|
||||
if (j>=doc_ce->hex_ed_width<<1)
|
||||
@@ -504,38 +507,36 @@ ic_cont:
|
||||
else
|
||||
b[m]=b[m] & 0xF | ch<<4;
|
||||
}
|
||||
doc->cur_data_col++;
|
||||
doc->cur_col++;
|
||||
goto ic_done;
|
||||
}
|
||||
if (doc->flags & DOCF_OVERSTRIKE) {
|
||||
if (Bt(chars_bitmap_displayable,ch)) {
|
||||
if (Bt(chars_bmp_displayable,ch)) {
|
||||
ic_overstrike_char:
|
||||
if (IsEditableText(doc_ce)) {
|
||||
if (doc->cur_data_col<doc_ce->max_col) {
|
||||
if (doc_ce->tag[doc->cur_data_col]) {
|
||||
doc_ce->tag[doc->cur_data_col++]=ch;
|
||||
if (doc->cur_col<doc_ce->max_col) {
|
||||
if (doc_ce->tag[doc->cur_col]) {
|
||||
doc_ce->tag[doc->cur_col++]=ch;
|
||||
goto ic_done;
|
||||
}
|
||||
} else {
|
||||
doc_ce=doc_ce->next;
|
||||
doc->cur_entry=doc_ce;
|
||||
doc->cur_data_col=doc_ce->min_col;
|
||||
doc->cur_col=doc_ce->min_col;
|
||||
goto ic_overstrike_char;
|
||||
}
|
||||
} else if (doc_ce->type_u8==DOCT_DATA) {
|
||||
if (doc_ce->de_flags & DOCEF_HAS_TERMINATOR) {
|
||||
if (doc_ce->tag[doc->cur_data_col] &&
|
||||
doc->cur_data_col<doc_ce->min_col+doc_ce->len) {
|
||||
doc_ce->tag[doc->cur_data_col++]=ch;
|
||||
if ( ! doc_ce->tag[doc->cur_data_col]) {
|
||||
doc_ce->tag[doc->cur_data_col]='_';
|
||||
doc_ce->tag[doc->cur_data_col+1]=0;
|
||||
if (doc_ce->tag[doc->cur_col] &&
|
||||
doc->cur_col<doc_ce->min_col+doc_ce->len) {
|
||||
doc_ce->tag[doc->cur_col++]=ch;
|
||||
if ( ! doc_ce->tag[doc->cur_col]) {
|
||||
doc_ce->tag[doc->cur_col]='_';
|
||||
doc_ce->tag[doc->cur_col+1]=0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (doc_ce->tag[doc->cur_data_col])
|
||||
doc_ce->tag[doc->cur_data_col++]=ch;
|
||||
}
|
||||
} else if (doc_ce->tag[doc->cur_col])
|
||||
doc_ce->tag[doc->cur_col++]=ch;
|
||||
goto ic_done;
|
||||
}
|
||||
b=MAlloc(2,doc->mem_task);
|
||||
@@ -548,7 +549,7 @@ ic_overstrike_char:
|
||||
} else if (ch=='\n') {
|
||||
while (doc->cur_entry->next!=doc && doc->cur_entry->y==y)
|
||||
doc->cur_entry=doc->cur_entry->next;
|
||||
doc->cur_data_col=doc->cur_entry->min_col;
|
||||
doc->cur_col=doc->cur_entry->min_col;
|
||||
} else if (ch=='\t') {
|
||||
if (doc->flags&DOCF_FORM)
|
||||
goto ic_form_tab;
|
||||
@@ -567,12 +568,12 @@ ic_overstrike_char:
|
||||
DocInsEntry(doc,doc_ne);
|
||||
} else if (ch=='\t') {
|
||||
if (doc->flags&DOCF_FORM &&
|
||||
(Bt(doldoc.type_flags_form,doc->cur_entry->type_u8) ||
|
||||
doc->cur_entry->de_flags&DOCEF_LINK) &&
|
||||
!(doc->cur_entry->de_flags&DOCEF_SKIP_IN_FORM)) {
|
||||
(Bt(doldoc.type_flags_form,doc->cur_entry->type_u8) ||
|
||||
doc->cur_entry->de_flags&DOCEF_LINK) &&
|
||||
!(doc->cur_entry->de_flags&DOCEF_SKIP_IN_FORM)) {
|
||||
ic_form_tab:
|
||||
doc->cur_entry=doc->cur_entry->next;
|
||||
doc->cur_data_col=doc->cur_entry->min_col;
|
||||
doc->cur_col=doc->cur_entry->min_col;
|
||||
DocFormFwd(doc);
|
||||
goto ic_done;
|
||||
} else {
|
||||
@@ -582,7 +583,7 @@ ic_form_tab:
|
||||
DocInsEntry(doc,doc_ne);
|
||||
}
|
||||
} else {
|
||||
if (Bt(chars_bitmap_displayable,ch)) {
|
||||
if (Bt(chars_bmp_displayable,ch)) {
|
||||
if (doc_ce->type_u8==DOCT_DATA) {
|
||||
i=doc_ce->len+doc_ce->min_col;
|
||||
if (doc_ce->de_flags & DOCEF_HAS_TERMINATOR)
|
||||
@@ -590,14 +591,14 @@ ic_form_tab:
|
||||
if (i>doc_ce->max_col) {
|
||||
b=doc_ce->tag;
|
||||
doc_ce->max_col++;
|
||||
for (i=doc_ce->max_col;i>doc->cur_data_col;i--)
|
||||
for (i=doc_ce->max_col;i>doc->cur_col;i--)
|
||||
b[i]=b[i-1];
|
||||
b[doc->cur_data_col++]=ch;
|
||||
b[doc->cur_col++]=ch;
|
||||
}
|
||||
} else if (IsEditableText(doc_ce)) {
|
||||
dst=b=MAlloc(doc_ce->max_col+2,doc->mem_task);
|
||||
src=doc_ce->tag;
|
||||
i=doc->cur_data_col;
|
||||
i=doc->cur_col;
|
||||
while (i-->0)
|
||||
*dst++=*src++;
|
||||
*dst++=ch;
|
||||
@@ -605,7 +606,7 @@ ic_form_tab:
|
||||
Free(doc_ce->tag);
|
||||
doc_ce->tag=b;
|
||||
doc_ce->max_col++;
|
||||
doc->cur_data_col++;
|
||||
doc->cur_col++;
|
||||
} else {
|
||||
b=MAlloc(2,doc->mem_task);
|
||||
*b=ch;
|
||||
@@ -620,11 +621,10 @@ ic_form_tab:
|
||||
}
|
||||
ic_done:
|
||||
DocRemSoftNewLines(doc,doc->cur_entry);
|
||||
if (doc->cur_entry->de_flags & DOCEF_UPDATE_DATA) {
|
||||
if (doc->cur_entry->type_u8==DOCT_DATA ||
|
||||
doc->cur_entry->type_u8==DOCT_CHECK_BOX)
|
||||
if (doc->cur_entry->de_flags & DOCEF_UPDATE_DATA &&
|
||||
(doc->cur_entry->type_u8==DOCT_DATA ||
|
||||
doc->cur_entry->type_u8==DOCT_CHECK_BOX))
|
||||
DocDataScan(doc,doc->cur_entry);
|
||||
}
|
||||
if (unlock)
|
||||
DocUnlock(doc);
|
||||
}
|
||||
@@ -637,7 +637,7 @@ U0 EdDelLine(CDoc *doc)
|
||||
while (doc_ce!=doc && doc_ce->y==y)
|
||||
doc_ce=doc_ce->next;
|
||||
doc->cur_entry=doc_ce;
|
||||
doc->cur_data_col=doc_ce->min_col;
|
||||
doc->cur_col=doc_ce->min_col;
|
||||
doc_ce=doc_ce->last;
|
||||
while (doc_ce!=doc && doc_ce->y==y) {
|
||||
doc_ce2=doc_ce->last;
|
||||
@@ -653,10 +653,12 @@ U0 DocEntryToggle(CDoc *doc)
|
||||
CDocEntry *doc_ce=doc->cur_entry,*cl1,*doc_ce2;
|
||||
U8 ch,*st,*st2;
|
||||
I64 i,j,k;
|
||||
if (doc_ce!=doc && !(doc->flags&(DOCF_PLAIN_TEXT|DOCF_PLAIN_TEXT_WITH_TABS))) {
|
||||
if (doc_ce->type_u8==DOCT_TEXT &&
|
||||
!(doc_ce->de_flags & ~(DOCEF_TAG|DOCG_BL_IV_UL|DOCEF_WORD_WRAP|DOCEF_HIGHLIGHT|DOCEF_SKIP|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP)) &&
|
||||
!(doc_ce->type&DOCG_BL_IV_UL)) {
|
||||
if (doc_ce!=doc &&
|
||||
!(doc->flags&(DOCF_PLAIN_TEXT|DOCF_PLAIN_TEXT_WITH_TABS))) {
|
||||
if (doc_ce->type_u8==DOCT_TEXT && !(doc_ce->de_flags &
|
||||
~(DOCEF_TAG|DOCG_BL_IV_UL|DOCEF_WORD_WRAP|DOCEF_HIGHLIGHT|
|
||||
DOCEF_SKIP|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP)) &&
|
||||
!(doc_ce->type&DOCG_BL_IV_UL)) {
|
||||
doc_ce2=doc_ce->last;
|
||||
for (k=0;k<20;k++) {
|
||||
if (doc_ce2!=doc) {
|
||||
@@ -672,7 +674,7 @@ U0 DocEntryToggle(CDoc *doc)
|
||||
Free(doc_ce->tag);
|
||||
doc_ce->tag=st;
|
||||
doc_ce->max_col=i+j;
|
||||
doc->cur_data_col+=i;
|
||||
doc->cur_col+=i;
|
||||
DocEntryDel(doc,doc_ce2);
|
||||
} else if (doc_ce2->type_u8==DOCT_SOFT_NEW_LINE)
|
||||
DocEntryDel(doc,doc_ce2);
|
||||
@@ -706,24 +708,24 @@ U0 DocEntryToggle(CDoc *doc)
|
||||
} else
|
||||
break;
|
||||
}
|
||||
i=doc->cur_data_col;
|
||||
i=doc->cur_col;
|
||||
while (i>doc_ce->min_col && doc_ce->tag[i]!='$$')
|
||||
i--;
|
||||
j=doc->cur_data_col+1;
|
||||
j=doc->cur_col+1;
|
||||
while (j<doc_ce->max_col && doc_ce->tag[j]!='$$')
|
||||
j++;
|
||||
if (i<j-1 && doc_ce->min_col<=i<j<doc_ce->max_col &&
|
||||
doc_ce->tag[i]=='$$' && doc_ce->tag[j]=='$$') {
|
||||
doc_ce->tag[i]=='$$' && doc_ce->tag[j]=='$$') {
|
||||
ch=doc_ce->tag[j+1];
|
||||
doc_ce->tag[j+1]=0;
|
||||
st=StrNew(doc_ce->tag+i);
|
||||
doc_ce->tag[j+1]=ch;
|
||||
StrCpy(doc_ce->tag+i,doc_ce->tag+j+1);
|
||||
doc->cur_data_col=i;
|
||||
doc->cur_col=i;
|
||||
st2=MStrPrint("%q",st);
|
||||
if (doc_ce=DocPrint(doc,st2)) {
|
||||
doc->cur_entry=doc_ce;
|
||||
doc->cur_data_col=doc_ce->min_col;
|
||||
doc->cur_col=doc_ce->min_col;
|
||||
}
|
||||
Free(st);
|
||||
Free(st2);
|
||||
|
||||
+42
-34
@@ -1,4 +1,4 @@
|
||||
#help_index "DolDoc/Output"
|
||||
#help_index "DolDoc/Output;StdOut/DolDoc"
|
||||
|
||||
public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
{//$LK,"PutKey",A="MN:PutKey"$(ch,sc) at doc insert pt, cur_entry.
|
||||
@@ -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_bitmap_getkey,ch) &&
|
||||
if (Bt(chars_bmp_getkey,ch) &&
|
||||
!(sc&(SCF_CTRL|SCF_ALT))) {
|
||||
if (sc&SCF_KEY_DESC) {
|
||||
st=Char2KeyName(ch,FALSE);
|
||||
@@ -39,7 +39,8 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
if (sc&SCF_KEY_DESC)
|
||||
KeyDescSet("Win/Toggle Border");
|
||||
else
|
||||
WinBorder(Bt(&doc->win_task->display_flags,DISPLAYf_NO_BORDER),doc->win_task);
|
||||
WinBorder(Bt(&doc->win_task->display_flags,
|
||||
DISPLAYf_NO_BORDER),doc->win_task);
|
||||
break;
|
||||
case CH_CTRLC:
|
||||
if (sc&SCF_KEY_DESC)
|
||||
@@ -61,7 +62,7 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
if (sc&SCF_KEY_DESC)
|
||||
KeyDescSet("Cmd/Find Wizard");
|
||||
else
|
||||
GrepWiz;
|
||||
FindWiz;
|
||||
} else {
|
||||
if (sc&SCF_KEY_DESC)
|
||||
KeyDescSet("Edit/Find & Replace");
|
||||
@@ -87,21 +88,21 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
else {
|
||||
DocCaptureUndo(doc);
|
||||
doc_ce=doc->cur_entry;
|
||||
if (doc->cur_data_col<=doc_ce->min_col) {
|
||||
if (doc->cur_col<=doc_ce->min_col) {
|
||||
doc_ce=doc->cur_entry=doc_ce->last;
|
||||
if (doc_ce!=doc && doc_ce->type_u8==DOCT_SOFT_NEW_LINE)
|
||||
doc_ce=doc->cur_entry=doc_ce->last;
|
||||
if (doc_ce==doc || doc_ce->type_u8==DOCT_PMT) {
|
||||
doc_ce=doc->cur_entry=doc_ce->next;
|
||||
doc->cur_data_col=doc_ce->min_col;
|
||||
doc->cur_col=doc_ce->min_col;
|
||||
} else {
|
||||
doc->cur_data_col=doc_ce->max_col;
|
||||
if (doc->cur_data_col>doc_ce->min_col)
|
||||
doc->cur_data_col--;
|
||||
doc->cur_col=doc_ce->max_col;
|
||||
if (doc->cur_col>doc_ce->min_col)
|
||||
doc->cur_col--;
|
||||
EdDelChar(doc);
|
||||
}
|
||||
} else {
|
||||
doc->cur_data_col--;
|
||||
doc->cur_col--;
|
||||
EdDelChar(doc);
|
||||
}
|
||||
}
|
||||
@@ -164,7 +165,7 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
Ed("::/Home/PersonalNotes.TXT.Z");
|
||||
else {
|
||||
m=DocRead("::/Home/PersonalMenu.TXT.Z");
|
||||
DocMenuDo(m);
|
||||
DocMenu(m);
|
||||
DocDel(m);
|
||||
}
|
||||
}
|
||||
@@ -217,11 +218,11 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
if (doc_ce->type_u8==DOCT_SPRITE)
|
||||
EdSpriteEd(doc,
|
||||
(doc_ce->x-doc->line_start_col+doc_ce->max_col)*FONT_WIDTH,
|
||||
(doc_ce->y-doc->cur_top_line_num)*FONT_HEIGHT);
|
||||
(doc_ce->y-doc->top_line_num)*FONT_HEIGHT);
|
||||
else
|
||||
EdSpriteIns(doc,
|
||||
(doc_ce->x+doc->cur_data_col-doc->line_start_col)*FONT_WIDTH,
|
||||
(doc_ce->y-doc->cur_top_line_num)*FONT_HEIGHT);
|
||||
(doc_ce->x+doc->cur_col-doc->line_start_col)*FONT_WIDTH,
|
||||
(doc_ce->y-doc->top_line_num)*FONT_HEIGHT);
|
||||
DocLock(doc);
|
||||
}
|
||||
}
|
||||
@@ -249,7 +250,8 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
if (sc&SCF_KEY_DESC)
|
||||
KeyDescSet("Edit/Toggle Plain Text Display");
|
||||
else
|
||||
if (!(doc->flags&DOCF_FORM) || doc->flags&(DOCF_PLAIN_TEXT|DOCF_PLAIN_TEXT_WITH_TABS))
|
||||
if (!(doc->flags&DOCF_FORM) ||
|
||||
doc->flags&(DOCF_PLAIN_TEXT|DOCF_PLAIN_TEXT_WITH_TABS))
|
||||
DocFlagsToggle(doc,DOCF_PLAIN_TEXT);
|
||||
}
|
||||
break;
|
||||
@@ -404,7 +406,8 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
DocUnlock(doc);
|
||||
if (sc&SCF_SHIFT) {
|
||||
if (TaskValidate(sys_macro_util_task))
|
||||
SendMsg(sys_macro_util_task,MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);
|
||||
PostMsgWait(sys_macro_util_task,
|
||||
MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);
|
||||
SysMacroStripKey(&sys_macro_root,ch,sc);
|
||||
PlaySysMacro;
|
||||
} else
|
||||
@@ -479,10 +482,12 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
else
|
||||
KeyDescSet("God Song");
|
||||
} else {
|
||||
//$LK,"::/Adam/God/HSNotes.TXT"$
|
||||
if (sc & SCF_SHIFT)
|
||||
//$LK,"::/Adam/God/HSNotes.TXT"$
|
||||
if (sc & SCF_SHIFT) {
|
||||
DocUnlock(doc);
|
||||
GodDoodle;
|
||||
else
|
||||
DocLock(doc);
|
||||
} else
|
||||
GodSong;
|
||||
}
|
||||
break;
|
||||
@@ -493,7 +498,7 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
else
|
||||
KeyDescSet("God Word");
|
||||
} else {
|
||||
//$LK,"::/Adam/God/HSNotes.TXT"$
|
||||
//$LK,"::/Adam/God/HSNotes.TXT"$
|
||||
FifoU8Flush(god.fifo);
|
||||
GodBitsIns(GOD_GOOD_BITS,KbdMouseEvtTime>>GOD_BAD_BITS);
|
||||
if (sc & SCF_SHIFT)
|
||||
@@ -519,7 +524,7 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
BEqu(&doc_ce->type,DOCEt_SELECTED,sc&SCF_SHIFT);
|
||||
doc_ce=doc->cur_entry=doc_ce->next;
|
||||
}
|
||||
doc->cur_data_col=doc_ce->min_col;
|
||||
doc->cur_col=doc_ce->min_col;
|
||||
DocFormBwd(doc);
|
||||
}
|
||||
} else if (sc&SCF_KEY_DESC) {
|
||||
@@ -545,7 +550,7 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
doc_ce=doc->cur_entry=doc_ce->last;
|
||||
}
|
||||
doc_ce=doc->cur_entry=doc->root.next;
|
||||
doc->cur_data_col=doc_ce->min_col;
|
||||
doc->cur_col=doc_ce->min_col;
|
||||
DocFormFwd(doc);
|
||||
}
|
||||
} else if (sc&SCF_KEY_DESC) {
|
||||
@@ -565,10 +570,11 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
} else {
|
||||
i=doc_ce->y+doc->win_task->win_height-1;
|
||||
if (doc_ce->type_u8==DOCT_HEX_ED)
|
||||
i+=doc->cur_data_col/3/doc_ce->hex_ed_width;
|
||||
i+=doc->cur_col/3/doc_ce->hex_ed_width;
|
||||
while (doc_ce!=doc &&
|
||||
(doc_ce->type_u8!=DOCT_HEX_ED && doc_ce->y<i ||
|
||||
doc_ce->type_u8==DOCT_HEX_ED && doc_ce->y+doc->cur_data_col/3/doc_ce->hex_ed_width<i)) {
|
||||
doc_ce->type_u8==DOCT_HEX_ED &&
|
||||
doc_ce->y+doc->cur_col/3/doc_ce->hex_ed_width<i)) {
|
||||
EdLineDown(doc,sc);
|
||||
//paranoid check for stuck on same node
|
||||
if (doc->cur_entry==doc_ce && doc_ce->type_u8!=DOCT_HEX_ED)
|
||||
@@ -586,10 +592,11 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
}else {
|
||||
i=doc_ce->y-(doc->win_task->win_height-1);
|
||||
if (doc_ce->type_u8==DOCT_HEX_ED)
|
||||
i+=doc->cur_data_col/3/doc_ce->hex_ed_width;
|
||||
i+=doc->cur_col/3/doc_ce->hex_ed_width;
|
||||
while (doc_ce->last!=doc &&
|
||||
(doc_ce->type_u8!=DOCT_HEX_ED && doc_ce->y>i ||
|
||||
doc_ce->type_u8==DOCT_HEX_ED && doc_ce->y+doc->cur_data_col/3/doc_ce->hex_ed_width>i) &&
|
||||
doc_ce->type_u8==DOCT_HEX_ED &&
|
||||
doc_ce->y+doc->cur_col/3/doc_ce->hex_ed_width>i) &&
|
||||
doc_ce->y!=doc->root.next->y) {
|
||||
EdLineUp(doc,sc);
|
||||
//paranoid check for stuck on same node
|
||||
@@ -693,15 +700,15 @@ public U0 DocPrintPartial(CDoc *doc,U8 *fmt,...)
|
||||
DocPutKey(doc,ch,0);
|
||||
else
|
||||
while (ch=*ptr) {
|
||||
if (!Bt(chars_bitmap_safe_dollar,ch) ||
|
||||
doc->flags & (DOCF_OVERSTRIKE | DOCF_IN_DOLLAR)) {
|
||||
if (!Bt(chars_bmp_safe_dollar,ch) ||
|
||||
doc->flags & (DOCF_OVERSTRIKE | DOCF_IN_DOLLAR)) {
|
||||
DocPutKey(doc,ch,0);
|
||||
ptr++;
|
||||
} else {
|
||||
ptr2=ptr++;
|
||||
while (TRUE) {
|
||||
ch=*ptr++;
|
||||
if (!Bt(chars_bitmap_safe_dollar,ch))
|
||||
if (!Bt(chars_bmp_safe_dollar,ch))
|
||||
break;
|
||||
}
|
||||
ptr--;
|
||||
@@ -711,8 +718,8 @@ public U0 DocPrintPartial(CDoc *doc,U8 *fmt,...)
|
||||
if (IsEditableText(doc_ce)) {
|
||||
dst=b=MAlloc(doc_ce->max_col+j+1,doc->mem_task);
|
||||
src=doc_ce->tag;
|
||||
i=doc->cur_data_col;
|
||||
doc->cur_data_col+=j;
|
||||
i=doc->cur_col;
|
||||
doc->cur_col+=j;
|
||||
doc_ce->max_col+=j;
|
||||
while (i-->0)
|
||||
*dst++=*src++;
|
||||
@@ -729,7 +736,7 @@ public U0 DocPrintPartial(CDoc *doc,U8 *fmt,...)
|
||||
doc_ne->de_flags=doldoc.dft_de_flags[DOCT_TEXT];
|
||||
QueIns(doc_ne,doc_ce->last);
|
||||
doc->cur_entry=doc_ne;
|
||||
doc->cur_data_col=StrLen(ptr2);
|
||||
doc->cur_col=StrLen(ptr2);
|
||||
}
|
||||
*ptr=ch;
|
||||
DocRemSoftNewLines(doc,doc->cur_entry);
|
||||
@@ -837,7 +844,7 @@ Bool DocFileEd(I64 _type,U8 *filename,
|
||||
|
||||
if (edf_dof_flags&EDF_WAS_WRITE)
|
||||
result=FALSE;
|
||||
if (!(edf_dof_flags&EDF_BAIL) && DocDo(doc,edf_dof_flags|DOF_DONT_HOME)) {
|
||||
if (!(edf_dof_flags&EDF_BAIL) && DocEd(doc,edf_dof_flags|DOF_DONT_HOME)) {
|
||||
DocLock(doc);
|
||||
doc_e=doc->cur_entry;
|
||||
if (doc_e!=doc)
|
||||
@@ -879,7 +886,8 @@ public I64 EdLinkCvt(U8 *link_st,U8 **_filename=NULL,U8 **_needle_str=NULL,
|
||||
switch (result=DefineMatch(st,"ST_LINK_TYPES",LMF_IGNORE_CASE)) {
|
||||
case LK_MAN_PAGE:
|
||||
if (temph=HashFind(filename2,Fs->hash_table,HTG_SRC_SYM))
|
||||
result=EdLinkCvt(temph->src_link,&filename,&needle_str,&num,edf_dof_flags);
|
||||
result=EdLinkCvt(temph->src_link,&filename,
|
||||
&needle_str,&num,edf_dof_flags);
|
||||
else
|
||||
result=-1;
|
||||
goto lc_done;
|
||||
|
||||
+37
-30
@@ -81,11 +81,12 @@ public U8 *DocSave(CDoc *doc,I64 *_size=NULL)
|
||||
cnt++;
|
||||
break;
|
||||
case DOCT_TEXT://$BK,1$Update $LK,"DOCT_TEXT",A="FF:D:/Compiler/Lex.CPP,DOCT_TEXT"$$BK,0$
|
||||
if (!(doc_e->de_flags & ~(DOCEF_TAG|DOCG_BL_IV_UL|DOCEF_WORD_WRAP|DOCEF_HIGHLIGHT|DOCEF_SKIP|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP)) &&
|
||||
!(doc_e->type&DOCG_BL_IV_UL)) {
|
||||
if (!(doc_e->de_flags & ~(DOCEF_TAG|DOCG_BL_IV_UL|DOCEF_WORD_WRAP|
|
||||
DOCEF_HIGHLIGHT|DOCEF_SKIP|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP))&&
|
||||
!(doc_e->type&DOCG_BL_IV_UL)) {
|
||||
cnt+=StrLen(doc_e->tag);
|
||||
if (!(doc->flags & (DOCF_PLAIN_TEXT | DOCF_PLAIN_TEXT_WITH_TABS)) ||
|
||||
doc->flags&DOCF_DBL_DOLLARS)
|
||||
doc->flags&DOCF_DBL_DOLLARS)
|
||||
cnt+=StrOcc(doc_e->tag,'$$');
|
||||
} else {
|
||||
st=Doc2PlainText(doc,doc_e);
|
||||
@@ -95,39 +96,42 @@ public U8 *DocSave(CDoc *doc,I64 *_size=NULL)
|
||||
break;
|
||||
default:
|
||||
if (doc_e->type_u8!=DOCT_SOFT_NEW_LINE &&
|
||||
doc_e->type_u8!=DOCT_CURSOR) {
|
||||
doc_e->type_u8!=DOCT_CURSOR) {
|
||||
st=Doc2PlainText(doc,doc_e);
|
||||
cnt+=StrLen(st)+2;
|
||||
Free(st);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (b=doc->bin_root.next;b!=&doc->bin_root;b=b->next) {
|
||||
if (b->use_cnt>b->temp_use_cnt)
|
||||
cnt+=offset(CDocBin.end)-
|
||||
offset(CDocBin.start)+b->size;
|
||||
offset(CDocBin.start)+b->size;
|
||||
}
|
||||
result=MAlloc(cnt);
|
||||
dst=result;
|
||||
for (doc_e=doc->root.next;doc_e!=doc;doc_e=doc_e->next) {
|
||||
if (!Bt(doldoc.type_flags_data,doc_e->type_u8)) {
|
||||
if (doc_e->type_u8==DOCT_TEXT &&
|
||||
!(doc_e->de_flags & ~(DOCEF_TAG|DOCG_BL_IV_UL|DOCEF_WORD_WRAP|DOCEF_HIGHLIGHT|DOCEF_SKIP|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP)) &&
|
||||
!(doc_e->type&DOCG_BL_IV_UL)) {
|
||||
!(doc_e->de_flags & ~(DOCEF_TAG|DOCG_BL_IV_UL|DOCEF_WORD_WRAP|
|
||||
DOCEF_HIGHLIGHT|DOCEF_SKIP|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP)) &&
|
||||
!(doc_e->type&DOCG_BL_IV_UL)) {
|
||||
src=doc_e->tag;
|
||||
i=0;
|
||||
while (ch=*src++) {
|
||||
if (doc_e==doc->cur_entry && i++==doc->cur_data_col && !(doc->flags&DOCF_NO_CURSOR))
|
||||
if (doc_e==doc->cur_entry && i++==doc->cur_col &&
|
||||
!(doc->flags&DOCF_NO_CURSOR))
|
||||
*dst++=CH_CURSOR;
|
||||
*dst++=ch;
|
||||
if (ch=='$$') {
|
||||
if (!(doc->flags & (DOCF_PLAIN_TEXT | DOCF_PLAIN_TEXT_WITH_TABS)) ||
|
||||
doc->flags&DOCF_DBL_DOLLARS)
|
||||
doc->flags&DOCF_DBL_DOLLARS)
|
||||
*dst++=ch;
|
||||
}
|
||||
}
|
||||
if (doc_e==doc->cur_entry && i++==doc->cur_data_col && !(doc->flags&DOCF_NO_CURSOR))
|
||||
if (doc_e==doc->cur_entry && i++==doc->cur_col &&
|
||||
!(doc->flags&DOCF_NO_CURSOR))
|
||||
*dst++=CH_CURSOR;
|
||||
} else {
|
||||
if (doc_e==doc->cur_entry && !(doc->flags&DOCF_NO_CURSOR))
|
||||
@@ -146,7 +150,7 @@ public U8 *DocSave(CDoc *doc,I64 *_size=NULL)
|
||||
break;
|
||||
default:
|
||||
if (doc_e->type_u8!=DOCT_SOFT_NEW_LINE &&
|
||||
doc_e->type_u8!=DOCT_CURSOR) {//(Cursor is set by cur_entry)
|
||||
doc_e->type_u8!=DOCT_CURSOR) {//(Cursor is set by cur_entry)
|
||||
*dst++='$$';
|
||||
st=Doc2PlainText(doc,doc_e);
|
||||
StrCpy(dst,st);
|
||||
@@ -158,7 +162,8 @@ public U8 *DocSave(CDoc *doc,I64 *_size=NULL)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (doc->cur_entry==doc && doc->root.next!=doc && !(doc->flags&DOCF_NO_CURSOR))
|
||||
if (doc->cur_entry==doc && doc->root.next!=doc &&
|
||||
!(doc->flags&DOCF_NO_CURSOR))
|
||||
*dst++=CH_CURSOR;
|
||||
*dst++=0;
|
||||
if (*result==CH_CURSOR) {
|
||||
@@ -189,7 +194,7 @@ public Bool DocWrite(CDoc *doc,Bool prompt=FALSE)
|
||||
{//Store doc to disk.
|
||||
I64 size;
|
||||
U8 *buf;
|
||||
if (prompt && !DocFormDo(&doc->filename) ||
|
||||
if (prompt && !DocForm(&doc->filename) ||
|
||||
doc->filename.name[0]=='A' && doc->filename.name[2]==':')
|
||||
return FALSE; //CANCEL || LK_DOC,LK_DOC_ANCHOR,LK_DOC_FIND,LK_DOC_LINE?
|
||||
buf=DocSave(doc,&size);
|
||||
@@ -207,18 +212,18 @@ public U0 DocInsDoc(CDoc *doc=NULL,CDoc *doc2)
|
||||
CDocEntry *doc_ne,*doc_e=doc2->root.next,*doc_ce;
|
||||
if (!doc) doc=DocPut;
|
||||
unlock_doc=DocLock(doc),
|
||||
DocRemSoftNewLines(doc,NULL);
|
||||
DocRemSoftNewLines(doc,NULL);
|
||||
doc_ce=doc->cur_entry;
|
||||
if (doc_ce->type_u8==DOCT_TEXT && doc->cur_data_col>doc_ce->min_col) {
|
||||
if (doc->cur_data_col<doc_ce->max_col) {
|
||||
dst=doc_ce->tag+doc->cur_data_col;
|
||||
if (doc_ce->type_u8==DOCT_TEXT && doc->cur_col>doc_ce->min_col) {
|
||||
if (doc->cur_col<doc_ce->max_col) {
|
||||
dst=doc_ce->tag+doc->cur_col;
|
||||
doc_ne=DocEntryNew(doc,doc_ce,StrNew(dst,doc->mem_task));
|
||||
*dst=0;
|
||||
doc_ne->type=DOCT_TEXT | doc_ce->type & 0xFFFFFF00;
|
||||
doc_ce->max_col=doc->cur_data_col;
|
||||
doc_ce->max_col=doc->cur_col;
|
||||
QueIns(doc_ne,doc_ce);
|
||||
doc->cur_entry=doc_ne;
|
||||
doc->cur_data_col=doc_ne->min_col;
|
||||
doc->cur_col=doc_ne->min_col;
|
||||
} else
|
||||
if (doc_ce!=doc)
|
||||
doc->cur_entry=doc_ce->next;
|
||||
@@ -247,7 +252,7 @@ public U0 EdCopyToClipboard(CDoc *doc)
|
||||
{//Copy $LK,"DOCET_SELECTED",A="MN:DOCET_SELECTED"$ flagged entries to clipboard.
|
||||
CDoc *doc2=sys_clipboard_doc;
|
||||
Bool unlock_doc=DocLock(doc),
|
||||
unlock_doc2=DocLock(doc2);
|
||||
unlock_doc2=DocLock(doc2);
|
||||
CDocEntry *doc_e=doc->root.next,*doc_ne;
|
||||
ClipboardDel;
|
||||
while (doc_e!=doc) {
|
||||
@@ -270,7 +275,7 @@ public U0 EdCutToClipboard(CDoc *doc)
|
||||
{//Remove selected entries and place on clipboard.
|
||||
CDoc *doc2=sys_clipboard_doc;
|
||||
Bool unlock_doc=DocLock(doc),
|
||||
unlock_doc2=DocLock(doc2);
|
||||
unlock_doc2=DocLock(doc2);
|
||||
CDocEntry *doc_e=doc->root.next,*doc_e1,*doc_ne,*doc_e2=NULL;
|
||||
ClipboardDel;
|
||||
while (doc_e!=doc) {
|
||||
@@ -289,7 +294,7 @@ public U0 EdCutToClipboard(CDoc *doc)
|
||||
}
|
||||
if (doc_e2) {
|
||||
doc->cur_entry=doc_e2;
|
||||
doc->cur_data_col=doc_e2->min_col;
|
||||
doc->cur_col=doc_e2->min_col;
|
||||
}
|
||||
DocRemSoftNewLines(doc,NULL);
|
||||
if (unlock_doc2)
|
||||
@@ -302,7 +307,7 @@ public U0 EdPasteClipboard(CDoc *doc)
|
||||
{//Insert copy of clipboard at insert pt, cur_entry.
|
||||
CDoc *doc2=sys_clipboard_doc;
|
||||
Bool unlock_doc=DocLock(doc),
|
||||
unlock_doc2=DocLock(doc2);
|
||||
unlock_doc2=DocLock(doc2);
|
||||
CDocEntry *doc_ce=doc->cur_entry,*doc_e;
|
||||
if (doc_ce->type_u8==DOCT_DATA) {
|
||||
doc_e=doc2->root.next;
|
||||
@@ -327,7 +332,7 @@ public U0 DocCut(CDoc *doc,CDocEntry *start,CDocEntry *end)
|
||||
doc_e1=start->next;
|
||||
if (start==doc->cur_entry) {
|
||||
doc->cur_entry=start->next;
|
||||
doc->cur_data_col=doc->cur_entry->min_col;
|
||||
doc->cur_col=doc->cur_entry->min_col;
|
||||
}
|
||||
DocEntryDel(doc,start);
|
||||
if (start==end)
|
||||
@@ -389,7 +394,8 @@ Bool DocCaptureUndo(CDoc *doc,Bool force=FALSE)
|
||||
unlock=DocLock(doc);
|
||||
time_stamp=GetTSC;
|
||||
if (doc->flags&DOCF_UNDO_DIRTY &&
|
||||
time_stamp>doc->undo_root.last->time_stamp+cnts.time_stamp_freq<<4 || force) {
|
||||
time_stamp>doc->undo_root.last->time_stamp+cnts.time_stamp_freq<<4 ||
|
||||
force) {
|
||||
u=CAlloc(sizeof(CDocUndo),doc->mem_task);
|
||||
u->time_stamp=time_stamp;
|
||||
u->body=DocSave(doc,&u->size);
|
||||
@@ -427,8 +433,8 @@ U0 DocUndoRestore(CDoc *doc)
|
||||
DocUnlock(doc);
|
||||
}
|
||||
|
||||
#help_index "Graphics/Windows BMP Files;Graphics/GRA Files;DolDoc/Output"
|
||||
|
||||
#help_index "Graphics/Windows BMP Files;Graphics/GRA Files;"\
|
||||
"DolDoc/Output;StdOut/DolDoc"
|
||||
public Bool DocType(CDoc *doc=NULL,U8 *filename,I64 trailing_new_lines=1)
|
||||
{//Output txt or graphic file to document.
|
||||
Bool result=FALSE;
|
||||
@@ -455,8 +461,9 @@ public Bool DocType(CDoc *doc=NULL,U8 *filename,I64 trailing_new_lines=1)
|
||||
return result;
|
||||
}
|
||||
|
||||
#help_index "Graphics/Windows BMP Files;Graphics/GRA Files;File/Cmd Line (Typically);DolDoc/Cmd Line (Typically);Cmd Line (Typically)"
|
||||
|
||||
#help_index "Graphics/Windows BMP Files;Graphics/GRA Files;"\
|
||||
"File/Cmd Line (Typically);DolDoc/Cmd Line (Typically);"\
|
||||
"StdOut;Cmd Line (Typically)"
|
||||
public Bool Type(U8 *filename,I64 trailing_new_lines=1)
|
||||
{//Output txt or graphic file to command line.
|
||||
return DocType(,filename,trailing_new_lines);
|
||||
|
||||
+50
-41
@@ -18,7 +18,7 @@ public Bool DocLineNumGoTo(CDoc *doc,I64 line_num) //one based
|
||||
}
|
||||
|
||||
public Bool DocFind(CDoc *haystack_doc,I64 start_line_num=MIN_I64,
|
||||
U8 *needle,I64 match=1)
|
||||
U8 *needle,I64 match=1)
|
||||
{//Find str by searching tags. Move cur_entry & center.
|
||||
Bool result=FALSE,unlock;
|
||||
CDocEntry *doc_e;
|
||||
@@ -38,13 +38,14 @@ public Bool DocFind(CDoc *haystack_doc,I64 start_line_num=MIN_I64,
|
||||
result=FALSE;
|
||||
while (doc_e!=haystack_doc) {
|
||||
if (doc_e->de_flags&DOCEF_TAG && doc_e->tag &&
|
||||
(ptr=StrIMatch(needle,doc_e->tag))) {//TODO: handle multientry strings
|
||||
//TODO: handle multientry strs
|
||||
(ptr=StrIMatch(needle,doc_e->tag))) {
|
||||
i=ptr-doc_e->tag;
|
||||
if (!--match) {
|
||||
haystack_doc->cur_entry=doc_e;
|
||||
if (i<doc_e->min_col) i=doc_e->min_col;
|
||||
if (i>doc_e->max_col) i=doc_e->max_col;
|
||||
haystack_doc->cur_data_col=i;
|
||||
haystack_doc->cur_col=i;
|
||||
result=TRUE;
|
||||
break;
|
||||
}
|
||||
@@ -74,7 +75,7 @@ public Bool DocAnchorFind(CDoc *haystack_doc,U8 *needle_str)
|
||||
if (doc_e->type_u8==DOCT_ANCHOR && doc_e->de_flags & DOCEF_AUX_STR) {
|
||||
if (!StrCmp(needle_str,doc_e->aux_str)) {
|
||||
haystack_doc->cur_entry=doc_e;
|
||||
haystack_doc->cur_data_col=doc_e->min_col;
|
||||
haystack_doc->cur_col=doc_e->min_col;
|
||||
result=TRUE;
|
||||
break;
|
||||
}
|
||||
@@ -104,11 +105,13 @@ public U0 EdFindNext(CDoc *doc)
|
||||
do {
|
||||
if (doc_e!=doc) {
|
||||
if (doc_e->de_flags&DOCEF_TAG && doc_e->tag &&
|
||||
!(doc_e->de_flags&(DOCEG1_DONT_EDIT|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP))) {
|
||||
if (doc_e->type & DOCET_SELECTED || !doc->find_replace->scan_selected_text) {
|
||||
!(doc_e->de_flags&(DOCEG1_DONT_EDIT|
|
||||
DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP))) {
|
||||
if (doc_e->type & DOCET_SELECTED ||
|
||||
!doc->find_replace->scan_selected_text) {
|
||||
if (doc->find_replace->scan_fwd) {
|
||||
if (doc_e==doc_ce) {
|
||||
ptr=doc_ce->tag+doc->cur_data_col+1;
|
||||
ptr=doc_ce->tag+doc->cur_col+1;
|
||||
if (ptr-doc_ce->tag>=doc_ce->max_col)
|
||||
goto fn_skip;
|
||||
if (ptr-doc_ce->tag<doc_ce->min_col)
|
||||
@@ -117,11 +120,11 @@ public U0 EdFindNext(CDoc *doc)
|
||||
ptr=doc_e->tag;
|
||||
if (ptr=StrFind(doc->find_replace->find_text,ptr,sf_flags)) {
|
||||
doc->cur_entry=doc_e;
|
||||
doc->cur_data_col=ptr-doc_e->tag;
|
||||
if (doc->cur_data_col>=doc_e->max_col)
|
||||
doc->cur_data_col=doc_e->max_col-1;
|
||||
if (doc->cur_data_col<doc_e->min_col)
|
||||
doc->cur_data_col=doc_e->min_col;
|
||||
doc->cur_col=ptr-doc_e->tag;
|
||||
if (doc->cur_col>=doc_e->max_col)
|
||||
doc->cur_col=doc_e->max_col-1;
|
||||
if (doc->cur_col<doc_e->min_col)
|
||||
doc->cur_col=doc_e->min_col;
|
||||
DocCenter(doc);
|
||||
if (unlock)
|
||||
DocUnlock(doc);
|
||||
@@ -131,7 +134,7 @@ public U0 EdFindNext(CDoc *doc)
|
||||
ptr2=NULL;
|
||||
ptr=doc_e->tag+doc_e->min_col;
|
||||
if (doc_e==doc_ce)
|
||||
ptr3=doc_ce->tag+doc->cur_data_col;
|
||||
ptr3=doc_ce->tag+doc->cur_col;
|
||||
else
|
||||
ptr3=doc_e->tag+doc_e->max_col;
|
||||
while (ptr=StrFind(doc->find_replace->find_text,ptr,sf_flags)) {
|
||||
@@ -141,11 +144,11 @@ public U0 EdFindNext(CDoc *doc)
|
||||
}
|
||||
if (ptr2 && ptr2<ptr3) {
|
||||
doc->cur_entry=doc_e;
|
||||
doc->cur_data_col=ptr2-doc_e->tag;
|
||||
if (doc->cur_data_col>=doc_e->max_col)
|
||||
doc->cur_data_col=doc_e->max_col-1;
|
||||
if (doc->cur_data_col<doc_e->min_col)
|
||||
doc->cur_data_col=doc_e->min_col;
|
||||
doc->cur_col=ptr2-doc_e->tag;
|
||||
if (doc->cur_col>=doc_e->max_col)
|
||||
doc->cur_col=doc_e->max_col-1;
|
||||
if (doc->cur_col<doc_e->min_col)
|
||||
doc->cur_col=doc_e->min_col;
|
||||
DocCenter(doc);
|
||||
if (unlock)
|
||||
DocUnlock(doc);
|
||||
@@ -177,11 +180,12 @@ public U0 EdSelectAll(CDoc *doc,Bool select)
|
||||
DocUnlock(doc);
|
||||
}
|
||||
|
||||
public Bool EdFindPaired(CDoc *doc,U8 plus,U8 minus,Bool fwd,Bool abort_on_dbl_colon=FALSE)
|
||||
public Bool EdFindPaired(CDoc *doc,U8 plus,U8 minus,
|
||||
Bool fwd,Bool abort_on_dbl_colon=FALSE)
|
||||
{//Find { } or ( ) pair. Move cur_entry & center.
|
||||
Bool unlock=DocLock(doc),result=FALSE;
|
||||
U8 *ptr;
|
||||
I64 ch,levels=0,colons=0,original_col=doc->cur_data_col;
|
||||
I64 ch,levels=0,colons=0,original_col=doc->cur_col;
|
||||
CDocEntry *doc_ce=doc->cur_entry,*doc_e=doc_ce,*original_ce=doc_ce;
|
||||
if (abort_on_dbl_colon && EdCurU8(doc)==':')
|
||||
colons=1;
|
||||
@@ -190,10 +194,10 @@ public Bool EdFindPaired(CDoc *doc,U8 plus,U8 minus,Bool fwd,Bool abort_on_dbl_c
|
||||
do {
|
||||
if (doc_e!=doc) {
|
||||
if (doc_e->de_flags&DOCEF_TAG && doc_e->tag &&
|
||||
!(doc_e->de_flags&(DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP))) {
|
||||
!(doc_e->de_flags&(DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP))) {
|
||||
if (fwd) {
|
||||
if (doc_e==doc_ce)
|
||||
ptr=doc_e->tag+doc->cur_data_col+1;
|
||||
ptr=doc_e->tag+doc->cur_col+1;
|
||||
else
|
||||
ptr=doc_e->tag;
|
||||
if (ptr-doc_e->tag<doc_e->min_col)
|
||||
@@ -204,7 +208,7 @@ public Bool EdFindPaired(CDoc *doc,U8 plus,U8 minus,Bool fwd,Bool abort_on_dbl_c
|
||||
if (abort_on_dbl_colon && ch==':') {
|
||||
if (++colons==2) {
|
||||
doc->cur_entry=doc_e;
|
||||
doc->cur_data_col=ptr-doc_e->tag-1;
|
||||
doc->cur_col=ptr-doc_e->tag-1;
|
||||
EdCursorLeft(doc);
|
||||
result=FALSE;
|
||||
goto pa_done;
|
||||
@@ -216,15 +220,16 @@ public Bool EdFindPaired(CDoc *doc,U8 plus,U8 minus,Bool fwd,Bool abort_on_dbl_c
|
||||
else if (ch==minus) {
|
||||
if (!levels--) {
|
||||
doc->cur_entry=doc_e;
|
||||
doc->cur_data_col=ptr-doc_e->tag-1;
|
||||
result=doc->cur_entry!=original_ce || doc->cur_data_col!=original_col;
|
||||
doc->cur_col=ptr-doc_e->tag-1;
|
||||
result=doc->cur_entry!=original_ce ||
|
||||
doc->cur_col!=original_col;
|
||||
goto pa_done;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (doc_e==doc_ce) {
|
||||
ptr=doc_e->tag+doc->cur_data_col-1;
|
||||
ptr=doc_e->tag+doc->cur_col-1;
|
||||
if (ptr-doc_e->tag>=doc_e->max_col)
|
||||
ptr=doc_e->tag+doc_e->max_col-1;
|
||||
} else
|
||||
@@ -236,7 +241,7 @@ public Bool EdFindPaired(CDoc *doc,U8 plus,U8 minus,Bool fwd,Bool abort_on_dbl_c
|
||||
if (abort_on_dbl_colon && ch==':') {
|
||||
if (++colons==2) {
|
||||
doc->cur_entry=doc_e;
|
||||
doc->cur_data_col=ptr-doc_e->tag+1;
|
||||
doc->cur_col=ptr-doc_e->tag+1;
|
||||
result=FALSE;
|
||||
goto pa_done;
|
||||
}
|
||||
@@ -247,8 +252,9 @@ public Bool EdFindPaired(CDoc *doc,U8 plus,U8 minus,Bool fwd,Bool abort_on_dbl_c
|
||||
else if (ch==minus) {
|
||||
if (!levels--) {
|
||||
doc->cur_entry=doc_e;
|
||||
doc->cur_data_col=ptr-doc_e->tag+1;
|
||||
result=doc->cur_entry!=original_ce || doc->cur_data_col!=original_col;
|
||||
doc->cur_col=ptr-doc_e->tag+1;
|
||||
result=doc->cur_entry!=original_ce ||
|
||||
doc->cur_col!=original_col;
|
||||
goto pa_done;
|
||||
}
|
||||
}
|
||||
@@ -284,7 +290,7 @@ public Bool EdGoToFun(CDoc *doc,Bool fwd,Bool abort_on_dbl_colon)
|
||||
if (++colons==2) {
|
||||
EdCursorLeft(doc);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
colons=0;
|
||||
if (ch=='{')
|
||||
@@ -335,7 +341,7 @@ public U0 EdSelectFun(CDoc *doc,Bool abort_on_dbl_colon=FALSE)
|
||||
if (doc_e->de_flags&DOCEF_TAG && doc_e->tag) {
|
||||
ptr=doc_e->tag;
|
||||
if (doc_e==doc->cur_entry)
|
||||
ptr+=doc->cur_data_col;
|
||||
ptr+=doc->cur_col;
|
||||
while (ch=*ptr++)
|
||||
if (abort_on_dbl_colon && ch==':') {
|
||||
if (++colons==2)
|
||||
@@ -379,7 +385,7 @@ I64 EdFindReplace(CDoc *doc)
|
||||
cmd=RSAC_REPLACE;
|
||||
else
|
||||
cmd=RSAC_ALL;
|
||||
if (!doc->find_replace->pmt || DocFormDo(doc->find_replace)) {
|
||||
if (!doc->find_replace->pmt || DocForm(doc->find_replace)) {
|
||||
result=0;
|
||||
unlock=DocLock(doc);
|
||||
if (doc->find_replace->match_case || doc->find_replace->local_var)
|
||||
@@ -393,7 +399,7 @@ I64 EdFindReplace(CDoc *doc)
|
||||
doc_ce=doc->root.next;
|
||||
while (doc_ce!=doc) {
|
||||
if (doc_ce->de_flags&DOCEF_TAG && doc_ce->tag &&
|
||||
!(doc_ce->de_flags&(DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP)) &&
|
||||
!(doc_ce->de_flags&(DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP)) &&
|
||||
StrFind(doc->find_replace->find_text,doc_ce->tag,sf_flags)) {
|
||||
doc_ce->type|=DOCET_SELECTED;
|
||||
result++;
|
||||
@@ -462,18 +468,21 @@ I64 EdFindReplace(CDoc *doc)
|
||||
break;
|
||||
}
|
||||
if (doc_e->type_u8==DOCT_TEXT &&
|
||||
!(doc_e->de_flags&(DOCEG1_DONT_EDIT|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP)) &&
|
||||
(doc_e->type & DOCET_SELECTED || !doc->find_replace->scan_selected_text&&!doc->find_replace->local_var)) {
|
||||
!(doc_e->de_flags&(DOCEG1_DONT_EDIT|DOCEF_HARD_SKIP|
|
||||
DOCEF_FILTER_SKIP)) &&
|
||||
(doc_e->type & DOCET_SELECTED ||
|
||||
!doc->find_replace->scan_selected_text&&
|
||||
!doc->find_replace->local_var)) {
|
||||
src=doc_e->tag;
|
||||
while (src) {
|
||||
src=StrFind(doc->find_replace->find_text,src,sf_flags);
|
||||
if (src) {
|
||||
doc->cur_data_col=src-doc_e->tag;
|
||||
doc->cur_col=src-doc_e->tag;
|
||||
doc->cur_entry=doc_e;
|
||||
if (cmd!=RSAC_ALL)
|
||||
DocCenter(doc);
|
||||
doc_e=doc->cur_entry;
|
||||
src=doc->cur_data_col+doc_e->tag;
|
||||
src=doc->cur_col+doc_e->tag;
|
||||
if (cmd!=RSAC_ALL) {
|
||||
DocUnlock(doc);
|
||||
cmd=PopUpReplaceSkipAllCancel("");
|
||||
@@ -496,14 +505,14 @@ I64 EdFindReplace(CDoc *doc)
|
||||
*dst++=doc_e->tag[i];
|
||||
Free(doc_e->tag);
|
||||
doc_e->tag=dst2;
|
||||
doc->cur_data_col=src-doc_e->tag;
|
||||
doc->cur_col=src-doc_e->tag;
|
||||
doc->cur_entry=doc_e;
|
||||
if (cmd!=RSAC_ALL) {
|
||||
DocRemSoftNewLines(doc,doc->cur_entry);
|
||||
DocRecalc(doc);
|
||||
}
|
||||
doc_e=doc->cur_entry;
|
||||
src=doc->cur_data_col+doc_e->tag;
|
||||
src=doc->cur_col+doc_e->tag;
|
||||
result++;
|
||||
} else
|
||||
src++;
|
||||
@@ -527,7 +536,7 @@ fr_unlock_done:
|
||||
}
|
||||
|
||||
public I64 EdReplace(CDoc *doc,U8 *find,U8 *replace,
|
||||
Bool selected=TRUE,Bool match_case=TRUE,Bool whole_labels=FALSE)
|
||||
Bool selected=TRUE,Bool match_case=TRUE,Bool whole_labels=FALSE)
|
||||
{//Find & replace using editor's cmd.
|
||||
CEdFindText old_find_replace;
|
||||
Bool unlock;
|
||||
@@ -565,6 +574,6 @@ U0 EdGoToLine(CDoc *doc)
|
||||
{//Prompt with form and go to line num.
|
||||
CEdLineGoTo gtl;
|
||||
gtl.line=1;
|
||||
if (DocFormDo(>l))
|
||||
if (DocForm(>l))
|
||||
DocLineNumGoTo(doc,gtl.line);
|
||||
}
|
||||
@@ -12,7 +12,7 @@ U32 *DocHighlight(CDocEntry *doc_e,U8 *src,I64 len,I64 _temp_u32_attr)
|
||||
case DOCSS_NORMAL:
|
||||
hl_normal:
|
||||
while (len) {
|
||||
while (len && !Bt(chars_bitmap_alpha_numeric,*src)) {
|
||||
while (len && !Bt(chars_bmp_alpha_numeric,*src)) {
|
||||
temp_u32_attr=_temp_u32_attr;
|
||||
ch1=*src++;
|
||||
switch (ch1) {
|
||||
@@ -65,13 +65,14 @@ hl_normal:
|
||||
if (!--len) goto hl_normal_done;
|
||||
}
|
||||
ptr=src;
|
||||
while (len && Bt(chars_bitmap_alpha_numeric,*src)) {
|
||||
while (len && Bt(chars_bmp_alpha_numeric,*src)) {
|
||||
src++;
|
||||
len--;
|
||||
}
|
||||
ch=*src;
|
||||
*src=0;
|
||||
if (temph=HashFind(ptr,cmp.asm_hash,HTT_KEYWORD|HTT_ASM_KEYWORD|HTT_OPCODE|HTT_REG)) {
|
||||
if (temph=HashFind(ptr,cmp.asm_hash,
|
||||
HTT_KEYWORD|HTT_ASM_KEYWORD|HTT_OPCODE|HTT_REG)) {
|
||||
if (temph->type&(HTT_KEYWORD|HTT_ASM_KEYWORD|HTT_OPCODE))
|
||||
temp_u32_attr=DOC_COLOR_KEYWORD<<8|mask_temp_u32_attr;
|
||||
else
|
||||
|
||||
+16
-16
@@ -2,14 +2,14 @@
|
||||
|
||||
U0 DocInit()
|
||||
{//$LK-UL,"CMD Defines",A="MN:DOCT_TEXT"$
|
||||
CLex *lx;
|
||||
CCmpCtrl *cc;
|
||||
I64 i;
|
||||
CHashGeneric *temph;
|
||||
|
||||
DefineLstLoad("ST_DOC_CMDS",
|
||||
"TX\0CR\0SR\0CU\0TB\0CL\0PB\0DA\0PL\0LM\0RM\0HD\0FO\0ID\0"
|
||||
"FG\0BG\0FD\0BD\0PT\0WW\0UL\0IV\0BK\0SX\0SY\0CM\0AN\0LK\0BT\0"
|
||||
"CB\0LS\0MA\0MU\0HX\0TR\0SP\0IB\0IS\0SO\0HL\0HC\0ER\0");
|
||||
"TX\0CR\0SR\0CU\0TB\0CL\0PB\0PL\0LM\0RM\0HD\0FO\0ID\0FG\0"
|
||||
"BG\0FD\0BD\0PT\0WW\0UL\0IV\0BK\0SX\0SY\0CM\0AN\0LK\0BT\0"
|
||||
"DA\0CB\0LS\0MA\0MU\0HX\0TR\0SP\0IB\0IS\0SO\0HL\0HC\0ER\0");
|
||||
DefineLstLoad("ST_DOC_FLAGS",
|
||||
"T\0A\0D\0HTML\0LE\0LM\0RE\0RM\0BI\0BP\0RT\0SX\0SY\0SCX\0U\0"
|
||||
"LC\0LA\0RC\0RA\0TC\0LX\0CX\0RX\0TY\0CY\0BY\0"
|
||||
@@ -26,21 +26,21 @@ U0 DocInit()
|
||||
|
||||
MemSet(doldoc.dft_de_flags, 0,sizeof(doldoc.dft_de_flags));
|
||||
MemSet(doldoc.dft_type_flags, 0,sizeof(doldoc.dft_type_flags));
|
||||
lx=LexNew("TX+T;DA+P+TRM+T;CM+LE+RE;AN+T;LK+L+UL+T;MA+X+UL+T;MU+X+UL+T;"
|
||||
cc=CmpCtrlNew("TX+T;DA+P+TRM+T;CM+LE+RE;AN+T;LK+L+UL+T;MA+X+UL+T;MU+X+UL+T;"
|
||||
"BT+X+B+T;CB+CA+P+T;LS+LS+P+T;HX+P+Z;TR+TR+C+CA+UL+T;SP+T;IB+T;IS+T;"
|
||||
"SO+T;HC+T;",LF_DONT_FREE_BUF);
|
||||
lx->htc.hash_table_lst=NULL;
|
||||
Lex(lx);
|
||||
while (lx->token==TK_IDENT) {
|
||||
if (temph=HashFind(lx->cur_str,doldoc.hash,DHT_DOC_CMD)) {
|
||||
"SO+T;HC+T;",CCF_DONT_FREE_BUF);
|
||||
cc->htc.hash_table_lst=NULL;
|
||||
Lex(cc);
|
||||
while (cc->token==TK_IDENT) {
|
||||
if (temph=HashFind(cc->cur_str,doldoc.hash,DHT_DOC_CMD)) {
|
||||
i=temph->user_data0;
|
||||
Lex(lx);
|
||||
PrsDocFlags(lx,&doldoc.dft_de_flags[i],&doldoc.dft_type_flags[i]);
|
||||
Lex(cc);
|
||||
PrsDocFlags(cc,&doldoc.dft_de_flags[i],&doldoc.dft_type_flags[i]);
|
||||
}
|
||||
if (lx->token==';')
|
||||
Lex(lx);
|
||||
if (cc->token==';')
|
||||
Lex(cc);
|
||||
}
|
||||
LexDel(lx);
|
||||
CmpCtrlDel(cc);
|
||||
|
||||
for (i=0;i<DOCT_NUM_TYPES;i++)
|
||||
doldoc.dft_de_flags[i]&=~DOCG_BL_IV_UL;
|
||||
@@ -50,7 +50,7 @@ U0 DocInit()
|
||||
if (Bt(&doldoc.dft_de_flags[i],DOCEf_TAG) && i!=DOCT_TEXT || i==DOCT_HEX_ED)
|
||||
Bts(doldoc.type_flags_form,i);
|
||||
|
||||
//Don't forget $LK,"cmp_type_flags_src_code",A="MN:cmp_type_flags_src_code"$.
|
||||
//Don't forget $LK,"cmp_type_flags_src_code",A="MN:cmp_type_flags_src_code"$.
|
||||
doldoc.type_flags_nontag_invisible[0]=
|
||||
1<<DOCT_PAGE_LEN|
|
||||
1<<DOCT_LEFT_MARGIN|
|
||||
|
||||
+18
-18
@@ -1,6 +1,6 @@
|
||||
#help_index "DolDoc/Misc"
|
||||
|
||||
U8 captured_macro_name[136];
|
||||
U8 captured_macro_name[STR_LEN];
|
||||
StrCpy(captured_macro_name,"Test");
|
||||
|
||||
I64 sys_macro_repeat_n=1;
|
||||
@@ -12,11 +12,11 @@ U0 SysMacroStripKey(CSrvCmd *macro_root,I64 a1,I64 a2)
|
||||
while (tempc!=macro_root) {
|
||||
tempc1=tempc->next;
|
||||
if (tempc->cmd_code==SVCT_MSG &&
|
||||
(tempc->msg_code==MSG_KEY_DOWN ||
|
||||
tempc->msg_code==MSG_KEY_UP ||
|
||||
tempc->msg_code==MSG_KEY_DOWN_UP) &&
|
||||
a1 && tempc->aux1==a1 ||
|
||||
!a1 && tempc->aux2==a2) {
|
||||
(tempc->msg_code==MSG_KEY_DOWN ||
|
||||
tempc->msg_code==MSG_KEY_UP ||
|
||||
tempc->msg_code==MSG_KEY_DOWN_UP) &&
|
||||
a1 && tempc->aux1==a1 ||
|
||||
!a1 && tempc->aux2==a2) {
|
||||
QueRem(tempc);
|
||||
SrvCmdDel(tempc);
|
||||
}
|
||||
@@ -32,14 +32,14 @@ class CMacroTemp
|
||||
{
|
||||
CMacroTemp *next,*last;
|
||||
I64 type;
|
||||
U8 buf[136];
|
||||
U8 buf[STR_LEN];
|
||||
};
|
||||
|
||||
CMacroTemp *Cmd2MT(CSrvCmd *tempc)
|
||||
{
|
||||
U8 buf[8];
|
||||
CMacroTemp *tempmt=CAlloc(sizeof(CMacroTemp));
|
||||
if (Bt(chars_bitmap_getkey,tempc->aux1) && tempc->msg_code==MSG_KEY_DOWN) {
|
||||
if (Bt(chars_bmp_macro,tempc->aux1) && tempc->msg_code==MSG_KEY_DOWN) {
|
||||
tempmt->type=MT_CHAR;
|
||||
buf[0]=tempc->aux1;
|
||||
buf[1]=0;
|
||||
@@ -47,7 +47,7 @@ CMacroTemp *Cmd2MT(CSrvCmd *tempc)
|
||||
} else {
|
||||
tempmt->type=MT_MSG;
|
||||
StrPrint(tempmt->buf,"Msg(0x%X,0x%X,0x%X);",
|
||||
tempc->msg_code,tempc->aux1,tempc->aux2);
|
||||
tempc->msg_code,tempc->aux1,tempc->aux2);
|
||||
}
|
||||
return tempmt;
|
||||
}
|
||||
@@ -58,7 +58,7 @@ U8 *SysMacro2Str(CSrvCmd *macro_root)
|
||||
I64 cnt=1; //terminating zero
|
||||
U8 *ptr,*m;
|
||||
CMacroTemp *tempmt,*tempmt1,root;
|
||||
Bool old_preempt=Preempt(OFF);
|
||||
Bool old_preempt=Preempt;
|
||||
LBtr(&sys_semas[SYS_SEMA_RECORD_MACRO],0);
|
||||
|
||||
QueInit(&root);
|
||||
@@ -113,7 +113,7 @@ U0 PlaySysMacro(I64 n=1)
|
||||
U8 *m;
|
||||
if (TaskValidate(task)) {
|
||||
LBtr(&sys_semas[SYS_SEMA_RECORD_MACRO],0);
|
||||
old_preempt=Preempt(OFF);
|
||||
old_preempt=Preempt;
|
||||
m=SysMacro2Str(&sys_macro_root);
|
||||
while (n-- && TaskValidate(task)) {
|
||||
if (task==Fs)
|
||||
@@ -128,11 +128,11 @@ U0 PlaySysMacro(I64 n=1)
|
||||
|
||||
U0 EdInsCapturedMacro()
|
||||
{
|
||||
Bool old_preempt=Preempt(OFF);
|
||||
Bool old_preempt=Preempt;
|
||||
U8 *st=SysMacro2Str(&sys_macro_root);
|
||||
if (sys_focus_task) {
|
||||
XTalk(sys_focus_task,"$$MA+LA,T=\"%s\",LM=\"%Q\"$$",
|
||||
captured_macro_name,st);
|
||||
captured_macro_name,st);
|
||||
Free(st);
|
||||
}
|
||||
Preempt(old_preempt);
|
||||
@@ -147,10 +147,10 @@ U0 EdInsCapturedMacro()
|
||||
I64 PopUpMacroMenu()
|
||||
{
|
||||
I64 result=0;
|
||||
U8 buf[136];
|
||||
U8 buf[STR_LEN];
|
||||
CSrvCmd *tempc;
|
||||
CDoc *doc=DocNew;
|
||||
CDocEntry *doc_e=DocPrint(doc,"$$DA-P,135,A=\"Name:%%s\"$$");
|
||||
CDocEntry *doc_e=DocPrint(doc,"$$DA-P,STR_LEN-1,A=\"Name:%%s\"$$");
|
||||
doc_e->data=captured_macro_name;
|
||||
DocDataFmt(doc,doc_e);
|
||||
|
||||
@@ -167,13 +167,13 @@ I64 PopUpMacroMenu()
|
||||
"$$CM+LX,17,0$$$$BT,\"CANCEL\",LE=DOCM_CANCEL$$"
|
||||
"\n\n\n$$GREEN$$SHIFT-F2$$FG$$ will play macro.\n");
|
||||
doc->flags|=DOCF_MIN_SIZE | DOCF_FORM;
|
||||
StrPrint(buf,"DocMenuDo(%d);",doc);
|
||||
StrPrint(buf,"DocMenu(%d);",doc);
|
||||
sys_macro_util_task=Spawn(&SrvCmdLine,NULL,"Macro Popup",,Fs);
|
||||
Fs->popup_task=sys_macro_util_task;
|
||||
LBts(&sys_macro_util_task->display_flags,DISPLAYf_WIN_ON_TOP);
|
||||
tempc=TaskExe(sys_macro_util_task,Fs,buf,
|
||||
1<<SVCf_WAKE_MASTER|1<<SVCf_FOCUS_MASTER);
|
||||
ScanResult(tempc,&result);
|
||||
1<<SVCf_WAKE_MASTER|1<<SVCf_FOCUS_MASTER);
|
||||
JobResultScan(tempc,&result);
|
||||
Fs->popup_task=NULL;
|
||||
Kill(sys_macro_util_task);
|
||||
sys_macro_util_task=NULL;
|
||||
|
||||
+36
-26
@@ -21,7 +21,7 @@ public Bool Ed(U8 *link_st,I64 edf_dof_flags=0)
|
||||
DocHelpIndex(doc,filename);
|
||||
ej_doc:
|
||||
if (!(edf_dof_flags&EDF_BAIL)) {
|
||||
DocDo(doc);
|
||||
DocEd(doc);
|
||||
DocDel(doc);
|
||||
}
|
||||
if (!(edf_dof_flags&EDF_WAS_WRITE))
|
||||
@@ -33,8 +33,8 @@ ej_doc:
|
||||
else {
|
||||
cont=TRUE;
|
||||
if (!(edf_dof_flags&EDF_BAIL) && !(LK_DOC<=i<=LK_DOC_LINE) &&
|
||||
!FilesFindMatch(filename,FILEMASK_TXT) &&
|
||||
!PopUpCancelOk(ST_WARN_ST "Not Text File\n\n"))
|
||||
!FilesFindMatch(filename,FILEMASK_TXT) &&
|
||||
!PopUpCancelOk(ST_WARN_ST "Not Text File\n\n"))
|
||||
cont=FALSE;
|
||||
if (cont)
|
||||
result=DocFileEd(i,filename,needle_str,&num,edf_dof_flags);
|
||||
@@ -57,7 +57,7 @@ public Bool Plain(U8 *filename,I64 edf_dof_flags=0)
|
||||
#help_index "DolDoc"
|
||||
public Bool DocLinkChk(U8 *link_st)
|
||||
{//Check for bad $LK,"Editor Link",A="MN:LK_FILE"$.
|
||||
U8 *filename;
|
||||
U8 *filename,*st;
|
||||
Bool result=FALSE;
|
||||
if (link_st) {
|
||||
switch (EdLinkCvt(link_st,&filename)) {
|
||||
@@ -66,11 +66,17 @@ public Bool DocLinkChk(U8 *link_st)
|
||||
case LK_FILE_LINE:
|
||||
case LK_PLAIN_LINE:
|
||||
case LK_FILE:
|
||||
//We don't check line number
|
||||
result=FileFind(filename,,FUF_JUST_FILES|FUF_Z_OR_NOT_Z|FUF_SCAN_PARENTS);
|
||||
//We don't check line number
|
||||
result=FileFind(filename,,
|
||||
FUF_JUST_FILES|FUF_Z_OR_NOT_Z|FUF_SCAN_PARENTS);
|
||||
break;
|
||||
case LK_BIBLE_FIND:
|
||||
result=TRUE; //We don't check verse string
|
||||
st=StrNew(link_st+3);
|
||||
if (StrOcc(st,','))
|
||||
StrLastRem(st,",");
|
||||
if (DefineMatch(st,"ST_BIBLE_BOOKS",LMF_IGNORE_CASE)>=0)
|
||||
result=TRUE;
|
||||
Free(st);
|
||||
break;
|
||||
default://TODO: Need to validate HI: and DF:
|
||||
if (Ed(link_st,EDF_BAIL))
|
||||
@@ -106,7 +112,7 @@ public U8 *DocLinkFile(U8 *link_st,CTask *mem_task=NULL)
|
||||
return result;
|
||||
}
|
||||
|
||||
#help_index "DolDoc/Task"
|
||||
#help_index "DolDoc/Task;StdOut/Task"
|
||||
public CDoc *DocBorderNew(CDoc *pdoc)
|
||||
{//Make new std border doc.
|
||||
CDocEntry *doc_e;
|
||||
@@ -145,7 +151,7 @@ public CDoc *DocBorderNew(CDoc *pdoc)
|
||||
|
||||
public U0 DocTermNew()
|
||||
{//Make into term win task with Put/Display/Border docs.
|
||||
Bool old_preempt=Preempt(OFF);
|
||||
Bool old_preempt=Preempt;
|
||||
CDoc *pdoc=DocNew;
|
||||
pdoc->right_click_link=&TermRightClickLink;
|
||||
pdoc->max_entries=4096;
|
||||
@@ -159,8 +165,9 @@ public U0 DocTermNew()
|
||||
Raw(OFF);
|
||||
}
|
||||
|
||||
#help_index "DolDoc/Input"
|
||||
public U8 *DocScanLine(CDoc *doc,CDocEntry *doc_e,I64 *cur_col=NULL,CDocEntry **_do_e_end=NULL)
|
||||
#help_index "DolDoc/Input;StdIn/DolDoc"
|
||||
public U8 *DocScanLine(CDoc *doc,CDocEntry *doc_e,
|
||||
I64 *cur_col=NULL,CDocEntry **_do_e_end=NULL)
|
||||
{//Start at entry in doc,make and return one line as str.
|
||||
CDocEntry *doc_e2=doc_e;
|
||||
Bool unlock=DocLock(doc);
|
||||
@@ -187,19 +194,19 @@ public U8 *DocScanLine(CDoc *doc,CDocEntry *doc_e,I64 *cur_col=NULL,CDocEntry **
|
||||
} else if (doc_e->type_u8==DOCT_TAB)
|
||||
*dst++='\t';
|
||||
if (doc_e==doc->cur_entry && cur_col)
|
||||
*cur_col=start-result+doc->cur_data_col;
|
||||
*cur_col=start-result+doc->cur_col;
|
||||
doc_e=doc_e->next;
|
||||
}
|
||||
if (_do_e_end) *_do_e_end=doc_e;
|
||||
*dst=0;
|
||||
if (doc_e==doc->cur_entry && cur_col && !doc->cur_data_col)
|
||||
if (doc_e==doc->cur_entry && cur_col && !doc->cur_col)
|
||||
*cur_col=dst-result;
|
||||
if (unlock)
|
||||
DocUnlock(doc);
|
||||
return result;
|
||||
}
|
||||
|
||||
#help_index "DolDoc/Output"
|
||||
#help_index "DolDoc/Output;StdOut/DolDoc"
|
||||
U0 DocDump(CDoc *doc,I64 uS_delay=0)
|
||||
{
|
||||
U8 *st;
|
||||
@@ -259,7 +266,7 @@ public CDocEntry *DocPutLine(CDoc *doc=NULL,CDocEntry *doc_e)
|
||||
return doc_e;
|
||||
}
|
||||
|
||||
#help_index "DolDoc/Input"
|
||||
#help_index "DolDoc/Input;StdIn/DolDoc"
|
||||
U8 *DocGetStr2(I64 flags=0)
|
||||
{//$LK,"Flags",A="MN:GSF_SHIFT_ESC_EXIT"$
|
||||
CDoc *doc;
|
||||
@@ -291,10 +298,11 @@ U8 *DocGetStr2(I64 flags=0)
|
||||
goto gs_done;
|
||||
}
|
||||
}
|
||||
//<CTRL-SHIFT-ENTER> is a blank line without entry
|
||||
} while (flags&GSF_WITH_NEW_LINE || ch!='\n' || sc & SCF_CTRL && sc & SCF_SHIFT);
|
||||
//<CTRL-SHIFT-ENTER> is a blank line without entry
|
||||
} while (flags&GSF_WITH_NEW_LINE || ch!='\n' ||
|
||||
sc & SCF_CTRL && sc & SCF_SHIFT);
|
||||
|
||||
Preempt(OFF);
|
||||
Preempt;
|
||||
doc=DocPut;
|
||||
DocLock(doc);
|
||||
if (flags&GSF_WITH_NEW_LINE) {
|
||||
@@ -319,11 +327,11 @@ U8 *DocGetStr2(I64 flags=0)
|
||||
doc_e=doc->cur_entry;
|
||||
do doc_e=doc_e->last;
|
||||
while (doc_e!=doc && doc_e->type_u8!=DOCT_NEW_LINE &&
|
||||
doc_e->type_u8!=DOCT_PMT);
|
||||
doc_e->type_u8!=DOCT_PMT);
|
||||
if (doc_e!=doc && doc_e->type_u8!=DOCT_PMT) {
|
||||
do doc_e=doc_e->last;
|
||||
while (doc_e!=doc && doc_e->type_u8!=DOCT_NEW_LINE &&
|
||||
doc_e->type_u8!=DOCT_PMT);
|
||||
doc_e->type_u8!=DOCT_PMT);
|
||||
}
|
||||
doc_e=doc_e->next;
|
||||
result=DocScanLine(doc,doc_e,NULL);
|
||||
@@ -335,7 +343,7 @@ gs_done:
|
||||
return result;
|
||||
}
|
||||
|
||||
#help_index "Keyboard Devices;Char/Input"
|
||||
#help_index "Keyboard Devices;Char/Input;StdIn"
|
||||
|
||||
public I64 GetI64(U8 *msg=NULL,I64 dft=0,I64 lo=MIN_I64,I64 hi=MAX_I64)
|
||||
{//Prompt user for I64 expression.
|
||||
@@ -389,7 +397,8 @@ public F64 GetF64(U8 *msg=NULL,F64 dft=0,F64 lo=MIN_F64,F64 hi=MAX_F64)
|
||||
}
|
||||
}
|
||||
|
||||
public CDate GetDate(U8 *msg=NULL,CDate dft=MIN_I64,CDate lo=MIN_I64,CDate hi=MAX_I64)
|
||||
public CDate GetDate(U8 *msg=NULL,CDate dft=MIN_I64,
|
||||
CDate lo=MIN_I64,CDate hi=MAX_I64)
|
||||
{//Prompt user for date expression. (Use $LK,"Now",A="MN:Now"$() if you want current time.)
|
||||
U8 *st;
|
||||
CDate result;
|
||||
@@ -497,14 +506,14 @@ I64 TermRightClickLink(CDoc *doc,CDocEntry *doc_e)
|
||||
break;
|
||||
case RIGHT_COPY:
|
||||
StrCpy(fn.name,st);
|
||||
if (DocFormDo(&fn)) {
|
||||
if (DocForm(&fn)) {
|
||||
result=ToBool(Copy(st,fn.name));
|
||||
} else
|
||||
send_new_line=TRUE;
|
||||
break;
|
||||
case RIGHT_MOVE:
|
||||
StrCpy(fn.name,st);
|
||||
if (DocFormDo(&fn))
|
||||
if (DocForm(&fn))
|
||||
result=Move(st,fn.name);
|
||||
else
|
||||
send_new_line=TRUE;
|
||||
@@ -551,7 +560,8 @@ I64 TermRightClickLink(CDoc *doc,CDocEntry *doc_e)
|
||||
return result;
|
||||
}
|
||||
|
||||
#help_index "Debugging/Dump;DolDoc/Cmd Line (Typically);Cmd Line (Typically);DolDoc/Output"
|
||||
#help_index "Debugging/Dump;DolDoc/Cmd Line (Typically);"\
|
||||
"Cmd Line (Typically);DolDoc/Output;StdOut/DolDoc"
|
||||
public U0 DocDm(U8 *buf,I64 cnt=0x80)
|
||||
{//Dump live chunk of mem showing addresses. Can be edited.
|
||||
CDocEntry *doc_e;
|
||||
@@ -578,7 +588,7 @@ public U0 DocD(U8 *buf,I64 cnt=0x80)
|
||||
DocUnlock(doc);
|
||||
}
|
||||
|
||||
#help_index "DolDoc/Output"
|
||||
#help_index "DolDoc/Output;StdOut/DolDoc"
|
||||
Bool KDDocPutS(U8 *st)
|
||||
{
|
||||
CDoc *doc;
|
||||
|
||||
+28
-27
@@ -266,12 +266,12 @@ U0 DocFormFwd(CDoc *doc,Bool giveup=FALSE)
|
||||
if (doc->flags & DOCF_FORM) {
|
||||
if (doc_e==doc) goto ff_recover;
|
||||
while (!Bt(doldoc.type_flags_form,doc_e->type_u8) &&
|
||||
!(doc_e->de_flags&DOCEF_LINK) ||
|
||||
doc_e->de_flags&DOCEF_SKIP_IN_FORM) {
|
||||
!(doc_e->de_flags&DOCEF_LINK) ||
|
||||
doc_e->de_flags&DOCEF_SKIP_IN_FORM) {
|
||||
doc_e=doc_e->next;
|
||||
if (doc_e==doc) {
|
||||
ff_recover:
|
||||
doc->cur_data_col=0;
|
||||
doc->cur_col=0;
|
||||
if (!giveup) {
|
||||
doc->cur_entry=doc_e->last;
|
||||
DocFormBwd(doc,TRUE);
|
||||
@@ -284,7 +284,7 @@ ff_recover:
|
||||
while (doc_e->type_u8==DOCT_INDENT)
|
||||
doc_e=doc_e->next;
|
||||
if (doc_e!=doc_e2) {
|
||||
doc->cur_data_col=doc_e->min_col;
|
||||
doc->cur_col=doc_e->min_col;
|
||||
doc->cur_entry=doc_e;
|
||||
}
|
||||
}
|
||||
@@ -294,11 +294,11 @@ U0 DocFormBwd(CDoc *doc,Bool giveup=FALSE)
|
||||
CDocEntry *doc_e=doc->cur_entry,*doc_e2=doc_e;
|
||||
if (doc->flags & DOCF_FORM) {
|
||||
while (!Bt(doldoc.type_flags_form,doc_e->type_u8) &&
|
||||
!(doc_e->de_flags&DOCEF_LINK) ||
|
||||
doc_e->de_flags&DOCEF_SKIP_IN_FORM) {
|
||||
!(doc_e->de_flags&DOCEF_LINK) ||
|
||||
doc_e->de_flags&DOCEF_SKIP_IN_FORM) {
|
||||
doc_e=doc_e->last;
|
||||
if (doc_e==doc) {
|
||||
doc->cur_data_col=0;
|
||||
doc->cur_col=0;
|
||||
if (!giveup) {
|
||||
doc->cur_entry=doc_e->next;
|
||||
DocFormFwd(doc,TRUE);
|
||||
@@ -311,7 +311,7 @@ U0 DocFormBwd(CDoc *doc,Bool giveup=FALSE)
|
||||
while (doc_e->type_u8==DOCT_INDENT)
|
||||
doc_e=doc_e->next;
|
||||
if (doc_e!=doc_e2) {
|
||||
doc->cur_data_col=doc_e->min_col;
|
||||
doc->cur_col=doc_e->min_col;
|
||||
doc->cur_entry=doc_e;
|
||||
}
|
||||
}
|
||||
@@ -323,11 +323,11 @@ public U0 DocTop(CDoc *doc=NULL)
|
||||
return;
|
||||
unlock=DocLock(doc);
|
||||
doc->cur_entry=doc->root.next;
|
||||
doc->cur_data_col=doc->cur_entry->min_col;
|
||||
doc->cur_col=doc->cur_entry->min_col;
|
||||
doc->x=0;
|
||||
doc->y=0;
|
||||
doc->line_start_col=0;
|
||||
doc->cur_top_line_num=0;
|
||||
doc->top_line_num=0;
|
||||
|
||||
DocFormFwd(doc);
|
||||
DocRecalc(doc);
|
||||
@@ -367,7 +367,7 @@ public U0 DocRst(CDoc *doc,Bool is_old)
|
||||
b=b1;
|
||||
}
|
||||
}
|
||||
//Check $LK,"DocInsDoc",A="MN:DocInsDoc"$
|
||||
//Check $LK,"DocInsDoc",A="MN:DocInsDoc"$
|
||||
doc->flags&=DOCF_BREAK_UNLOCKED;
|
||||
doc->root.next=doc->root.last=doc;
|
||||
QueInit(&doc->bin_root);
|
||||
@@ -495,9 +495,8 @@ U0 DocDataFmt(CDoc *doc,CDocEntry *doc_e,I64 d=DOCM_CANCEL)
|
||||
}
|
||||
doc_e->max_col=StrLen(doc_e->tag);
|
||||
} else if (doc_e->de_flags & DOCEF_LST) {
|
||||
if (doc_e->de_flags & DOCEF_DEFINE &&
|
||||
(temph=HashFind(doc_e->define_str,doc->win_task->hash_table,HTT_DEFINE_STR)) &&
|
||||
0<=d<temph->cnt) {
|
||||
if (doc_e->de_flags & DOCEF_DEFINE && (temph=HashFind(doc_e->define_str,
|
||||
doc->win_task->hash_table,HTT_DEFINE_STR)) && 0<=d<temph->cnt) {
|
||||
ptr=MStrPrint("[%s]",temph->sub_lst[d]);
|
||||
Free(doc_e->tag);
|
||||
doc_e->tag=StrNew(ptr,doc->mem_task);
|
||||
@@ -521,7 +520,7 @@ U0 DocDataScan(CDoc *doc,CDocEntry *doc_e)
|
||||
U8 *ptr,*ptr1,*ptr2;
|
||||
CHashDefineStr *temph;
|
||||
if (doc_e->type_u8==DOCT_DATA && doc_e->de_flags&DOCEF_AUX_STR ||
|
||||
doc_e->type_u8==DOCT_CHECK_BOX || doc_e->de_flags & DOCEF_LST) {
|
||||
doc_e->type_u8==DOCT_CHECK_BOX || doc_e->de_flags & DOCEF_LST) {
|
||||
if (doc_e->de_flags & DOCEF_DATA_IS_PTR) {
|
||||
if (!(ptr=doc_e->data)) return;
|
||||
} else
|
||||
@@ -545,7 +544,8 @@ U0 DocDataScan(CDoc *doc,CDocEntry *doc_e)
|
||||
} else if (doc_e->de_flags & DOCEF_LST) {
|
||||
d=0;
|
||||
if (doc_e->tag && doc_e->de_flags & DOCEF_DEFINE &&
|
||||
(temph=HashFind(doc_e->define_str,doc->win_task->hash_table,HTT_DEFINE_STR))) {
|
||||
(temph=HashFind(doc_e->define_str,
|
||||
doc->win_task->hash_table,HTT_DEFINE_STR))) {
|
||||
ptr1=ptr2=StrNew(doc_e->tag);
|
||||
if (*ptr2=='[') {
|
||||
ptr2++;
|
||||
@@ -596,7 +596,7 @@ U0 DocRemSoftNewLines(CDoc *doc=NULL,CDocEntry *doc_e=NULL)
|
||||
if (doc_e->type_u8==DOCT_SOFT_NEW_LINE) {
|
||||
if (doc->cur_entry==doc_e) {
|
||||
doc->cur_entry=doc_e2;
|
||||
doc->cur_data_col=doc->cur_entry->min_col;
|
||||
doc->cur_col=doc->cur_entry->min_col;
|
||||
}
|
||||
DocEntryDel(doc,doc_e);
|
||||
} else if (saved_ll && doc_e->type_u8==DOCT_NEW_LINE)
|
||||
@@ -612,9 +612,9 @@ U0 DocRemSoftNewLines(CDoc *doc=NULL,CDocEntry *doc_e=NULL)
|
||||
public I64 DocMax(I64 i=MAX_I64)
|
||||
{//Set max document entries. (Cmd line buffer.)
|
||||
//Adjusts the size of the cmd line buf.
|
||||
//Normally, the cmd line deletes entries
|
||||
//when more are added and the old scroll up.
|
||||
//See $LK,"max_entries",A="FF:::/Adam/DolDoc/DocMain.CPP,max_entries"$.
|
||||
//Normally, the cmd line deletes entries
|
||||
//when more are added and the old scroll up.
|
||||
//See $LK,"max_entries",A="FF:::/Adam/DolDoc/DocMain.CPP,max_entries"$.
|
||||
I64 result;
|
||||
CDoc *doc;
|
||||
if (doc=DocPut) {
|
||||
@@ -650,10 +650,10 @@ public CDoc *DocNew(U8 *filename=NULL,CTask *task=NULL)
|
||||
return doc;
|
||||
}
|
||||
|
||||
#help_index "DolDoc/Task"
|
||||
#help_index "DolDoc/Task;StdOut/Task"
|
||||
public CDoc *DocPut(CTask *task=NULL)
|
||||
{//Current document that StdOut Put() goes to.
|
||||
//Basically, StdOut unless double buffering.
|
||||
//Basically, StdOut unless double buffering.
|
||||
CDoc *result;
|
||||
if (!task) task=Fs;
|
||||
if ((result=task->put_doc) && result->doc_signature==DOC_SIGNATURE_VAL)
|
||||
@@ -684,13 +684,13 @@ public CDoc *DocBorder(CTask *task=NULL)
|
||||
|
||||
public CDoc *DocDblBufStart(CTask *task=NULL)
|
||||
{//See $LK,"::/Demo/Spy.CPP"$
|
||||
Bool unlock_ddoc,old_preempt=Preempt(OFF);
|
||||
Bool unlock_ddoc,old_preempt=Preempt;
|
||||
CDoc *pdoc=DocPut(task),*ddoc=DocDisplay(task),*result;
|
||||
if (!pdoc || !ddoc || pdoc!=ddoc)
|
||||
result=NULL; //Already Double buffering
|
||||
else {
|
||||
if (!task) task=Fs;
|
||||
unlock_ddoc=DocLock(ddoc); //dont want change during winupdate, so lock DocPut$WW,0$
|
||||
unlock_ddoc=DocLock(ddoc); //dont change during winupdate, so lock DocPut$WW,0$
|
||||
result=DocNew(,task);
|
||||
result->win_task =ddoc->win_task;
|
||||
result->max_entries =ddoc->max_entries;
|
||||
@@ -715,7 +715,7 @@ public CDoc *DocDblBufStart(CTask *task=NULL)
|
||||
|
||||
public Bool DocDblBufEnd(CTask *task=NULL)
|
||||
{//See $LK,"::/Demo/Spy.CPP"$
|
||||
Bool result=FALSE,old_preempt=Preempt(OFF);
|
||||
Bool result=FALSE,old_preempt=Preempt;
|
||||
CDoc *pdoc=DocPut(task),*ddoc=DocDisplay(task);
|
||||
if (pdoc && ddoc && pdoc!=ddoc) {//Double buffering?
|
||||
if (!task) task=Fs;
|
||||
@@ -733,7 +733,7 @@ public Bool DocDblBufEnd(CTask *task=NULL)
|
||||
|
||||
public Bool DocDblBufSwap(CTask *task=NULL)
|
||||
{//See $LK,"::/Demo/Spy.CPP"$
|
||||
Bool result=FALSE,old_preempt=Preempt(OFF);
|
||||
Bool result=FALSE,old_preempt=Preempt;
|
||||
CDoc *pdoc=DocPut(task),*ddoc=DocDisplay(task);
|
||||
if (pdoc && ddoc && pdoc!=ddoc) {//Double buffering?
|
||||
if (!task) task=Fs;
|
||||
@@ -746,7 +746,8 @@ public Bool DocDblBufSwap(CTask *task=NULL)
|
||||
MemCpy(ddoc->find_replace,pdoc->find_replace,sizeof(CEdFindText));
|
||||
MemCpy(&ddoc->filename,&pdoc->filename,sizeof(CEdFileName));
|
||||
ddoc->max_entries =pdoc->max_entries;
|
||||
ddoc->flags =pdoc->flags&DOCG_DBL_BUF_FLAGS | ddoc->flags&~DOCG_DBL_BUF_FLAGS;
|
||||
ddoc->flags =pdoc->flags&DOCG_DBL_BUF_FLAGS |
|
||||
ddoc->flags&~DOCG_DBL_BUF_FLAGS;
|
||||
ddoc->left_click_link =pdoc->left_click_link;
|
||||
ddoc->right_click_link =pdoc->right_click_link;
|
||||
ddoc->user_put_data =pdoc->user_put_data;
|
||||
|
||||
+14
-13
@@ -7,7 +7,8 @@ I64 DocOptEntry(CDoc *,CDocEntry *doc_e)
|
||||
|
||||
if (doc_e->de_flags&DOCEF_LINK && doc_e->de_flags&(DOCEF_AUX_STR|DOCEF_TAG)) {
|
||||
if (doc_e->de_flags & DOCEF_AUX_STR && doc_e->de_flags & DOCEF_TAG &&
|
||||
!MemCmp(doc_e->aux_str,"FI:",3) && !StrCmp(doc_e->aux_str+3,doc_e->tag)) {
|
||||
!MemCmp(doc_e->aux_str,"FI:",3) &&
|
||||
!StrCmp(doc_e->aux_str+3,doc_e->tag)) {
|
||||
Free(doc_e->aux_str);
|
||||
doc_e->aux_str=NULL;
|
||||
doc_e->de_flags&=~DOCEF_AUX_STR;
|
||||
@@ -31,18 +32,18 @@ I64 DocOptEntry(CDoc *,CDocEntry *doc_e)
|
||||
Free(st);
|
||||
}
|
||||
/* !!! Dangerous, but handy !!!
|
||||
if (doc_e->de_flags & DOCEF_AUX_STR) {
|
||||
if (st=StrMatch(".Z",doc_e->aux_str)) {
|
||||
StrCpy(st,st+2);
|
||||
result++;
|
||||
}
|
||||
}
|
||||
if (doc_e->de_flags&DOCEF_TAG) {
|
||||
if (st=StrMatch(".Z",doc_e->tag)) {
|
||||
StrCpy(st,st+2);
|
||||
result++;
|
||||
}
|
||||
}
|
||||
if (doc_e->de_flags & DOCEF_AUX_STR) {
|
||||
if (st=StrMatch(".Z",doc_e->aux_str)) {
|
||||
StrCpy(st,st+2);
|
||||
result++;
|
||||
}
|
||||
}
|
||||
if (doc_e->de_flags&DOCEF_TAG) {
|
||||
if (st=StrMatch(".Z",doc_e->tag)) {
|
||||
StrCpy(st,st+2);
|
||||
result++;
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
return result;
|
||||
|
||||
+110
-99
@@ -1,10 +1,11 @@
|
||||
#help_index "DolDoc"
|
||||
|
||||
I64 PrsDocFlagSingle(CLex *lx,I64 *_de_flags,U32 *_type,Bool turn_on)
|
||||
I64 PrsDocFlagSingle(CCmpCtrl *cc,I64 *_de_flags,U32 *_type,Bool turn_on)
|
||||
{
|
||||
I64 result=-1;
|
||||
CHashGeneric *temph;
|
||||
if (lx->token==TK_IDENT && (temph=HashFind(lx->cur_str,doldoc.hash,DHT_DOC_FLAG))) {
|
||||
if (cc->token==TK_IDENT &&
|
||||
(temph=HashFind(cc->cur_str,doldoc.hash,DHT_DOC_FLAG))) {
|
||||
result=temph->user_data0;
|
||||
if (result<64) {
|
||||
BEqu(_de_flags,result,turn_on);
|
||||
@@ -17,24 +18,24 @@ I64 PrsDocFlagSingle(CLex *lx,I64 *_de_flags,U32 *_type,Bool turn_on)
|
||||
break;
|
||||
}
|
||||
}
|
||||
Lex(lx); //skip flag
|
||||
Lex(cc); //skip flag
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
I64 PrsDocFlags(CLex *lx,I64 *_de_flags,U32 *_type)
|
||||
I64 PrsDocFlags(CCmpCtrl *cc,I64 *_de_flags,U32 *_type)
|
||||
{
|
||||
I64 result=-1;
|
||||
Bool turn_on;
|
||||
while (TRUE) {
|
||||
if (lx->token=='+')
|
||||
if (cc->token=='+')
|
||||
turn_on=TRUE;
|
||||
else if (lx->token=='-')
|
||||
else if (cc->token=='-')
|
||||
turn_on=FALSE;
|
||||
else
|
||||
break;
|
||||
Lex(lx);
|
||||
result=PrsDocFlagSingle(lx,_de_flags,_type,turn_on);
|
||||
Lex(cc);
|
||||
result=PrsDocFlagSingle(cc,_de_flags,_type,turn_on);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -45,7 +46,8 @@ I64 DocBinPtrRst(CDoc *doc,CDocEntry *doc_e)
|
||||
CDoc *doc2;
|
||||
CDocBin *tempb,*tempb2;
|
||||
I64 i,bin_num=0;
|
||||
if (doc_e->de_flags&DOCEF_HAS_BIN && doc_e->bin_ptr_link && StrLen(doc_e->bin_ptr_link)) {
|
||||
if (doc_e->de_flags&DOCEF_HAS_BIN &&
|
||||
doc_e->bin_ptr_link && StrLen(doc_e->bin_ptr_link)) {
|
||||
bin_num=doc_e->bin_num;
|
||||
st=StrNew(doc_e->bin_ptr_link);
|
||||
st2=StrNew(st);
|
||||
@@ -54,7 +56,7 @@ I64 DocBinPtrRst(CDoc *doc,CDocEntry *doc_e)
|
||||
if (i>0||*st2) {
|
||||
doc2=DocRead(st);
|
||||
if (i>0 && (tempb2=DocBinFindNum(doc2,i)) ||
|
||||
i==0 && (tempb2=DocBinFindTag(doc2,st2))) {
|
||||
i==0 && (tempb2=DocBinFindTag(doc2,st2))) {
|
||||
i=1;
|
||||
if (bin_num>0) {
|
||||
if (tempb=DocBinFindNum(doc,bin_num)) {
|
||||
@@ -91,7 +93,8 @@ U8 *Doc2PlainText(CDoc *doc,CDocEntry *doc_e)
|
||||
t1,f1,de_flags,type;
|
||||
U8 *buf,*buf2;
|
||||
|
||||
if (doc_e->type_u8==DOCT_FOREGROUND && doc->flags&DOCF_COLOR_NAMES && 0<=attr<NUM_COLORS) {
|
||||
if (doc_e->type_u8==DOCT_FOREGROUND &&
|
||||
doc->flags&DOCF_COLOR_NAMES && 0<=attr<NUM_COLORS) {
|
||||
buf=StrNew(DefineSub(attr,"ST_COLORS"));
|
||||
attr=DOC_DFT;
|
||||
} else
|
||||
@@ -100,7 +103,8 @@ U8 *Doc2PlainText(CDoc *doc,CDocEntry *doc_e)
|
||||
f1=doldoc.dft_de_flags[doc_e->type_u8];
|
||||
t1=doc_e->type_u8|doldoc.dft_type_flags[doc_e->type_u8];
|
||||
|
||||
de_flags=doc_e->de_flags&~(DOCG_BL_IV_UL|DOCEF_SELECTED|DOCEF_HIGHLIGHT|DOCEF_WORD_WRAP|DOCEF_SKIP|DOCEF_FILTER_SKIP);
|
||||
de_flags=doc_e->de_flags&~(DOCG_BL_IV_UL|DOCEF_SELECTED|
|
||||
DOCEF_HIGHLIGHT|DOCEF_WORD_WRAP|DOCEF_SKIP|DOCEF_FILTER_SKIP);
|
||||
for (i=0;i<DOCEf_NUM_FLAGS;i++)
|
||||
if (Bt(&f1,i)!=Bt(&de_flags,i)) {
|
||||
if (Bt(&de_flags,i)) {
|
||||
@@ -174,9 +178,12 @@ U8 *Doc2PlainText(CDoc *doc,CDocEntry *doc_e)
|
||||
nobound_switch (j) {
|
||||
case DOCEf_TAG:
|
||||
if (doc_e->type_u8==DOCT_DATA || doc_e->type_u8==DOCT_MACRO &&
|
||||
(doc_e->de_flags&DOCEF_LEFT_MACRO && !StrCmp(doc_e->tag,doc_e->left_macro) ||
|
||||
doc_e->de_flags&DOCEF_RIGHT_MACRO && !StrCmp(doc_e->tag,doc_e->right_macro)) ||
|
||||
doc_e->de_flags&DOCEF_LST && !StrCmp(doc_e->tag,"[]") && doc_e->de_flags&DOCEF_DEFINE) {
|
||||
(doc_e->de_flags&DOCEF_LEFT_MACRO &&
|
||||
!StrCmp(doc_e->tag,doc_e->left_macro) ||
|
||||
doc_e->de_flags&DOCEF_RIGHT_MACRO &&
|
||||
!StrCmp(doc_e->tag,doc_e->right_macro)) ||
|
||||
doc_e->de_flags&DOCEF_LST && !StrCmp(doc_e->tag,"[]") &&
|
||||
doc_e->de_flags&DOCEF_DEFINE) {
|
||||
buf2=buf;
|
||||
buf=NULL;
|
||||
} else {
|
||||
@@ -227,7 +234,7 @@ U8 *Doc2PlainText(CDoc *doc,CDocEntry *doc_e)
|
||||
break;
|
||||
case DOCEf_RAW_TYPE:
|
||||
if (doc_e->type_u8==DOCT_CHECK_BOX&&doc_e->raw_type!=RT_I8 ||
|
||||
doc_e->type_u8!=DOCT_CHECK_BOX&&doc_e->raw_type!=RT_I64)
|
||||
doc_e->type_u8!=DOCT_CHECK_BOX&&doc_e->raw_type!=RT_I64)
|
||||
buf2=MStrPrint("%sRT=%Z,",buf,doc_e->raw_type,"ST_RAW_TYPES");
|
||||
break;
|
||||
case DOCEf_SHIFTED_X:
|
||||
@@ -264,12 +271,12 @@ CDocEntry *PrsDollarCmd(CDoc *doc,U8 *st)
|
||||
U8 *ptr,*st2;
|
||||
CDocEntry *doc_e=NULL;
|
||||
CHashGeneric *temph;
|
||||
CLex *lx=LexNew(st,LF_DONT_FREE_BUF);
|
||||
CHashTable *old_hash_table_lst=lx->htc.hash_table_lst;
|
||||
CCmpCtrl *cc=CmpCtrlNew(st,CCF_DONT_FREE_BUF);
|
||||
CHashTable *old_hash_table_lst=cc->htc.hash_table_lst;
|
||||
try {
|
||||
lx->htc.hash_table_lst=NULL;
|
||||
if (Lex(lx)==TK_IDENT) {
|
||||
if (temph=HashFind(lx->cur_str,doldoc.hash,DHT_DOC_CMD|DHT_COLOR)) {
|
||||
cc->htc.hash_table_lst=NULL;
|
||||
if (Lex(cc)==TK_IDENT) {
|
||||
if (temph=HashFind(cc->cur_str,doldoc.hash,DHT_DOC_CMD|DHT_COLOR)) {
|
||||
if (temph->type&DHT_DOC_CMD)
|
||||
i=temph->user_data0;
|
||||
else {//DHT_COLOR
|
||||
@@ -278,20 +285,20 @@ CDocEntry *PrsDollarCmd(CDoc *doc,U8 *st)
|
||||
}
|
||||
} else
|
||||
goto pd_err;
|
||||
Lex(lx); //skip cmd code
|
||||
Lex(cc); //skip cmd code
|
||||
doc_e=CAlloc(sizeof(CDocEntry),doc->mem_task);
|
||||
doc_e->type=i;
|
||||
doc_e->de_flags=doldoc.dft_de_flags[i];
|
||||
doc_e->type|=doldoc.dft_type_flags[i];
|
||||
doc_e->raw_type=RT_I64;
|
||||
j=PrsDocFlags(lx,&doc_e->de_flags,&doc_e->type);
|
||||
lx->htc.hash_table_lst=old_hash_table_lst;
|
||||
j=PrsDocFlags(cc,&doc_e->de_flags,&doc_e->type);
|
||||
cc->htc.hash_table_lst=old_hash_table_lst;
|
||||
nobound_switch (i) {
|
||||
case DOCT_DATA:
|
||||
while (lx->token==',')
|
||||
Lex(lx);
|
||||
if (lx->token)
|
||||
doc_e->len=LexExpressionI64(lx);
|
||||
while (cc->token==',')
|
||||
Lex(cc);
|
||||
if (cc->token)
|
||||
doc_e->len=LexExpressionI64(cc);
|
||||
else
|
||||
goto pd_err;
|
||||
break;
|
||||
@@ -299,16 +306,16 @@ CDocEntry *PrsDollarCmd(CDoc *doc,U8 *st)
|
||||
doc_e->raw_type=RT_I8;
|
||||
break;
|
||||
case DOCT_HEX_ED:
|
||||
while (lx->token==',')
|
||||
Lex(lx);
|
||||
if (lx->token)
|
||||
doc_e->len=LexExpressionI64(lx);
|
||||
while (cc->token==',')
|
||||
Lex(cc);
|
||||
if (cc->token)
|
||||
doc_e->len=LexExpressionI64(cc);
|
||||
else
|
||||
goto pd_err;
|
||||
while (lx->token==',')
|
||||
Lex(lx);
|
||||
if (lx->token)
|
||||
doc_e->hex_ed_width=LexExpressionI64(lx);
|
||||
while (cc->token==',')
|
||||
Lex(cc);
|
||||
if (cc->token)
|
||||
doc_e->hex_ed_width=LexExpressionI64(cc);
|
||||
else
|
||||
goto pd_err;
|
||||
break;
|
||||
@@ -329,10 +336,10 @@ CDocEntry *PrsDollarCmd(CDoc *doc,U8 *st)
|
||||
case DOCT_BLINK:
|
||||
case DOCT_SHIFTED_X:
|
||||
case DOCT_SHIFTED_Y:
|
||||
while (lx->token==',')
|
||||
Lex(lx);
|
||||
if (lx->token)
|
||||
doc_e->attr=LexExpressionI64(lx);
|
||||
while (cc->token==',')
|
||||
Lex(cc);
|
||||
if (cc->token)
|
||||
doc_e->attr=LexExpressionI64(cc);
|
||||
else
|
||||
doc_e->attr=attr;
|
||||
break;
|
||||
@@ -343,15 +350,15 @@ CDocEntry *PrsDollarCmd(CDoc *doc,U8 *st)
|
||||
|
||||
processed_flags=0;
|
||||
while (TRUE) {
|
||||
lx->htc.hash_table_lst=NULL;
|
||||
while (lx->token==',')
|
||||
Lex(lx);
|
||||
lx->htc.hash_table_lst=old_hash_table_lst;
|
||||
j=PrsDocFlagSingle(lx,&doc_e->de_flags,&doc_e->type,TRUE);
|
||||
cc->htc.hash_table_lst=NULL;
|
||||
while (cc->token==',')
|
||||
Lex(cc);
|
||||
cc->htc.hash_table_lst=old_hash_table_lst;
|
||||
j=PrsDocFlagSingle(cc,&doc_e->de_flags,&doc_e->type,TRUE);
|
||||
if (!(de_flags=~processed_flags & doc_e->de_flags & DOCEG1_HAS_ARG))
|
||||
break;
|
||||
if (lx->token=='=')
|
||||
Lex(lx);
|
||||
if (cc->token=='=')
|
||||
Lex(cc);
|
||||
else
|
||||
j=Bsf(de_flags);
|
||||
if (j<0 || Bts(&processed_flags,j))
|
||||
@@ -360,10 +367,11 @@ CDocEntry *PrsDollarCmd(CDoc *doc,U8 *st)
|
||||
case DOCEf_TAG:
|
||||
if (!doc_e->tag) {
|
||||
//If a $$MA,LM=""$$, Tag is filled when the LM is processed.
|
||||
//if doc_e->df_flags&DOCEF_LST, Tag is filled when the Define is processed.
|
||||
//(The dft_flag1.tag calls this after.)
|
||||
if (lx->token==TK_STR) {
|
||||
st2=LexExtStr(lx);
|
||||
//if doc_e->df_flags&DOCEF_LST,
|
||||
// Tag is filled when the Define is processed.
|
||||
//(The dft_flag1.tag calls this after.)
|
||||
if (cc->token==TK_STR) {
|
||||
st2=LexExtStr(cc);
|
||||
if (i==DOCT_CHECK_BOX) {
|
||||
st=MStrPrint("[X] %s",st2);
|
||||
Free(st2);
|
||||
@@ -388,22 +396,23 @@ CDocEntry *PrsDollarCmd(CDoc *doc,U8 *st)
|
||||
}
|
||||
break;
|
||||
case DOCEf_AUX_STR:
|
||||
if (lx->token==TK_STR) {
|
||||
st2=LexExtStr(lx);
|
||||
if (cc->token==TK_STR) {
|
||||
st2=LexExtStr(cc);
|
||||
doc_e->aux_str=StrNew(st2,doc->mem_task);
|
||||
Free(st2);
|
||||
//$AN,"Anchor",A="DataTagWidth"$
|
||||
if (i==DOCT_DATA) {
|
||||
if (ptr=StrMatch(":",doc_e->aux_str))
|
||||
doc_e->min_col=ptr-doc_e->aux_str+1;
|
||||
doc_e->tag=MAlloc(doc_e->len+doc_e->min_col+2,doc->mem_task); //+2 because "_\0"
|
||||
doc_e->tag=MAlloc(doc_e->len+doc_e->min_col+2,
|
||||
doc->mem_task); //+2 because "_\0"
|
||||
}
|
||||
} else
|
||||
goto pd_err;
|
||||
break;
|
||||
case DOCEf_DEFINE:
|
||||
if (lx->token==TK_STR) {
|
||||
st2=LexExtStr(lx);
|
||||
if (cc->token==TK_STR) {
|
||||
st2=LexExtStr(cc);
|
||||
doc_e->define_str=StrNew(st2,doc->mem_task);
|
||||
Free(st2);
|
||||
if (doc_e->de_flags&DOCEF_LST && !doc_e->tag)
|
||||
@@ -412,22 +421,22 @@ CDocEntry *PrsDollarCmd(CDoc *doc,U8 *st)
|
||||
goto pd_err;
|
||||
break;
|
||||
case DOCEf_HTML_LINK:
|
||||
if (lx->token==TK_STR) {
|
||||
st2=LexExtStr(lx);
|
||||
if (cc->token==TK_STR) {
|
||||
st2=LexExtStr(cc);
|
||||
doc_e->html_link=StrNew(st2,doc->mem_task);
|
||||
Free(st2);
|
||||
} else
|
||||
goto pd_err;
|
||||
break;
|
||||
case DOCEf_LEFT_EXP:
|
||||
if (lx->token)
|
||||
doc_e->left_exp=LexExpression(lx);
|
||||
if (cc->token)
|
||||
doc_e->left_exp=LexExpression(cc);
|
||||
else
|
||||
goto pd_err;
|
||||
break;
|
||||
case DOCEf_LEFT_MACRO:
|
||||
if (lx->token==TK_STR) {
|
||||
st2=LexExtStr(lx);
|
||||
if (cc->token==TK_STR) {
|
||||
st2=LexExtStr(cc);
|
||||
doc_e->left_macro=StrNew(st2,doc->mem_task);
|
||||
Free(st2);
|
||||
if (i==DOCT_MACRO && !doc_e->tag)
|
||||
@@ -436,14 +445,14 @@ CDocEntry *PrsDollarCmd(CDoc *doc,U8 *st)
|
||||
goto pd_err;
|
||||
break;
|
||||
case DOCEf_RIGHT_EXP:
|
||||
if (lx->token)
|
||||
doc_e->right_exp=LexExpression(lx);
|
||||
if (cc->token)
|
||||
doc_e->right_exp=LexExpression(cc);
|
||||
else
|
||||
goto pd_err;
|
||||
break;
|
||||
case DOCEf_RIGHT_MACRO:
|
||||
if (lx->token==TK_STR) {
|
||||
st2=LexExtStr(lx);
|
||||
if (cc->token==TK_STR) {
|
||||
st2=LexExtStr(cc);
|
||||
doc_e->right_macro=StrNew(st2,doc->mem_task);
|
||||
Free(st2);
|
||||
if (i==DOCT_MACRO && !doc_e->tag)
|
||||
@@ -452,14 +461,14 @@ CDocEntry *PrsDollarCmd(CDoc *doc,U8 *st)
|
||||
goto pd_err;
|
||||
break;
|
||||
case DOCEf_HAS_BIN:
|
||||
if (lx->token)
|
||||
doc_e->bin_num=LexExpressionI64(lx);
|
||||
if (cc->token)
|
||||
doc_e->bin_num=LexExpressionI64(cc);
|
||||
else
|
||||
goto pd_err;
|
||||
break;
|
||||
case DOCEf_BIN_PTR_LINK:
|
||||
if (lx->token==TK_STR) {
|
||||
st2=LexExtStr(lx);
|
||||
if (cc->token==TK_STR) {
|
||||
st2=LexExtStr(cc);
|
||||
doc_e->bin_ptr_link=StrNew(st2,doc->mem_task);
|
||||
Free(st2);
|
||||
if (!DocBinPtrRst(doc,doc_e))
|
||||
@@ -468,36 +477,36 @@ CDocEntry *PrsDollarCmd(CDoc *doc,U8 *st)
|
||||
goto pd_err;
|
||||
break;
|
||||
case DOCEf_RAW_TYPE:
|
||||
if (lx->token==TK_IDENT) {
|
||||
j=DefineMatch(lx->cur_str,"ST_RAW_TYPES");
|
||||
if (cc->token==TK_IDENT) {
|
||||
j=DefineMatch(cc->cur_str,"ST_RAW_TYPES");
|
||||
if (j<0)
|
||||
goto pd_err;
|
||||
doc_e->raw_type=j;
|
||||
Lex(lx);
|
||||
Lex(cc);
|
||||
} else
|
||||
goto pd_err;
|
||||
break;
|
||||
case DOCEf_SHIFTED_X:
|
||||
if (lx->token)
|
||||
doc_e->type|=(LexExpressionI64(lx) & 0x1F)<<16;
|
||||
if (cc->token)
|
||||
doc_e->type|=(LexExpressionI64(cc) & 0x1F)<<16;
|
||||
else
|
||||
goto pd_err;
|
||||
break;
|
||||
case DOCEf_SHIFTED_Y:
|
||||
if (lx->token)
|
||||
doc_e->type|=(LexExpressionI64(lx) & 0x1F)<<21;
|
||||
if (cc->token)
|
||||
doc_e->type|=(LexExpressionI64(cc) & 0x1F)<<21;
|
||||
else
|
||||
goto pd_err;
|
||||
break;
|
||||
case DOCEf_SCROLLING_X:
|
||||
if (lx->token)
|
||||
doc_e->scroll_len=LexExpressionI64(lx);
|
||||
if (cc->token)
|
||||
doc_e->scroll_len=LexExpressionI64(cc);
|
||||
else
|
||||
goto pd_err;
|
||||
break;
|
||||
case DOCEf_USER_DATA:
|
||||
if (lx->token)
|
||||
doc_e->user_data=LexExpression(lx);
|
||||
if (cc->token)
|
||||
doc_e->user_data=LexExpression(cc);
|
||||
else
|
||||
goto pd_err;
|
||||
break;
|
||||
@@ -512,11 +521,12 @@ pd_err:
|
||||
doc_e->type=DOCT_ERROR;
|
||||
doc_e->de_flags=0;
|
||||
}
|
||||
if (doc_e->de_flags & DOCEF_LST && !(doc_e->de_flags & DOCEF_DATA_IS_PTR)) {
|
||||
if (doc_e->de_flags & DOCEF_LST &&
|
||||
!(doc_e->de_flags & DOCEF_DATA_IS_PTR)) {
|
||||
DocDataScan(doc,doc_e);
|
||||
DocDataFmt(doc,doc_e);
|
||||
}
|
||||
LexDel(lx);
|
||||
CmpCtrlDel(cc);
|
||||
} catch {
|
||||
Fs->catch_except=TRUE;
|
||||
if (!doc_e)
|
||||
@@ -537,40 +547,40 @@ public U0 DocInsEntry(CDoc *doc,CDocEntry *doc_e)
|
||||
doc_e->y=doc_ce->y;
|
||||
doc_e->page_line_num=doc_ce->page_line_num;
|
||||
MemCpy(&doc_e->settings,&doc_ce->settings,sizeof(CDocSettings));
|
||||
if (doc->cur_data_col>0 &&
|
||||
doc_ce->type_u8==DOCT_TEXT &&
|
||||
!(doc_ce->de_flags&(DOCEF_TAG_CB|DOCEF_DEFINE|
|
||||
if (doc->cur_col>0 &&
|
||||
doc_ce->type_u8==DOCT_TEXT &&
|
||||
!(doc_ce->de_flags&(DOCEF_TAG_CB|DOCEF_DEFINE|
|
||||
DOCEF_HTML_LINK|DOCEF_BIN_PTR_LINK)) &&
|
||||
doc->cur_data_col<doc_ce->max_col) {
|
||||
dst=doc_ce->tag+doc->cur_data_col;
|
||||
doc->cur_col<doc_ce->max_col) {
|
||||
dst=doc_ce->tag+doc->cur_col;
|
||||
doc_ne=DocEntryNew(doc,doc_ce,StrNew(dst,doc->mem_task));
|
||||
*dst=0;
|
||||
doc_ne->type=DOCT_TEXT|doc_ce->type&0xFFFFFF00;
|
||||
doc_ce->max_col=doc->cur_data_col;
|
||||
doc_ce->max_col=doc->cur_col;
|
||||
QueIns(doc_ne,doc_ce);
|
||||
doc->cur_data_col=0;
|
||||
doc->cur_col=0;
|
||||
doc_ce=doc_ne;
|
||||
}
|
||||
if (doc_ce->type_u8==DOCT_TEXT && doc->cur_data_col>=doc_ce->max_col) {
|
||||
if (doc_ce->type_u8==DOCT_TEXT && doc->cur_col>=doc_ce->max_col) {
|
||||
QueIns(doc_e,doc_ce);
|
||||
doc->cur_entry=doc_e->next;
|
||||
} else {
|
||||
QueIns(doc_e,doc_ce->last);
|
||||
doc->cur_entry=doc_ce;
|
||||
}
|
||||
doc->cur_data_col=doc->cur_entry->min_col;
|
||||
doc->cur_col=doc->cur_entry->min_col;
|
||||
DocRemSoftNewLines(doc,doc->cur_entry);
|
||||
if (unlock)
|
||||
DocUnlock(doc);
|
||||
}
|
||||
|
||||
#help_index "DolDoc/Output"
|
||||
#help_index "DolDoc/Output;StdOut/DolDoc"
|
||||
CDocEntry *DocPutS(CDoc *doc,U8 *st)
|
||||
{//Don't use this. Use $LK-UL,"DocPrint",A="MN:DocPrint"$().
|
||||
//Does not handle partial Doc entries
|
||||
//Does not handle partial Doc entries
|
||||
//Returns last newly created dollar-sign CDocEntry.
|
||||
U8 *ptr=st,*ptr2,*st2,*ptr3,*ptr4,*src,
|
||||
*char_bitmap;
|
||||
*char_bitmap;
|
||||
Bool unlock;
|
||||
I64 ch,j;
|
||||
CDocEntry *doc_e=NULL,*result=NULL,*doc_ce;
|
||||
@@ -578,11 +588,11 @@ CDocEntry *DocPutS(CDoc *doc,U8 *st)
|
||||
return NULL;
|
||||
unlock=DocLock(doc);
|
||||
if (doc->flags & DOCF_PLAIN_TEXT_WITH_TABS)
|
||||
char_bitmap=chars_bitmap_zero_cr_nl_cursor;
|
||||
char_bitmap=chars_bmp_zero_cr_nl_cursor;
|
||||
else if (doc->flags & DOCF_PLAIN_TEXT)
|
||||
char_bitmap=chars_bitmap_zero_tab_ff_cr_nl_cursor;
|
||||
char_bitmap=chars_bmp_zero_tab_ff_cr_nl_cursor;
|
||||
else
|
||||
char_bitmap=chars_bitmap_zero_tab_ff_cr_nl_cursor_dollar;
|
||||
char_bitmap=chars_bmp_zero_tab_ff_cr_nl_cursor_dollar;
|
||||
doc_ce=doc->cur_entry;
|
||||
while (*ptr) {
|
||||
ptr2=ptr;
|
||||
@@ -694,7 +704,8 @@ CDocEntry *DocPutS(CDoc *doc,U8 *st)
|
||||
DocInsEntry(doc,doc_e);
|
||||
} else if (ch==CH_FORM_FEED) {
|
||||
doc_e=CAlloc(sizeof(CDocEntryBase),doc->mem_task);
|
||||
doc_e->type=DOCT_PAGE_BREAK | doc->settings_root.dft_text_attr<<8;
|
||||
doc_e->type=DOCT_PAGE_BREAK |
|
||||
doc->settings_root.dft_text_attr<<8;
|
||||
doc_e->de_flags=doldoc.dft_de_flags[DOCT_PAGE_BREAK];
|
||||
DocInsEntry(doc,doc_e);
|
||||
} else
|
||||
|
||||
+109
-86
@@ -1,6 +1,7 @@
|
||||
#help_index "DolDoc"
|
||||
|
||||
public I64 DocEntryRun(CDoc *doc,CDocEntry *doc_e,Bool exited,I64 *_has_action=NULL)
|
||||
public I64 DocEntryRun(CDoc *doc,CDocEntry *doc_e,
|
||||
Bool exited,I64 *_has_action=NULL)
|
||||
{//Do action on final entry selected by user.
|
||||
//Sometimes returns locked, sometimes unlocked
|
||||
U8 ch=doc->cmd_U8,*st;
|
||||
@@ -52,9 +53,11 @@ public I64 DocEntryRun(CDoc *doc,CDocEntry *doc_e,Bool exited,I64 *_has_action=N
|
||||
}
|
||||
has_action=TRUE;
|
||||
}
|
||||
if (!exited && doc_e->de_flags & DOCEF_LST && doc_e->de_flags & DOCEF_DEFINE &&
|
||||
(temph=HashFind(doc_e->define_str,doc->win_task->hash_table,HTT_DEFINE_STR)) &&
|
||||
(result=PopUpPickLst(temph->data))!=DOCM_CANCEL) {
|
||||
if (!exited && doc_e->de_flags & DOCEF_LST &&
|
||||
doc_e->de_flags & DOCEF_DEFINE &&
|
||||
(temph=HashFind(doc_e->define_str,
|
||||
doc->win_task->hash_table,HTT_DEFINE_STR)) &&
|
||||
(result=PopUpPickLst(temph->data))!=DOCM_CANCEL) {
|
||||
DocDataFmt(doc,doc_e,result);
|
||||
DocDataScan(doc,doc_e);
|
||||
has_action=TRUE;
|
||||
@@ -150,7 +153,7 @@ U8 *EdDollarTypeCB(CDoc *,CDocEntry *doc_e,CTask *mem_task)
|
||||
{
|
||||
CDoc *doc=doc_e->user_data;
|
||||
U8 *src=DefineSub(doc->cur_entry->type_u8,"ST_DOC_CMDS"),
|
||||
*st=CAlloc(8,mem_task);
|
||||
*st=CAlloc(8,mem_task);
|
||||
if (doc->cur_entry==doc)
|
||||
src="EOF";
|
||||
else if (!src)
|
||||
@@ -168,7 +171,7 @@ public I64 DocGetKey(I64 *_sc=NULL)
|
||||
DocRecalc(DocPut);
|
||||
cont=FALSE;
|
||||
if (ch==CH_ESC || ch==CH_SHIFT_ESC) {//Check for exit filter mode
|
||||
Preempt(OFF);
|
||||
Preempt;
|
||||
if (DocPut && DocPut->find_replace->filter_lines) {
|
||||
EdUndoFilter(DocPut);
|
||||
cont=TRUE;
|
||||
@@ -180,7 +183,7 @@ public I64 DocGetKey(I64 *_sc=NULL)
|
||||
return ch;
|
||||
}
|
||||
|
||||
#help_index "DolDoc/Output"
|
||||
#help_index "DolDoc/Output;StdOut/DolDoc"
|
||||
public Bool View()
|
||||
{//Go live for user interaction until <ESC> or <SHIFT-ESC>.
|
||||
I64 ch;
|
||||
@@ -190,16 +193,16 @@ public Bool View()
|
||||
}
|
||||
|
||||
#help_index "DolDoc"
|
||||
public Bool DocDo(CDoc *doc,I64 dof_flags=0)
|
||||
public Bool DocEd(CDoc *doc,I64 dof_flags=0)
|
||||
{//Live for user interaction. End on <ESC> or <SHIFT-ESC>.
|
||||
CDoc *old_put_doc =DocPut,
|
||||
*old_display_doc=DocDisplay,
|
||||
*old_border_doc =DocBorder,*bdoc;
|
||||
*old_display_doc=DocDisplay,
|
||||
*old_border_doc =DocBorder,*bdoc;
|
||||
CDocEntry *doc_e;
|
||||
I64 old_attr=Fs->text_attr,
|
||||
old_top =Fs->win_top, old_bottom=Fs->win_bottom,
|
||||
old_left=Fs->win_left,old_right =Fs->win_right,
|
||||
old_title_src=Fs->title_src;
|
||||
old_top =Fs->win_top, old_bottom=Fs->win_bottom,
|
||||
old_left=Fs->win_left,old_right =Fs->win_right,
|
||||
old_title_src=Fs->title_src;
|
||||
Bool result,unlock,old_preempt;
|
||||
U8 *old_task_title;
|
||||
if (dof_flags&DOF_WIN_MAX)
|
||||
@@ -256,7 +259,7 @@ public Bool DocDo(CDoc *doc,I64 dof_flags=0)
|
||||
DocRecalc(doc);
|
||||
if (!(dof_flags&DOF_DONT_HOME))
|
||||
DocTop(doc);
|
||||
old_preempt=Preempt(OFF);
|
||||
old_preempt=Preempt;
|
||||
Fs->border_doc=bdoc;
|
||||
if (doc!=old_display_doc)
|
||||
doc->parent_doc=old_display_doc;
|
||||
@@ -279,7 +282,7 @@ public Bool DocDo(CDoc *doc,I64 dof_flags=0)
|
||||
}
|
||||
result=View;
|
||||
|
||||
Preempt(OFF);
|
||||
Preempt;
|
||||
DocLock(doc);
|
||||
if (result) {
|
||||
doc_e=doc->root.next;
|
||||
@@ -309,11 +312,10 @@ public Bool DocDo(CDoc *doc,I64 dof_flags=0)
|
||||
return result;
|
||||
}
|
||||
|
||||
#help_index "DolDoc/Input"
|
||||
public Bool DocFormDo(U8 *_d,U8 *class_name=lastclass,
|
||||
#help_index "DolDoc/Input;StdIn/DolDoc"
|
||||
public Bool DocForm(U8 *_d,U8 *class_name=lastclass,
|
||||
I64 dof_flags=0,U8 *header=NULL,U8 *footer=NULL)
|
||||
{//Supply a class name that has fmtstr definitions.
|
||||
//and this routine will allow user input.
|
||||
{//User input. Supply a class name that has fmtstr definitions.
|
||||
//See $LK,"::/Demo/DolDoc/Form.CPP"$ and $LK,"::/Demo/LastClass.CPP"$.
|
||||
CMemberLst *ml;
|
||||
CDocEntry *doc_e;
|
||||
@@ -344,7 +346,7 @@ public Bool DocFormDo(U8 *_d,U8 *class_name=lastclass,
|
||||
if (doc->root.next!=doc) {
|
||||
Fs->border_src=BDS_CONST;
|
||||
DocRecalc(doc);
|
||||
if (DocDo(doc,dof_flags)) {
|
||||
if (DocEd(doc,dof_flags)) {
|
||||
doc_e=doc->cur_entry;
|
||||
result=TRUE;
|
||||
if (doc_e!=doc) {
|
||||
@@ -359,25 +361,25 @@ public Bool DocFormDo(U8 *_d,U8 *class_name=lastclass,
|
||||
return result;
|
||||
}
|
||||
|
||||
U0 DocMenuDoEndTaskCB()
|
||||
U0 DocMenuEndTaskCB()
|
||||
{
|
||||
WinToTop;
|
||||
throw;
|
||||
}
|
||||
|
||||
public I64 DocMenuDo(CDoc *m,I64 dof_flags=0)
|
||||
{//Do (Run) menu chooser doc. (Returns menu doc unlocked.)
|
||||
public I64 DocMenu(CDoc *m,I64 dof_flags=0)
|
||||
{//Run menu chooser doc. Returns menu doc unlocked.
|
||||
U8 *old_end_cb=Fs->task_end_cb;
|
||||
Bool old_break_shift_esc=LBts(&Fs->task_flags,TASKf_BREAK_TO_SHIFT_ESC);
|
||||
CDocEntry *doc_e;
|
||||
I64 old_border_src=Fs->border_src,result=DOCM_CANCEL,has_action;
|
||||
Fs->task_end_cb=&DocMenuDoEndTaskCB;
|
||||
Fs->task_end_cb=&DocMenuEndTaskCB;
|
||||
try {
|
||||
if (m) {
|
||||
m->desc='Menu';
|
||||
Fs->border_src=BDS_CONST;
|
||||
md_restart:
|
||||
if (DocDo(m,dof_flags)) {
|
||||
dm_restart:
|
||||
if (DocEd(m,dof_flags)) {
|
||||
doc_e=m->cur_entry;
|
||||
if (doc_e!=m) {
|
||||
result=DocEntryRun(m,doc_e,TRUE,&has_action);
|
||||
@@ -385,7 +387,7 @@ md_restart:
|
||||
if (!has_action) {
|
||||
result=DOCM_CANCEL;
|
||||
dof_flags|=DOF_DONT_HOME;
|
||||
goto md_restart;
|
||||
goto dm_restart;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -412,10 +414,10 @@ public I64 PopUpEd(U8 *filename,CTask *parent=NULL,CTask **_pu_task=NULL)
|
||||
return result;
|
||||
}
|
||||
|
||||
#help_index "DolDoc/Output"
|
||||
#help_index "DolDoc/Output;StdOut/DolDoc"
|
||||
public CTask *PopUpViewDoc(CDoc *doc,I64 dof_flags=0)
|
||||
{//Pass doc to PopUp win task for viewing.
|
||||
U8 *buf=MStrPrint("Preempt(ON);DocDo(0x%X,0x%X);",doc,dof_flags);
|
||||
U8 *buf=MStrPrint("Preempt(ON);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);
|
||||
Free(buf);
|
||||
@@ -441,21 +443,21 @@ public CTask *PopUpViewPrint(U8 *fmt,...)
|
||||
return task;
|
||||
}
|
||||
|
||||
#help_index "DolDoc/Input"
|
||||
#help_index "DolDoc/Input;StdIn/DolDoc"
|
||||
public I64 PopUpMenu(CDoc *doc,I64 dof_flags=0)
|
||||
{//Do (Run) menu chooser doc in PopUp win task.
|
||||
{//Run menu chooser doc in PopUp win task.
|
||||
doc->flags|=DOCF_MIN_SIZE | DOCF_FORM;
|
||||
return PopUpPrint("DocMenuDo(0x%X,0x%X);",doc,dof_flags);
|
||||
return PopUpPrint("DocMenu(0x%X,0x%X);",doc,dof_flags);
|
||||
}
|
||||
|
||||
public Bool PopUpForm(U8 *_d,U8 *class_name=lastclass,I64 dof_flags=DOF_MIN_SIZE,
|
||||
U8 *header=NULL,U8 *footer=NULL)
|
||||
public Bool PopUpForm(U8 *_d,U8 *class_name=lastclass,
|
||||
I64 dof_flags=DOF_MIN_SIZE,U8 *header=NULL,U8 *footer=NULL)
|
||||
{//See $LK,"::/Demo/DolDoc/Form.CPP"$ and $LK,"::/Demo/LastClass.CPP"$.
|
||||
return PopUpPrint("DocFormDo(0x%X,0x%X,0x%X,0x%X,0x%X);",_d,class_name,
|
||||
dof_flags,header,footer);
|
||||
return PopUpPrint("DocForm(0x%X,0x%X,0x%X,0x%X,0x%X);",_d,class_name,
|
||||
dof_flags,header,footer);
|
||||
}
|
||||
|
||||
#help_index "DolDoc/Input;File/FileNames"
|
||||
#help_index "DolDoc/Input;File/FileNames;StdIn/DolDoc"
|
||||
public U8 *PopUpPickFile(U8 *dir=NULL)
|
||||
{//Filename chooser. Uses $LK,"FileMgr",A="MN:FileMgr"$().
|
||||
U8 *result,*st,*st2;
|
||||
@@ -493,7 +495,7 @@ public U8 *FileNameForm(U8 *dft=NULL,I64 dof_flags=0,CTask *mem_task=NULL)
|
||||
StrCpy(fn.name,dft);
|
||||
else
|
||||
*fn.name=0;
|
||||
if (DocFormDo(&fn,,dof_flags))
|
||||
if (DocForm(&fn,,dof_flags))
|
||||
return StrNew(fn.name,mem_task);
|
||||
else
|
||||
return NULL;
|
||||
@@ -501,8 +503,8 @@ public U8 *FileNameForm(U8 *dft=NULL,I64 dof_flags=0,CTask *mem_task=NULL)
|
||||
|
||||
public U8 *PopUpFileName(U8 *dft=NULL,I64 dof_flags=0)
|
||||
{//Filename chooser. Uses form, not $LK,"FileMgr",A="MN:FileMgr"$().
|
||||
U8 *st=MStrPrint("FileNameForm(\"%Q\",0x%X,Fs->parent_task);",dft,dof_flags|DOF_MIN_SIZE),
|
||||
*result=PopUp(st,Fs);
|
||||
U8 *st=MStrPrint("FileNameForm(\"%Q\",0x%X,Fs->parent_task);",
|
||||
dft,dof_flags|DOF_MIN_SIZE),*result=PopUp(st,Fs);
|
||||
Free(st);
|
||||
return result;
|
||||
}
|
||||
@@ -520,7 +522,7 @@ Bool PopUpCd()
|
||||
return result;
|
||||
}
|
||||
|
||||
#help_index "DolDoc/Input;Char/Lists"
|
||||
#help_index "DolDoc/Input;Char/Lists;StdIn/DolDoc"
|
||||
public U8 *PopUpPickLst(U8 *lst)
|
||||
{//Prompt for lst entry in PopUp win task.
|
||||
I64 i=0;
|
||||
@@ -545,7 +547,7 @@ public U8 *PopUpPickDefineSub(U8 *st)
|
||||
return PopUpPickLst(Define(st));
|
||||
}
|
||||
|
||||
#help_index "DolDoc/Input"
|
||||
#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.
|
||||
I64 i,l1=StrLen(b1);
|
||||
@@ -611,7 +613,7 @@ I64 PopUpReplaceSkipAllCancel(U8 *header=NULL,U8 *footer=NULL)
|
||||
return i;
|
||||
}
|
||||
|
||||
U8 *DoPopUpGetStr(U8 *header,CTask *mem_task)
|
||||
U8 *PopUpGetStr2(U8 *header,CTask *mem_task)
|
||||
{
|
||||
U8 *result,*st;
|
||||
if (header)
|
||||
@@ -624,8 +626,8 @@ U8 *DoPopUpGetStr(U8 *header,CTask *mem_task)
|
||||
|
||||
public U8 *PopUpGetStr(U8 *header=NULL)
|
||||
{//Prompt for text str in PopUp win task.
|
||||
U8 *st=MStrPrint("DoPopUpGetStr(0x%X,0x%X);",header,Fs),
|
||||
*result=PopUp(st,Fs);
|
||||
U8 *st=MStrPrint("PopUpGetStr2(0x%X,0x%X);",header,Fs),
|
||||
*result=PopUp(st,Fs);
|
||||
Free(st);
|
||||
return result;
|
||||
}
|
||||
@@ -638,7 +640,16 @@ public I64 PopUpGetI64(U8 *msg,I64 dft,I64 lo=MIN_I64,I64 hi=MAX_I64)
|
||||
return result;
|
||||
}
|
||||
|
||||
public I64 PopUpRangeI64(I64 lo,I64 hi,I64 step=1,U8 *header=NULL,U8 *footer=NULL)
|
||||
public F64 PopUpGetF64(U8 *msg,F64 dft,F64 lo=MIN_F64,F64 hi=MAX_F64)
|
||||
{//Prompt for F64 text expression in PopUp win task.
|
||||
U8 *st=MStrPrint("GetF64(0x%X,0x%X(F64),0x%X(F64),0x%X(F64));",msg,dft,lo,hi);
|
||||
F64 result=PopUp(st,Fs)(F64);
|
||||
Free(st);
|
||||
return result;
|
||||
}
|
||||
|
||||
public I64 PopUpRangeI64(I64 lo,I64 hi,I64 step=1,
|
||||
U8 *header=NULL,U8 *footer=NULL)
|
||||
{//Evenly-spaced I64 range chooser in PopUp win task.
|
||||
I64 i;
|
||||
CDoc *doc=DocNew;
|
||||
@@ -659,7 +670,7 @@ public F64 PopUpRangeF64(F64 lo,F64 hi,F64 step,
|
||||
{//Evenly-spaced F64 range chooser in PopUp win task.
|
||||
F64 d;
|
||||
I64 i;
|
||||
U8 buf[136];
|
||||
U8 buf[STR_LEN];
|
||||
CDoc *doc=DocNew;
|
||||
if (header)
|
||||
DocPrint(doc,"%s",header);
|
||||
@@ -680,7 +691,7 @@ public F64 PopUpRangeF64Exp(F64 lo,F64 hi,F64 factor,
|
||||
{//Exp-spaced F64 range chooser in PopUp win task.
|
||||
F64 d;
|
||||
I64 i;
|
||||
U8 buf[136];
|
||||
U8 buf[STR_LEN];
|
||||
CDoc *doc=DocNew;
|
||||
if (header)
|
||||
DocPrint(doc,"%s",header);
|
||||
@@ -707,11 +718,11 @@ public I64 AdamFile(U8 *filename,Bool warn_ext=TRUE)
|
||||
{//Tell adam task to compile and run a file.
|
||||
Bool okay=TRUE;
|
||||
U8 *name=FileNameAbs(filename),
|
||||
*name2=DftExt(name,"CPP.Z");
|
||||
*name2=DftExt(name,"CPP.Z");
|
||||
I64 result=0;
|
||||
if (warn_ext &&
|
||||
!FilesFindMatch(name2,FILEMASK_JIT) &&
|
||||
!PopUpCancelOk(ST_WARN_ST "Not .CPP File\n\n"))
|
||||
!FilesFindMatch(name2,FILEMASK_JIT) &&
|
||||
!PopUpCancelOk(ST_WARN_ST "Not .CPP File\n\n"))
|
||||
okay=FALSE;
|
||||
if (okay)
|
||||
result=Adam("#include \"%s\";",name2);
|
||||
@@ -720,18 +731,21 @@ public I64 AdamFile(U8 *filename,Bool warn_ext=TRUE)
|
||||
return result;
|
||||
}
|
||||
|
||||
public I64 PopUpFile(U8 *filename,Bool warn_ext=TRUE,CTask *parent=NULL,CTask **_pu_task=NULL)
|
||||
public I64 PopUpFile(U8 *filename,Bool warn_ext=TRUE,
|
||||
CTask *parent=NULL,CTask **_pu_task=NULL)
|
||||
{//Run code file in PopUp win task.
|
||||
Bool okay=TRUE;
|
||||
U8 *st,*name=FileNameAbs(filename),
|
||||
*name2=DftExt(name,"CPP.Z");
|
||||
*name2=DftExt(name,"CPP.Z");
|
||||
I64 result=0;
|
||||
if (warn_ext &&
|
||||
!FilesFindMatch(name2,FILEMASK_JIT) &&
|
||||
!PopUpCancelOk(ST_WARN_ST "Not .CPP File\n\n"))
|
||||
!FilesFindMatch(name2,FILEMASK_JIT) &&
|
||||
!PopUpCancelOk(ST_WARN_ST "Not .CPP File\n\n"))
|
||||
okay=FALSE;
|
||||
if (okay) {
|
||||
st=MStrPrint("\"$$$$WW+H,1$$$$\";Auto(\"ExeFile2(\\\"%s\\\");\\n\");UserTaskCont;",name2);
|
||||
st=MStrPrint(
|
||||
"\"$$$$WW+H,1$$$$\";Auto(\"ExeFile2(\\\"%s\\\");\\n\");UserTaskCont;",
|
||||
name2);
|
||||
result=PopUp(st,parent,_pu_task);
|
||||
Free(st);
|
||||
}
|
||||
@@ -741,7 +755,8 @@ public I64 PopUpFile(U8 *filename,Bool warn_ext=TRUE,CTask *parent=NULL,CTask **
|
||||
}
|
||||
|
||||
#help_index "Graphics/Input"
|
||||
public I64 PopUpColor(U8 *header=NULL,Bool allow_transparent=TRUE,Bool allow_dft=TRUE)
|
||||
public I64 PopUpColor(U8 *header=NULL,
|
||||
Bool allow_transparent=TRUE,Bool allow_dft=TRUE)
|
||||
{//Chooser for 16-color, default or transparent.
|
||||
I64 i;
|
||||
CDoc *doc=DocNew;
|
||||
@@ -749,7 +764,7 @@ public I64 PopUpColor(U8 *header=NULL,Bool allow_transparent=TRUE,Bool allow_dft
|
||||
DocPrint(doc,"%s",header);
|
||||
if (allow_transparent)
|
||||
DocPrint(doc,"$$MU,\"TRANSPARENT\",LE=TRANSPARENT$$\n");
|
||||
for (i=0;i<16;i++)
|
||||
for (i=0;i<NUM_COLORS;i++)
|
||||
DocPrint(doc,"$$BG,%d$$$$MU,\"__%-8Z__\",LE=%d$$$$BG$$\n",i,i,"ST_COLORS",i);
|
||||
if (allow_dft)
|
||||
DocPrint(doc,"$$BG,WHITE$$$$MU,\"DEFAULT\",LE=DOC_DFT$$$$BG$$");
|
||||
@@ -759,27 +774,32 @@ public I64 PopUpColor(U8 *header=NULL,Bool allow_transparent=TRUE,Bool allow_dft
|
||||
}
|
||||
|
||||
public I64 PopUpColorLighting(U8 *header=NULL)
|
||||
{//Chooser for std TempleOS $LK,"GrLighting",A="MN:GrLighting"$() color.
|
||||
{//Chooser for std TempleOS $LK,"DCLighting",A="MN:DCLighting"$() color.
|
||||
I64 i;
|
||||
CDoc *doc=DocNew;
|
||||
if (header)
|
||||
DocPrint(doc,"%s",header);
|
||||
DocPrint(doc,"\nSingle-Sided means both sides same color."
|
||||
"\nDouble-Sided means back side darker."
|
||||
"\n"
|
||||
"\nHalf-Range means 0 to [0,7]"
|
||||
"\n [8,15]-8 to [8,15]"
|
||||
"\nFull-Range means 0 to [0,7] to [0,7]+8"
|
||||
"\n");
|
||||
DocPrint(doc,"\n$$LTPURPLE$$Single-Sided Full-Range Double-Sided Full-Range\n$$BLACK$$");
|
||||
for (i=0;i<8;i++) {
|
||||
"\nDouble-Sided means back side darker."
|
||||
"\n"
|
||||
"\nHalf-Range means 0 to [0,7]"
|
||||
"\n [8,15]-8 to [8,15]"
|
||||
"\nFull-Range means 0 to [0,7] to [0,7]+8"
|
||||
"\n");
|
||||
DocPrint(doc,
|
||||
"\n$$LTPURPLE$$Single-Sided Full-Range Double-Sided Full-Range\n$$BLACK$$");
|
||||
for (i=0;i<NUM_COLORS/2;i++) {
|
||||
DocPrint(doc,"$$BG,%d$$$$MU,\"__%-19Z__\",LE=%d$$$$BG$$ ",i,i,"ST_COLORS",i);
|
||||
DocPrint(doc,"$$BG,%d$$$$MU,\"__%-19Z__\",LE=%d$$$$BG$$\n",i,i,"ST_COLORS",ROPF_TWO_SIDED+i);
|
||||
DocPrint(doc,"$$BG,%d$$$$MU,\"__%-19Z__\",LE=%d$$$$BG$$\n",i,i,"ST_COLORS",
|
||||
ROPF_TWO_SIDED+i);
|
||||
}
|
||||
DocPrint(doc,"\n$$LTPURPLE$$Single-Sided Half-Range Double-Sided Half-Range\n$$BLACK$$");
|
||||
for (i=0;i<16;i++) {
|
||||
DocPrint(doc,"$$BG,%d$$$$MU,\"__%-19Z__\",LE=%d$$$$BG$$ ",i,i,"ST_COLORS",ROPF_HALF_RANGE_COLOR+i);
|
||||
DocPrint(doc,"$$BG,%d$$$$MU,\"__%-19Z__\",LE=%d$$$$BG$$\n",i,i,"ST_COLORS",ROPF_TWO_SIDED+ROPF_HALF_RANGE_COLOR+i);
|
||||
DocPrint(doc,
|
||||
"\n$$LTPURPLE$$Single-Sided Half-Range Double-Sided Half-Range\n$$BLACK$$");
|
||||
for (i=0;i<NUM_COLORS;i++) {
|
||||
DocPrint(doc,"$$BG,%d$$$$MU,\"__%-19Z__\",LE=%d$$$$BG$$ ",
|
||||
i,i,"ST_COLORS",ROPF_HALF_RANGE_COLOR+i);
|
||||
DocPrint(doc,"$$BG,%d$$$$MU,\"__%-19Z__\",LE=%d$$$$BG$$\n",
|
||||
i,i,"ST_COLORS",ROPF_TWO_SIDED+ROPF_HALF_RANGE_COLOR+i);
|
||||
}
|
||||
i=PopUpMenu(doc);
|
||||
DocDel(doc);
|
||||
@@ -791,7 +811,8 @@ class CTransformForm
|
||||
F64 x_scale fmtstr "$$DA-TRM,32,RT=F64,A=\"X Scale :%12.6f\"$$\n";
|
||||
F64 y_scale fmtstr "$$DA-TRM,32,RT=F64,A=\"Y Scale :%12.6f\"$$\n";
|
||||
F64 z_scale fmtstr "$$DA-TRM,32,RT=F64,A=\"Z Scale :%12.6f\"$$\n";
|
||||
F64 é_z fmtstr "\nAngles are in degrees\n$$DA-TRM,32,RT=F64,A=\"Z-Axis :%12.6f\"$$\n";
|
||||
F64 é_z fmtstr
|
||||
"\nAngles are in degrees\n$$DA-TRM,32,RT=F64,A=\"Z-Axis :%12.6f\"$$\n";
|
||||
F64 é_y fmtstr "$$DA-TRM,32,RT=F64,A=\"Y-Axis :%12.6f\"$$\n";
|
||||
F64 é_x fmtstr "$$DA-TRM,32,RT=F64,A=\"X-Axis :%12.6f\"$$\n";
|
||||
F64 x_offset fmtstr "\n$$DA-TRM,32,RT=F64,A=\"X Offset:%12.6f\"$$\n";
|
||||
@@ -818,9 +839,9 @@ Bool PopUpTransform(I64 *r)
|
||||
r[10]=tf->z_scale*GR_SCALE;
|
||||
r[15]=GR_SCALE;
|
||||
|
||||
GrRotZEqu(r,tf->é_z*ã/180.0);
|
||||
GrRotYEqu(r,tf->é_y*ã/180.0);
|
||||
GrRotXEqu(r,tf->é_x*ã/180.0);
|
||||
Mat4x4RotZ(r,tf->é_z*ã/180.0);
|
||||
Mat4x4RotY(r,tf->é_y*ã/180.0);
|
||||
Mat4x4RotX(r,tf->é_x*ã/180.0);
|
||||
|
||||
r[3] =tf->x_offset*GR_SCALE;
|
||||
r[7] =tf->y_offset*GR_SCALE;
|
||||
@@ -846,21 +867,23 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
else
|
||||
i1=TRANSPARENT;
|
||||
dc->color=j1+i1<<16+ROPF_DITHER;
|
||||
GrRect(dc,i*PU_SPACING,j*PU_SPACING+FramePtr("DitherDoFrame",task),PU_SPACING,PU_SPACING);
|
||||
GrRect(dc,i*PU_SPACING,j*PU_SPACING+FramePtr("DitherFrame",task),
|
||||
PU_SPACING,PU_SPACING);
|
||||
}
|
||||
i=(17*PU_SPACING+FONT_WIDTH-1)/FONT_WIDTH;
|
||||
if (doc->max_x>i) i=doc->max_x;
|
||||
WinHorz(task->win_left,task->win_left+i,task);
|
||||
WinVert(task->win_top,task->win_top+doc->max_y+(17*PU_SPACING+FONT_WIDTH-1)/FONT_WIDTH,task);
|
||||
WinVert(task->win_top,task->win_top+doc->max_y+
|
||||
(17*PU_SPACING+FONT_WIDTH-1)/FONT_WIDTH,task);
|
||||
}
|
||||
|
||||
I64 DitherColorDo(U8 *header=NULL)
|
||||
I64 DitherColor2(U8 *header=NULL)
|
||||
{
|
||||
I64 msg_code,a1,a2,result=-1,i,j;
|
||||
DocClear;
|
||||
"%s",header;
|
||||
DocRecalc(DocPut);
|
||||
FramePtrAdd("DitherDoFrame",(DocPut->max_y+1)*FONT_HEIGHT);
|
||||
FramePtrAdd("DitherFrame",(DocPut->max_y+1)*FONT_HEIGHT);
|
||||
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
|
||||
Fs->draw_it=&DrawIt;
|
||||
do {
|
||||
@@ -868,26 +891,26 @@ I64 DitherColorDo(U8 *header=NULL)
|
||||
if (msg_code==MSG_IP_L_DOWN) {
|
||||
msg_code=GetMsg(&a1,&a2,1<<MSG_IP_L_UP);
|
||||
i=a1/PU_SPACING;
|
||||
j=(a2-FramePtr("DitherDoFrame"))/PU_SPACING;
|
||||
j=(a2-FramePtr("DitherFrame"))/PU_SPACING;
|
||||
if (a1>=0 && a2>=0 && 0<=j<17 && 0<=i<17) {
|
||||
if (j==16) j=TRANSPARENT;
|
||||
if (i==16) i=TRANSPARENT;
|
||||
result=j+i<<16+ROPF_DITHER;
|
||||
goto dcd_done;
|
||||
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);
|
||||
dcd_done:
|
||||
dc_done:
|
||||
SettingsPop;
|
||||
FramePtrDel("DitherDoFrame");
|
||||
FramePtrDel("DitherFrame");
|
||||
return result;
|
||||
}
|
||||
|
||||
public I64 PopUpColorDither(U8 *header=NULL)
|
||||
{//Chooser for 2 x 16 colors or transparent.
|
||||
U8 buf[136];
|
||||
StrPrint(buf,"DitherColorDo(0x%X);",header);
|
||||
U8 buf[STR_LEN];
|
||||
StrPrint(buf,"DitherColor2(0x%X);",header);
|
||||
return PopUp(buf,Fs);
|
||||
}
|
||||
+10
-10
@@ -16,7 +16,7 @@ public U0 DocCenter(CDoc *doc=NULL,I64 recalc=DOC_RECALC)
|
||||
task=doc->win_task;
|
||||
DocRecalc(doc,FALSE,recalc);
|
||||
if (!(doc->flags&DOCF_BORDER_DOC))
|
||||
doc->cur_top_line_num=doc->y-(task->win_height+1)>>1;
|
||||
doc->top_line_num=doc->y-(task->win_height+1)>>1;
|
||||
if (unlock)
|
||||
DocUnlock(doc);
|
||||
}
|
||||
@@ -29,7 +29,7 @@ U0 DocDelToNum(CDoc *doc,I64 num)
|
||||
if (!(doc_e->de_flags & (DOCEF_HOLD|DOCEF_FILTER_SKIP))) {
|
||||
if (doc_e==doc->cur_entry) {
|
||||
doc->cur_entry=doc_e2;
|
||||
doc->cur_data_col=doc_e2->min_col;
|
||||
doc->cur_col=doc_e2->min_col;
|
||||
}
|
||||
DocEntryDel(doc,doc_e);
|
||||
}
|
||||
@@ -45,7 +45,7 @@ U0 DocDelToEntry(CDoc *doc,CDocEntry *clear_entry)
|
||||
if (!(doc_e->de_flags & (DOCEF_HOLD|DOCEF_FILTER_SKIP))) {
|
||||
if (doc_e==doc->cur_entry) {
|
||||
doc->cur_entry=doc_e2;
|
||||
doc->cur_data_col=doc_e2->min_col;
|
||||
doc->cur_col=doc_e2->min_col;
|
||||
}
|
||||
DocEntryDel(doc,doc_e);
|
||||
}
|
||||
@@ -62,7 +62,7 @@ U0 DocBorderLstDraw(CDoc *doc)
|
||||
U64 ch;
|
||||
CDoc *templ=doc;
|
||||
CD3I64 saved_scroll;
|
||||
Bool old_preempt=Preempt(OFF);
|
||||
Bool old_preempt=Preempt;
|
||||
while (templ && templ->doc_signature==DOC_SIGNATURE_VAL) {
|
||||
y+=(Bsr(templ->desc)+7)>>3+1; //StrLen+1
|
||||
templ=templ->parent_doc;
|
||||
@@ -94,7 +94,7 @@ public U0 DocBottom(CDoc *doc=NULL)
|
||||
return;
|
||||
unlock=DocLock(doc);
|
||||
doc->cur_entry=doc;
|
||||
doc->cur_data_col=0;
|
||||
doc->cur_col=0;
|
||||
DocRecalc(doc);
|
||||
if (unlock)
|
||||
DocUnlock(doc);
|
||||
@@ -145,7 +145,7 @@ public U0 DocCollapse(Bool collapse=TRUE,CDoc *doc=NULL)
|
||||
DocUnlock(doc);
|
||||
}
|
||||
|
||||
#help_index "DolDoc/Output"
|
||||
#help_index "DolDoc/Output;StdOut/DolDoc"
|
||||
public U0 DocPrintAtomic(CDoc *doc,U8 *fmt,...)
|
||||
{//Necessary when hidden text might screw-up
|
||||
//inserts. It does multiple whole doc cmds all-at-once.
|
||||
@@ -166,13 +166,13 @@ public U0 DocPrintAtomic(CDoc *doc,U8 *fmt,...)
|
||||
Free(buf);
|
||||
}
|
||||
|
||||
#help_index "DolDoc/Task"
|
||||
#help_index "DolDoc/Task;StdOut/Task"
|
||||
U0 DocUpdateTaskDocs(CTask *task)
|
||||
{//This is called from $LK,"GrUpdateWins",A="MN:GrUpdateWins"$() by the winmgr at 30fps.
|
||||
{//This is called from $LK,"GrUpdateTaskWin",A="MN:GrUpdateTaskWin"$() by the winmgr at 30fps.
|
||||
CDrv *dv;
|
||||
CDoc *doc;
|
||||
CD3I64 saved_scroll;
|
||||
Bool old_preempt=Preempt(OFF);
|
||||
Bool old_preempt=Preempt;
|
||||
I64 border_attr;
|
||||
if (task->border_src==BDS_CUR_DRV && task->cur_dv) {
|
||||
border_attr=task->cur_dv->text_attr;
|
||||
@@ -195,7 +195,7 @@ U0 DocUpdateTaskDocs(CTask *task)
|
||||
MemCpy(task->task_title,doc->filename.name,TASK_TITLE_LEN);
|
||||
Preempt(old_preempt);
|
||||
DocRecalc(doc,TRUE,DOC_RECALC_TO_SCREEN);
|
||||
Preempt(OFF);
|
||||
Preempt;
|
||||
}
|
||||
if ((doc=DocBorder(task)) && !(doc->flags&DOCF_DONT_SHOW)) {
|
||||
WinScrollNull(task,&saved_scroll);
|
||||
|
||||
+104
-79
@@ -17,7 +17,7 @@ I64 DocWordWrapDel(CDoc *doc,CDocEntry *doc_e,
|
||||
if (doc_e2->type_u8==DOCT_SOFT_NEW_LINE && !same_win) {
|
||||
if (doc->cur_entry==doc_e2) {
|
||||
doc->cur_entry=doc_e2->next;
|
||||
doc->cur_data_col=doc->cur_entry->min_col;
|
||||
doc->cur_col=doc->cur_entry->min_col;
|
||||
}
|
||||
if (*_best_doc_e==doc_e2) {
|
||||
*_best_doc_e=doc_e2->next;
|
||||
@@ -34,7 +34,7 @@ I64 DocWordWrapDel(CDoc *doc,CDocEntry *doc_e,
|
||||
doc_e->tag=ptr;
|
||||
if (doc->cur_entry==doc_e2) {
|
||||
doc->cur_entry=doc_e;
|
||||
doc->cur_data_col+=k;
|
||||
doc->cur_col+=k;
|
||||
}
|
||||
if (*_best_doc_e==doc_e2) {
|
||||
*_best_doc_e=doc_e;
|
||||
@@ -94,7 +94,7 @@ U0 DocRecalcXY(CDoc *doc,CDocEntry *doc_e,
|
||||
doc->page_line_num+=y-i;
|
||||
if (doc->page_line_num<0)
|
||||
doc->page_line_num=doc_e->settings.page_len+
|
||||
doc->page_line_num%doc_e->settings.page_len;
|
||||
doc->page_line_num%doc_e->settings.page_len;
|
||||
else
|
||||
doc->page_line_num=doc->page_line_num%doc_e->settings.page_len;
|
||||
if (doc_e->settings.header!=DOC_DFT &&
|
||||
@@ -112,7 +112,8 @@ U0 DocRecalcXY(CDoc *doc,CDocEntry *doc_e,
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (doc->page_line_num>=doc_e->settings.page_len-doc_e->settings.footer) {
|
||||
if (doc->page_line_num>=
|
||||
doc_e->settings.page_len-doc_e->settings.footer) {
|
||||
y+=doc_e->settings.footer;
|
||||
if (doc_e->settings.header==DOC_DFT)
|
||||
doc->page_line_num=0;
|
||||
@@ -137,10 +138,10 @@ CDocEntry *DocWordWrapAdd(CDoc *doc,CDocEntry *doc_e,
|
||||
ii=x+1-doc_e->settings.left_margin;
|
||||
if (IsEditableText(doc_e)) {
|
||||
if (doc->cur_entry==doc_e->next) {
|
||||
if (doc->cur_data_col==doc_e->next->min_col)
|
||||
if (doc->cur_col==doc_e->next->min_col)
|
||||
i--;
|
||||
} else {
|
||||
if (doc->cur_entry==doc_e && doc->cur_data_col==i)
|
||||
if (doc->cur_entry==doc_e && doc->cur_col==i)
|
||||
i--;
|
||||
}
|
||||
if (*_k>i) {
|
||||
@@ -154,9 +155,9 @@ CDocEntry *DocWordWrapAdd(CDoc *doc,CDocEntry *doc_e,
|
||||
doc_e2=MAllocIdentical(doc_e,doc->mem_task);
|
||||
doc_e2->tag=StrNew(doc_e->tag+i,doc->mem_task);
|
||||
QueIns(doc_e2,doc_e);
|
||||
if (doc->cur_entry==doc_e && doc->cur_data_col>=i) {
|
||||
if (doc->cur_entry==doc_e && doc->cur_col>=i) {
|
||||
doc->cur_entry=doc_e2;
|
||||
doc->cur_data_col=doc->cur_data_col-i;
|
||||
doc->cur_col=doc->cur_col-i;
|
||||
}
|
||||
doc_e->tag[i]=0;
|
||||
ptr=StrNew(doc_e->tag,doc->mem_task);
|
||||
@@ -164,7 +165,8 @@ CDocEntry *DocWordWrapAdd(CDoc *doc,CDocEntry *doc_e,
|
||||
doc_e->tag=ptr;
|
||||
doc_e2=CAlloc(sizeof(CDocEntryBase),doc->mem_task);
|
||||
doc_e2->type=DOCT_SOFT_NEW_LINE | doc_e->type & 0xFFFFFF00;
|
||||
doc_e2->de_flags=doc_e->de_flags&~DOCEF_TAG|doldoc.dft_de_flags[DOCT_SOFT_NEW_LINE];
|
||||
doc_e2->de_flags=doc_e->de_flags
|
||||
&~DOCEF_TAG|doldoc.dft_de_flags[DOCT_SOFT_NEW_LINE];
|
||||
doc_e2->x=x;
|
||||
doc_e2->y=y;
|
||||
doc_e2->page_line_num=doc_e->page_line_num;
|
||||
@@ -185,7 +187,8 @@ CDocEntry *DocWordWrapAdd(CDoc *doc,CDocEntry *doc_e,
|
||||
doc_e2=CAlloc(sizeof(CDocEntryBase),doc->mem_task);
|
||||
doc_e2->type=DOCT_SOFT_NEW_LINE | doc_e->type & 0xFFFFFF00;
|
||||
doc_e2->de_flags=DOCEF_WORD_WRAP|doldoc.dft_de_flags[DOCT_SOFT_NEW_LINE]|
|
||||
doc_e->de_flags & (DOCEF_HIGHLIGHT|DOCG_BL_IV_UL|DOCEF_SKIP|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP);
|
||||
doc_e->de_flags&(DOCEF_HIGHLIGHT|DOCG_BL_IV_UL|
|
||||
DOCEF_SKIP|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP);
|
||||
doc_e2->x=x;
|
||||
doc_e2->y=y;
|
||||
doc_e2->page_line_num=doc_e->last->page_line_num;
|
||||
@@ -202,7 +205,9 @@ I64 DocTempAttr(CDoc *doc,CDocEntry *doc_e,I64 cur_u8_attr)
|
||||
I64 temp_u32_attr;
|
||||
doc_e->de_flags=doc->flags& (DOCG_BL_IV_UL|DOCEF_WORD_WRAP|DOCEF_HIGHLIGHT) |
|
||||
doc_e->de_flags&~(DOCG_BL_IV_UL|DOCEF_WORD_WRAP|DOCEF_HIGHLIGHT);
|
||||
temp_u32_attr=(cur_u8_attr&0xF0)<<8|doc->flags&DOCG_BL_IV_UL|(doc_e->settings.shifted_x&0x1F)<<16|(doc_e->settings.shifted_y&0x1F)<<21;
|
||||
temp_u32_attr=(cur_u8_attr&0xF0)<<8|
|
||||
doc->flags&DOCG_BL_IV_UL|(doc_e->settings.shifted_x&0x1F)<<16|
|
||||
(doc_e->settings.shifted_y&0x1F)<<21;
|
||||
if (doc_e->de_flags & DOCEF_HAS_BIN && *doc_e->tag=='<')
|
||||
temp_u32_attr.u8[1]|=DOC_COLOR_BIN;
|
||||
else
|
||||
@@ -259,7 +264,7 @@ public Bool DocRecalc(CDoc *doc,Bool has_cursor=FALSE,I64 recalc=DOC_RECALC)
|
||||
find_cursor=FALSE,blink_flag,full_refresh=TRUE,unlock;
|
||||
CTask *win_task,*mem_task;
|
||||
CDC *dc;
|
||||
U8 *bptr,*ptr,buf[136],ch;
|
||||
U8 *bptr,*ptr,buf[STR_LEN],ch;
|
||||
U32 *u32_ptr,*hl;
|
||||
I32 *depth_buf=NULL;
|
||||
F64 cur_time=tS;
|
||||
@@ -340,11 +345,12 @@ public Bool DocRecalc(CDoc *doc,Bool has_cursor=FALSE,I64 recalc=DOC_RECALC)
|
||||
hss=&win_task->horz_scroll;
|
||||
vss=&win_task->vert_scroll;
|
||||
if (doc->flags&DOCF_BORDER_DOC) {
|
||||
doc->cur_top_line_num=0;
|
||||
doc->top_line_num=0;
|
||||
doc->line_start_col=0;
|
||||
has_cursor=FALSE;
|
||||
if (recalc==DOC_RECALC_TO_SCREEN)
|
||||
doc->settings_root.cur_text_attr=doc->settings_root.dft_text_attr=win_task->border_attr;
|
||||
doc->settings_root.cur_text_attr=
|
||||
doc->settings_root.dft_text_attr=win_task->border_attr;
|
||||
} else {
|
||||
if (has_cursor && full_refresh) {
|
||||
if (Bt(&hss->flags,WSSf_SET_TO_POS)||Bt(&vss->flags,WSSf_SET_TO_POS)) {
|
||||
@@ -354,35 +360,37 @@ public Bool DocRecalc(CDoc *doc,Bool has_cursor=FALSE,I64 recalc=DOC_RECALC)
|
||||
LBtr(&hss->flags,WSSf_SET_TO_POS);
|
||||
}
|
||||
if (Bt(&vss->flags,WSSf_SET_TO_POS)) {
|
||||
doc->cur_top_line_num=vss->pos;
|
||||
doc->top_line_num=vss->pos;
|
||||
LBtr(&vss->flags,WSSf_SET_TO_POS);
|
||||
}
|
||||
}
|
||||
doc->x=doc->line_start_col+width/2;
|
||||
doc->y=doc->cur_top_line_num+height/2;
|
||||
doc->y=doc->top_line_num+height/2;
|
||||
find_cursor=TRUE;
|
||||
}
|
||||
}
|
||||
if (recalc==DOC_RECALC_TO_SCREEN)
|
||||
doc->settings_root.cur_text_attr=doc->settings_root.dft_text_attr=win_task->text_attr;
|
||||
doc->settings_root.cur_text_attr=
|
||||
doc->settings_root.dft_text_attr=win_task->text_attr;
|
||||
}
|
||||
x0=doc->line_start_col;
|
||||
y0=doc->cur_top_line_num;
|
||||
y0=doc->top_line_num;
|
||||
same_win=top ==doc->old_win_top &&
|
||||
bottom==doc->old_win_bottom &&
|
||||
left ==doc->old_win_left &&
|
||||
right ==doc->old_win_right &&
|
||||
doc->cur_entry==doc->old_cur_entry &&
|
||||
doc->cur_data_col==doc->old_cur_data_col;
|
||||
doc->cur_col==doc->old_cur_col;
|
||||
if (recalc==DOC_RECALC_TO_SCREEN) {
|
||||
y_plot_top=y0-scroll_y/FONT_HEIGHT;
|
||||
y_plot_bottom=y0+height-1-scroll_y/FONT_HEIGHT;
|
||||
if (!(doc->flags&DOCF_BORDER_DOC) && !Bt(&win_task->display_flags,DISPLAYf_NO_BORDER))
|
||||
if (!(doc->flags&DOCF_BORDER_DOC) &&
|
||||
!Bt(&win_task->display_flags,DISPLAYf_NO_BORDER))
|
||||
DocBorderLstDraw(doc);
|
||||
}
|
||||
|
||||
if (doc->cur_data_col<=doc->cur_entry->min_col)
|
||||
doc->cur_data_col=doc->cur_entry->min_col;
|
||||
if (doc->cur_col<=doc->cur_entry->min_col)
|
||||
doc->cur_col=doc->cur_entry->min_col;
|
||||
doc_e=doc->root.next;
|
||||
doc_e->de_flags&=~(DOCG_BL_IV_UL|DOCEF_WORD_WRAP|DOCEF_HIGHLIGHT);
|
||||
if (doc_e==doc->root.next)
|
||||
@@ -404,7 +412,7 @@ public Bool DocRecalc(CDoc *doc,Bool has_cursor=FALSE,I64 recalc=DOC_RECALC)
|
||||
best_doc_e=doc;
|
||||
best_col=0;
|
||||
doc->cur_entry=doc;
|
||||
doc->cur_data_col=0;
|
||||
doc->cur_col=0;
|
||||
doc_e=doc;
|
||||
}
|
||||
skipped_update= doc_e==doc && doc->root.next!=doc;
|
||||
@@ -423,7 +431,7 @@ public Bool DocRecalc(CDoc *doc,Bool has_cursor=FALSE,I64 recalc=DOC_RECALC)
|
||||
MemCpy(&doc_e->settings,s,sizeof(CDocSettings));
|
||||
s=&doc_e->settings;
|
||||
if (doc_e->de_flags & (DOCEF_TAG_CB|DOCEF_DEFINE) &&
|
||||
!(doc_e->de_flags & DOCEF_LST)) {
|
||||
!(doc_e->de_flags & DOCEF_LST)) {
|
||||
Free(doc_e->tag);
|
||||
if (doc_e->de_flags & DOCEF_TAG_CB) {
|
||||
if (doc_e->tag_cb)
|
||||
@@ -431,17 +439,18 @@ public Bool DocRecalc(CDoc *doc,Bool has_cursor=FALSE,I64 recalc=DOC_RECALC)
|
||||
else
|
||||
doc_e->tag=StrNew("",mem_task);
|
||||
} else {
|
||||
if (temph=HashFind(doc_e->define_str,win_task->hash_table,HTT_DEFINE_STR))
|
||||
if (temph=HashFind(doc_e->define_str,
|
||||
win_task->hash_table,HTT_DEFINE_STR))
|
||||
doc_e->tag=StrNew(temph->data,mem_task);
|
||||
else
|
||||
doc_e->tag=CAlloc(1,mem_task);
|
||||
}
|
||||
doc_e->max_col=StrLen(doc_e->tag);
|
||||
if (doc->cur_entry==doc_e && doc->cur_data_col>=doc_e->max_col) {
|
||||
if (doc->cur_entry==doc_e && doc->cur_col>=doc_e->max_col) {
|
||||
if (doc_e->max_col)
|
||||
doc->cur_data_col=doc_e->max_col-1;
|
||||
doc->cur_col=doc_e->max_col-1;
|
||||
else
|
||||
doc->cur_data_col=0;
|
||||
doc->cur_col=0;
|
||||
}
|
||||
}
|
||||
k=DocWordWrapDel(doc,doc_e,full_refresh,same_win,
|
||||
@@ -475,8 +484,8 @@ public Bool DocRecalc(CDoc *doc,Bool has_cursor=FALSE,I64 recalc=DOC_RECALC)
|
||||
cursor_y=doc_e->y;
|
||||
|
||||
if (doc_e->de_flags & DOCEF_REFRESH_DATA &&
|
||||
(doc_e->type_u8==DOCT_DATA || doc_e->type_u8==DOCT_CHECK_BOX ||
|
||||
doc_e->de_flags & DOCEF_LST)) {
|
||||
(doc_e->type_u8==DOCT_DATA || doc_e->type_u8==DOCT_CHECK_BOX ||
|
||||
doc_e->de_flags & DOCEF_LST)) {
|
||||
DocDataFmt(doc,doc_e);
|
||||
k=StrLen(doc_e->tag);
|
||||
}
|
||||
@@ -520,8 +529,9 @@ public Bool DocRecalc(CDoc *doc,Bool has_cursor=FALSE,I64 recalc=DOC_RECALC)
|
||||
ijif>>=3;
|
||||
for (k=0;k<doc_e->scroll_len;k++) {
|
||||
ch=ptr[(ijif+k)%j];
|
||||
if (!Bt(chars_bitmap_displayable,ch)) ch='.';
|
||||
if (recalc==DOC_RECALC_TO_SCREEN && !(doc_e->de_flags&DOCEF_DONT_DRAW)) {
|
||||
if (!Bt(chars_bmp_displayable,ch)) ch='.';
|
||||
if (recalc==DOC_RECALC_TO_SCREEN &&
|
||||
!(doc_e->de_flags&DOCEF_DONT_DRAW)) {
|
||||
if (doc_e->de_flags & DOCEF_BORDER_PLOT &&
|
||||
!Bt(&win_task->display_flags,DISPLAYf_NO_BORDER))
|
||||
TextChar(win_task,TRUE,x-x0,y-y0,temp_u32_attr+ch);
|
||||
@@ -540,7 +550,8 @@ public Bool DocRecalc(CDoc *doc,Bool has_cursor=FALSE,I64 recalc=DOC_RECALC)
|
||||
if (doc_e->de_flags & DOCEF_BORDER_PLOT &&
|
||||
!Bt(&win_task->display_flags,DISPLAYf_NO_BORDER)) {
|
||||
while (ch=*ptr++) {
|
||||
if (recalc==DOC_RECALC_TO_SCREEN && !(doc_e->de_flags&DOCEF_DONT_DRAW))
|
||||
if (recalc==DOC_RECALC_TO_SCREEN &&
|
||||
!(doc_e->de_flags&DOCEF_DONT_DRAW))
|
||||
TextChar(win_task,TRUE,x-x0,y-y0,temp_u32_attr+ch);
|
||||
else
|
||||
if (find_cursor) {
|
||||
@@ -558,8 +569,10 @@ public Bool DocRecalc(CDoc *doc,Bool has_cursor=FALSE,I64 recalc=DOC_RECALC)
|
||||
hl=DocHighlight(doc_e,ptr,k,temp_u32_attr);
|
||||
else
|
||||
hl=NULL;
|
||||
if (recalc==DOC_RECALC_TO_SCREEN && !(doc_e->de_flags&DOCEF_DONT_DRAW)) {
|
||||
if (y>y_plot_bottom) //Technically we should do this for scrolling_x, too.
|
||||
if (recalc==DOC_RECALC_TO_SCREEN &&
|
||||
!(doc_e->de_flags&DOCEF_DONT_DRAW)) {
|
||||
//Technically we should do this for scrolling_x, too.
|
||||
if (y>y_plot_bottom)
|
||||
more=TRUE;
|
||||
else if (y>=y_plot_top) {
|
||||
if (hl)
|
||||
@@ -591,8 +604,9 @@ public Bool DocRecalc(CDoc *doc,Bool has_cursor=FALSE,I64 recalc=DOC_RECALC)
|
||||
}
|
||||
nobound_switch (doc_e->type_u8) {
|
||||
case DOCT_TEXT:
|
||||
if (!col2 && !(doc_e->de_flags&(DOCEF_TREE|DOCEF_LST|DOCEF_TAG_CB|DOCEF_DEFINE|
|
||||
DOCEF_HTML_LINK|DOCEF_BIN_PTR_LINK)))
|
||||
if (!col2 && !(doc_e->de_flags
|
||||
&(DOCEF_TREE|DOCEF_LST|DOCEF_TAG_CB|DOCEF_DEFINE|
|
||||
DOCEF_HTML_LINK|DOCEF_BIN_PTR_LINK)))
|
||||
del_cl=TRUE;
|
||||
break;
|
||||
case DOCT_HEX_ED:
|
||||
@@ -608,7 +622,8 @@ public Bool DocRecalc(CDoc *doc,Bool has_cursor=FALSE,I64 recalc=DOC_RECALC)
|
||||
StrPrint(buf,"%08tX ",bptr);
|
||||
ptr=buf;
|
||||
while (ch=*ptr++) {
|
||||
if (recalc==DOC_RECALC_TO_SCREEN && !(doc_e->de_flags&DOCEF_DONT_DRAW)) {
|
||||
if (recalc==DOC_RECALC_TO_SCREEN &&
|
||||
!(doc_e->de_flags&DOCEF_DONT_DRAW)) {
|
||||
if (doc_e->de_flags & DOCEF_BORDER_PLOT &&
|
||||
!Bt(&win_task->display_flags,DISPLAYf_NO_BORDER))
|
||||
TextChar(win_task,TRUE,x-x0,y-y0,temp_u32_attr+ch);
|
||||
@@ -629,7 +644,8 @@ public Bool DocRecalc(CDoc *doc,Bool has_cursor=FALSE,I64 recalc=DOC_RECALC)
|
||||
StrPrint(buf,"%02tX",*bptr++);
|
||||
ptr=buf;
|
||||
while (ch=*ptr++) {
|
||||
if (recalc==DOC_RECALC_TO_SCREEN && !(doc_e->de_flags&DOCEF_DONT_DRAW)) {
|
||||
if (recalc==DOC_RECALC_TO_SCREEN &&
|
||||
!(doc_e->de_flags&DOCEF_DONT_DRAW)) {
|
||||
if (doc_e->de_flags & DOCEF_BORDER_PLOT &&
|
||||
!Bt(&win_task->display_flags,DISPLAYf_NO_BORDER))
|
||||
TextChar(win_task,TRUE,x-x0,y-y0,temp_u32_attr+ch);
|
||||
@@ -652,8 +668,9 @@ public Bool DocRecalc(CDoc *doc,Bool has_cursor=FALSE,I64 recalc=DOC_RECALC)
|
||||
x+=(doc_e->hex_ed_width-k)*3;
|
||||
for (j=0;j<k;j++) {
|
||||
ch=*bptr++;
|
||||
if (!Bt(chars_bitmap_displayable,ch)) ch='.';
|
||||
if (recalc==DOC_RECALC_TO_SCREEN && !(doc_e->de_flags&DOCEF_DONT_DRAW)) {
|
||||
if (!Bt(chars_bmp_displayable,ch)) ch='.';
|
||||
if (recalc==DOC_RECALC_TO_SCREEN &&
|
||||
!(doc_e->de_flags&DOCEF_DONT_DRAW)) {
|
||||
if (doc_e->de_flags & DOCEF_BORDER_PLOT &&
|
||||
!Bt(&win_task->display_flags,DISPLAYf_NO_BORDER))
|
||||
TextChar(win_task,TRUE,x-x0,y-y0,temp_u32_attr+ch);
|
||||
@@ -679,7 +696,8 @@ public Bool DocRecalc(CDoc *doc,Bool has_cursor=FALSE,I64 recalc=DOC_RECALC)
|
||||
if (doc_e->de_flags & DOCEF_BORDER_PLOT &&
|
||||
!Bt(&win_task->display_flags,DISPLAYf_NO_BORDER)) {
|
||||
while (x<k) {
|
||||
if (recalc==DOC_RECALC_TO_SCREEN && !(doc_e->de_flags&DOCEF_DONT_DRAW))
|
||||
if (recalc==DOC_RECALC_TO_SCREEN &&
|
||||
!(doc_e->de_flags&DOCEF_DONT_DRAW))
|
||||
TextChar(win_task,TRUE,x-x0,y-y0,temp_u32_attr+CH_SPACE);
|
||||
if (find_cursor) {
|
||||
d2=DocCharDist(doc,x,y);
|
||||
@@ -690,7 +708,8 @@ public Bool DocRecalc(CDoc *doc,Bool has_cursor=FALSE,I64 recalc=DOC_RECALC)
|
||||
}
|
||||
} else {
|
||||
k-=x;
|
||||
if (recalc==DOC_RECALC_TO_SCREEN && !(doc_e->de_flags&DOCEF_DONT_DRAW)) {
|
||||
if (recalc==DOC_RECALC_TO_SCREEN &&
|
||||
!(doc_e->de_flags&DOCEF_DONT_DRAW)) {
|
||||
if (y_plot_top<=y<=y_plot_bottom)
|
||||
TextLenStr(win_task,x-x0,y-y0,k,temp_u32_attr," ");
|
||||
x+=k;
|
||||
@@ -709,8 +728,8 @@ public Bool DocRecalc(CDoc *doc,Bool has_cursor=FALSE,I64 recalc=DOC_RECALC)
|
||||
break;
|
||||
case DOCT_NEW_LINE:
|
||||
case DOCT_SOFT_NEW_LINE:
|
||||
if (recalc==DOC_RECALC_TO_SCREEN &&
|
||||
!(doc_e->de_flags&DOCEF_DONT_DRAW)&& y_plot_top<=y<=y_plot_bottom)
|
||||
if (recalc==DOC_RECALC_TO_SCREEN &&!(doc_e->de_flags&DOCEF_DONT_DRAW)&&
|
||||
y_plot_top<=y<=y_plot_bottom)
|
||||
TextLenAttr(win_task,x-x0,y-y0,width-(x-x0),cur_u8_attr<<8);
|
||||
if (doc_e->de_flags&DOCEF_HIGHLIGHT) {
|
||||
if (s->state==DOCSS_CPP_Z_COMMENT)
|
||||
@@ -856,7 +875,7 @@ rc_adjust_xy:
|
||||
cur_u8_attr=cur_u8_attr&0xF0|DOC_COLOR_PMT;
|
||||
if (y==cursor_y) {
|
||||
doc->cur_entry=doc_e->next;
|
||||
doc->cur_data_col=doc->cur_entry->min_col;
|
||||
doc->cur_col=doc->cur_entry->min_col;
|
||||
}
|
||||
break;
|
||||
case DOCT_WORD_WRAP:
|
||||
@@ -898,14 +917,15 @@ rc_adjust_xy:
|
||||
case DOCT_CURSOR:
|
||||
if (!find_cursor && !(doc->flags & DOCF_NO_CURSOR)) {
|
||||
doc->cur_entry=doc_e->next;
|
||||
doc->cur_data_col=doc->cur_entry->min_col;
|
||||
doc->cur_col=doc->cur_entry->min_col;
|
||||
}
|
||||
del_cl=TRUE;
|
||||
break;
|
||||
case DOCT_SPRITE:
|
||||
if (!doc_e->bin_data && doc->flags&DOCEF_HAS_BIN)
|
||||
doc_e->bin_data=DocBinFindNum(doc,doc_e->bin_num);
|
||||
if ((tempb=doc_e->bin_data) && !tempb->tag && doc_e->tag && *doc_e->tag)
|
||||
if ((tempb=doc_e->bin_data) &&
|
||||
!tempb->tag && doc_e->tag && *doc_e->tag)
|
||||
tempb->tag=StrNew(doc_e->tag,mem_task);
|
||||
if (tempb && dc) {
|
||||
DCRst(dc);
|
||||
@@ -926,14 +946,13 @@ rc_adjust_xy:
|
||||
i^=0xF;
|
||||
if (temp_u32_attr & DOCET_INVERT)
|
||||
i^=0xF;
|
||||
if (blink_flag && (doc_e==doc->cur_entry || temp_u32_attr&DOCET_BLINK))
|
||||
if (blink_flag &&
|
||||
(doc_e==doc->cur_entry || temp_u32_attr&DOCET_BLINK))
|
||||
i^=0xF;
|
||||
}
|
||||
dc->color=i;
|
||||
if (find_cursor)
|
||||
dc->flags|=DCF_LOCATE_NEAREST;
|
||||
dc->nearest_sprite_elem_num=0;
|
||||
dc->nearest_dist=MAX_I64;
|
||||
if (recalc==DOC_RECALC_TO_SCREEN && doc->cur_sprite==bptr) {
|
||||
dc->flags|=DCF_LOCATE_NEAREST;
|
||||
dc->cur_x=ip.pos.x;
|
||||
@@ -955,13 +974,14 @@ rc_adjust_xy:
|
||||
}
|
||||
if (ii&(1<<SPT_MESH|1<<SPT_SHIFTABLE_MESH)) {
|
||||
if (!depth_buf) {
|
||||
DCAllocDepthBuf(dc);
|
||||
DCDepthBufAlloc(dc);
|
||||
depth_buf=dc->depth_buf;
|
||||
} else
|
||||
dc->depth_buf=depth_buf;
|
||||
GrRotZEqu(dc->r,cur_time*3.1);
|
||||
GrRotYEqu(dc->r,cur_time*1.9);
|
||||
GrRotXEqu(dc->r,cur_time);
|
||||
Mat4x4IdentEqu(dc->r);
|
||||
Mat4x4RotZ(dc->r,cur_time*3.1);
|
||||
Mat4x4RotY(dc->r,cur_time*1.9);
|
||||
Mat4x4RotX(dc->r,cur_time);
|
||||
dc->flags|=DCF_TRANSFORMATION;
|
||||
dc->x=xx;
|
||||
dc->y=yy;
|
||||
@@ -971,7 +991,7 @@ rc_adjust_xy:
|
||||
Sprite3(dc,xx,yy,zz,bptr);
|
||||
dc->depth_buf=NULL;
|
||||
if (recalc==DOC_RECALC_TO_SCREEN && doc->cur_sprite==bptr)
|
||||
doc->cur_sprite_elem_num=dc->nearest_sprite_elem_num;
|
||||
doc->nearest_sprite_elem_num=dc->nearest_sprite_elem_num;
|
||||
dc->flags&=~(DCF_LOCATE_NEAREST|DCF_DONT_DRAW|DCF_TRANSFORMATION);
|
||||
if (dc->nearest_dist<=D) {
|
||||
D=dc->nearest_dist;
|
||||
@@ -980,8 +1000,10 @@ rc_adjust_xy:
|
||||
}
|
||||
break;
|
||||
case DOCT_SONG:
|
||||
if (sys_focus_task==win_task && recalc==DOC_RECALC_TO_SCREEN && !(doc_e->de_flags&DOCEF_DONT_DRAW)) {
|
||||
if (doc_e->aux_str && (!music.cur_song || StrCmp(music.cur_song,doc_e->aux_str))) {
|
||||
if (sys_focus_task==win_task && recalc==DOC_RECALC_TO_SCREEN &&
|
||||
!(doc_e->de_flags&DOCEF_DONT_DRAW)) {
|
||||
if (doc_e->aux_str &&
|
||||
(!music.cur_song || StrCmp(music.cur_song,doc_e->aux_str))) {
|
||||
Free(music.cur_song);
|
||||
MusicSettingsRst;
|
||||
music.cur_song=AStrNew(doc_e->aux_str);
|
||||
@@ -999,7 +1021,7 @@ rc_adjust_xy:
|
||||
|
||||
if (doc_e->de_flags & DOCEF_HAS_BORDER)
|
||||
TextBorder(win_task,doc_e->x-x0,x-x0-1,doc_e->y-y0,y-y0,
|
||||
temp_u32_attr.u8[1],ToBool(doc_e->de_flags & DOCEF_SOLID_BORDER));
|
||||
temp_u32_attr.u8[1],ToBool(doc_e->de_flags & DOCEF_SOLID_BORDER));
|
||||
if (full_refresh) {
|
||||
switch (doc_e->type_u8) {
|
||||
case DOCT_CHECK_BOX:
|
||||
@@ -1033,7 +1055,8 @@ rc_adjust_xy:
|
||||
else
|
||||
tree_collapsed=FALSE;
|
||||
doc_e2=doc_e->next;
|
||||
while (doc_e2!=doc && doc_e2->type_u8!=DOCT_INDENT && !(doc_e2->de_flags & DOCEF_TREE))
|
||||
while (doc_e2!=doc && doc_e2->type_u8!=DOCT_INDENT &&
|
||||
!(doc_e2->de_flags & DOCEF_TREE))
|
||||
doc_e2=doc_e2->next;
|
||||
if (doc_e2->type_u8==DOCT_INDENT) {
|
||||
j=i=s->indent;
|
||||
@@ -1056,10 +1079,11 @@ rc_adjust_xy:
|
||||
|
||||
doc_e2=doc_e->next;
|
||||
rc_skip:
|
||||
while (doc_e2!=doc && doc_e2->de_flags & (DOCEF_SKIP|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP)) {
|
||||
while (doc_e2!=doc && doc_e2->de_flags
|
||||
&(DOCEF_SKIP|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP)) {
|
||||
if (doc_e2==doc->cur_entry) {
|
||||
doc->cur_entry=doc_e2->next;
|
||||
doc->cur_data_col=doc->cur_entry->min_col;
|
||||
doc->cur_col=doc->cur_entry->min_col;
|
||||
}
|
||||
if (full_refresh) {
|
||||
doc_e2->x=x;
|
||||
@@ -1067,7 +1091,8 @@ rc_skip:
|
||||
doc_e2->page_line_num=doc->page_line_num;
|
||||
MemCpy(&doc_e2->settings,s,sizeof(CDocSettings));
|
||||
doc_e2->type.u8[1]=cur_u8_attr;
|
||||
doc_e2->de_flags=doc->flags&(DOCG_BL_IV_UL|DOCEF_WORD_WRAP|DOCEF_HIGHLIGHT) |
|
||||
doc_e2->de_flags=doc->flags
|
||||
&(DOCG_BL_IV_UL|DOCEF_WORD_WRAP|DOCEF_HIGHLIGHT) |
|
||||
doc_e2->de_flags&~(DOCG_BL_IV_UL|DOCEF_WORD_WRAP|DOCEF_HIGHLIGHT);
|
||||
}
|
||||
doc_e2=doc_e2->next;
|
||||
@@ -1078,7 +1103,7 @@ rc_skip:
|
||||
if (!(doc_e->de_flags & (DOCEF_HOLD|DOCEF_FILTER_SKIP))) {
|
||||
if (doc_e==doc->cur_entry) {
|
||||
doc->cur_entry=doc_e2;
|
||||
doc->cur_data_col=doc_e2->min_col;
|
||||
doc->cur_col=doc_e2->min_col;
|
||||
}
|
||||
if (best_doc_e==doc_e) {
|
||||
best_doc_e=doc_e2;
|
||||
@@ -1151,7 +1176,7 @@ rc_skip:
|
||||
}
|
||||
if (find_cursor) {
|
||||
doc->cur_entry=best_doc_e;
|
||||
doc->cur_data_col=best_col;
|
||||
doc->cur_col=best_col;
|
||||
DocFormBwd(doc);
|
||||
//We need this because text coordinates are used
|
||||
if (best_d<FONT_WIDTH)
|
||||
@@ -1161,10 +1186,10 @@ rc_skip:
|
||||
|
||||
if (doc->cur_entry->type_u8!=DOCT_HEX_ED) {
|
||||
doc->y=doc->cur_entry->y;
|
||||
doc->x=doc->cur_entry->x+doc->cur_data_col;
|
||||
doc->x=doc->cur_entry->x+doc->cur_col;
|
||||
} else {
|
||||
doc->y=doc->cur_entry->y+doc->cur_data_col/3/doc->cur_entry->hex_ed_width;
|
||||
x=doc->cur_data_col%(doc->cur_entry->hex_ed_width*3);
|
||||
doc->y=doc->cur_entry->y+doc->cur_col/3/doc->cur_entry->hex_ed_width;
|
||||
x=doc->cur_col%(doc->cur_entry->hex_ed_width*3);
|
||||
i=x/doc->cur_entry->hex_ed_width;
|
||||
doc->x=doc->cur_entry->x+9;
|
||||
if (i<2)
|
||||
@@ -1184,15 +1209,15 @@ rc_skip:
|
||||
x=scroll_x/FONT_WIDTH;
|
||||
y=scroll_y/FONT_HEIGHT;
|
||||
}
|
||||
if (doc->cur_top_line_num-y+height-1>doc->max_y)
|
||||
doc->cur_top_line_num=doc->max_y-(height-1)+y;
|
||||
if (doc->cur_top_line_num-y<doc->min_y)
|
||||
doc->cur_top_line_num=doc->min_y+y;
|
||||
if (doc->top_line_num-y+height-1>doc->max_y)
|
||||
doc->top_line_num=doc->max_y-(height-1)+y;
|
||||
if (doc->top_line_num-y<doc->min_y)
|
||||
doc->top_line_num=doc->min_y+y;
|
||||
|
||||
if (doc->y-doc->cur_top_line_num+y>height-1)
|
||||
doc->cur_top_line_num=doc->y-(height-1)+y;
|
||||
if (doc->y-doc->cur_top_line_num+y<0)
|
||||
doc->cur_top_line_num=doc->y+y;
|
||||
if (doc->y-doc->top_line_num+y>height-1)
|
||||
doc->top_line_num=doc->y-(height-1)+y;
|
||||
if (doc->y-doc->top_line_num+y<0)
|
||||
doc->top_line_num=doc->y+y;
|
||||
|
||||
if (doc->line_start_col-x+width-1>doc->max_x)
|
||||
doc->line_start_col=doc->max_x-(width-1)+x;
|
||||
@@ -1207,7 +1232,7 @@ rc_skip:
|
||||
}
|
||||
if (recalc==DOC_RECALC_TO_SCREEN && has_cursor) {
|
||||
x=doc->x-doc->line_start_col+left +scroll_x/FONT_WIDTH;
|
||||
y=doc->y-doc->cur_top_line_num+top+scroll_y/FONT_HEIGHT;
|
||||
y=doc->y-doc->top_line_num+top+scroll_y/FONT_HEIGHT;
|
||||
if (0<=x<=right && 0<=y<=bottom &&
|
||||
x<TEXT_COLS && y<TEXT_ROWS &&
|
||||
!(doc->flags&DOCF_HIDE_CURSOR)) {
|
||||
@@ -1231,7 +1256,7 @@ rc_skip:
|
||||
vss->max=vss->min;
|
||||
else
|
||||
vss->max=doc->max_y-height+1;
|
||||
vss->pos=doc->cur_top_line_num;
|
||||
vss->pos=doc->top_line_num;
|
||||
}
|
||||
}
|
||||
LBEqu(&doc->flags,DOCf_MORE,more);
|
||||
@@ -1243,7 +1268,7 @@ rc_skip:
|
||||
doc->old_win_left=left;
|
||||
doc->old_win_right=right;
|
||||
doc->old_cur_entry=doc->cur_entry;
|
||||
doc->old_cur_data_col=doc->old_cur_data_col;
|
||||
doc->old_cur_col=doc->old_cur_col;
|
||||
}
|
||||
if (doc->flags & DOCF_HAS_SONG)
|
||||
LBts(&win_task->task_flags,TASKf_HAS_SONG);
|
||||
|
||||
+50
-48
@@ -17,32 +17,33 @@ public Bool DocTreeFind(CDoc *haystack_doc,U8 *needle_path,
|
||||
while (doc_e!=haystack_doc) {
|
||||
if (doc_e->type_u8==DOCT_INDENT)
|
||||
i+=doc_e->attr;
|
||||
else if (i==k && doc_e->de_flags&DOCEF_TREE && !StrCmp(doc_e->tag+3,st2)) {
|
||||
if (*st1)
|
||||
break;
|
||||
else {
|
||||
if (_tree_entry) *_tree_entry=doc_e;
|
||||
i=0;
|
||||
while (doc_e!=haystack_doc && doc_e->type_u8!=DOCT_INDENT)
|
||||
doc_e=doc_e->next;
|
||||
if (doc_e!=haystack_doc) {
|
||||
i=doc_e->attr;
|
||||
if (_start_indent) *_start_indent=doc_e;
|
||||
doc_e=doc_e->next;
|
||||
while (doc_e!=haystack_doc && i>0) {
|
||||
if (doc_e->type_u8==DOCT_INDENT) {
|
||||
i+=doc_e->attr;
|
||||
if (i<=0) {
|
||||
if (_end_indent) *_end_indent=doc_e;
|
||||
result=TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
doc_e=doc_e->next;
|
||||
}
|
||||
}
|
||||
goto ft_done;
|
||||
}
|
||||
else if (i==k && doc_e->de_flags&DOCEF_TREE &&
|
||||
!StrCmp(doc_e->tag+3,st2)) {
|
||||
if (*st1)
|
||||
break;
|
||||
else {
|
||||
if (_tree_entry) *_tree_entry=doc_e;
|
||||
i=0;
|
||||
while (doc_e!=haystack_doc && doc_e->type_u8!=DOCT_INDENT)
|
||||
doc_e=doc_e->next;
|
||||
if (doc_e!=haystack_doc) {
|
||||
i=doc_e->attr;
|
||||
if (_start_indent) *_start_indent=doc_e;
|
||||
doc_e=doc_e->next;
|
||||
while (doc_e!=haystack_doc && i>0) {
|
||||
if (doc_e->type_u8==DOCT_INDENT) {
|
||||
i+=doc_e->attr;
|
||||
if (i<=0) {
|
||||
if (_end_indent) *_end_indent=doc_e;
|
||||
result=TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
doc_e=doc_e->next;
|
||||
}
|
||||
}
|
||||
goto ft_done;
|
||||
}
|
||||
}
|
||||
doc_e=doc_e->next;
|
||||
}
|
||||
@@ -61,12 +62,12 @@ public Bool DocTreeMake(CDoc *doc,U8 *path)
|
||||
{//Make registry-like tree widget.
|
||||
I64 i=0,j=MIN_I64,k=0;
|
||||
U8 *st1=StrNew(path),
|
||||
*st2=MAlloc(StrLen(path)+1),
|
||||
*st3=StrNew(path);
|
||||
*st2=MAlloc(StrLen(path)+1),
|
||||
*st3=StrNew(path);
|
||||
Bool result=TRUE,unlock_doc=DocLock(doc);
|
||||
CDocEntry *doc_e=doc->root.next;
|
||||
doc->cur_entry=doc;
|
||||
doc->cur_data_col=0;
|
||||
doc->cur_col=0;
|
||||
while (*st1 && doc_e!=doc) {
|
||||
StrFirstRem(st1,"/",st2);
|
||||
if (*st2) {
|
||||
@@ -75,17 +76,18 @@ public Bool DocTreeMake(CDoc *doc,U8 *path)
|
||||
i+=doc_e->attr;
|
||||
if (i==j) {
|
||||
doc->cur_entry=doc_e;
|
||||
doc->cur_data_col=0;
|
||||
doc->cur_col=0;
|
||||
goto mt_done;
|
||||
}
|
||||
} else if (i==k && doc_e->de_flags&DOCEF_TREE && !StrCmp(doc_e->tag+3,st2)) {
|
||||
Free(st3);
|
||||
st3=StrNew(st1);
|
||||
j=i;
|
||||
if (!*st1)
|
||||
result=FALSE;
|
||||
else
|
||||
break;
|
||||
} else if (i==k && doc_e->de_flags&DOCEF_TREE &&
|
||||
!StrCmp(doc_e->tag+3,st2)) {
|
||||
Free(st3);
|
||||
st3=StrNew(st1);
|
||||
j=i;
|
||||
if (!*st1)
|
||||
result=FALSE;
|
||||
else
|
||||
break;
|
||||
}
|
||||
doc_e=doc_e->next;
|
||||
}
|
||||
@@ -99,7 +101,7 @@ mt_done:
|
||||
if (*st2) {
|
||||
DocPrint(doc,"$$TR+C,\"%s\"$$\n$$ID,2$$",st2);
|
||||
doc->cur_entry=DocPrint(doc,"$$ID,-2$$");
|
||||
doc->cur_data_col=0;
|
||||
doc->cur_col=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -116,16 +118,16 @@ public I64 ExeDoc(CDoc *doc,Bool just_load=FALSE)
|
||||
{//JIT Compile and execute a document.
|
||||
I64 result;
|
||||
Bool okay=TRUE,unlock_doc=DocLock(doc);
|
||||
CLex *lx=LexNew(,LF_DONT_FREE_BUF);
|
||||
CCmpCtrl *cc=CmpCtrlNew(,CCF_DONT_FREE_BUF);
|
||||
if (just_load)
|
||||
lx->flags|=LF_JUST_LOAD;
|
||||
cc->flags|=CCF_JUST_LOAD;
|
||||
if (Fs->last_lex!=&Fs->next_lex)
|
||||
lx->opts=Fs->last_lex->opts;
|
||||
QueIns(lx,Fs->last_lex);
|
||||
LexAttachDoc(lx,,doc);
|
||||
cc->opts=Fs->last_lex->opts;
|
||||
QueIns(cc,Fs->last_lex);
|
||||
LexAttachDoc(cc,,doc);
|
||||
try {
|
||||
Lex(lx);
|
||||
result=ExeCmdLine(lx);
|
||||
Lex(cc);
|
||||
result=ExeCmdLine(cc);
|
||||
} catch {
|
||||
if (Fs->except_ch=='Compiler' || Fs->except_ch=='Break') {
|
||||
Fs->catch_except=TRUE;
|
||||
@@ -133,9 +135,9 @@ public I64 ExeDoc(CDoc *doc,Bool just_load=FALSE)
|
||||
result=0;
|
||||
}
|
||||
}
|
||||
QueRem(lx);
|
||||
QueRem(cc);
|
||||
if (okay)
|
||||
LexDel(lx); //TODO: can crash
|
||||
CmpCtrlDel(cc); //TODO: can crash
|
||||
if (unlock_doc)
|
||||
DocUnlock(doc);
|
||||
return result;
|
||||
|
||||
+32
-29
@@ -3,8 +3,8 @@
|
||||
public U8 *DBlk(I64 blk,Bool write=FALSE)
|
||||
{//Dump disk block. Optionally, write.
|
||||
//If you set write to TRUE, the block will
|
||||
//be written when you press <ESC>.
|
||||
//See $LK,"::/Demo/Dsk/DskRaw.CPP"$.
|
||||
//be written when you press <ESC>.
|
||||
//See $LK,"::/Demo/Dsk/DskRaw.CPP"$.
|
||||
U8 *buf=MAlloc(BLK_SIZE);
|
||||
|
||||
RBlks(Fs->cur_dv,buf,blk,1);
|
||||
@@ -22,9 +22,9 @@ public U8 *DBlk(I64 blk,Bool write=FALSE)
|
||||
public U8 *DCluster(I64 c,Bool write=FALSE,I64 num=0)
|
||||
{//Dump disk cluster. Optionally, write.
|
||||
//If you set write to TRUE, the cluster will
|
||||
//be written when you press <ESC>.
|
||||
//See $LK,"::/Demo/Dsk/DskRaw.CPP"$.
|
||||
//Do $LK,"Dir",A="MN:Dir"$("*",TRUE); to get cluster numbers of files.
|
||||
//be written when you press <ESC>.
|
||||
//See $LK,"::/Demo/Dsk/DskRaw.CPP"$.
|
||||
//Do $LK,"Dir",A="MN:Dir"$("*",TRUE); to get cluster numbers of files.
|
||||
U8 *buf=MAlloc(Fs->cur_dv->spc<<BLK_SIZE_BITS);
|
||||
c=ClusterNumNext(Fs->cur_dv,c,num);
|
||||
RClusters(Fs->cur_dv,buf,c,1);
|
||||
@@ -43,7 +43,7 @@ public U8 *DCluster(I64 c,Bool write=FALSE,I64 num=0)
|
||||
public U8 *Dump(U8 *filename,Bool write=FALSE)
|
||||
{//Dump file. Optionally, write.
|
||||
//If you set write to TRUE, the file will
|
||||
//be written when you press <ESC>.
|
||||
//be written when you press <ESC>.
|
||||
U8 *buf;
|
||||
I64 size;
|
||||
if (buf=FileRead(filename,&size)) {
|
||||
@@ -95,16 +95,16 @@ public I64 FileCnt(CDirEntry *tempde)
|
||||
public Bool Copy(U8 *src_files_find_mask,U8 *dst_files_find_mask=".")
|
||||
{//Copy files.
|
||||
//If the name ends in ".Z", it will
|
||||
//be stored compressed. If not ".Z"
|
||||
//it will be stored uncompressed.
|
||||
//be stored compressed. If not ".Z"
|
||||
//it will be stored uncompressed.
|
||||
Bool result=TRUE;
|
||||
CFileAccess *fa;
|
||||
CDirContext *dirc;
|
||||
CDirEntry *tempde,*tempde1;
|
||||
U8 *st;
|
||||
if (!(tempde=FilesFind(src_files_find_mask,FUF_CLUSTER_ORDER)))
|
||||
return FALSE;
|
||||
if (IsDir(dst_files_find_mask)) {
|
||||
if (fa=FileAccessNew(dst_files_find_mask,TRUE)) {
|
||||
if (dirc=DirContextNew(dst_files_find_mask,TRUE)) {
|
||||
while (tempde) {
|
||||
tempde1=tempde->next;
|
||||
if (!(tempde->attr & RS_ATTR_DIR)) {
|
||||
@@ -116,7 +116,7 @@ public Bool Copy(U8 *src_files_find_mask,U8 *dst_files_find_mask=".")
|
||||
DirEntryDel(tempde);
|
||||
tempde=tempde1;
|
||||
}
|
||||
FileAccessDel(fa);
|
||||
DirContextDel(dirc);
|
||||
}
|
||||
return result;
|
||||
} else
|
||||
@@ -151,10 +151,11 @@ I64 CopyTree2(CDirEntry *tempde,I64 src_dir_len,I64 dst_dir_len,U8 *dst_dir)
|
||||
}
|
||||
return result;
|
||||
}
|
||||
public I64 CopyTree(U8 *src_files_find_mask,U8 *dst_files_find_mask,Bool no_mask=TRUE)
|
||||
public I64 CopyTree(U8 *src_files_find_mask,U8 *dst_files_find_mask,
|
||||
Bool no_mask=TRUE)
|
||||
{//Copy directory tree.
|
||||
//Returns the count of copied files (not dirs).
|
||||
CFileAccess *fa;
|
||||
CDirContext *dirc;
|
||||
CDirEntry *tempde=NULL;
|
||||
I64 result=0,i1,i2;
|
||||
U8 *st1,*st2;
|
||||
@@ -169,18 +170,18 @@ public I64 CopyTree(U8 *src_files_find_mask,U8 *dst_files_find_mask,Bool no_mask
|
||||
}
|
||||
Free(st1);
|
||||
Free(st2);
|
||||
if (fa=FileAccessNew(src_files_find_mask,TRUE,,no_mask)) {
|
||||
tempde=SysFilesFind(fa->mask,FUF_RECURSE);
|
||||
if (dirc=DirContextNew(src_files_find_mask,TRUE,,no_mask)) {
|
||||
tempde=FilesFind(dirc->mask,FUF_RECURSE);
|
||||
st1=CurDir;
|
||||
FileAccessDel(fa);
|
||||
DirContextDel(dirc);
|
||||
i1=StrLen(st1);
|
||||
if (i1==3) i1--;
|
||||
if (fa=FileAccessNew(dst_files_find_mask,TRUE,TRUE)) {
|
||||
if (dirc=DirContextNew(dst_files_find_mask,TRUE,TRUE)) {
|
||||
st2=CurDir;
|
||||
i2=StrLen(st2);
|
||||
if (i2==3) i2--;
|
||||
result=CopyTree2(tempde,i1,i2,st2);
|
||||
FileAccessDel(fa);
|
||||
DirContextDel(dirc);
|
||||
Free(st2);
|
||||
}
|
||||
DirTreeDel(tempde);
|
||||
@@ -198,7 +199,7 @@ I64 DelTreeDirs(CDirEntry *tempde1)
|
||||
if (tempde1->attr & RS_ATTR_DIR) {
|
||||
if (tempde1->sub)
|
||||
result+=DelTreeDirs(tempde1->sub);
|
||||
result+=SysDel(tempde1->full_name,TRUE);
|
||||
result+=Del(tempde1->full_name,TRUE,TRUE);
|
||||
}
|
||||
DirEntryDel(tempde1);
|
||||
tempde1=tempde2;
|
||||
@@ -215,7 +216,7 @@ I64 DelTreeFiles(CDirEntry *tempde1)
|
||||
if (tempde1->sub)
|
||||
result+=DelTreeFiles(tempde1->sub);
|
||||
} else
|
||||
result+=SysDel(tempde1->full_name,FALSE);
|
||||
result+=Del(tempde1->full_name,FALSE,TRUE);
|
||||
DirEntryDel(tempde1);
|
||||
tempde1=tempde2;
|
||||
}
|
||||
@@ -228,8 +229,8 @@ public I64 DelTree(U8 *files_find_mask,U8 *fu_flags=NULL)
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||
if (IsDir(files_find_mask)) {
|
||||
result=DelTreeDirs(FilesFind(files_find_mask,fuf_flags));
|
||||
result+=SysDel(files_find_mask,TRUE);
|
||||
result+=SysDel(files_find_mask,FALSE);
|
||||
result+=Del(files_find_mask,TRUE,TRUE);
|
||||
result+=Del(files_find_mask,FALSE,TRUE);
|
||||
} else
|
||||
result=DelTreeFiles(FilesFind(files_find_mask,fuf_flags));
|
||||
return result;
|
||||
@@ -240,7 +241,7 @@ U0 TouchFile(U8 *filename,U8 *attr,CDate cdt=MIN_I64)
|
||||
CDrv *dv=Let2Drv(*filename);
|
||||
CDirEntry de;
|
||||
U8 *cur_dir=StrNew(filename),
|
||||
buf[136];
|
||||
buf[STR_LEN];
|
||||
if (FileFind(filename,&de,FUF_JUST_FILES)) {
|
||||
Free(de.full_name);
|
||||
if (!StrCmp(attr,"+?"))
|
||||
@@ -260,14 +261,15 @@ U0 TouchFile(U8 *filename,U8 *attr,CDate cdt=MIN_I64)
|
||||
} else
|
||||
PrintErr("File not found.\n");
|
||||
}
|
||||
public U0 Touch(U8 *files_find_mask,U8 *attr="+?",U8 *fu_flags=NULL,CDate cdt=MIN_I64)
|
||||
public U0 Touch(U8 *files_find_mask,U8 *attr="+?",
|
||||
U8 *fu_flags=NULL,CDate cdt=MIN_I64)
|
||||
{/*Touch file attributes and DateTime.
|
||||
Default lists attributes.
|
||||
attr: "+?" =show current
|
||||
"+T" =resident
|
||||
$LK,"RS_ATTR_READ_ONLY",A="MN:RS_ATTR_READ_ONLY"$ $LK,"ST_FILE_ATTRS",A="MN:ST_FILE_ATTRS"$
|
||||
"+T" =resident
|
||||
$LK,"RS_ATTR_READ_ONLY",A="MN:RS_ATTR_READ_ONLY"$ $LK,"ST_FILE_ATTRS",A="MN:ST_FILE_ATTRS"$
|
||||
To Set DateL:
|
||||
Touch(filename,"",,datetime);
|
||||
Touch(filename,"",,datetime);
|
||||
*/
|
||||
I64 fuf_flags=0;
|
||||
CDirEntry *tempde,*tempde1;
|
||||
@@ -374,7 +376,8 @@ I64 Size1(CDirEntry *tempde,I64 *_fuf_flags,I64 round_to)
|
||||
CDrv *dv;
|
||||
while (tempde) {
|
||||
if ((i=tempde->size) && Bt(_fuf_flags,FUf_EXPAND) &&
|
||||
!(tempde->attr&RS_ATTR_DIR) && FileAttr(tempde->name)&RS_ATTR_COMPRESSED) {
|
||||
!(tempde->attr&RS_ATTR_DIR) &&
|
||||
FileAttr(tempde->name)&RS_ATTR_COMPRESSED) {
|
||||
dv=Let2Drv(*tempde->full_name);
|
||||
RBlks(dv,buf,Cluster2Blk(dv,tempde->cluster),1);
|
||||
i=(&buf)(CArcCompress *)->expanded_size;
|
||||
@@ -392,7 +395,7 @@ I64 Size1(CDirEntry *tempde,I64 *_fuf_flags,I64 round_to)
|
||||
public I64 Size(U8 *files_find_mask="/*",U8 *fu_flags=NULL,I64 round_to=0)
|
||||
{//Total size of files in mask. "+x" for expanded size.
|
||||
//Does not include directory size of base directory, but
|
||||
//does include size of sub directories.
|
||||
//does include size of sub directories.
|
||||
I64 fuf_flags=0,result=0;
|
||||
CDirEntry *tempde1=NULL;
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r");
|
||||
|
||||
+31
-29
@@ -78,28 +78,28 @@ I64 drv_dsk_dsk_size;
|
||||
public U0 PrtDsk(U8 drv_let=0)
|
||||
{//Partition the disk containing partition drv_let.
|
||||
//drv_let=0 means add new drive that
|
||||
//is not already mounted.
|
||||
//is not already mounted.
|
||||
CBlkDev *bd;
|
||||
CPlannedDrv root,*temppp;
|
||||
CMasterBoot mbr;
|
||||
Bool pri=TRUE;
|
||||
I64 ext_base,drv_let2,pri_cnt=0,
|
||||
i,start_offset,offset,remaining;
|
||||
"This command does not play well\n"
|
||||
"with other operating systems.\n"
|
||||
"You really should use another\n"
|
||||
"operating system's partitioner.\n"
|
||||
"If you use this, it may, in fact,\n"
|
||||
"make your hard drive impossible\n"
|
||||
"to repartition with other operating\n"
|
||||
"until you set block zero to zero\n"
|
||||
"with $$LK,\"MasterBootZero\",\"MN:MasterBootZero\"$$()\n\n\n"
|
||||
"Continue";
|
||||
i,start_offset,offset,remaining;
|
||||
"This command does not play well\n"
|
||||
"with other operating systems.\n"
|
||||
"You really should use another\n"
|
||||
"operating system's partitioner.\n"
|
||||
"If you use this, it may, in fact,\n"
|
||||
"make your hard drive impossible\n"
|
||||
"to repartition with other operating\n"
|
||||
"until you set block zero to zero\n"
|
||||
"with $$LK,\"MasterBootZero\",\"MN:MasterBootZero\"$$()\n\n\n"
|
||||
"Continue";
|
||||
if (!YorN) return;
|
||||
|
||||
if (drv_let)
|
||||
try
|
||||
Let2BlkDev(drv_let);
|
||||
Let2BlkDev(drv_let);
|
||||
catch {
|
||||
drv_let=0;
|
||||
Fs->catch_except=TRUE;
|
||||
@@ -136,9 +136,9 @@ public U0 PrtDsk(U8 drv_let=0)
|
||||
pri=FALSE;
|
||||
}
|
||||
"Blocks Remaining:%d (0x%X)\n",
|
||||
remaining-DRV_HEADER,remaining-DRV_HEADER;
|
||||
remaining-DRV_HEADER,remaining-DRV_HEADER;
|
||||
temppp->size=CeilU64(GetI64("Size in Blocks :",
|
||||
remaining-DRV_HEADER)+DRV_HEADER,ROUND_DRV_TO);
|
||||
remaining-DRV_HEADER)+DRV_HEADER,ROUND_DRV_TO);
|
||||
} while (!(ROUND_DRV_TO<=temppp->size<=FloorU64(remaining,ROUND_DRV_TO)));
|
||||
QueIns(temppp,root.last);
|
||||
remaining-=temppp->size;
|
||||
@@ -225,7 +225,7 @@ public U0 PrtDsk(U8 drv_let=0)
|
||||
for (i=bd->first_drv_let;i<drv_let2;i++)
|
||||
Fmt(i,,FALSE);
|
||||
|
||||
pd_done:
|
||||
pd_done:
|
||||
while (root.next!=&root) {
|
||||
temppp=root.next;
|
||||
QueRem(temppp);
|
||||
@@ -243,7 +243,7 @@ U0 RedSeaDrvView(U8 drv_let=0)
|
||||
CDC *dc=DCAlias;
|
||||
|
||||
l=(GR_HEIGHT-3*FONT_HEIGHT)*(GR_WIDTH-FONT_WIDTH<<1),
|
||||
s=(dv->size+dv->spc-1)/dv->spc;
|
||||
s=(dv->size+dv->spc-1)/dv->spc;
|
||||
|
||||
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
|
||||
WinMax;
|
||||
@@ -285,7 +285,7 @@ U0 FAT32DrvView(U8 drv_let=0)
|
||||
U32 *bitmap;
|
||||
CDC *dc=DCAlias;
|
||||
l=(GR_HEIGHT-3*FONT_HEIGHT)*(GR_WIDTH-FONT_WIDTH<<1),
|
||||
s=(dv->size+dv->spc-1)/dv->spc;
|
||||
s=(dv->size+dv->spc-1)/dv->spc;
|
||||
|
||||
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
|
||||
WinMax;
|
||||
@@ -340,9 +340,9 @@ public U0 DrvView(U8 drv_let=0)
|
||||
public U0 DskView(U8 drv_let=0)
|
||||
{//Disk view. Pie chart of partition sizes.
|
||||
I64 i,j,
|
||||
h=Fs->pix_width,
|
||||
v=Fs->pix_height,
|
||||
radius;
|
||||
h=Fs->pix_width,
|
||||
v=Fs->pix_height,
|
||||
radius;
|
||||
CDrv *dv;
|
||||
CBlkDev *bd=Let2BlkDev(drv_let);
|
||||
CDC *dc=DCAlias;
|
||||
@@ -367,18 +367,18 @@ public U0 DskView(U8 drv_let=0)
|
||||
sect_end =-((dv->base_offset+dv->size)*2*ã/(bd->max_blk+1));
|
||||
dc->color=BLACK;
|
||||
GrLine(dc,h>>1,v>>1,
|
||||
h>>1+radius*Cos(sect_start),
|
||||
v>>1+radius*Sin(sect_start));
|
||||
h>>1+radius*Cos(sect_start),
|
||||
v>>1+radius*Sin(sect_start));
|
||||
GrLine(dc,h>>1,v>>1,
|
||||
h>>1+radius*Cos(sect_end),
|
||||
v>>1+radius*Sin(sect_end));
|
||||
h>>1+radius*Cos(sect_end),
|
||||
v>>1+radius*Sin(sect_end));
|
||||
|
||||
dc->color=j;
|
||||
GrPrint(dc,0,v-FONT_HEIGHT*j,"%C %-8Z",Drv2Let(dv),
|
||||
dv->type.u16[0],"ST_DRV_TYPES");
|
||||
dv->type.u16[0],"ST_DRV_TYPES");
|
||||
GrFloodFill(dc,
|
||||
h>>1+(radius-4)*Cos((sect_start+sect_end)/2),
|
||||
v>>1+(radius-4)*Sin((sect_start+sect_end)/2),FALSE);
|
||||
h>>1+(radius-4)*Cos((sect_start+sect_end)/2),
|
||||
v>>1+(radius-4)*Sin((sect_start+sect_end)/2),FALSE);
|
||||
j++;
|
||||
}
|
||||
}
|
||||
@@ -389,6 +389,8 @@ public U0 DskView(U8 drv_let=0)
|
||||
DCDel(dc);
|
||||
}
|
||||
|
||||
#help_index "File/Cmd Line (Typically);Cmd Line (Typically)"
|
||||
|
||||
public I64 Zip(U8 *files_find_mask="*",U8 *fu_flags=NULL)
|
||||
{//Compress files by moving to .Z filename.
|
||||
U8 *st;
|
||||
@@ -412,7 +414,7 @@ public I64 Zip(U8 *files_find_mask="*",U8 *fu_flags=NULL)
|
||||
public I64 Unzip(U8 *files_find_mask="*.Z",U8 *fu_flags=NULL)
|
||||
{//Uncompress files by moving to not .Z filename.
|
||||
//You don't have to do this for normal operation.
|
||||
//It automatically unzips ".Z" files.
|
||||
//It automatically unzips ".Z" files.
|
||||
U8 *st;
|
||||
CDirEntry *tempde,*tempde1;
|
||||
I64 result=0,fuf_flags=0;
|
||||
|
||||
+17
-13
@@ -11,7 +11,8 @@ Bool ChkDskConfirm(Bool *_fix,Bool *_confirm)
|
||||
return *_fix;
|
||||
}
|
||||
|
||||
I64 RedSeaChkDskLst(CDrv *dv,CDirEntry *tempde1,U8 *bits,U8 *bits2,I64 size,I64 bpc)
|
||||
I64 RedSeaChkDskLst(CDrv *dv,CDirEntry *tempde1,
|
||||
U8 *bits,U8 *bits2,I64 size,I64 bpc)
|
||||
{
|
||||
CDirEntry *tempde2;
|
||||
I64 i,j,errs=0;
|
||||
@@ -23,18 +24,18 @@ I64 RedSeaChkDskLst(CDrv *dv,CDirEntry *tempde1,U8 *bits,U8 *bits2,I64 size,I64
|
||||
for (i=0;i<j;i++) {
|
||||
if (i+tempde1->cluster-dv->data_area>size) {
|
||||
PrintErr("Invalid Cluster:%s Cluster:%X\n",tempde1->full_name,
|
||||
i+tempde1->cluster);
|
||||
i+tempde1->cluster);
|
||||
errs++;
|
||||
break;
|
||||
}
|
||||
if (LBts(bits,i+tempde1->cluster-dv->data_area)) {
|
||||
PrintErr("Dbl Alloc:%s Cluster:%X\n",tempde1->full_name,
|
||||
i+tempde1->cluster);
|
||||
i+tempde1->cluster);
|
||||
errs++;
|
||||
}
|
||||
if (!LBtr(bits2,i+tempde1->cluster-dv->data_area)) {
|
||||
PrintErr("UnAlloc:%s Cluster:%X\n",tempde1->full_name,
|
||||
i+tempde1->cluster);
|
||||
i+tempde1->cluster);
|
||||
errs++;
|
||||
}
|
||||
}
|
||||
@@ -49,8 +50,8 @@ I64 RedSeaChkDsk(U8 drv_let,Bool *_fix,Bool *_confirm)
|
||||
I64 i,j,bpc,size,errs=0;
|
||||
CDrv *dv=Let2Drv(drv_let),*old_dv=Fs->cur_dv;
|
||||
U8 *files_find_mask=MStrPrint("%c:/*",Drv2Let(dv)),
|
||||
*old_dir=StrNew(Fs->cur_dir),
|
||||
*bits,*bits2;
|
||||
*old_dir=StrNew(Fs->cur_dir),
|
||||
*bits,*bits2;
|
||||
CDirEntry *ptr,*ptr2;
|
||||
|
||||
Drv(drv_let);
|
||||
@@ -84,7 +85,8 @@ I64 RedSeaChkDsk(U8 drv_let,Bool *_fix,Bool *_confirm)
|
||||
}
|
||||
}
|
||||
|
||||
errs+=RedSeaChkDskLst(dv,FilesFind(files_find_mask,FUF_RECURSE),bits,bits2,size,bpc);
|
||||
errs+=RedSeaChkDskLst(dv,FilesFind(files_find_mask,FUF_RECURSE),
|
||||
bits,bits2,size,bpc);
|
||||
for (i=1;i<size;i++)
|
||||
if (Bt(bits2,i)) {
|
||||
PrintWarn("Shouldn't Alloc Cluster:%0X\n",i+dv->data_area);
|
||||
@@ -102,7 +104,8 @@ I64 RedSeaChkDsk(U8 drv_let,Bool *_fix,Bool *_confirm)
|
||||
return errs;
|
||||
}
|
||||
|
||||
I64 FAT32ChkDskLst(CDrv *dv,CDirEntry *tempde1,U8 *bits,U32 *bits2,I64 size,I64 bpc)
|
||||
I64 FAT32ChkDskLst(CDrv *dv,CDirEntry *tempde1,
|
||||
U8 *bits,U32 *bits2,I64 size,I64 bpc)
|
||||
{
|
||||
CDirEntry *tempde2;
|
||||
I64 i,c,errs=0;
|
||||
@@ -152,8 +155,8 @@ I64 FAT32ChkDsk(U8 drv_let,Bool *_fix,Bool *_confirm)
|
||||
I64 i,bpc,size,c,errs=0;
|
||||
CDrv *dv=Let2Drv(drv_let),*old_dv=Fs->cur_dv;
|
||||
U8 *files_find_mask=MStrPrint("%c:/*",Drv2Let(dv)),
|
||||
*old_dir=StrNew(Fs->cur_dir),
|
||||
*bits;
|
||||
*old_dir=StrNew(Fs->cur_dir),
|
||||
*bits;
|
||||
U32 *bits2;
|
||||
Drv(drv_let);
|
||||
"Scanning...\n";
|
||||
@@ -182,7 +185,8 @@ I64 FAT32ChkDsk(U8 drv_let,Bool *_fix,Bool *_confirm)
|
||||
c=ClusterNumNext(dv,c);
|
||||
}
|
||||
|
||||
errs+=FAT32ChkDskLst(dv,FilesFind(files_find_mask,FUF_RECURSE),bits,bits2,size,bpc);
|
||||
errs+=FAT32ChkDskLst(dv,FilesFind(files_find_mask,FUF_RECURSE),
|
||||
bits,bits2,size,bpc);
|
||||
|
||||
bits2[1]=0; //See $LK,"FAT32Fmt",A="MN:FAT32Fmt"$()
|
||||
for (i=1;i<size;i++)
|
||||
@@ -220,8 +224,8 @@ public I64 ChkDsk(U8 drv_let=0,Bool fix=FALSE,Bool confirm=TRUE)
|
||||
if (fix)
|
||||
"It might be a little better. ";
|
||||
"Copy files to another partition or CD-ROM, "
|
||||
"reformat, and copy back. "
|
||||
"Or, copy from a back-up.\n";
|
||||
"reformat, and copy back. "
|
||||
"Or, copy from a back-up.\n";
|
||||
}
|
||||
return errs;
|
||||
}
|
||||
+19
-12
@@ -1,4 +1,4 @@
|
||||
#help_index "DolDoc/Output"
|
||||
#help_index "DolDoc/Output;StdOut/DolDoc"
|
||||
U0 DirFileDoc(CDoc *doc,CDirEntry *tempde)
|
||||
{
|
||||
while (tempde) {
|
||||
@@ -49,7 +49,8 @@ CFMUncollapsedLst *FMCollectUncollapsedLst(CDoc *doc)
|
||||
return result;
|
||||
}
|
||||
|
||||
U0 FMMarkUncollapsed(CDoc *doc,CFMUncollapsedLst *tempc,U8 *cur_entry,U8 *next_entry)
|
||||
U0 FMMarkUncollapsed(CDoc *doc,CFMUncollapsedLst *tempc,
|
||||
U8 *cur_entry,U8 *next_entry)
|
||||
{
|
||||
CDocEntry *doc_e=doc->root.next;
|
||||
CFMUncollapsedLst *tempc1;
|
||||
@@ -71,7 +72,8 @@ U0 FMMarkUncollapsed(CDoc *doc,CFMUncollapsedLst *tempc,U8 *cur_entry,U8 *next_e
|
||||
if (StrLen(tempde->full_name)==StrLen(cur_entry))
|
||||
cur_entry=NULL;
|
||||
} else if (next_entry) {
|
||||
if (!StrNCmp(next_entry,tempde->full_name,StrLen(tempde->full_name))) {
|
||||
if (!StrNCmp(next_entry,
|
||||
tempde->full_name,StrLen(tempde->full_name))) {
|
||||
doc->cur_entry=doc_e;
|
||||
if (StrLen(tempde->full_name)==StrLen(next_entry))
|
||||
cur_entry=NULL;
|
||||
@@ -86,7 +88,8 @@ U0 FMMarkUncollapsed(CDoc *doc,CFMUncollapsedLst *tempc,U8 *cur_entry,U8 *next_e
|
||||
if (StrLen(tempde->full_name)==StrLen(cur_entry))
|
||||
cur_entry=NULL;
|
||||
} else if (next_entry) {
|
||||
if (!StrNCmp(next_entry,tempde->full_name,StrLen(tempde->full_name))) {
|
||||
if (!StrNCmp(next_entry,
|
||||
tempde->full_name,StrLen(tempde->full_name))) {
|
||||
doc->cur_entry=doc_e;
|
||||
if (StrLen(tempde->full_name)==StrLen(next_entry))
|
||||
cur_entry=NULL;
|
||||
@@ -199,7 +202,8 @@ U0 FMRebuildDoc(CDoc **_doc,CDirEntry **_root,I64 mode)
|
||||
doc->flags|=DOCF_FORM;
|
||||
switch (mode) {
|
||||
case FM_NORMAL:
|
||||
DocPrint(doc,"$$PURPLE$$File Manager\n\n$$LK,\"Click for Help\",A=\"FI:::/Doc/FileMgr.TXT\"$$\n\n");
|
||||
DocPrint(doc,"$$PURPLE$$File Manager\n\n"
|
||||
"$$LK,\"Click for Help\",A=\"FI:::/Doc/FileMgr.TXT\"$$\n\n");
|
||||
break;
|
||||
case FM_PICK_FILE:
|
||||
DocPrint(doc,"$$PURPLE$$Pick file and press <ESC>\n\n");
|
||||
@@ -247,7 +251,7 @@ U0 FMRename(CDoc *doc)
|
||||
if (parent=tempde->parent) {
|
||||
Cd(parent->full_name);
|
||||
StrCpy(fn.name,tempde->name);
|
||||
if (DocFormDo(&fn)) {
|
||||
if (DocForm(&fn)) {
|
||||
Silent;
|
||||
Move(tempde->name,fn.name);
|
||||
Silent(OFF);
|
||||
@@ -258,7 +262,7 @@ U0 FMRename(CDoc *doc)
|
||||
if (parent=tempde->parent) {
|
||||
Cd(parent->full_name);
|
||||
StrCpy(fn.name,tempde->name);
|
||||
if (DocFormDo(&fn)) {
|
||||
if (DocForm(&fn)) {
|
||||
if (StrCmp(tempde->name,fn.name)) {
|
||||
Silent;
|
||||
if (CopyTree(tempde->name,fn.name))
|
||||
@@ -280,7 +284,7 @@ U0 FMMkDir(CDoc *doc)
|
||||
tempde=doc_e->user_data;
|
||||
if (parent=tempde->parent) {
|
||||
Cd(parent->full_name);
|
||||
if (DocFormDo(&fn)) {
|
||||
if (DocForm(&fn)) {
|
||||
Silent;
|
||||
MkDir(fn.name);
|
||||
Silent(OFF);
|
||||
@@ -289,7 +293,7 @@ U0 FMMkDir(CDoc *doc)
|
||||
} else if (doc_e->type_u8==DOCT_TREE) {
|
||||
tempde=doc_e->user_data;
|
||||
Cd(tempde->full_name);
|
||||
if (DocFormDo(&fn)) {
|
||||
if (DocForm(&fn)) {
|
||||
Silent;
|
||||
MkDir(fn.name);
|
||||
Silent(OFF);
|
||||
@@ -378,7 +382,7 @@ U0 FMMakeISO(CDoc *doc)
|
||||
st=MStrPrint("%s*",tempde->full_name);
|
||||
else
|
||||
st=MStrPrint("%s/*",tempde->full_name);
|
||||
CDFileCreate(,st);
|
||||
ISOFileCreate(,st);
|
||||
Free(st);
|
||||
Silent(OFF);
|
||||
}
|
||||
@@ -581,7 +585,9 @@ public U8 *FileMgr(I64 mode=FM_NORMAL,CTask *mem_task=NULL)
|
||||
case MSG_IP_L_UP:
|
||||
if (doc_ce) {
|
||||
gr.fp_final_screen_update=fp_old_final_screen_update;
|
||||
if (WinCursorPosSet(Fs,a1/FONT_WIDTH+Fs->win_left+Fs->scroll_x/FONT_WIDTH,a2/FONT_HEIGHT+Fs->win_top+Fs->scroll_y/FONT_HEIGHT,TRUE)) {
|
||||
if (WinCursorPosSet(Fs,
|
||||
a1/FONT_WIDTH+Fs->win_left+Fs->scroll_x/FONT_WIDTH,
|
||||
a2/FONT_HEIGHT+Fs->win_top+Fs->scroll_y/FONT_HEIGHT,TRUE)) {
|
||||
doc_e=doc->cur_entry;
|
||||
if (doc_e!=doc_ce) {
|
||||
st2=NULL;
|
||||
@@ -705,7 +711,8 @@ public U8 *FileMgr(I64 mode=FM_NORMAL,CTask *mem_task=NULL)
|
||||
else if (mode==FM_PICK_DIR) {
|
||||
if (doc_ce->type_u8==DOCT_TREE)
|
||||
result=StrNew(tempde->full_name,mem_task);
|
||||
else if (doc_ce->type_u8==DOCT_MENU_VAL && (tempde=tempde->parent))
|
||||
else if (doc_ce->type_u8==DOCT_MENU_VAL &&
|
||||
(tempde=tempde->parent))
|
||||
result=StrNew(tempde->full_name,mem_task);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -137,7 +137,8 @@ U0 BibleInit()
|
||||
"98684\0"
|
||||
"100111\0");
|
||||
DefinePrint("ST_BIBLE_LINES","%d",
|
||||
Str2I64(DefineSub(DefineCnt("ST_BIBLE_BOOK_LINES")-1,"ST_BIBLE_BOOK_LINES"))-1);
|
||||
Str2I64(DefineSub(DefineCnt("ST_BIBLE_BOOK_LINES")-1,
|
||||
"ST_BIBLE_BOOK_LINES"))-1);
|
||||
} BibleInit;
|
||||
|
||||
public U8 *BibleLine2Verse(I64 line,I64 separate_ch=CH_SPACE)
|
||||
@@ -180,7 +181,8 @@ public U8 *BibleLine2Verse(I64 line,I64 separate_ch=CH_SPACE)
|
||||
}
|
||||
if (doc_e->type_u8==DOCT_TEXT && StrLen(doc_e->tag)>=3) {
|
||||
ptr=doc_e->tag+StrLen(doc_e->tag)-1;
|
||||
while (ptr>doc_e->tag && (!('0'<=*(ptr-1)<='9') || *ptr!=':' || !('0'<=*(ptr+1)<='9')))
|
||||
while (ptr>doc_e->tag && (!('0'<=*(ptr-1)<='9') || *ptr!=':' ||
|
||||
!('0'<=*(ptr+1)<='9')))
|
||||
ptr--;
|
||||
ptr--;
|
||||
while (ptr>=doc_e->tag && '0'<=*ptr<='9')
|
||||
|
||||
+51
-28
@@ -1,4 +1,4 @@
|
||||
#help_index "God;Graphics/Sprite"
|
||||
#help_index "God;Graphics/Sprite;Sprites"
|
||||
|
||||
U0 GodDoodleDraw(CTask *task,CDC *dc)
|
||||
{
|
||||
@@ -6,21 +6,25 @@ U0 GodDoodleDraw(CTask *task,CDC *dc)
|
||||
if (Blink) {
|
||||
if (god.doodle_done) {
|
||||
dc->color=RED;
|
||||
GrPrint(dc,(task->pix_width-FONT_WIDTH*29)>>1,(task->pix_height-3*FONT_HEIGHT)>>1,
|
||||
"Press <ESC> to insert sprite.");
|
||||
GrPrint(dc,(task->pix_width-FONT_WIDTH*39)>>1,(task->pix_height-3*FONT_HEIGHT)>>1+2*FONT_HEIGHT,
|
||||
"Press <SHIFT-ESC> to throw-away sprite.");
|
||||
GrPrint(dc,(task->pix_width-FONT_WIDTH*29)>>1,
|
||||
(task->pix_height-3*FONT_HEIGHT)>>1,
|
||||
"Press <ESC> to insert sprite.");
|
||||
GrPrint(dc,(task->pix_width-FONT_WIDTH*39)>>1,
|
||||
(task->pix_height-3*FONT_HEIGHT)>>1+2*FONT_HEIGHT,
|
||||
"Press <SHIFT-ESC> to throw-away sprite.");
|
||||
} else {
|
||||
dc->color=GREEN;
|
||||
GrPrint(dc,(task->pix_width-FONT_WIDTH*25)>>1,(task->pix_height-FONT_HEIGHT)>>1,
|
||||
"Press <SPACE> repeatedly.");
|
||||
GrPrint(dc,(task->pix_width-FONT_WIDTH*25)>>1,
|
||||
(task->pix_height-FONT_HEIGHT)>>1,
|
||||
"Press <SPACE> repeatedly.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
U0 GodDoodleSmooth(I64 num)
|
||||
{
|
||||
CDC *dc=DCExtract(god.doodle_dc,0,0,god.doodle_dc->width-1,god.doodle_dc->height-1);
|
||||
CDC *dc=DCExtract(god.doodle_dc,0,0,
|
||||
god.doodle_dc->width-1,god.doodle_dc->height-1);
|
||||
I64 i,x,y,x1,y1,c,histogram[16],best,best_cnt,c_old=god.doodle_dc->color;
|
||||
for (y=0;y<god.doodle_dc->height;y++)
|
||||
for (x=0;x<god.doodle_dc->width;x++) {
|
||||
@@ -45,10 +49,30 @@ U0 GodDoodleSmooth(I64 num)
|
||||
DCDel(dc);
|
||||
}
|
||||
|
||||
U0 GodDoodleBitsIns(I64 num_bits,I64 n)
|
||||
{//Insert bits into God doodle bit fifo.
|
||||
I64 i;
|
||||
for (i=0;i<num_bits;i++) {
|
||||
FifoU8Ins(god.doodle_fifo,n&1);
|
||||
n>>=1;
|
||||
}
|
||||
}
|
||||
|
||||
U0 GodDoodleHexIns(U8 *st)
|
||||
{//Insert hex record into God doodle bit fifo.
|
||||
U8 buf[2];
|
||||
if (st) {
|
||||
buf[1]=0;
|
||||
while (*buf=*st++)
|
||||
if (Bt(chars_bmp_hex_numeric,*buf))
|
||||
GodDoodleBitsIns(4,Str2I64(buf,16));
|
||||
}
|
||||
}
|
||||
|
||||
I64 GodDoodleBits(I64 num_bits)
|
||||
{
|
||||
U8 b;
|
||||
I64 i,k,result=0;
|
||||
I64 result=0;
|
||||
while (num_bits) {
|
||||
if (FifoU8Rem(god.doodle_fifo,&b)) {
|
||||
result=result<<1+b;
|
||||
@@ -62,19 +86,14 @@ I64 GodDoodleBits(I64 num_bits)
|
||||
FifoU8Flush(god.doodle_fifo);
|
||||
} else if ('0'<=god.doodle_ch<='9')
|
||||
GodDoodleSmooth(god.doodle_ch-'0');
|
||||
else {
|
||||
k=KbdMouseEvtTime>>GOD_BAD_BITS;
|
||||
for (i=0;i<GOD_GOOD_BITS;i++) {
|
||||
FifoU8Ins(god.doodle_fifo,k&1);
|
||||
k>>=1;
|
||||
}
|
||||
}
|
||||
else
|
||||
GodDoodleBitsIns(GOD_GOOD_BITS,KbdMouseEvtTime>>GOD_BAD_BITS);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public U8 *GodDoodleSprite()
|
||||
public U8 *GodDoodleSprite(U8 *hex=NULL)
|
||||
{//Make God draw sprite. $LK+PU,"Holy Spirit Instructions",A="FI:::/Adam/God/HSNotes.TXT"$
|
||||
I64 i,j,w,h,x,y,ch;
|
||||
U8 *elems;
|
||||
@@ -97,6 +116,7 @@ public U8 *GodDoodleSprite()
|
||||
|
||||
Fs->draw_it=&GodDoodleDraw;
|
||||
FifoU8Flush(god.doodle_fifo);
|
||||
GodDoodleHexIns(hex);
|
||||
try {
|
||||
for (i=0;i<3;i++) {
|
||||
god.doodle_dc->color=RED;
|
||||
@@ -104,29 +124,32 @@ public U8 *GodDoodleSprite()
|
||||
nobound_switch (GodDoodleBits(3)) {
|
||||
case 0:
|
||||
GrEllipse3(god.doodle_dc,
|
||||
(w-1)*GodDoodleBits(5)/15.5-w/2,(h-1)*GodDoodleBits(5)/15.5-h/2,0,
|
||||
(w-1)*GodDoodleBits(5)/15.5,(h-1)*GodDoodleBits(5)/15.5);
|
||||
(w-1)*GodDoodleBits(5)/15.5-w/2,
|
||||
(h-1)*GodDoodleBits(5)/15.5-h/2,0,
|
||||
(w-1)*GodDoodleBits(5)/15.5,(h-1)*GodDoodleBits(5)/15.5);
|
||||
break;
|
||||
case 1:
|
||||
GrCircle3(god.doodle_dc,
|
||||
(w-1)*GodDoodleBits(5)/15.5-w/2,(h-1)*GodDoodleBits(5)/15.5-h/2,0,
|
||||
(w-1)*GodDoodleBits(5)/15.5);
|
||||
(w-1)*GodDoodleBits(5)/15.5-w/2,
|
||||
(h-1)*GodDoodleBits(5)/15.5-h/2,0,
|
||||
(w-1)*GodDoodleBits(5)/15.5);
|
||||
break;
|
||||
case 2:
|
||||
GrBorder(god.doodle_dc,
|
||||
(w-1)*GodDoodleBits(5)/15.5-w/2,(h-1)*GodDoodleBits(5)/15.5-h/2,
|
||||
(w-1)*GodDoodleBits(5)/15.5,(h-1)*GodDoodleBits(5)/15.5);
|
||||
(w-1)*GodDoodleBits(5)/15.5-w/2,
|
||||
(h-1)*GodDoodleBits(5)/15.5-h/2,
|
||||
(w-1)*GodDoodleBits(5)/15.5,(h-1)*GodDoodleBits(5)/15.5);
|
||||
break;
|
||||
case 3...7:
|
||||
GrLine3(god.doodle_dc,
|
||||
(w-1)*GodDoodleBits(4)/15,(h-1)*GodDoodleBits(4)/15,0,
|
||||
(w-1)*GodDoodleBits(4)/15,(h-1)*GodDoodleBits(4)/15,0);
|
||||
(w-1)*GodDoodleBits(4)/15,(h-1)*GodDoodleBits(4)/15,0,
|
||||
(w-1)*GodDoodleBits(4)/15,(h-1)*GodDoodleBits(4)/15,0);
|
||||
break;
|
||||
}
|
||||
for (j=0;j<6;j++) {
|
||||
x=(w-1)*GodDoodleBits(5)/31+w/64;
|
||||
y=(h-1)*GodDoodleBits(5)/31+h/64;
|
||||
switch(GodDoodleBits(2)) {
|
||||
nobound_switch(GodDoodleBits(2)) {
|
||||
case 0: god.doodle_dc->color=BLACK; break;
|
||||
case 1: god.doodle_dc->color=DKGRAY; break;
|
||||
case 2: god.doodle_dc->color=LTGRAY; break;
|
||||
@@ -155,10 +178,10 @@ public U8 *GodDoodleSprite()
|
||||
}
|
||||
|
||||
#help_index "God"
|
||||
public U0 GodDoodle()
|
||||
public U0 GodDoodle(U8 *hex=NULL)
|
||||
{//Make God draw sprite, insert in doc. $LK+PU,"Holy Spirit Instructions",A="FI:::/Adam/God/HSNotes.TXT"$
|
||||
U8 *elems;
|
||||
if (elems=GodDoodleSprite) {
|
||||
if (elems=GodDoodleSprite(hex)) {
|
||||
Sprite(elems);
|
||||
Free(elems);
|
||||
}
|
||||
|
||||
+3
-3
@@ -14,11 +14,11 @@ public class CGodGlbls
|
||||
Bool doodle_done;
|
||||
} god;
|
||||
MemSet(&god,0,sizeof(CGodGlbls));
|
||||
god.doodle_fifo =FifoU8New(32);
|
||||
god.fifo =FifoU8New(32);
|
||||
god.doodle_fifo =FifoU8New(2048*8);
|
||||
god.fifo =FifoU8New(2048*8);
|
||||
|
||||
extern U0 GodBitsIns(I64 num_bits,I64 n);
|
||||
extern U0 GodWord();
|
||||
extern U0 GodPassage(I64 num_lines=20);
|
||||
extern U0 GodSong();
|
||||
extern U0 GodDoodle();
|
||||
extern U0 GodDoodle(U8 *hex=NULL);
|
||||
@@ -155,7 +155,7 @@ public U8 *GodSongStr()
|
||||
}
|
||||
|
||||
public U0 GodSong()
|
||||
{//Make God generate 2measures x 2 + 2measures x 2 song. $LK+PU,"Holy Spirit Instructions",A="FI:::/Adam/God/HSNotes.TXT"$
|
||||
{//Make God generate 2measuresx2+2measuresx2. $LK+PU,"Holy Spirit Instructions",A="FI:::/Adam/God/HSNotes.TXT"$
|
||||
U8 *st1=GodSongStr,*st2=GodSongStr;
|
||||
if (st1 && st2)
|
||||
DocPrint(DocPut,"$$SO,\"<Song>\",A=\"%s%s%s%s\"$$",st1,st1,st2,st2);
|
||||
|
||||
@@ -94,6 +94,7 @@ Pretty ladies? $FG,4$$TX,"A prince is not flustered.",HTML="http://www.youtube
|
||||
Animal sacrifices? $FG,4$Early Jews were "primitive".$FG$
|
||||
What do elephants think about? $FG,4$"Skin, hunger"$FG$
|
||||
What makes elephants happy? $FG,4$"Baths"$FG$
|
||||
Elephants $FG,4$"Mini-skirts" (Skin webbing from back leg.)$FG$
|
||||
What makes my birds happy? $FG,4$"Gnawing"$FG$
|
||||
What makes my birds laugh? $FG,4$"Bite ouch" (If I say "ouch".)$FG$
|
||||
What are my birds saying? $FG,4$"Chanting"$FG$
|
||||
@@ -117,6 +118,7 @@ Should I listen to classical? $FG,4$"Poison"$FG$
|
||||
Do You like chess people? $FG,4$"Do not admire the proud."$FG$
|
||||
Chess? $FG,4$"... will winter with you."$FG$
|
||||
$FG,4$"Headstones"$FG$
|
||||
If You could teach one class? $FG,4$Health$FG$
|
||||
Favorite video game? $FG,4$Donkey Kong$FG$
|
||||
Favorite National Park? $FG,4$$TX,"Whitman Mission",HTML="http://www.nps.gov/whmi/index.htm"$$FG$
|
||||
Favorite National Anthem? $FG,4$$TX,"Latvia's National Anthem",HTML="http://www.youtube.com/watch?v=qKITbBjO4nE"$$FG$
|
||||
|
||||
+15
-4
@@ -48,6 +48,17 @@ public U0 GodBitsIns(I64 num_bits,I64 n)
|
||||
}
|
||||
}
|
||||
|
||||
public U0 GodHexIns(U8 *st)
|
||||
{//Insert hex record into God bit fifo.
|
||||
U8 buf[2];
|
||||
if (st) {
|
||||
buf[1]=0;
|
||||
while (*buf=*st++)
|
||||
if (Bt(chars_bmp_hex_numeric,*buf))
|
||||
GodBitsIns(4,Str2I64(buf,16));
|
||||
}
|
||||
}
|
||||
|
||||
public I64 GodBits(I64 num_bits,U8 *msg=NULL)
|
||||
{//Return N bits. If low on entropy pop-up okay.
|
||||
U8 b;
|
||||
@@ -76,11 +87,11 @@ public I64 GodInit(U8 *files_find_mask="/Adam/God/Vocab.TXT*",U8 *fu_flags=NULL)
|
||||
while (tempde) {
|
||||
if (buf=ptr=FileRead(tempde->full_name)) {
|
||||
while (*ptr) {
|
||||
while (*ptr && !Bt(chars_bitmap_word,*ptr))
|
||||
while (*ptr && !Bt(chars_bmp_word,*ptr))
|
||||
ptr++;
|
||||
if (*ptr) {
|
||||
ptr2=ptr;
|
||||
while (*ptr && Bt(chars_bitmap_word,*ptr))
|
||||
while (*ptr && Bt(chars_bmp_word,*ptr))
|
||||
ptr++;
|
||||
i++;
|
||||
}
|
||||
@@ -99,11 +110,11 @@ public I64 GodInit(U8 *files_find_mask="/Adam/God/Vocab.TXT*",U8 *fu_flags=NULL)
|
||||
while (tempde) {
|
||||
if (buf=ptr=FileRead(tempde->full_name)) {
|
||||
while (*ptr) {
|
||||
while (*ptr && !Bt(chars_bitmap_word,*ptr))
|
||||
while (*ptr && !Bt(chars_bmp_word,*ptr))
|
||||
ptr++;
|
||||
if (*ptr) {
|
||||
ptr2=ptr;
|
||||
while (*ptr && Bt(chars_bitmap_word,*ptr))
|
||||
while (*ptr && Bt(chars_bmp_word,*ptr))
|
||||
ptr++;
|
||||
ch=*ptr;
|
||||
*ptr=0;
|
||||
|
||||
+4350
-5032
File diff suppressed because it is too large.
Load diff
+16
-10
@@ -5,7 +5,8 @@ U0 GrInit1()
|
||||
"End\0Color\0Dither Color\0"
|
||||
"Width\0Planar Symmetry\0Transform On\0Transform Off\0Shift\0"
|
||||
"Point\0PolyPoint\0Line\0PolyLine\0Rect\0Rotated Rect\0"
|
||||
"Circle\0Ellipse\0Polygon\0BSpline2\0BSpline2 Closed\0BSpline3\0BSpline3 Closed\0"
|
||||
"Circle\0Ellipse\0Polygon\0BSpline2\0BSpline2 Closed\0"
|
||||
"BSpline3\0BSpline3 Closed\0"
|
||||
"Flood Fill\0Flood Fill Not Color\0BitMap\0Mesh\0Shiftable Mesh\0"
|
||||
"Arrow\0Text\0Text Box\0Text Diamond\0");
|
||||
DefineLstLoad("ST_SPRITE_ELEM_CODES",
|
||||
@@ -18,12 +19,13 @@ U0 GrInit1()
|
||||
}
|
||||
GrInit1;
|
||||
|
||||
#help_index "Graphics/Sprite"
|
||||
#help_index "Sprites/Binary"
|
||||
|
||||
class CMeshTri
|
||||
{
|
||||
I32 color; //Give one of 0-7 colors. Colors 8-15 are 0-7 with intensity bit set.
|
||||
I32 nums[3]; //Vertex number
|
||||
I32 color; //Give one of 0-7 colors.
|
||||
//Colors 8-15 are 0-7 with intensity bit set.
|
||||
I32 nums[3]; //Vertex number
|
||||
};
|
||||
|
||||
class CQueMeshTri
|
||||
@@ -49,7 +51,7 @@ public class CSpriteDitherColor : CSpriteBase
|
||||
U16 dither_color;
|
||||
};
|
||||
|
||||
public class CSpriteWidth : CSpriteBase
|
||||
public class CSpriteW : CSpriteBase
|
||||
{
|
||||
I32 width;
|
||||
};
|
||||
@@ -136,7 +138,7 @@ public class CSpritePtMeshU8s : CSpriteBase
|
||||
#define SPT_END 0 //$LK,"CSpriteBase",A="MN:CSpriteBase"$
|
||||
#define SPT_COLOR 1 //$LK,"CSpriteColor",A="MN:CSpriteColor"$
|
||||
#define SPT_DITHER_COLOR 2 //$LK,"CSpriteDitherColor",A="MN:CSpriteDitherColor"$
|
||||
#define SPT_WIDTH 3 //$LK,"CSpriteWidth",A="MN:CSpriteWidth"$
|
||||
#define SPT_WIDTH 3 //$LK,"CSpriteW",A="MN:CSpriteW"$
|
||||
#define SPT_PLANAR_SYMMETRY 4 //$LK,"CSpritePtPt",A="MN:CSpritePtPt"$
|
||||
#define SPT_TRANSFORM_ON 5 //$LK,"CSpriteBase",A="MN:CSpriteBase"$
|
||||
#define SPT_TRANSFORM_OFF 6 //$LK,"CSpriteBase",A="MN:CSpriteBase"$
|
||||
@@ -157,14 +159,17 @@ public class CSpritePtMeshU8s : CSpriteBase
|
||||
#define SPT_FLOOD_FILL 21 //$LK,"CSpritePt",A="MN:CSpritePt"$
|
||||
#define SPT_FLOOD_FILL_NOT 22 //$LK,"CSpritePt",A="MN:CSpritePt"$
|
||||
#define SPT_BITMAP 23 //$LK,"CSpritePtWHU8s",A="MN:CSpritePtWHU8s"$
|
||||
#define SPT_MESH 24 //$LK,"CSpriteMeshU8s",A="MN:CSpriteMeshU8s"$ See $MA-X+PU,"::/Apps/GrModels",LM="Cd(\"::/Apps/GrModels\");Dir;View;\n"$.
|
||||
#define SPT_MESH 24 //$LK,"CSpriteMeshU8s",A="MN:CSpriteMeshU8s"$ See $MA-X+PU,"::/Apps/GrModels",LM="Cd(\"::/Apps/GrModels\");Dir;View;\n"$.
|
||||
#define SPT_SHIFTABLE_MESH 25 //$LK,"CSpritePtMeshU8s",A="MN:CSpritePtMeshU8s"$ See $MA-X+PU,"::/Apps/GrModels",LM="Cd(\"::/Apps/GrModels\");Dir;View;\n"$.
|
||||
#define SPT_ARROW 26 //$LK,"CSpritePtPt",A="MN:CSpritePtPt"$
|
||||
#define SPT_TEXT 27 //$LK,"CSpritePtStr",A="MN:CSpritePtStr"$
|
||||
#define SPT_TEXT_BOX 28 //$LK,"CSpritePtStr",A="MN:CSpritePtStr"$
|
||||
#define SPT_TEXT_DIAMOND 29 //$LK,"CSpritePtStr",A="MN:CSpritePtStr"$
|
||||
#define SPT_NUM_TYPES 30
|
||||
//See $LK,"Graphics/Sprite",A="HI:Graphics/Sprite"$. See $LK,"::/Adam/Gr/GrSpritePlot.CPP",A="FL:::/Adam/Gr/GrSpritePlot.CPP,1"$ and
|
||||
|
||||
#help_index "Graphics/Sprite;Sprites;Sprites/Binary"
|
||||
|
||||
//See $LK,"Sprites",A="HI:Sprites"$. See $LK,"::/Adam/Gr/GrSpritePlot.CPP",A="FL:::/Adam/Gr/GrSpritePlot.CPP,1"$ and
|
||||
//$LK,"::/Demo/Graphics/SpriteRaw.CPP"$ for how CSprite are stored.
|
||||
public class CSprite
|
||||
{
|
||||
@@ -175,7 +180,7 @@ public class CSprite
|
||||
CSpriteBase b;
|
||||
CSpriteColor c;
|
||||
CSpriteDitherColor d;
|
||||
CSpriteWidth w;
|
||||
CSpriteW w;
|
||||
CSpritePt p;
|
||||
CSpritePtPt pp;
|
||||
CSpritePtPtAng ppa;
|
||||
@@ -195,13 +200,14 @@ public class CSprite
|
||||
|
||||
extern I64 GrBlot3(CDC *dc,I64 x1,I64 y1,I64 z1,CDC *img);
|
||||
extern U8 *GrBitMap4ToBitMap8(U8 *dst,U8 *src,I64 src_size,I64 bkcolor);
|
||||
extern I64 *Mat4x4New(I64 *src,CTask *mem_task=NULL);
|
||||
extern U8 *SpriteQue2Sprite(CSprite *root,I64 *_size=NULL);
|
||||
|
||||
#include "GrGlbls"
|
||||
#include "GrTextBase"
|
||||
#include "GrAsm"
|
||||
#include "GrDC"
|
||||
#include "GrPalette"
|
||||
#include "GrDC"
|
||||
#include "GrInit"
|
||||
#include "GrMath"
|
||||
#include "GrScreen"
|
||||
|
||||
+4
-4
@@ -1,6 +1,5 @@
|
||||
#help_index "Graphics/Misc"
|
||||
asm {
|
||||
USE64
|
||||
//************************************
|
||||
_GR_UPDATE_LINE64::
|
||||
PUSH RBP
|
||||
@@ -398,9 +397,10 @@ _GR_ROP_EQU_U8_NO_CLIPPING::
|
||||
@@10: POP RBP
|
||||
RET1 24
|
||||
}
|
||||
_extern _GR_ROP_EQU_U8_NO_CLIPPING U0 GrRopEquU8NoClipping(I64 ch,U8 *dst,I64 width_internal);
|
||||
//No clipping
|
||||
public _extern _IS_PIX_COVERED0 Bool IsPixCovered0(CTask *task,I64 x,I64 y);
|
||||
_extern _GR_ROP_EQU_U8_NO_CLIPPING U0 GrRopEquU8NoClipping(I64 ch,
|
||||
U8 *dst,I64 width_internal);
|
||||
public _extern _IS_PIX_COVERED0 Bool IsPixCovered0(
|
||||
CTask *task,I64 x,I64 y);//No clipping
|
||||
|
||||
_extern _GR_UPDATE_LINE64 U0 GrUpdateLine64(
|
||||
U64 **_vga,U64 **_src,I64 d,U8 **_dst);
|
||||
|
||||
+175
-159
@@ -4,16 +4,11 @@ public Bool GrPlot0(CDC *dc=gr.dc,I64 x,I64 y)
|
||||
{//2D. No clipping or transformation or pen width.
|
||||
U8 *dst;
|
||||
I32 *db;
|
||||
I64 d,dist;
|
||||
I64 d;
|
||||
CColorROPU32 c,color=dc->color,bkcolor=dc->bkcolor;
|
||||
|
||||
if (dc->flags & DCF_LOCATE_NEAREST) {
|
||||
dist=DistSqrI64(x,y,dc->cur_x,dc->cur_y);
|
||||
if (dist<=dc->nearest_dist) {
|
||||
dc->nearest_sprite_elem_num=dc->cur_sprite_elem_num;
|
||||
dc->nearest_dist=dist;
|
||||
}
|
||||
}
|
||||
if (dc->flags & DCF_LOCATE_NEAREST)
|
||||
dc->dist=DistSqrI64(x,y,dc->cur_x,dc->cur_y);
|
||||
if (dc->flags & DCF_RECORD_EXTENTS) {
|
||||
if (x<dc->min_x) dc->min_x=x;
|
||||
if (x>dc->max_x) dc->max_x=x;
|
||||
@@ -71,8 +66,9 @@ public I64 GrPeek0(CDC *dc=gr.dc,I64 x,I64 y)
|
||||
public I64 GrBlot(CDC *dc=gr.dc,I64 x,I64 y,CDC *img)
|
||||
{//2D. Clipping but not transformation..
|
||||
I64 i,j,k,k1,kk,kk1,w1,h1,w2,h2,
|
||||
leading_pixels,leading_pixel_mask,whole_I64s,trailing_pixels,trailing_pixel_mask,
|
||||
reg bit_shift,dist,win_z_buf_line_inc,win_z_buf_line_dec,win_z_num,
|
||||
leading_pixels,leading_pixel_mask,whole_I64s,
|
||||
trailing_pixels,trailing_pixel_mask,
|
||||
reg bit_shift,win_z_buf_line_inc,win_z_buf_line_dec,win_z_num,
|
||||
color_mask;
|
||||
U8 reg *dst,*src;
|
||||
I32 db;
|
||||
@@ -99,13 +95,8 @@ public I64 GrBlot(CDC *dc=gr.dc,I64 x,I64 y,CDC *img)
|
||||
x+=win_task->pix_left;
|
||||
y+=win_task->pix_top;
|
||||
}
|
||||
if (dc->flags & DCF_LOCATE_NEAREST) {//TODO:Untested
|
||||
dist=DistSqrI64(x+img->width>>1,y+img->height>>1,dc->cur_x,dc->cur_y);
|
||||
if (dist<=dc->nearest_dist) {
|
||||
dc->nearest_sprite_elem_num=dc->cur_sprite_elem_num;
|
||||
dc->nearest_dist=dist;
|
||||
}
|
||||
}
|
||||
if (dc->flags & DCF_LOCATE_NEAREST)
|
||||
dc->dist=DistSqrI64(x+img->width>>1,y+img->height>>1,dc->cur_x,dc->cur_y);
|
||||
if (dc->flags & DCF_SCREEN_BITMAP) {
|
||||
if (x+w1<0) w1=-x;
|
||||
if (x+w2>win_task->pix_right+1)
|
||||
@@ -166,7 +157,8 @@ public I64 GrBlot(CDC *dc=gr.dc,I64 x,I64 y,CDC *img)
|
||||
win_z_buf_ptr=NULL;
|
||||
else {
|
||||
win_z_num=win_task->win_z_num;
|
||||
win_z_buf_ptr=gr.win_z_buf(U8 *)+((h1+y)/FONT_HEIGHT*TEXT_COLS+(w1+x)/FONT_WIDTH)*sizeof(U16);
|
||||
win_z_buf_ptr=gr.win_z_buf(U8 *)+((h1+y)/FONT_HEIGHT*TEXT_COLS+
|
||||
(w1+x)/FONT_WIDTH)*sizeof(U16);
|
||||
win_z_buf_line_dec=whole_I64s;
|
||||
if (leading_pixels)
|
||||
win_z_buf_line_dec++;
|
||||
@@ -187,7 +179,9 @@ public I64 GrBlot(CDC *dc=gr.dc,I64 x,I64 y,CDC *img)
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
if (bit_shift)
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|
|
||||
(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&~leading_pixel_mask&color_mask;
|
||||
(*src(U64 *)++>>bit_shift|
|
||||
*src(I64 *)<<(64-bit_shift))&
|
||||
~leading_pixel_mask&color_mask;
|
||||
else
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|
|
||||
*src(I64 *)++&~leading_pixel_mask&color_mask;
|
||||
@@ -199,7 +193,8 @@ public I64 GrBlot(CDC *dc=gr.dc,I64 x,I64 y,CDC *img)
|
||||
if (bit_shift)
|
||||
for (i=0;i<whole_I64s;i++)
|
||||
if (win_z_num>=*win_z_buf_ptr++)
|
||||
*dst(I64 *)++=(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&color_mask;
|
||||
*dst(I64 *)++=(*src(U64 *)++>>bit_shift|
|
||||
*src(I64 *)<<(64-bit_shift))&color_mask;
|
||||
else {
|
||||
src(I64 *)++;
|
||||
dst(I64 *)++;
|
||||
@@ -215,7 +210,9 @@ public I64 GrBlot(CDC *dc=gr.dc,I64 x,I64 y,CDC *img)
|
||||
if (trailing_pixels && win_z_num>=*win_z_buf_ptr++) {
|
||||
if (bit_shift)
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&~trailing_pixel_mask&color_mask;
|
||||
(*src(U64 *)++>>bit_shift|
|
||||
*src(I64 *)<<(64-bit_shift))&
|
||||
~trailing_pixel_mask&color_mask;
|
||||
else
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
*src(I64 *)++&~trailing_pixel_mask&color_mask;
|
||||
@@ -234,14 +231,17 @@ public I64 GrBlot(CDC *dc=gr.dc,I64 x,I64 y,CDC *img)
|
||||
if (leading_pixels) {
|
||||
if (bit_shift)
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|
|
||||
(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&~leading_pixel_mask&color_mask;
|
||||
(*src(U64 *)++>>bit_shift|
|
||||
*src(I64 *)<<(64-bit_shift))&
|
||||
~leading_pixel_mask&color_mask;
|
||||
else
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|
|
||||
*src(I64 *)++&~leading_pixel_mask&color_mask;
|
||||
}
|
||||
if (bit_shift)
|
||||
for (i=0;i<whole_I64s;i++)
|
||||
*dst(I64 *)++=(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&color_mask;
|
||||
*dst(I64 *)++=(*src(U64 *)++>>bit_shift|
|
||||
*src(I64 *)<<(64-bit_shift))&color_mask;
|
||||
else
|
||||
for (i=0;i<whole_I64s;i++)
|
||||
*dst(I64 *)++=*src(I64 *)++&color_mask;
|
||||
@@ -249,7 +249,9 @@ public I64 GrBlot(CDC *dc=gr.dc,I64 x,I64 y,CDC *img)
|
||||
if (trailing_pixels) {
|
||||
if (bit_shift)
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&~trailing_pixel_mask&color_mask;
|
||||
(*src(U64 *)++>>bit_shift|
|
||||
*src(I64 *)<<(64-bit_shift))&
|
||||
~trailing_pixel_mask&color_mask;
|
||||
else
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
*src(I64 *)++&~trailing_pixel_mask&color_mask;
|
||||
@@ -268,7 +270,8 @@ public I64 GrBlot(CDC *dc=gr.dc,I64 x,I64 y,CDC *img)
|
||||
}
|
||||
} else {
|
||||
win_z_num =win_task->win_z_num;
|
||||
win_z_buf_ptr =gr.win_z_buf(U8 *)+((h1+y)/FONT_HEIGHT*TEXT_COLS+(w1+x)/FONT_WIDTH)*sizeof(U16);
|
||||
win_z_buf_ptr =gr.win_z_buf(U8 *)+
|
||||
((h1+y)/FONT_HEIGHT*TEXT_COLS+(w1+x)/FONT_WIDTH)*sizeof(U16);
|
||||
win_z_buf_line_dec=whole_I64s;
|
||||
if (leading_pixels)
|
||||
win_z_buf_line_dec++;
|
||||
@@ -307,7 +310,8 @@ public I64 GrBlot(CDC *dc=gr.dc,I64 x,I64 y,CDC *img)
|
||||
win_z_buf_ptr=NULL;
|
||||
else {
|
||||
win_z_num=win_task->win_z_num;
|
||||
win_z_buf_ptr=gr.win_z_buf(U8 *)+((h1+y)/FONT_HEIGHT*TEXT_COLS+(w1+x)/FONT_WIDTH)*sizeof(U16);
|
||||
win_z_buf_ptr=gr.win_z_buf(U8 *)+
|
||||
((h1+y)/FONT_HEIGHT*TEXT_COLS+(w1+x)/FONT_WIDTH)*sizeof(U16);
|
||||
win_z_buf_line_dec=whole_I64s;
|
||||
if (leading_pixels)
|
||||
win_z_buf_line_dec++;
|
||||
@@ -328,7 +332,8 @@ public I64 GrBlot(CDC *dc=gr.dc,I64 x,I64 y,CDC *img)
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
if (bit_shift)
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|
|
||||
(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&~leading_pixel_mask;
|
||||
(*src(U64 *)++>>bit_shift|
|
||||
*src(I64 *)<<(64-bit_shift))&~leading_pixel_mask;
|
||||
else
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|
|
||||
*src(I64 *)++&~leading_pixel_mask;
|
||||
@@ -340,7 +345,8 @@ public I64 GrBlot(CDC *dc=gr.dc,I64 x,I64 y,CDC *img)
|
||||
if (bit_shift)
|
||||
for (i=0;i<whole_I64s;i++)
|
||||
if (win_z_num>=*win_z_buf_ptr++)
|
||||
*dst(I64 *)++=*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift);
|
||||
*dst(I64 *)++=*src(U64 *)++>>bit_shift|
|
||||
*src(I64 *)<<(64-bit_shift);
|
||||
else {
|
||||
src(I64 *)++;
|
||||
dst(I64 *)++;
|
||||
@@ -356,7 +362,8 @@ public I64 GrBlot(CDC *dc=gr.dc,I64 x,I64 y,CDC *img)
|
||||
if (trailing_pixels && win_z_num>=*win_z_buf_ptr++) {
|
||||
if (bit_shift)
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&~trailing_pixel_mask;
|
||||
(*src(U64 *)++>>bit_shift|
|
||||
*src(I64 *)<<(64-bit_shift))&~trailing_pixel_mask;
|
||||
else
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
*src(I64 *)++&~trailing_pixel_mask;
|
||||
@@ -375,14 +382,16 @@ public I64 GrBlot(CDC *dc=gr.dc,I64 x,I64 y,CDC *img)
|
||||
if (leading_pixels) {
|
||||
if (bit_shift)
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|
|
||||
(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&~leading_pixel_mask;
|
||||
(*src(U64 *)++>>bit_shift|
|
||||
*src(I64 *)<<(64-bit_shift))&~leading_pixel_mask;
|
||||
else
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|
|
||||
*src(I64 *)++&~leading_pixel_mask;
|
||||
}
|
||||
if (bit_shift)
|
||||
for (i=0;i<whole_I64s;i++)
|
||||
*dst(I64 *)++=*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift);
|
||||
*dst(I64 *)++=*src(U64 *)++>>bit_shift|
|
||||
*src(I64 *)<<(64-bit_shift);
|
||||
else
|
||||
for (i=0;i<whole_I64s;i++)
|
||||
*dst(I64 *)++=*src(I64 *)++;
|
||||
@@ -390,7 +399,8 @@ public I64 GrBlot(CDC *dc=gr.dc,I64 x,I64 y,CDC *img)
|
||||
if (trailing_pixels) {
|
||||
if (bit_shift)
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&~trailing_pixel_mask;
|
||||
(*src(U64 *)++>>bit_shift|
|
||||
*src(I64 *)<<(64-bit_shift))&~trailing_pixel_mask;
|
||||
else
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
*src(I64 *)++&~trailing_pixel_mask;
|
||||
@@ -413,8 +423,9 @@ here1a:
|
||||
k+=img->width_internal;
|
||||
}
|
||||
} else {
|
||||
win_z_num =win_task->win_z_num;
|
||||
win_z_buf_ptr =gr.win_z_buf(U8 *)+((h1+y)/FONT_HEIGHT*TEXT_COLS+(w1+x)/FONT_WIDTH)*sizeof(U16);
|
||||
win_z_num =win_task->win_z_num;
|
||||
win_z_buf_ptr =gr.win_z_buf(U8 *)+
|
||||
((h1+y)/FONT_HEIGHT*TEXT_COLS+(w1+x)/FONT_WIDTH)*sizeof(U16);
|
||||
win_z_buf_line_dec=whole_I64s;
|
||||
if (leading_pixels)
|
||||
win_z_buf_line_dec++;
|
||||
@@ -458,7 +469,8 @@ here1a:
|
||||
win_z_buf_ptr=NULL;
|
||||
else {
|
||||
win_z_num=win_task->win_z_num;
|
||||
win_z_buf_ptr=gr.win_z_buf(U8 *)+((h1+y)/FONT_HEIGHT*TEXT_COLS+(w1+x)/FONT_WIDTH)*sizeof(U16);
|
||||
win_z_buf_ptr=gr.win_z_buf(U8 *)+
|
||||
((h1+y)/FONT_HEIGHT*TEXT_COLS+(w1+x)/FONT_WIDTH)*sizeof(U16);
|
||||
win_z_buf_line_dec=whole_I64s;
|
||||
if (leading_pixels)
|
||||
win_z_buf_line_dec++;
|
||||
@@ -479,7 +491,8 @@ here1a:
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
if (bit_shift)
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|
|
||||
(*dst(I64 *)^(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift)))&~leading_pixel_mask;
|
||||
(*dst(I64 *)^(*src(U64 *)++>>bit_shift|
|
||||
*src(I64 *)<<(64-bit_shift)))&~leading_pixel_mask;
|
||||
else
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|
|
||||
(*dst(I64 *)^*src(I64 *)++)&~leading_pixel_mask;
|
||||
@@ -491,7 +504,8 @@ here1a:
|
||||
if (bit_shift)
|
||||
for (i=0;i<whole_I64s;i++)
|
||||
if (win_z_num>=*win_z_buf_ptr++)
|
||||
*dst(I64 *)++^=*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift);
|
||||
*dst(I64 *)++^=*src(U64 *)++>>bit_shift|
|
||||
*src(I64 *)<<(64-bit_shift);
|
||||
else {
|
||||
src(I64 *)++;
|
||||
dst(I64 *)++;
|
||||
@@ -507,7 +521,8 @@ here1a:
|
||||
if (trailing_pixels && win_z_num>=*win_z_buf_ptr++) {
|
||||
if (bit_shift)
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
(*dst(I64 *)^(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift)))&~trailing_pixel_mask;
|
||||
(*dst(I64 *)^(*src(U64 *)++>>bit_shift|
|
||||
*src(I64 *)<<(64-bit_shift)))&~trailing_pixel_mask;
|
||||
else
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
(*dst(I64 *)^*src(I64 *)++)&~trailing_pixel_mask;
|
||||
@@ -526,21 +541,24 @@ here1a:
|
||||
if (leading_pixels) {
|
||||
if (bit_shift)
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|
|
||||
(*dst(I64 *)^(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift)))&~leading_pixel_mask;
|
||||
(*dst(I64 *)^(*src(U64 *)++>>bit_shift|
|
||||
*src(I64 *)<<(64-bit_shift)))&~leading_pixel_mask;
|
||||
else
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|
|
||||
(*dst(I64 *)^*src(I64 *)++)&~leading_pixel_mask;
|
||||
}
|
||||
if (bit_shift)
|
||||
for (i=0;i<whole_I64s;i++)
|
||||
*dst(I64 *)++^=*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift);
|
||||
*dst(I64 *)++^=*src(U64 *)++>>bit_shift|
|
||||
*src(I64 *)<<(64-bit_shift);
|
||||
else
|
||||
for (i=0;i<whole_I64s;i++)
|
||||
*dst(I64 *)++^=*src(I64 *)++;
|
||||
if (trailing_pixels) {
|
||||
if (bit_shift)
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
(*dst(I64 *)^(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift)))&~trailing_pixel_mask;
|
||||
(*dst(I64 *)^(*src(U64 *)++>>bit_shift|
|
||||
*src(I64 *)<<(64-bit_shift)))&~trailing_pixel_mask;
|
||||
else
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
(*dst(I64 *)^*src(I64 *)++)&~trailing_pixel_mask;
|
||||
@@ -588,7 +606,8 @@ U8 *GrBitMap1ToBitMap8(U8 *dst,U8 *src,I64 src_size,I64 bkcolor)
|
||||
return dst;
|
||||
}
|
||||
|
||||
public CDC *DCExtract(CDC *dc=gr.dc,I64 x1,I64 y1,I64 x2,I64 y2,CTask *task=NULL)
|
||||
public CDC *DCExtract(CDC *dc=gr.dc,I64 x1,I64 y1,I64 x2,I64 y2,
|
||||
CTask *task=NULL)
|
||||
{//Extract new device context rect from device context.
|
||||
CDC *result;
|
||||
CTask *win_task;
|
||||
@@ -597,9 +616,9 @@ public CDC *DCExtract(CDC *dc=gr.dc,I64 x1,I64 y1,I64 x2,I64 y2,CTask *task=NULL
|
||||
if (dc->flags & DCF_SCREEN_BITMAP) {
|
||||
win_task=dc->win_task;
|
||||
x1+=win_task->pix_left+win_task->scroll_x;
|
||||
y1+=win_task->pix_top+win_task->scroll_y;
|
||||
y1+=win_task->pix_top +win_task->scroll_y;
|
||||
x2+=win_task->pix_left+win_task->scroll_x;
|
||||
y2+=win_task->pix_top+win_task->scroll_y;
|
||||
y2+=win_task->pix_top +win_task->scroll_y;
|
||||
}
|
||||
result=DCNew(x2-x1+1,y2-y1+1,task);
|
||||
DCFill(result);
|
||||
@@ -613,7 +632,7 @@ public I64 GrPutChar(CDC *dc=gr.dc,I64 x,I64 y,U8 ch)
|
||||
{//2D. Clipping but not transformation.
|
||||
U8 reg *src,reg *dst,*font_ptr;
|
||||
I64 i,m,leading_pixels,trailing_pixels,leading_pixel_mask,trailing_pixel_mask,
|
||||
j,k1,kk1,w1,h1,w2,h2,reg bit_shift,dist,reg color_mask;
|
||||
j,k1,kk1,w1,h1,w2,h2,reg bit_shift,reg color_mask;
|
||||
CColorROPU32 color,c;
|
||||
CTask *win_task;
|
||||
|
||||
@@ -638,13 +657,8 @@ public I64 GrPutChar(CDC *dc=gr.dc,I64 x,I64 y,U8 ch)
|
||||
x+=win_task->pix_left;
|
||||
y+=win_task->pix_top;
|
||||
}
|
||||
if (dc->flags & DCF_LOCATE_NEAREST) {//TODO:Untested
|
||||
dist=DistSqrI64(x+w2>>1,y+h2>>1,dc->cur_x,dc->cur_y);
|
||||
if (dist<=dc->nearest_dist) {
|
||||
dc->nearest_sprite_elem_num=dc->cur_sprite_elem_num;
|
||||
dc->nearest_dist=dist;
|
||||
}
|
||||
}
|
||||
if (dc->flags & DCF_LOCATE_NEAREST)
|
||||
dc->dist=DistSqrI64(x+w2>>1,y+h2>>1,dc->cur_x,dc->cur_y);
|
||||
if (dc->flags & DCF_SCREEN_BITMAP) {
|
||||
if (x+w1<0) w1=-x;
|
||||
if (x+w2>win_task->pix_right+1)
|
||||
@@ -660,9 +674,9 @@ public I64 GrPutChar(CDC *dc=gr.dc,I64 x,I64 y,U8 ch)
|
||||
h2=dc->height-y;
|
||||
if (w1<w2<=FONT_WIDTH && h1<h2<=FONT_HEIGHT) {
|
||||
if (dc->flags & DCF_RECORD_EXTENTS) {
|
||||
if (x+w1<dc->min_x) dc->min_x=x+w1;
|
||||
if (x+w1 <dc->min_x) dc->min_x=x+w1;
|
||||
if (x+w2-1>dc->max_x) dc->max_x=x+w2-1;
|
||||
if (y+h1<dc->min_y) dc->min_y=y+h1;
|
||||
if (y+h1 <dc->min_y) dc->min_y=y+h1;
|
||||
if (y+h2-1>dc->max_y) dc->max_y=y+h2-1;
|
||||
}
|
||||
if (dc->flags & DCF_DONT_DRAW)
|
||||
@@ -709,7 +723,8 @@ public I64 GrPutChar(CDC *dc=gr.dc,I64 x,I64 y,U8 ch)
|
||||
case ROPB_MONO:
|
||||
for (j=h2-h1;j;j--) {
|
||||
m=gr.to_8_bits[*src(U16 *)>>bit_shift&0xFF];
|
||||
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|(color_mask&m|*dst(I64 *)&~m)&~leading_pixel_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|
|
||||
(color_mask&m|*dst(I64 *)&~m)&~leading_pixel_mask;
|
||||
src++;
|
||||
dst+=dc->width_internal;
|
||||
}
|
||||
@@ -717,7 +732,9 @@ public I64 GrPutChar(CDC *dc=gr.dc,I64 x,I64 y,U8 ch)
|
||||
case ROPB_XOR:
|
||||
if (color_mask) {
|
||||
for (j=h2-h1;j;j--) {
|
||||
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|(*dst(I64 *)^gr.to_8_bits[*src(U16 *)>>bit_shift&0xFF])&~leading_pixel_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|
|
||||
(*dst(I64 *)^gr.to_8_bits[*src(U16 *)>>bit_shift&0xFF])&
|
||||
~leading_pixel_mask;
|
||||
src++;
|
||||
dst+=dc->width_internal;
|
||||
}
|
||||
@@ -736,19 +753,21 @@ public I64 GrPutChar(CDC *dc=gr.dc,I64 x,I64 y,U8 ch)
|
||||
case ROPB_MONO:
|
||||
for (j=h2-h1;j;j--) {
|
||||
m=gr.to_8_bits[*src(U16 *)>>bit_shift&0xFF];
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|(color_mask&m|*dst(I64 *)&~m)&~trailing_pixel_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
(color_mask&m|*dst(I64 *)&~m)&~trailing_pixel_mask;
|
||||
src++;
|
||||
dst+=dc->width_internal;
|
||||
}
|
||||
break;
|
||||
case ROPB_XOR:
|
||||
if (color_mask) {
|
||||
if (color_mask)
|
||||
for (j=h2-h1;j;j--) {
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|(*dst(I64 *)^gr.to_8_bits[*src(U16 *)>>bit_shift&0xFF])&~trailing_pixel_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
(*dst(I64 *)^gr.to_8_bits[*src(U16 *)>>bit_shift&0xFF])&
|
||||
~trailing_pixel_mask;
|
||||
src++;
|
||||
dst+=dc->width_internal;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -764,21 +783,24 @@ public I64 GrPutChar(CDC *dc=gr.dc,I64 x,I64 y,U8 ch)
|
||||
for (j=h1;j<h2;j++) {
|
||||
if (!IsPixCovered0(win_task,k1,y+j)) {
|
||||
m=gr.to_8_bits[*src(U16 *)>>bit_shift&0xFF];
|
||||
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|(color_mask&m|*dst(I64 *)&~m)&~leading_pixel_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|
|
||||
(color_mask&m|*dst(I64 *)&~m)&~leading_pixel_mask;
|
||||
}
|
||||
src++;
|
||||
dst+=dc->width_internal;
|
||||
}
|
||||
break;
|
||||
case ROPB_XOR:
|
||||
if (color_mask) {
|
||||
if (color_mask)
|
||||
for (j=h1;j<h2;j++) {
|
||||
if (!IsPixCovered0(win_task,k1,y+j))
|
||||
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|(*dst(I64 *)^gr.to_8_bits[*src(U16 *)>>bit_shift&0xFF])&~leading_pixel_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|
|
||||
(*dst(I64 *)^gr.to_8_bits
|
||||
[*src(U16 *)>>bit_shift&0xFF])&
|
||||
~leading_pixel_mask;
|
||||
src++;
|
||||
dst+=dc->width_internal;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
k1+=8;
|
||||
@@ -795,21 +817,24 @@ public I64 GrPutChar(CDC *dc=gr.dc,I64 x,I64 y,U8 ch)
|
||||
for (j=h1;j<h2;j++) {
|
||||
if (!IsPixCovered0(win_task,k1,y+j)) {
|
||||
m=gr.to_8_bits[*src(U16 *)>>bit_shift&0xFF];
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|(color_mask&m|*dst(I64 *)&~m)&~trailing_pixel_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
(color_mask&m|*dst(I64 *)&~m)&~trailing_pixel_mask;
|
||||
}
|
||||
src++;
|
||||
dst+=dc->width_internal;
|
||||
}
|
||||
break;
|
||||
case ROPB_XOR:
|
||||
if (color_mask) {
|
||||
if (color_mask)
|
||||
for (j=h1;j<h2;j++) {
|
||||
if (!IsPixCovered0(win_task,k1,y+j))
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|(*dst(I64 *)^gr.to_8_bits[*src(U16 *)>>bit_shift&0xFF])&~trailing_pixel_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
(*dst(I64 *)^gr.to_8_bits
|
||||
[*src(U16 *)>>bit_shift&0xFF])&
|
||||
~trailing_pixel_mask;
|
||||
src++;
|
||||
dst+=dc->width_internal;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -885,8 +910,9 @@ public I64 GrVPrint(CDC *dc=gr.dc,I64 x,I64 y,U8 *fmt,...)
|
||||
public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
{//2D. Width Height. Clipping but not transformation.
|
||||
//Returns cnt of pixs changed.
|
||||
I64 i,result=0,j,k1,kk1,w1,h1,w2,h2,dist,
|
||||
leading_pixels,original_leading_pixels,whole_I64s,trailing_pixels,leading_pixel_mask,trailing_pixel_mask,
|
||||
I64 i,result=0,j,k1,kk1,w1,h1,w2,h2,
|
||||
leading_pixels,original_leading_pixels,whole_I64s,
|
||||
trailing_pixels,leading_pixel_mask,trailing_pixel_mask,
|
||||
win_z_buf_line_inc,win_z_buf_line_dec,win_z_num,color_mask;
|
||||
U8 reg *dst;
|
||||
U16 reg *win_z_buf_ptr;
|
||||
@@ -916,17 +942,10 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
y+=win_task->pix_top;
|
||||
}
|
||||
if (dc->flags & DCF_LOCATE_NEAREST) {//TODO:Untested
|
||||
if (dc->cur_x>=x && dc->cur_y>=y &&
|
||||
dc->cur_x<=x+w && dc->cur_y<=y+h) {
|
||||
dc->nearest_sprite_elem_num=dc->cur_sprite_elem_num;
|
||||
dc->nearest_dist=0;
|
||||
} else {
|
||||
dist=DistSqrI64(x+w>>1,y+h>>1,dc->cur_x,dc->cur_y);
|
||||
if (dist<=dc->nearest_dist) {
|
||||
dc->nearest_sprite_elem_num=dc->cur_sprite_elem_num;
|
||||
dc->nearest_dist=dist;
|
||||
}
|
||||
}
|
||||
if (x<=dc->cur_x<=x+w && y<=dc->cur_y<=y+h)
|
||||
dc->dist=0;
|
||||
else
|
||||
dc->dist=DistSqrI64(x+w>>1,y+h>>1,dc->cur_x,dc->cur_y);
|
||||
}
|
||||
if (dc->flags & DCF_SCREEN_BITMAP) {
|
||||
if (x+w1<0) w1=-x;
|
||||
@@ -943,9 +962,9 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
h2=dc->height-y;
|
||||
if (w1<w2<=w && h1<h2<=h) {
|
||||
if (dc->flags & DCF_RECORD_EXTENTS) {
|
||||
if (x+w1<dc->min_x) dc->min_x=x+w1;
|
||||
if (x+w1 <dc->min_x) dc->min_x=x+w1;
|
||||
if (x+w2-1>dc->max_x) dc->max_x=x+w2-1;
|
||||
if (y+h1<dc->min_y) dc->min_y=y+h1;
|
||||
if (y+h1 <dc->min_y) dc->min_y=y+h1;
|
||||
if (y+h2-1>dc->max_y) dc->max_y=y+h2-1;
|
||||
}
|
||||
if (dc->flags & DCF_DONT_DRAW)
|
||||
@@ -992,7 +1011,8 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
win_z_buf_ptr=NULL;
|
||||
else {
|
||||
win_z_num=win_task->win_z_num;
|
||||
win_z_buf_ptr=gr.win_z_buf(U8 *)+((h1+y)/FONT_HEIGHT*TEXT_COLS+(w1+x)/FONT_WIDTH)*sizeof(U16);
|
||||
win_z_buf_ptr=gr.win_z_buf(U8 *)+((h1+y)/FONT_HEIGHT*TEXT_COLS+
|
||||
(w1+x)/FONT_WIDTH)*sizeof(U16);
|
||||
win_z_buf_line_dec=whole_I64s;
|
||||
if (leading_pixels)
|
||||
win_z_buf_line_dec++;
|
||||
@@ -1018,7 +1038,8 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
dst=dc->body+kk1&~7;
|
||||
if (leading_pixels) {
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|color_mask&~leading_pixel_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|
|
||||
color_mask&~leading_pixel_mask;
|
||||
result+=leading_pixels;
|
||||
}
|
||||
dst(I64 *)++;
|
||||
@@ -1029,7 +1050,8 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
result+=8;
|
||||
}
|
||||
if (trailing_pixels && win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|color_mask&~trailing_pixel_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
color_mask&~trailing_pixel_mask;
|
||||
result+=trailing_pixels;
|
||||
}
|
||||
if ((j+y)&7==7)
|
||||
@@ -1047,11 +1069,13 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
color_mask=gr.to_8_colors[color.c0.color];
|
||||
dst=dc->body+kk1&~7;
|
||||
if (leading_pixels)
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|color_mask&~leading_pixel_mask;
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|
|
||||
color_mask&~leading_pixel_mask;
|
||||
for (i=0;i<whole_I64s;i++,dst(I64 *)++)
|
||||
*dst(I64 *)=color_mask;
|
||||
if (trailing_pixels)
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|color_mask&~trailing_pixel_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
color_mask&~trailing_pixel_mask;
|
||||
kk1+=dc->width_internal;
|
||||
if (RandU16<dc->dither_probability_u16)
|
||||
color.c0=dither_colors.c1;
|
||||
@@ -1069,7 +1093,8 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
dst=dc->body+kk1&~7;
|
||||
if (leading_pixels) {
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|*dst(I64 *)^color_mask&~leading_pixel_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|
|
||||
*dst(I64 *)^color_mask&~leading_pixel_mask;
|
||||
result+=leading_pixels;
|
||||
}
|
||||
dst(I64 *)++;
|
||||
@@ -1080,7 +1105,8 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
result+=8;
|
||||
}
|
||||
if (trailing_pixels && win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|*dst(I64 *)^color_mask&~trailing_pixel_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
*dst(I64 *)^color_mask&~trailing_pixel_mask;
|
||||
result+=trailing_pixels;
|
||||
}
|
||||
if ((j+y)&7==7)
|
||||
@@ -1098,11 +1124,13 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
color_mask=gr.to_8_colors[color.c0.color];
|
||||
dst=dc->body+kk1&~7;
|
||||
if (leading_pixels)
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|*dst(I64 *)^color_mask&~leading_pixel_mask;
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|
|
||||
*dst(I64 *)^color_mask&~leading_pixel_mask;
|
||||
for (i=0;i<whole_I64s;i++,dst(I64 *)++)
|
||||
*dst(I64 *)^=color_mask;
|
||||
if (trailing_pixels)
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|*dst(I64 *)^color_mask&~trailing_pixel_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
*dst(I64 *)^color_mask&~trailing_pixel_mask;
|
||||
kk1+=dc->width_internal;
|
||||
if (RandU16<dc->dither_probability_u16)
|
||||
color.c0=dither_colors.c1;
|
||||
@@ -1127,7 +1155,8 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
dst=dc->body+kk1&~7;
|
||||
if (leading_pixels) {
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|color_mask&~leading_pixel_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|
|
||||
color_mask&~leading_pixel_mask;
|
||||
result+=leading_pixels;
|
||||
}
|
||||
dst(I64 *)++;
|
||||
@@ -1138,7 +1167,8 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
result+=8;
|
||||
}
|
||||
if (trailing_pixels && win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|color_mask&~trailing_pixel_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
color_mask&~trailing_pixel_mask;
|
||||
result+=trailing_pixels;
|
||||
}
|
||||
if ((j+y)&7==7)
|
||||
@@ -1154,11 +1184,13 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
gr.to_8_bits[0xAA]&gr.to_8_colors[color.c1.color];
|
||||
dst=dc->body+kk1&~7;
|
||||
if (leading_pixels)
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|color_mask&~leading_pixel_mask;
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|
|
||||
color_mask&~leading_pixel_mask;
|
||||
for (i=0;i<whole_I64s;i++,dst(I64 *)++)
|
||||
*dst(I64 *)=color_mask;
|
||||
if (trailing_pixels)
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|color_mask&~trailing_pixel_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
color_mask&~trailing_pixel_mask;
|
||||
kk1+=dc->width_internal;
|
||||
SwapU16(&color.c0,&color.c1);
|
||||
}
|
||||
@@ -1174,7 +1206,8 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
dst=dc->body+kk1&~7;
|
||||
if (leading_pixels) {
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|*dst(I64 *)^color_mask&~leading_pixel_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|
|
||||
*dst(I64 *)^color_mask&~leading_pixel_mask;
|
||||
result+=leading_pixels;
|
||||
}
|
||||
dst(I64 *)++;
|
||||
@@ -1185,7 +1218,8 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
result+=8;
|
||||
}
|
||||
if (trailing_pixels && win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|*dst(I64 *)^color_mask&~trailing_pixel_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
*dst(I64 *)^color_mask&~trailing_pixel_mask;
|
||||
result+=trailing_pixels;
|
||||
}
|
||||
if ((j+y)&7==7)
|
||||
@@ -1201,11 +1235,13 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
gr.to_8_bits[0xAA]&gr.to_8_colors[color.c1.color];
|
||||
dst=dc->body+kk1&~7;
|
||||
if (leading_pixels)
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|*dst(I64 *)^color_mask&~leading_pixel_mask;
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|
|
||||
*dst(I64 *)^color_mask&~leading_pixel_mask;
|
||||
for (i=0;i<whole_I64s;i++,dst(I64 *)++)
|
||||
*dst(I64 *)^=color_mask;
|
||||
if (trailing_pixels)
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|*dst(I64 *)^color_mask&~trailing_pixel_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
*dst(I64 *)^color_mask&~trailing_pixel_mask;
|
||||
kk1+=dc->width_internal;
|
||||
SwapU16(&color.c0,&color.c1);
|
||||
}
|
||||
@@ -1225,7 +1261,8 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
dst=dc->body+kk1&~7;
|
||||
if (leading_pixels) {
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|color_mask&~leading_pixel_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|
|
||||
color_mask&~leading_pixel_mask;
|
||||
result+=leading_pixels;
|
||||
}
|
||||
dst(I64 *)++;
|
||||
@@ -1236,7 +1273,8 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
result+=8;
|
||||
}
|
||||
if (trailing_pixels && win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|color_mask&~trailing_pixel_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
color_mask&~trailing_pixel_mask;
|
||||
result+=trailing_pixels;
|
||||
}
|
||||
if ((j+y)&7==7)
|
||||
@@ -1249,11 +1287,13 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
for (j=h2-h1;j;j--) {
|
||||
dst(I64 *)=dc->body+kk1&~7;
|
||||
if (leading_pixels)
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|color_mask&~leading_pixel_mask;
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|
|
||||
color_mask&~leading_pixel_mask;
|
||||
for (i=0;i<whole_I64s;i++,dst(I64 *)++)
|
||||
*dst(I64 *)=color_mask;
|
||||
if (trailing_pixels)
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|color_mask&~trailing_pixel_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
color_mask&~trailing_pixel_mask;
|
||||
kk1+=dc->width_internal;
|
||||
}
|
||||
result=(h2-h1)*(w2-w1);
|
||||
@@ -1266,7 +1306,8 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
dst=dc->body+kk1&~7;
|
||||
if (leading_pixels) {
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|*dst(I64 *)^color_mask&~leading_pixel_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|
|
||||
*dst(I64 *)^color_mask&~leading_pixel_mask;
|
||||
result+=leading_pixels;
|
||||
}
|
||||
dst(I64 *)++;
|
||||
@@ -1277,7 +1318,8 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
result+=8;
|
||||
}
|
||||
if (trailing_pixels && win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|*dst(I64 *)^color_mask&~trailing_pixel_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
*dst(I64 *)^color_mask&~trailing_pixel_mask;
|
||||
result+=trailing_pixels;
|
||||
}
|
||||
if ((j+y)&7==7)
|
||||
@@ -1290,11 +1332,13 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
for (j=h2-h1;j;j--) {
|
||||
dst=dc->body+kk1&~7;
|
||||
if (leading_pixels)
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|*dst(I64 *)^color_mask&~leading_pixel_mask;
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|
|
||||
*dst(I64 *)^color_mask&~leading_pixel_mask;
|
||||
for (i=0;i<whole_I64s;i++,dst(I64 *)++)
|
||||
*dst(I64 *)^=color_mask;
|
||||
if (trailing_pixels)
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|*dst(I64 *)^color_mask&~trailing_pixel_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
*dst(I64 *)^color_mask&~trailing_pixel_mask;
|
||||
kk1+=dc->width_internal;
|
||||
}
|
||||
result=(h2-h1)*(w2-w1);
|
||||
@@ -1327,11 +1371,8 @@ I64 GrRayLenMinus(CDC *dc,I64 x,I64 y)
|
||||
if (dc->flags & DCF_SCREEN_BITMAP) {
|
||||
x3+=win_task->pix_left;
|
||||
y3+=win_task->pix_top;
|
||||
if (x3<0 || y3<0 ||
|
||||
x3>win_task->pix_right ||
|
||||
y3>win_task->pix_bottom ||
|
||||
!(dc->flags&DCF_ON_TOP) &&
|
||||
IsPixCovered0(win_task,x3,y3))
|
||||
if (!(0<=x3<=win_task->pix_right) || !(0<=y3<=win_task->pix_bottom) ||
|
||||
!(dc->flags&DCF_ON_TOP) && IsPixCovered0(win_task,x3,y3))
|
||||
goto gr_done;
|
||||
}
|
||||
if (x3>=dc->width || y3>=dc->height)
|
||||
@@ -1345,10 +1386,8 @@ I64 GrRayLenMinus(CDC *dc,I64 x,I64 y)
|
||||
if (dc->flags & DCF_SCREEN_BITMAP) {
|
||||
if (x3<0) break;
|
||||
x3+=win_task->pix_left;
|
||||
if (x3<0 || x3>win_task->pix_right ||
|
||||
x3>=dc->width ||
|
||||
!(dc->flags&DCF_ON_TOP) &&
|
||||
IsPixCovered0(win_task,x3,y3))
|
||||
if (!(0<=x3<=win_task->pix_right) || x3>=dc->width ||
|
||||
!(dc->flags&DCF_ON_TOP) && IsPixCovered0(win_task,x3,y3))
|
||||
break;
|
||||
} else
|
||||
if (!(0<=x3<dc->width))
|
||||
@@ -1379,8 +1418,9 @@ gr_done:
|
||||
I64 GrRayLen(CDC *dc,I64 *x1,I64 y,I64 z=0,I32 *db=NULL)
|
||||
{
|
||||
//Returns cnt of pixs changed
|
||||
I64 result=0,d,x=*x1,x2,x3,y3,dist;
|
||||
Bool plot,dither,probability_dither,not_color=ToBool(dc->flags&DCF_FILL_NOT_COLOR);
|
||||
I64 result=0,d,x=*x1,x2,x3,y3;
|
||||
Bool plot,dither,probability_dither,
|
||||
not_color=ToBool(dc->flags&DCF_FILL_NOT_COLOR);
|
||||
U8 *dst,*dst2;
|
||||
CColorROPU32 c,c2,color=dc->color,bkcolor=dc->bkcolor;
|
||||
I32 *db2;
|
||||
@@ -1400,11 +1440,8 @@ I64 GrRayLen(CDC *dc,I64 *x1,I64 y,I64 z=0,I32 *db=NULL)
|
||||
if (dc->flags & DCF_SCREEN_BITMAP) {
|
||||
x3+=win_task->pix_left;
|
||||
y3+=win_task->pix_top;
|
||||
if (x3<0 || y3<0 ||
|
||||
x3>win_task->pix_right ||
|
||||
y3>win_task->pix_bottom ||
|
||||
!(dc->flags&DCF_ON_TOP) &&
|
||||
IsPixCovered0(win_task,x3,y3))
|
||||
if (!(0<=x3<=win_task->pix_right) || !(0<=y3<=win_task->pix_bottom) ||
|
||||
!(dc->flags&DCF_ON_TOP) && IsPixCovered0(win_task,x3,y3))
|
||||
goto gr_done;
|
||||
}
|
||||
if (x3>=dc->width || y3>=dc->height)
|
||||
@@ -1432,10 +1469,8 @@ I64 GrRayLen(CDC *dc,I64 *x1,I64 y,I64 z=0,I32 *db=NULL)
|
||||
if (dc->flags & DCF_SCREEN_BITMAP) {
|
||||
if (x3<0) break;
|
||||
x3+=win_task->pix_left;
|
||||
if (x3<0 || x3>win_task->pix_right ||
|
||||
x3>=dc->width ||
|
||||
!(dc->flags&DCF_ON_TOP) &&
|
||||
IsPixCovered0(win_task,x3,y3))
|
||||
if (!(0<=x3<=win_task->pix_right) || x3>=dc->width ||
|
||||
!(dc->flags&DCF_ON_TOP) && IsPixCovered0(win_task,x3,y3))
|
||||
break;
|
||||
} else {
|
||||
if (!(0<=x3<dc->width))
|
||||
@@ -1459,13 +1494,8 @@ I64 GrRayLen(CDC *dc,I64 *x1,I64 y,I64 z=0,I32 *db=NULL)
|
||||
|
||||
if ((not_color && c!=dc->color2 ||
|
||||
!not_color && c==dc->color2) && plot) {
|
||||
if (dc->flags & DCF_LOCATE_NEAREST) {
|
||||
dist=DistSqrI64(x3,y3,dc->cur_x,dc->cur_y);
|
||||
if (dist<=dc->nearest_dist) {
|
||||
dc->nearest_sprite_elem_num=dc->cur_sprite_elem_num;
|
||||
dc->nearest_dist=dist;
|
||||
}
|
||||
}
|
||||
if (dc->flags & DCF_LOCATE_NEAREST)
|
||||
dc->dist=DistSqrI64(x3,y3,dc->cur_x,dc->cur_y);
|
||||
if (dc->flags & DCF_RECORD_EXTENTS) {
|
||||
if (x3<dc->min_x) dc->min_x=x3;
|
||||
if (x3>dc->max_x) dc->max_x=x3;
|
||||
@@ -1513,10 +1543,8 @@ I64 GrRayLen(CDC *dc,I64 *x1,I64 y,I64 z=0,I32 *db=NULL)
|
||||
if (dc->flags & DCF_SCREEN_BITMAP) {
|
||||
if (x3<0) break;
|
||||
x3+=win_task->pix_left;
|
||||
if (x3<0 || x3>win_task->pix_right ||
|
||||
x3>=dc->width ||
|
||||
!(dc->flags&DCF_ON_TOP) &&
|
||||
IsPixCovered0(win_task,x3,y3))
|
||||
if (!(0<=x3<=win_task->pix_right) || x3>=dc->width ||
|
||||
!(dc->flags&DCF_ON_TOP) && IsPixCovered0(win_task,x3,y3))
|
||||
break;
|
||||
} else
|
||||
if (!(0<=x3<dc->width))
|
||||
@@ -1538,13 +1566,8 @@ I64 GrRayLen(CDC *dc,I64 *x1,I64 y,I64 z=0,I32 *db=NULL)
|
||||
|
||||
if ((not_color && c!=dc->color2 ||
|
||||
!not_color && c==dc->color2) && plot) {
|
||||
if (dc->flags & DCF_LOCATE_NEAREST) {
|
||||
dist=DistSqrI64(x3,y3,dc->cur_x,dc->cur_y);
|
||||
if (dist<=dc->nearest_dist) {
|
||||
dc->nearest_sprite_elem_num=dc->cur_sprite_elem_num;
|
||||
dc->nearest_dist=dist;
|
||||
}
|
||||
}
|
||||
if (dc->flags & DCF_LOCATE_NEAREST)
|
||||
dc->dist=DistSqrI64(x3,y3,dc->cur_x,dc->cur_y);
|
||||
if (dc->flags & DCF_RECORD_EXTENTS) {
|
||||
if (x3<dc->min_x) dc->min_x=x3;
|
||||
if (x3>dc->max_x) dc->max_x=x3;
|
||||
@@ -1589,8 +1612,8 @@ gr_done:
|
||||
public I64 GrHLine(CDC *dc=gr.dc,I64 x1,I64 x2,I64 y,I64 z1=0,I64 z2=0)
|
||||
{//3D. No transformation or pen width.
|
||||
//Returns cnt of pixs changed
|
||||
//Uses $LK,"fixed-point",A="FI:::/Demo/Lectures/FixedPoint.CPP"$.
|
||||
I64 dx,dz,z,result=0,i,j,d,dist;
|
||||
//Uses $LK,"fixed-point",A="FI:::/Demo/Lectures/FixedPoint.CPP"$.
|
||||
I64 dist,dx,dz,z,result=0,i,j,d;
|
||||
U8 *dst;
|
||||
CColorROPU32 c,c2,color=dc->color,bkcolor=dc->bkcolor,dither_colors;
|
||||
I32 *db;
|
||||
@@ -1641,9 +1664,7 @@ public I64 GrHLine(CDC *dc=gr.dc,I64 x1,I64 x2,I64 y,I64 z1=0,I64 z2=0)
|
||||
x2=win_task->pix_right;
|
||||
}
|
||||
y+=win_task->pix_top;
|
||||
if (y>win_task->pix_bottom ||
|
||||
y<0 ||
|
||||
x2<0)
|
||||
if (!(0<=y<=win_task->pix_bottom) || x2<0)
|
||||
goto gr_done;
|
||||
}
|
||||
if (x1>=dc->width || y>=dc->height)
|
||||
@@ -1671,18 +1692,14 @@ public I64 GrHLine(CDC *dc=gr.dc,I64 x1,I64 x2,I64 y,I64 z1=0,I64 z2=0)
|
||||
else
|
||||
dist=SqrI64(dc->cur_x-x2);
|
||||
dist+=SqrI64(y-dc->cur_y);
|
||||
if (dist<=dc->nearest_dist) {
|
||||
dc->nearest_sprite_elem_num=dc->cur_sprite_elem_num;
|
||||
dc->nearest_dist=dist;
|
||||
}
|
||||
dc->dist=dist;
|
||||
}
|
||||
if (dc->flags & DCF_DONT_DRAW)
|
||||
goto gr_done;
|
||||
|
||||
if (!(dc->flags & DCF_SCREEN_BITMAP) ||
|
||||
win_task->next_task==sys_winmgr_task ||
|
||||
dc->flags&DCF_ON_TOP ||
|
||||
!IsPixCovered0(win_task,x1,y))
|
||||
dc->flags&DCF_ON_TOP || !IsPixCovered0(win_task,x1,y))
|
||||
char_clear=TRUE;
|
||||
else
|
||||
char_clear=FALSE;
|
||||
@@ -1750,8 +1767,7 @@ public I64 GrHLine(CDC *dc=gr.dc,I64 x1,I64 x2,I64 y,I64 z1=0,I64 z2=0)
|
||||
if (!(x1&(FONT_WIDTH-1)) && x1<=x2) {
|
||||
if (!(dc->flags & DCF_SCREEN_BITMAP)||
|
||||
win_task->next_task==sys_winmgr_task ||
|
||||
dc->flags&DCF_ON_TOP ||
|
||||
!IsPixCovered0(win_task,x1,y))
|
||||
dc->flags&DCF_ON_TOP || !IsPixCovered0(win_task,x1,y))
|
||||
char_clear=TRUE;
|
||||
else
|
||||
char_clear=FALSE;
|
||||
|
||||
+31
-20
@@ -12,7 +12,7 @@ public I64 GrFillPoly3(CDC *dc=gr.dc,I64 n,CD3I32 *poly)
|
||||
x=poly[j].x; y=poly[j].y; z=poly[j].z;
|
||||
if (dc->flags&DCF_TRANSFORMATION)
|
||||
(*dc->transform)(dc,&x,&y,&z);
|
||||
GrReflect(dc,&x,&y,&z);
|
||||
DCReflect(dc,&x,&y,&z);
|
||||
tri[0].x=x; tri[0].y=y; tri[0].z=z;
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ public I64 GrFillPoly3(CDC *dc=gr.dc,I64 n,CD3I32 *poly)
|
||||
x=poly[j].x; y=poly[j].y; z=poly[j].z;
|
||||
if (dc->flags&DCF_TRANSFORMATION)
|
||||
(*dc->transform)(dc,&x,&y,&z);
|
||||
GrReflect(dc,&x,&y,&z);
|
||||
DCReflect(dc,&x,&y,&z);
|
||||
}
|
||||
tri[1].x=x; tri[1].y=y; tri[1].z=z;
|
||||
|
||||
@@ -29,7 +29,7 @@ public I64 GrFillPoly3(CDC *dc=gr.dc,I64 n,CD3I32 *poly)
|
||||
x=poly[j].x; y=poly[j].y; z=poly[j].z;
|
||||
if (dc->flags&DCF_TRANSFORMATION)
|
||||
(*dc->transform)(dc,&x,&y,&z);
|
||||
GrReflect(dc,&x,&y,&z);
|
||||
DCReflect(dc,&x,&y,&z);
|
||||
tri[2].x=x; tri[2].y=y; tri[2].z=z;
|
||||
|
||||
result+=GrFillTri0(dc,&tri[0],&tri[1],&tri[2]);
|
||||
@@ -90,7 +90,8 @@ public I64 GrRect3(CDC *dc=gr.dc,I64 x,I64 y,I64 z,I64 w,I64 h)
|
||||
return GrFillPoly3(dc,4,poly);
|
||||
}
|
||||
|
||||
public U0 GrBorder(CDC *dc=gr.dc,I64 x1,I64 y1,I64 x2,I64 y2,I64 step=1,I64 start=0)
|
||||
public U0 GrBorder(CDC *dc=gr.dc,I64 x1,I64 y1,I64 x2,I64 y2,
|
||||
I64 step=1,I64 start=0)
|
||||
{//2D. Transformation with pen width.
|
||||
//Can be used with ROPF_DITHER+WHITE<<16+BLACK for dotted rect.
|
||||
GrLine3(dc,x1,y1,0,x2,y1,0,step,start);
|
||||
@@ -99,7 +100,8 @@ public U0 GrBorder(CDC *dc=gr.dc,I64 x1,I64 y1,I64 x2,I64 y2,I64 step=1,I64 star
|
||||
GrLine3(dc,x1,y2,0,x1,y1,0,step,start);
|
||||
}
|
||||
|
||||
public Bool GrArrow3(CDC *dc=gr.dc,I64 x1,I64 y1,I64 z1,I64 x2,I64 y2,I64 z2,F64 w=2.75,I64 step=1,I64 start=0)
|
||||
public Bool GrArrow3(CDC *dc=gr.dc,I64 x1,I64 y1,I64 z1,
|
||||
I64 x2,I64 y2,I64 z2,F64 w=2.75,I64 step=1,I64 start=0)
|
||||
{//3D. Transformation with pen width.
|
||||
I64 _x1,_y1,_z1,_x2,_y2,_z2,dx,dy;
|
||||
F64 d;
|
||||
@@ -112,16 +114,18 @@ public Bool GrArrow3(CDC *dc=gr.dc,I64 x1,I64 y1,I64 z1,I64 x2,I64 y2,I64 z2,F64
|
||||
}
|
||||
if (dc->flags & DCF_SYMMETRY) {
|
||||
_x1=x1; _y1=y1; _z1=z1;
|
||||
GrReflect(dc,&_x1,&_y1,&_z1);
|
||||
DCReflect(dc,&_x1,&_y1,&_z1);
|
||||
_x2=x2; _y2=y2; _z2=z2;
|
||||
GrReflect(dc,&_x2,&_y2,&_z2);
|
||||
DCReflect(dc,&_x2,&_y2,&_z2);
|
||||
dc->flags&=~DCF_SYMMETRY;
|
||||
result=Line(dc,_x1,_y1,_z1,_x2,_y2,_z2,&GrPlot3,step,start);
|
||||
dx=_x2-_x1; dy=_y2-_y1;
|
||||
if (d=Sqrt(dx*dx+dy*dy)) {
|
||||
d=w*dc->pen_width/d;
|
||||
result|=Line(dc,_x2-dx*d+dy*d+0.5,_y2-dy*d-dx*d+0.5,_z2,_x2,_y2,_z2,&GrPlot3,step);
|
||||
result|=Line(dc,_x2-dx*d-dy*d+0.5,_y2-dy*d+dx*d+0.5,_z2,_x2,_y2,_z2,&GrPlot3,step);
|
||||
result|=Line(dc,_x2-dx*d+dy*d+0.5,_y2-dy*d-dx*d+0.5,_z2,
|
||||
_x2,_y2,_z2,&GrPlot3,step);
|
||||
result|=Line(dc,_x2-dx*d-dy*d+0.5,_y2-dy*d+dx*d+0.5,_z2,
|
||||
_x2,_y2,_z2,&GrPlot3,step);
|
||||
}
|
||||
was_symmetry=TRUE;
|
||||
if (dc->flags&DCF_JUST_MIRROR)
|
||||
@@ -131,8 +135,10 @@ public Bool GrArrow3(CDC *dc=gr.dc,I64 x1,I64 y1,I64 z1,I64 x2,I64 y2,I64 z2,F64
|
||||
dx=x2-x1; dy=y2-y1;
|
||||
if (d=Sqrt(dx*dx+dy*dy)) {
|
||||
d=w*dc->pen_width/d;
|
||||
result|=Line(dc,x2-dx*d+dy*d+0.5,y2-dy*d-dx*d+0.5,z2,x2,y2,z2,&GrPlot3,step);
|
||||
result|=Line(dc,x2-dx*d-dy*d+0.5,y2-dy*d+dx*d+0.5,z2,x2,y2,z2,&GrPlot3,step);
|
||||
result|=Line(dc,x2-dx*d+dy*d+0.5,y2-dy*d-dx*d+0.5,z2,
|
||||
x2,y2,z2,&GrPlot3,step);
|
||||
result|=Line(dc,x2-dx*d-dy*d+0.5,y2-dy*d+dx*d+0.5,z2,
|
||||
x2,y2,z2,&GrPlot3,step);
|
||||
}
|
||||
gr_done:
|
||||
if (was_transform)
|
||||
@@ -174,7 +180,8 @@ public Bool GrTextBox3(CDC *dc=gr.dc,I64 x1,I64 y1,I64 z1,U8 *s,I64 border=2)
|
||||
|
||||
#define MAX_DIAMOND_SLOPE 2.75
|
||||
|
||||
public Bool GrTextDiamond3(CDC *dc=gr.dc,I64 x1,I64 y1,I64 z1,U8 *_s,I64 border=2)
|
||||
public Bool GrTextDiamond3(CDC *dc=gr.dc,
|
||||
I64 x1,I64 y1,I64 z1,U8 *_s,I64 border=2)
|
||||
{//3D. Transformation. DCF_SYMMETRY is silly.
|
||||
Bool first=TRUE;
|
||||
U8 ch,*ptr,*ptr_end,*st,*s;
|
||||
@@ -239,7 +246,8 @@ public Bool GrTextDiamond3(CDC *dc=gr.dc,I64 x1,I64 y1,I64 z1,U8 *_s,I64 border=
|
||||
}
|
||||
|
||||
#help_index "Graphics/Mesh"
|
||||
public I64 Gr3Mesh(CDC *dc=gr.dc,I64 vertex_cnt,CD3I32 *p,I64 tri_cnt,CMeshTri *tri)
|
||||
public I64 Gr3Mesh(CDC *dc=gr.dc,I64 vertex_cnt,CD3I32 *p,
|
||||
I64 tri_cnt,CMeshTri *tri)
|
||||
{//Returns cnt of pixs changed.
|
||||
CColorROPU32 old_color=dc->color;
|
||||
I64 i,x,y,z,result=0;
|
||||
@@ -261,20 +269,23 @@ public I64 Gr3Mesh(CDC *dc=gr.dc,I64 vertex_cnt,CD3I32 *p,I64 tri_cnt,CMeshTri *
|
||||
p_sym=p;
|
||||
for (i=0;i<vertex_cnt;i++,p_sym++,dst++) {
|
||||
x=p_sym->x; y=p_sym->y; z=p_sym->z;
|
||||
GrReflect(dc,&x,&y,&z);
|
||||
DCReflect(dc,&x,&y,&z);
|
||||
dst->x=x; dst->y=y; dst->z=z;
|
||||
}
|
||||
p_sym=pt_sym;
|
||||
for (i=0;i<tri_cnt;i++,tri_sym++) {
|
||||
(*dc->lighting)(dc,&p_sym[tri_sym->nums[0]],&p_sym[tri_sym->nums[2]],&p_sym[tri_sym->nums[1]],tri_sym->color);
|
||||
result+=GrFillTri0(dc,&p_sym[tri_sym->nums[0]],&p_sym[tri_sym->nums[2]],&p_sym[tri_sym->nums[1]]);
|
||||
(*dc->lighting)(dc,&p_sym[tri_sym->nums[0]],&p_sym[tri_sym->nums[2]],
|
||||
&p_sym[tri_sym->nums[1]],tri_sym->color);
|
||||
result+=GrFillTri0(dc,&p_sym[tri_sym->nums[0]],&p_sym[tri_sym->nums[2]],
|
||||
&p_sym[tri_sym->nums[1]]);
|
||||
}
|
||||
Free(pt_sym);
|
||||
if (dc->flags&DCF_JUST_MIRROR)
|
||||
goto mesh_done;
|
||||
}
|
||||
for (i=0;i<tri_cnt;i++,tri++) {
|
||||
(*dc->lighting)(dc,&p[tri->nums[0]],&p[tri->nums[1]],&p[tri->nums[2]],tri->color);
|
||||
(*dc->lighting)(dc,&p[tri->nums[0]],&p[tri->nums[1]],
|
||||
&p[tri->nums[2]],tri->color);
|
||||
result+=GrFillTri0(dc,&p[tri->nums[0]],&p[tri->nums[1]],&p[tri->nums[2]]);
|
||||
}
|
||||
mesh_done:
|
||||
@@ -285,9 +296,9 @@ mesh_done:
|
||||
|
||||
#help_index "Graphics/Misc;Input Pointer/Displayed Image"
|
||||
public U0 DrawStdInputPtr(CDC *dc,I64 x,I64 y)
|
||||
{//This is a callback.
|
||||
{//This is a callback. See $LK,"::/Demo/Graphics/Grid.CPP.Z"$.
|
||||
//Called by $LK,"DrawInputPtr",A="MN:DrawInputPtr"$() which is
|
||||
//called by $LK,"WinFinalUpdate",A="MN:WinFinalUpdate"$().
|
||||
//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);
|
||||
@@ -296,7 +307,7 @@ public U0 DrawStdInputPtr(CDC *dc,I64 x,I64 y)
|
||||
gr.fp_draw_input_ptr=&DrawStdInputPtr;
|
||||
|
||||
public U0 DrawWaitInputPtr(CDC *dc,I64 x,I64 y)
|
||||
{//This is a callback.
|
||||
{//This is a callback. See $LK,"::/Demo/Graphics/Grid.CPP.Z"$.
|
||||
I64 old_pen_width=dc->pen_width;
|
||||
CColorROPU32 old_color=dc->color;
|
||||
dc->pen_width=3;
|
||||
|
||||
+105
-83
@@ -3,7 +3,7 @@
|
||||
|
||||
#define GR_SCALE (1<<32)
|
||||
|
||||
public U0 GrRot(I64 r[4][4],I64 *_x,I64 *_y,I64 *_z)
|
||||
public U0 Mat4x4MulXYZ(I64 r[4][4],I64 *_x,I64 *_y,I64 *_z)
|
||||
{//Rotate 3D point using 4x4 matrix. Uses $LK,"fixed-point",A="FI:::/Demo/Lectures/FixedPoint.CPP"$.
|
||||
I64 x1,y1,z1,xx=*_x,yy=*_y,zz=*_z;
|
||||
x1=(r[0][0]*xx+r[0][1]*yy+r[0][2]*zz+r[0][3])>>32;
|
||||
@@ -12,26 +12,16 @@ public U0 GrRot(I64 r[4][4],I64 *_x,I64 *_y,I64 *_z)
|
||||
*_x=x1;*_y=y1;*_z=z1;
|
||||
}
|
||||
|
||||
public U0 GrTransform(CDC *dc,I64 *_x,I64 *_y,I64 *_z)
|
||||
{//This is a callback.
|
||||
public U0 DCTransform(CDC *dc,I64 *_x,I64 *_y,I64 *_z)
|
||||
{//This is the dft dc->transform() callback.
|
||||
//Uses $LK,"fixed-point",A="FI:::/Demo/Lectures/FixedPoint.CPP"$.
|
||||
GrRot(dc->r,_x,_y,_z);
|
||||
Mat4x4MulXYZ(dc->r,_x,_y,_z);
|
||||
*_x+=dc->x;
|
||||
*_y+=dc->y;
|
||||
*_z+=dc->z;
|
||||
}
|
||||
|
||||
public I64 *GrIdentNew(CTask *mem_task=NULL)
|
||||
{//MAlloc an identity matrix. Uses $LK,"fixed-point",A="FI:::/Demo/Lectures/FixedPoint.CPP"$.
|
||||
I64 *r=CAlloc(sizeof(I64)*16,mem_task);
|
||||
r[0] .i32[1]=1;
|
||||
r[5] .i32[1]=1;
|
||||
r[10].i32[1]=1;
|
||||
r[15].i32[1]=1;
|
||||
return r;
|
||||
}
|
||||
|
||||
public I64 *GrIdentEqu(I64 r[4][4])
|
||||
public I64 *Mat4x4IdentEqu(I64 r[4][4])
|
||||
{//Set matrix to identity. Uses $LK,"fixed-point",A="FI:::/Demo/Lectures/FixedPoint.CPP"$.
|
||||
MemSet(r,0,sizeof(I64)*16);
|
||||
r[0][0].i32[1]=1;
|
||||
@@ -41,26 +31,32 @@ public I64 *GrIdentEqu(I64 r[4][4])
|
||||
return r;
|
||||
}
|
||||
|
||||
public I64 GrRotNormSqr65536(I64 r[4][4])
|
||||
public I64 *Mat4x4IdentNew(CTask *mem_task=NULL)
|
||||
{//MAlloc an identity matrix. Uses $LK,"fixed-point",A="FI:::/Demo/Lectures/FixedPoint.CPP"$.
|
||||
return Mat4x4IdentEqu(MAlloc(sizeof(I64)*16,mem_task));
|
||||
}
|
||||
|
||||
public I64 Mat4x4NormSqr65536(I64 r[4][4])
|
||||
{//Norm Squared of r.
|
||||
//(1.0/Sqrt(3))*65536=37837.22
|
||||
return SqrI64((r[0][0]*37838+r[0][1]*37838+r[0][2]*37838)>>32)+
|
||||
SqrI64((r[1][0]*37837+r[1][1]*37837+r[1][2]*37837)>>32)+
|
||||
SqrI64((r[2][0]*37837+r[2][1]*37837+r[2][2]*37837)>>32);
|
||||
SqrI64((r[1][0]*37837+r[1][1]*37837+r[1][2]*37837)>>32)+
|
||||
SqrI64((r[2][0]*37837+r[2][1]*37837+r[2][2]*37837)>>32);
|
||||
}
|
||||
|
||||
public U0 GrSetRotMat(CDC *dc=NULL,I64 r[4][4])
|
||||
{//Set device context's rot matrix. Will be $LK,"Free",A="MN:Free"$d() in $LK,"DCDel",A="MN:DCDel"$(). Uses $LK,"fixed-point",A="FI:::/Demo/Lectures/FixedPoint.CPP"$.
|
||||
public U0 DCMat4x4Set(CDC *dc=NULL,I64 r[4][4])
|
||||
{//Set device context's rot matrix. Will be $LK,"Free",A="MN:Free"$d() in $LK,"DCDel",A="MN:DCDel"$().Uses $LK,"fixed-point",A="FI:::/Demo/Lectures/FixedPoint.CPP"$.
|
||||
//The main purpose is to set matrix norm for pen width scaling.
|
||||
//NULL as dc means gr.dc
|
||||
//NULL as dc means gr.dc
|
||||
if (!dc) dc=gr.dc;
|
||||
dc->r=r;
|
||||
dc->r_norm=Sqrt(GrRotNormSqr65536(r))*65536; //scaled 32 bits
|
||||
dc->r_norm=Sqrt(Mat4x4NormSqr65536(r))*65536; //scaled 32 bits
|
||||
}
|
||||
|
||||
#help_index "Graphics/Mesh"
|
||||
public U0 GrLighting(CDC *dc,CD3I32 *p1,CD3I32 *p2,CD3I32 *p3,CColorROPU32 color)
|
||||
{//This is a callback.
|
||||
public U0 DCLighting(CDC *dc,
|
||||
CD3I32 *p1,CD3I32 *p2,CD3I32 *p3,CColorROPU32 color)
|
||||
{//This is the dft dc->lighting() callback.
|
||||
CD3I32 v1,v2;
|
||||
I64 i,vn_x,vn_y,vn_z;
|
||||
F64 d;
|
||||
@@ -73,8 +69,8 @@ public U0 GrLighting(CDC *dc,CD3I32 *p1,CD3I32 *p2,CD3I32 *p3,CColorROPU32 color
|
||||
v2.y=p3->y-p2->y;
|
||||
v2.z=p3->z-p2->z;
|
||||
|
||||
//V1 and V2 are vects along two sides
|
||||
//of the tri joined at p2.
|
||||
//V1 and V2 are vects along two sides
|
||||
//of the tri joined at p2.
|
||||
|
||||
vn_x=v1.y*v2.z-v1.z*v2.y;
|
||||
vn_y=v1.z*v2.x-v1.x*v2.z;
|
||||
@@ -85,21 +81,21 @@ public U0 GrLighting(CDC *dc,CD3I32 *p1,CD3I32 *p2,CD3I32 *p3,CColorROPU32 color
|
||||
vn_y*=d;
|
||||
vn_z*=d;
|
||||
//Vn is the cross product of V1 and V3
|
||||
//which means it is perpendicular. It
|
||||
//is the normal vect to the surface.
|
||||
//It has been scaled to length 65536.
|
||||
//which means it is perpendicular. It
|
||||
//is the normal vect to the surface.
|
||||
//It has been scaled to length 65536.
|
||||
|
||||
//Light source has been scaled to length 65536.
|
||||
//Light source has been scaled to length 65536.
|
||||
i=(vn_x*dc->ls.x+vn_y*dc->ls.y+vn_z*dc->ls.z)>>16;
|
||||
//The dot product of the light source
|
||||
//vect and the surface normal
|
||||
//gives an illumination number.
|
||||
//65536*65536>>16=65536
|
||||
//vect and the surface normal
|
||||
//gives an illumination number.
|
||||
//65536*65536>>16=65536
|
||||
|
||||
//TempleOS will generate a random U16
|
||||
//and compare to dither_probability_u16 and
|
||||
//will pick from two colors.
|
||||
//Probability dithering does not work with pen_width>1 at this time.
|
||||
//TempleOS will generate a random U16
|
||||
//and compare to dither_probability_u16 and
|
||||
//will pick from two colors.
|
||||
//Probability dithering does not work with pen_width>1 at this time.
|
||||
if (color.c0.rop&ROPBF_TWO_SIDED) {
|
||||
color.c0.rop&=~ROPBF_TWO_SIDED;
|
||||
i=AbsI64(i)<<1;
|
||||
@@ -148,18 +144,19 @@ public U0 DCRst(CDC *dc)
|
||||
dc->x=0;
|
||||
dc->y=0;
|
||||
dc->z=0;
|
||||
dc->transform=&GrTransform;
|
||||
dc->lighting =&GrLighting;
|
||||
GrIdentEqu(dc->r);
|
||||
dc->transform=&DCTransform;
|
||||
dc->lighting =&DCLighting;
|
||||
Mat4x4IdentEqu(dc->r);
|
||||
dc->r_norm=GR_SCALE;
|
||||
dc->flags&=~(DCF_SYMMETRY|DCF_TRANSFORMATION|DCF_JUST_MIRROR);
|
||||
MemCpy(dc->palette,gr_palette_std,sizeof(CBGR48)*NUM_COLORS);
|
||||
}
|
||||
|
||||
public U0 DCExtentsInit(CDC *dc=NULL)
|
||||
{//Init markers for extent of next newly drawn graphics.
|
||||
//NULL means gr.dc
|
||||
//See $LK,"::/Demo/Graphics/Extents.CPP"$
|
||||
//You should clear the record flag yourself
|
||||
//See $LK,"::/Demo/Graphics/Extents.CPP"$
|
||||
//You should clear the record flag yourself
|
||||
if (!dc) dc=gr.dc;
|
||||
dc->flags|=DCF_RECORD_EXTENTS;
|
||||
dc->min_x=MAX_I64;
|
||||
@@ -189,7 +186,7 @@ public CDC *DCAlias(CDC *dc=NULL,CTask *task=NULL)
|
||||
public CDC *DCNew(I64 width,I64 height,CTask *task=NULL,Bool null_bitmap=FALSE)
|
||||
{//Create new width x height device context.
|
||||
//Internally only allows widths which are divisible by 8.
|
||||
//Don't forget these $MA-X+PU,"sizeof(CDC)",LM="Find(\"sizeof(CDC)\",\"/*\");View;"$.
|
||||
//Don't forget these $MA-X+PU,"sizeof(CDC)",LM="Find(\"sizeof(CDC)\",\"/*\");View;"$.
|
||||
CDC *result;
|
||||
if (!task) task=Fs;
|
||||
result=CAlloc(sizeof(CDC),task);
|
||||
@@ -235,7 +232,7 @@ public U0 DCDepthBufRst(CDC *dc)
|
||||
MemSetU32(dc->depth_buf,MAX_I32,dc->width_internal*dc->height);
|
||||
}
|
||||
|
||||
public U0 DCAllocDepthBuf(CDC *dc)
|
||||
public U0 DCDepthBufAlloc(CDC *dc)
|
||||
{//Alloc a 32-bit depth buffer for device context.
|
||||
Free(dc->depth_buf);
|
||||
dc->depth_buf=MAlloc(dc->width_internal*dc->height*sizeof(I32),dc->mem_task);
|
||||
@@ -249,7 +246,7 @@ public CDC *DCCopy(CDC *dc,CTask *task=NULL)
|
||||
if (dc->dc_signature!=DCS_SIGNATURE_VAL)
|
||||
throw('Graphics');
|
||||
result=MAllocIdentical(dc,task);
|
||||
GrSetRotMat(result,MAllocIdentical(dc->r,task));
|
||||
DCMat4x4Set(result,Mat4x4New(dc->r,task));
|
||||
result->mem_task=task;
|
||||
result->body=MAllocIdentical(dc->body,task);
|
||||
result->depth_buf=MAllocIdentical(dc->depth_buf,task);
|
||||
@@ -285,37 +282,55 @@ public I64 DCColorChg(CDC *dc,I64 src_color,I64 dst_color=TRANSPARENT)
|
||||
return result;
|
||||
}
|
||||
|
||||
public U8 *DCSave(CDC *dc,I64 *_size=NULL,Bool compressed=TRUE)
|
||||
public U8 *DCSave(CDC *dc,I64 *_size=NULL,I64 dcsf_flags=DCSF_COMPRESSED)
|
||||
{//Stores device context to mem, perhaps, with compression.
|
||||
U8 *result,*ptr,*body;
|
||||
Bool old_preempt;
|
||||
CArcCompress *ac;
|
||||
I64 i=dc->width_internal*dc->height,old_flags=dc->flags;
|
||||
CArcCompress *arc;
|
||||
I64 body_size=dc->width_internal*dc->height,total_size,flags;
|
||||
CBGR48 palette[NUM_COLORS];
|
||||
|
||||
if (compressed) {
|
||||
ac=CompressBuf(dc->body,i);
|
||||
i=ac->compressed_size;
|
||||
body=ac;
|
||||
if (dcsf_flags&DCSF_COMPRESSED) {
|
||||
arc=CompressBuf(dc->body,body_size);
|
||||
body_size=arc->compressed_size;
|
||||
body=arc;
|
||||
} else {
|
||||
ac=NULL;
|
||||
arc=NULL;
|
||||
body=dc->body;
|
||||
}
|
||||
|
||||
ptr=result=MAlloc(offset(CDC.end)-offset(CDC.start)+i);
|
||||
total_size=offset(CDC.end)-offset(CDC.start)+body_size;
|
||||
if (dcsf_flags&DCSF_COMPRESSED)
|
||||
flags=DCF_COMPRESSED;
|
||||
else
|
||||
flags=0;
|
||||
|
||||
old_preempt=Preempt(OFF); //in case it is a screen bitmap
|
||||
if (compressed) dc->flags|=DCF_COMPRESSED;
|
||||
dc->flags&=DCF_COMPRESSED;
|
||||
MemCpy(result,&dc->start,offset(CDC.end)-offset(CDC.start));
|
||||
dc->flags=old_flags;
|
||||
Preempt(old_preempt);
|
||||
if (dcsf_flags&DCSF_PALETTE_GET)
|
||||
GrPaletteGet(palette);
|
||||
else
|
||||
MemCpy(palette,&dc->palette,NUM_COLORS*sizeof(CBGR48));
|
||||
if (MemCmp(palette,gr_palette_std,NUM_COLORS*sizeof(CBGR48))) {
|
||||
flags|=DCF_PALETTE;
|
||||
total_size+=NUM_COLORS*sizeof(CBGR48);
|
||||
}
|
||||
|
||||
ptr=result=MAlloc(total_size);
|
||||
|
||||
#assert !offset(CDC.start)
|
||||
MemCpy(ptr,&dc->start,offset(CDC.end)-offset(CDC.start));
|
||||
ptr(CDC *)->flags=flags;
|
||||
ptr+=offset(CDC.end)-offset(CDC.start);
|
||||
MemCpy(ptr,body,i);
|
||||
ptr+=i;
|
||||
|
||||
Free(ac);
|
||||
if (_size) *_size=ptr-result;
|
||||
#assert offset(CDC.end)==offset(CDC.palette)
|
||||
if (flags&DCF_PALETTE) {
|
||||
MemCpy(ptr,palette,NUM_COLORS*sizeof(CBGR48));
|
||||
ptr+=NUM_COLORS*sizeof(CBGR48);
|
||||
}
|
||||
|
||||
MemCpy(ptr,body,body_size);
|
||||
ptr+=body_size;
|
||||
|
||||
Free(arc);
|
||||
if (_size) *_size=total_size;
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -323,28 +338,34 @@ public CDC *DCLoad(U8 *src,I64 *_size=NULL,CTask *task=NULL)
|
||||
{//Loads device context from mem.
|
||||
CDC *result;
|
||||
U8 *ptr=src;
|
||||
CArcCompress *ac;
|
||||
CArcCompress *arc;
|
||||
I64 body_size;
|
||||
if (!task) task=Fs;
|
||||
result=CAlloc(sizeof(CDC),task);
|
||||
result->win_task=task;
|
||||
result->mem_task=task;
|
||||
MemCpy(&result->start,src,
|
||||
offset(CDC.end)-offset(CDC.start));
|
||||
MemCpy(&result->start,ptr,offset(CDC.end)-offset(CDC.start));
|
||||
ptr+=offset(CDC.end)-offset(CDC.start);
|
||||
|
||||
if (result->flags&DCF_PALETTE) {
|
||||
MemCpy(&result->palette,ptr,NUM_COLORS*sizeof(CBGR48));
|
||||
ptr+=NUM_COLORS*sizeof(CBGR48);
|
||||
} else
|
||||
MemCpy(&result->palette,gr_palette_std,NUM_COLORS*sizeof(CBGR48));
|
||||
|
||||
body_size=result->width_internal*result->height;
|
||||
if (result->flags&DCF_COMPRESSED) {
|
||||
result->flags&=~DCF_COMPRESSED;
|
||||
ac=ptr;
|
||||
result->body=ExpandBuf(ac,task);
|
||||
ptr+=ac->compressed_size;
|
||||
arc=ptr;
|
||||
result->body=ExpandBuf(arc,task);
|
||||
ptr+=arc->compressed_size;
|
||||
} else {
|
||||
result->body=MAlloc(body_size,task);
|
||||
MemCpy(result->body,ptr,body_size);
|
||||
ptr+=body_size;
|
||||
}
|
||||
result->pen_width=1;
|
||||
result->r=GrIdentNew(task);
|
||||
result->r=Mat4x4IdentNew(task);
|
||||
result->r_norm.u32[1]=1;
|
||||
result->dc_signature=DCS_SIGNATURE_VAL;
|
||||
if (_size) *_size=ptr-src;
|
||||
@@ -354,11 +375,11 @@ public CDC *DCLoad(U8 *src,I64 *_size=NULL,CTask *task=NULL)
|
||||
#help_index "Graphics/GRA Files"
|
||||
#help_file "::/Doc/GRAFiles"
|
||||
#help_index "Graphics/Device Contexts;Graphics/GRA Files"
|
||||
public I64 GRAWrite(U8 *filename,CDC *dc)
|
||||
public I64 GRAWrite(U8 *filename,CDC *dc,I64 dcsf_flags=DCSF_COMPRESSED)
|
||||
{//TempleOS GRA File.
|
||||
I64 size;
|
||||
U8 *st=DftExt(filename,"GRA.Z"),
|
||||
*src=DCSave(dc,&size);
|
||||
*src=DCSave(dc,&size,dcsf_flags);
|
||||
FileWrite(st,src,size);
|
||||
Free(st);
|
||||
Free(src);
|
||||
@@ -369,7 +390,7 @@ public CDC *GRARead(U8 *filename,CTask *task=NULL)
|
||||
{//TempleOS GRA File.
|
||||
CDC *dc=NULL;
|
||||
U8 *st=DftExt(filename,"GRA.Z"),
|
||||
*src=FileRead(st);
|
||||
*src=FileRead(st);
|
||||
if (src)
|
||||
dc=DCLoad(src,,task);
|
||||
Free(src);
|
||||
@@ -377,9 +398,9 @@ public CDC *GRARead(U8 *filename,CTask *task=NULL)
|
||||
return dc;
|
||||
}
|
||||
|
||||
#help_index "Graphics/Sprite;Graphics/GRA Files;DolDoc/Output"
|
||||
#help_index "Graphics/Sprite;Graphics/GRA Files;DolDoc/Output;StdOut/DolDoc"
|
||||
public U0 DocGRA(CDoc *doc=NULL,U8 *filename)
|
||||
{//Put a GRA file into a document as a sprite.
|
||||
{//Put a GRA file into a document as asprite.
|
||||
CDC *dc=GRARead(filename);
|
||||
CSprite *elems=DC2Sprite(dc);
|
||||
DocSprite(doc,elems);
|
||||
@@ -388,7 +409,7 @@ public U0 DocGRA(CDoc *doc=NULL,U8 *filename)
|
||||
}
|
||||
|
||||
#help_index "Graphics/Device Contexts;Graphics/Screen"
|
||||
public CDC *DCCaptureScreen(Bool include_zoom=TRUE,CTask *task=NULL)
|
||||
public CDC *DCScreenCapture(Bool include_zoom=TRUE,CTask *task=NULL)
|
||||
{//Capture screen to a device context.
|
||||
CDC *dc;
|
||||
U8 *dst;
|
||||
@@ -399,19 +420,20 @@ public CDC *DCCaptureScreen(Bool include_zoom=TRUE,CTask *task=NULL)
|
||||
dc=DCCopy(gr.dc1,task);
|
||||
dc->flags&=~DCF_SCREEN_BITMAP;
|
||||
dst=MAlloc(dc->width_internal*dc->height,task);
|
||||
//Pick background color that never occurs. COLOR_INVALID
|
||||
GrBitMap4ToBitMap8(dst,dc->body,(dc->width_internal*dc->height)>>1,COLOR_INVALID);
|
||||
//Pick background color that never occurs. COLOR_INVALID
|
||||
GrBitMap4ToBitMap8(dst,dc->body,
|
||||
(dc->width_internal*dc->height)>>1,COLOR_INVALID);
|
||||
Free(dc->body);
|
||||
dc->body=dst;
|
||||
return dc;
|
||||
}
|
||||
|
||||
#help_index "Graphics/GRA Files;Graphics/Screen"
|
||||
public I64 GRACaptureScreen(U8 *filename,Bool include_zoom=TRUE)
|
||||
public I64 GRAScreenCapture(U8 *filename,Bool include_zoom=TRUE)
|
||||
{//Capture screen to a TempleOS GRA File.
|
||||
I64 size;
|
||||
CDC *dc=DCCaptureScreen(include_zoom);
|
||||
size=GRAWrite(filename,dc);
|
||||
CDC *dc=DCScreenCapture(include_zoom);
|
||||
size=GRAWrite(filename,dc,DCSF_COMPRESSED|DCSF_PALETTE_GET);
|
||||
DCDel(dc);
|
||||
return size;
|
||||
}
|
||||
+1
-1
@@ -11,7 +11,7 @@ CtrlAltLetCBSet('Z',&CtrlAltZ,"Sys/Zoom In or Out");
|
||||
|
||||
U0 Screen2Clipboard(I64)
|
||||
{
|
||||
CDC *dc=DCCaptureScreen;
|
||||
CDC *dc=DCScreenCapture;
|
||||
U8 *elems=DC2Sprite(dc);
|
||||
Bool unlock_doc=DocLock(sys_clipboard_doc);
|
||||
ClipboardDel;
|
||||
|
||||
+3
-3
@@ -12,7 +12,7 @@ public class CGrGlbls
|
||||
U32 *text_base; //See $LK,"TextBase Layer",A="HI:TextBase Layer"$. (Similar to 0xB8000 but 32 bits)
|
||||
U16 *win_z_buf;
|
||||
|
||||
#define SPHT_ELEM_CODE 1
|
||||
#define SPHT_ELEM_CODE 1
|
||||
CHashTable *sprite_hash;
|
||||
|
||||
U16 *win_uncovered_bitmap;
|
||||
@@ -25,13 +25,13 @@ public class CGrGlbls
|
||||
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/WallPaper.CPP,empty_sprite"$
|
||||
|
||||
#define GR_NUM_PEN_BRUSHES 64
|
||||
#define GR_NUM_PEN_BRUSHES 64
|
||||
CDC *pen_brushes[GR_NUM_PEN_BRUSHES],
|
||||
*collision_pen_brushes[GR_NUM_PEN_BRUSHES],
|
||||
*even_pen_brushes[GR_NUM_PEN_BRUSHES],
|
||||
*odd_pen_brushes[GR_NUM_PEN_BRUSHES];
|
||||
|
||||
#define GR_MAX_SCREEN_ZOOM 8
|
||||
#define GR_MAX_SCREEN_ZOOM 8
|
||||
U8 *screen_zoom_tables[GR_MAX_SCREEN_ZOOM+1];
|
||||
I64 screen_zoom,sx,sy;
|
||||
|
||||
|
||||
+8
-8
@@ -62,7 +62,7 @@ U0 GrSetUpTables()
|
||||
OutU8(VGAP_INDEX,VGAR_MAP_MASK);
|
||||
OutU8(VGAP_DATA,0x0F);
|
||||
//Virtual Box crashes on the following for some reason.
|
||||
// MemSet(VGAM_GRAPHICS,0,GR_HEIGHT*GR_WIDTH>>3);
|
||||
// MemSet(VGAM_GRAPHICS,0,GR_HEIGHT*GR_WIDTH>>3);
|
||||
MemSet(gr.screen_image->body,0,GR_WIDTH*GR_HEIGHT>>1);
|
||||
}
|
||||
for (i=1;i<=GR_MAX_SCREEN_ZOOM;i++) {
|
||||
@@ -128,17 +128,17 @@ U0 WinZBufFill(CTask *task)
|
||||
if (w=r-l+1)
|
||||
for (y=t;y<=b;y++)
|
||||
MemSetU16(gr.win_z_buf(U8 *)+(y*TEXT_COLS+l)*sizeof(U16),
|
||||
task->win_z_num,w);
|
||||
task->win_z_num,w);
|
||||
}
|
||||
|
||||
public U0 WinZBufUpdate()
|
||||
{//Might have to call this if you are doing graphics outside winmgr callback routines.
|
||||
{//Might have to call if doing graphics outside winmgr callback routines.
|
||||
//Call it if, for example, when a pop-up window closes and you need to refresh
|
||||
//before graphics.
|
||||
//before graphics.
|
||||
I64 i,z=1;
|
||||
U16 *ptr;
|
||||
CTask *task,*task1;
|
||||
Bool old_preempt=Preempt(OFF);
|
||||
Bool old_preempt=Preempt;
|
||||
if (gr.win_z_buf) {
|
||||
LBtr(&sys_semas[SYS_SEMA_UPDATE_WIN_Z_BUF],0);
|
||||
task1=task=sys_winmgr_task;
|
||||
@@ -167,9 +167,9 @@ U0 GrInit2()
|
||||
HashDefineLstAdd("ST_SPRITE_ELEM_CODES",SPHT_ELEM_CODE,gr.sprite_hash);
|
||||
gr.screen_zoom=1;
|
||||
|
||||
SetStdPalette;
|
||||
fp_set_std_palette=&SetStdPalette;
|
||||
SetVGAPalette4Indices;
|
||||
PaletteSetStd;
|
||||
fp_set_std_palette=&PaletteSetStd;
|
||||
GrPaletteIndicesSet;
|
||||
|
||||
gr.to_8_bits =MAlloc(256*sizeof(I64));
|
||||
gr.to_8_colors=MAlloc(256*sizeof(I64));
|
||||
|
||||
+94
-138
@@ -13,7 +13,7 @@ public Bool Line(U8 *aux_data,
|
||||
{//Step through line segment calling callback.
|
||||
//Uses $LK,"fixed-point",A="FI:::/Demo/Lectures/FixedPoint.CPP"$.
|
||||
I64 i,j,d,dx=x2-x1,dy=y2-y1,dz=z2-z1,_x,_y,_z,
|
||||
adx=AbsI64(dx),ady=AbsI64(dy),adz=AbsI64(dz);
|
||||
adx=AbsI64(dx),ady=AbsI64(dy),adz=AbsI64(dz);
|
||||
Bool first=TRUE;
|
||||
if (adx>=ady) {
|
||||
if (adx>=adz) {
|
||||
@@ -58,7 +58,7 @@ public Bool Line(U8 *aux_data,
|
||||
}
|
||||
x1<<=32; y1<<=32; z1<<=32;
|
||||
for (j=0;j<start;j++) {
|
||||
x1+=dx; y1+=dy; z1+=dz;
|
||||
x1+=dx; y1+=dy; z1+=dz;
|
||||
}
|
||||
if (step!=1 && step!=0) {
|
||||
dx*=step;
|
||||
@@ -68,7 +68,7 @@ public Bool Line(U8 *aux_data,
|
||||
}
|
||||
for (i=start;i<=d;i++) {
|
||||
if ((_x!=x1.i32[1] || _y!=y1.i32[1] || _z!=z1.i32[1] || first) &&
|
||||
!(*fp_plot)(aux_data,x1.i32[1],y1.i32[1],z1.i32[1]))
|
||||
!(*fp_plot)(aux_data,x1.i32[1],y1.i32[1],z1.i32[1]))
|
||||
return FALSE;
|
||||
first=FALSE;
|
||||
_x=x1.i32[1]; _y=y1.i32[1]; _z=z1.i32[1];
|
||||
@@ -80,82 +80,44 @@ public Bool Line(U8 *aux_data,
|
||||
}
|
||||
|
||||
#help_index "Graphics/Math/3D Transformation"
|
||||
public I64 *GrRotXNew(F64 è,CTask *mem_task=NULL)
|
||||
{//MAlloc 4x4 matrix to rot about X axis. Uses $LK,"fixed-point",A="FI:::/Demo/Lectures/FixedPoint.CPP"$.
|
||||
F64 my_cos=Cos(è)*GR_SCALE,
|
||||
my_sin=Sin(è)*GR_SCALE;
|
||||
I64 *r=CAlloc(sizeof(I64)*16,mem_task);
|
||||
|
||||
r[5]=my_cos;
|
||||
r[10]=my_cos;
|
||||
r[9]=my_sin;
|
||||
r[6]=-my_sin;
|
||||
r[0]=GR_SCALE;
|
||||
r[15]=GR_SCALE;
|
||||
return r;
|
||||
}
|
||||
|
||||
public I64 *GrRotYNew(F64 ê,CTask *mem_task=NULL)
|
||||
{//MAlloc 4x4 matrix to rot about Y axis. Uses $LK,"fixed-point",A="FI:::/Demo/Lectures/FixedPoint.CPP"$.
|
||||
F64 my_cos=Cos(ê)*GR_SCALE,
|
||||
my_sin=Sin(ê)*GR_SCALE;
|
||||
I64 *r=CAlloc(sizeof(I64)*16,mem_task);
|
||||
|
||||
r[0]=my_cos;
|
||||
r[10]=my_cos;
|
||||
r[8]=-my_sin;
|
||||
r[2]=my_sin;
|
||||
r[5]=GR_SCALE;
|
||||
r[15]=GR_SCALE;
|
||||
return r;
|
||||
}
|
||||
|
||||
public I64 *GrRotZNew(F64 é,CTask *mem_task=NULL)
|
||||
{//MAlloc 4x4 matrix to rot about Z axis. Uses $LK,"fixed-point",A="FI:::/Demo/Lectures/FixedPoint.CPP"$.
|
||||
F64 my_cos=Cos(é)*GR_SCALE,
|
||||
my_sin=Sin(é)*GR_SCALE;
|
||||
I64 *r=CAlloc(sizeof(I64)*16,mem_task);
|
||||
|
||||
r[0]=my_cos;
|
||||
r[5]=my_cos;
|
||||
r[4]=my_sin;
|
||||
r[1]=-my_sin;
|
||||
r[10]=GR_SCALE;
|
||||
r[15]=GR_SCALE;
|
||||
return r;
|
||||
}
|
||||
|
||||
public I64 *GrScaleNew(I64 *m1,F64 s,CTask *mem_task=NULL)
|
||||
{//MAlloc matrix that is scaled version of a 4x4 matrix. Uses $LK,"fixed-point",A="FI:::/Demo/Lectures/FixedPoint.CPP"$.
|
||||
I64 i,*r=CAlloc(sizeof(I64)*16,mem_task);
|
||||
for (i=0;i<16;i++)
|
||||
r[i]=m1[i]*s;
|
||||
return r;
|
||||
}
|
||||
|
||||
public I64 *GrMulMat(I64 *m1,I64 *m2,CTask *mem_task=NULL)
|
||||
{//Multiply 4x4 matrices, return MAlloced matrix. Uses $LK,"fixed-point",A="FI:::/Demo/Lectures/FixedPoint.CPP"$.
|
||||
public I64 *Mat4x4MulMat4x4Equ(I64 *dst,I64 *m1,I64 *m2)
|
||||
{//Multiply 4x4 matrices and store in dst. Uses $LK,"fixed-point",A="FI:::/Demo/Lectures/FixedPoint.CPP"$.
|
||||
//Conceptually, the transform m1 is applied after m2
|
||||
I64 i,j,k,*r=CAlloc(sizeof(I64)*16,mem_task);
|
||||
F64 d;
|
||||
I64 i,j,k;
|
||||
F64 sum;
|
||||
for (i=0;i<4;i++) {
|
||||
for (j=0;j<4;j++) {
|
||||
for (k=0;k<4;k++) {
|
||||
d=m1[k+4*j];
|
||||
d*=m2[i+4*k]; //TODO! Possible overflow if norm > one.
|
||||
d/=GR_SCALE;
|
||||
r[i+4*j]+=d;
|
||||
}
|
||||
sum=0;
|
||||
for (k=0;k<4;k++)
|
||||
sum+=ToF64(m1[k+4*j])*ToF64(m2[i+4*k]);
|
||||
dst[i+4*j]=sum/GR_SCALE;
|
||||
}
|
||||
}
|
||||
return r;
|
||||
return dst;
|
||||
}
|
||||
|
||||
public I64 *GrRotXEqu(I64 *m1,F64 è)
|
||||
public I64 *Mat4x4MulMat4x4New(I64 *m1,I64 *m2,CTask *mem_task=NULL)
|
||||
{//Multiply 4x4 matrices. Return MAlloced matrix. Uses $LK,"fixed-point",A="FI:::/Demo/Lectures/FixedPoint.CPP"$.
|
||||
//Conceptually, the transform m1 is applied after m2
|
||||
return Mat4x4MulMat4x4Equ(MAlloc(sizeof(I64)*16,mem_task),m1,m2);
|
||||
}
|
||||
|
||||
public I64 *Mat4x4Equ(I64 *dst,I64 *src)
|
||||
{//Copy 4x4 Rot matrix.
|
||||
MemCpy(dst,src,sizeof(I64)*16);
|
||||
return dst;
|
||||
}
|
||||
|
||||
public I64 *Mat4x4New(I64 *src,CTask *mem_task=NULL)
|
||||
{//Return MAlloced copy of 4x4 Rot matrix.
|
||||
return Mat4x4Equ(MAlloc(sizeof(I64)*16,mem_task),src);
|
||||
}
|
||||
|
||||
public I64 *Mat4x4RotX(I64 *m1,F64 č)
|
||||
{//Rot matrix about X axis. Uses $LK,"fixed-point",A="FI:::/Demo/Lectures/FixedPoint.CPP"$.
|
||||
F64 my_cos=Cos(è)*GR_SCALE,
|
||||
my_sin=Sin(è)*GR_SCALE;
|
||||
I64 r[16],*r2;
|
||||
my_sin=Sin(č)*GR_SCALE;
|
||||
I64 r[16],r2[16];
|
||||
MemSet(r,0,sizeof(r));
|
||||
r[5]=my_cos;
|
||||
r[10]=my_cos;
|
||||
@@ -163,18 +125,14 @@ public I64 *GrRotXEqu(I64 *m1,F64
|
||||
r[6]=-my_sin;
|
||||
r[0]=GR_SCALE;
|
||||
r[15]=GR_SCALE;
|
||||
|
||||
r2=GrMulMat(r,m1);
|
||||
MemCpy(m1,r2,sizeof(I64)*16);
|
||||
Free(r2);
|
||||
return m1;
|
||||
return Mat4x4Equ(m1,Mat4x4MulMat4x4Equ(r2,r,m1));
|
||||
}
|
||||
|
||||
public I64 *GrRotYEqu(I64 *m1,F64 ê)
|
||||
public I64 *Mat4x4RotY(I64 *m1,F64 ę)
|
||||
{//Rot matrix about Y axis. Uses $LK,"fixed-point",A="FI:::/Demo/Lectures/FixedPoint.CPP"$.
|
||||
F64 my_cos=Cos(ê)*GR_SCALE,
|
||||
my_sin=Sin(ê)*GR_SCALE;
|
||||
I64 r[16],*r2;
|
||||
my_sin=Sin(ę)*GR_SCALE;
|
||||
I64 r[16],r2[16];
|
||||
MemSet(r,0,sizeof(r));
|
||||
r[0]=my_cos;
|
||||
r[10]=my_cos;
|
||||
@@ -182,18 +140,14 @@ public I64 *GrRotYEqu(I64 *m1,F64
|
||||
r[2]=my_sin;
|
||||
r[5]=GR_SCALE;
|
||||
r[15]=GR_SCALE;
|
||||
|
||||
r2=GrMulMat(r,m1);
|
||||
MemCpy(m1,r2,sizeof(I64)*16);
|
||||
Free(r2);
|
||||
return m1;
|
||||
return Mat4x4Equ(m1,Mat4x4MulMat4x4Equ(r2,r,m1));
|
||||
}
|
||||
|
||||
public I64 *GrRotZEqu(I64 *m1,F64 é)
|
||||
public I64 *Mat4x4RotZ(I64 *m1,F64 é)
|
||||
{//Rot matrix about Z axis. Uses $LK,"fixed-point",A="FI:::/Demo/Lectures/FixedPoint.CPP"$.
|
||||
F64 my_cos=Cos(é)*GR_SCALE,
|
||||
my_sin=Sin(é)*GR_SCALE;
|
||||
I64 r[16],*r2;
|
||||
my_sin=Sin(é)*GR_SCALE;
|
||||
I64 r[16],r2[16];
|
||||
MemSet(r,0,sizeof(r));
|
||||
r[0]=my_cos;
|
||||
r[5]=my_cos;
|
||||
@@ -201,14 +155,10 @@ public I64 *GrRotZEqu(I64 *m1,F64
|
||||
r[1]=-my_sin;
|
||||
r[10]=GR_SCALE;
|
||||
r[15]=GR_SCALE;
|
||||
|
||||
r2=GrMulMat(r,m1);
|
||||
MemCpy(m1,r2,sizeof(I64)*16);
|
||||
Free(r2);
|
||||
return m1;
|
||||
return Mat4x4Equ(m1,Mat4x4MulMat4x4Equ(r2,r,m1));
|
||||
}
|
||||
|
||||
public I64 *GrScaleEqu(I64 *m1,F64 s)
|
||||
public I64 *Mat4x4Scale(I64 *m1,F64 s)
|
||||
{//Scale 4x4 matrix by value.
|
||||
I64 i;
|
||||
for (i=0;i<16;i++)
|
||||
@@ -216,7 +166,7 @@ public I64 *GrScaleEqu(I64 *m1,F64 s)
|
||||
return m1;
|
||||
}
|
||||
|
||||
public U0 GrScalePenWidth(CDC *dc=gr.dc)
|
||||
public U0 DCPenWidthScale(CDC *dc=gr.dc)
|
||||
{//Scale device context's pen width by norm of transformation.
|
||||
I64 d;
|
||||
if (dc->flags&DCF_TRANSFORMATION) {
|
||||
@@ -229,7 +179,7 @@ public U0 GrScalePenWidth(CDC *dc=gr.dc)
|
||||
}
|
||||
}
|
||||
|
||||
public I64 *GrSetTranslation(I64 r[4][4],I64 x,I64 y,I64 z)
|
||||
public I64 *Mat4x4TranslationEqu(I64 r[4][4],I64 x,I64 y,I64 z)
|
||||
{//Set translation values in 4x4 matrix. Uses $LK,"fixed-point",A="FI:::/Demo/Lectures/FixedPoint.CPP"$.
|
||||
r[0][3]=x<<32;
|
||||
r[1][3]=y<<32;
|
||||
@@ -238,7 +188,7 @@ public I64 *GrSetTranslation(I64 r[4][4],I64 x,I64 y,I64 z)
|
||||
return r;
|
||||
}
|
||||
|
||||
public I64 *GrAddTranslation(I64 r[4][4],I64 x,I64 y,I64 z)
|
||||
public I64 *Mat4x4TranslationAdd(I64 r[4][4],I64 x,I64 y,I64 z)
|
||||
{//Add translation to 4x4 matrix. Uses $LK,"fixed-point",A="FI:::/Demo/Lectures/FixedPoint.CPP"$.
|
||||
r[0][3]+=x<<32;
|
||||
r[1][3]+=y<<32;
|
||||
@@ -247,7 +197,7 @@ public I64 *GrAddTranslation(I64 r[4][4],I64 x,I64 y,I64 z)
|
||||
return r;
|
||||
}
|
||||
|
||||
public Bool GrSetSymmetry(CDC *dc=gr.dc,I64 x1,I64 y1,I64 x2,I64 y2)
|
||||
public Bool DCSymmetrySet(CDC *dc=gr.dc,I64 x1,I64 y1,I64 x2,I64 y2)
|
||||
{//2D. Set device context's symmetry.
|
||||
F64 d;
|
||||
if (y1==y2 && x1==x2)
|
||||
@@ -256,8 +206,8 @@ public Bool GrSetSymmetry(CDC *dc=gr.dc,I64 x1,I64 y1,I64 x2,I64 y2)
|
||||
dc->sym.sny=x1-x2;
|
||||
dc->sym.snz=0;
|
||||
if (d=Sqrt(SqrI64(dc->sym.snx)+
|
||||
SqrI64(dc->sym.sny)+
|
||||
SqrI64(dc->sym.snz))) {
|
||||
SqrI64(dc->sym.sny)+
|
||||
SqrI64(dc->sym.snz))) {
|
||||
d=GR_SCALE/d;
|
||||
dc->sym.snx *= d;
|
||||
dc->sym.sny *= d;
|
||||
@@ -269,15 +219,16 @@ public Bool GrSetSymmetry(CDC *dc=gr.dc,I64 x1,I64 y1,I64 x2,I64 y2)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
public Bool GrSetSymmetry3(CDC *dc=gr.dc,I64 x1,I64 y1,I64 z1,I64 x2,I64 y2,I64 z2,I64 x3,I64 y3,I64 z3)
|
||||
public Bool DCSymmetry3Set(CDC *dc=gr.dc,I64 x1,I64 y1,I64 z1,
|
||||
I64 x2,I64 y2,I64 z2,I64 x3,I64 y3,I64 z3)
|
||||
{//3D. Set device context's symmetry.
|
||||
F64 d,x,y,z,xx,yy,zz;
|
||||
I64 xx1,yy1,zz1,xx2,yy2,zz2,*r;
|
||||
xx1=x1-x2; yy1=y1-y2; zz1=z1-z2;
|
||||
xx2=x3-x2; yy2=y3-y2; zz2=z3-z2;
|
||||
if (!xx1 && !yy1 && !zz1 ||
|
||||
!xx2 && !yy2 && !zz2 ||
|
||||
xx1==xx2 && yy1==yy2 && zz1==zz2)
|
||||
!xx2 && !yy2 && !zz2 ||
|
||||
xx1==xx2 && yy1==yy2 && zz1==zz2)
|
||||
return FALSE;
|
||||
|
||||
x=yy1*zz2-zz1*yy2;
|
||||
@@ -304,12 +255,12 @@ public Bool GrSetSymmetry3(CDC *dc=gr.dc,I64 x1,I64 y1,I64 z1,I64 x2,I64 y2,I64
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
public U0 GrReflect(CDC *dc,I64 *_x,I64 *_y,I64 *_z)
|
||||
public U0 DCReflect(CDC *dc,I64 *_x,I64 *_y,I64 *_z)
|
||||
{//Reflect 3D point about device context's symmetry. Uses $LK,"fixed-point",A="FI:::/Demo/Lectures/FixedPoint.CPP"$.
|
||||
I64 x=*_x<<32,y=*_y<<32,z=*_z<<32,
|
||||
xx=*_x-dc->sym.sx,yy=*_y-dc->sym.sy,zz=*_z-dc->sym.sz,
|
||||
d=(xx*dc->sym.snx+yy*dc->sym.sny+zz*dc->sym.snz)>>16,
|
||||
xn,yn,zn,xx2,yy2,zz2;
|
||||
xx=*_x-dc->sym.sx,yy=*_y-dc->sym.sy,zz=*_z-dc->sym.sz,
|
||||
d=(xx*dc->sym.snx+yy*dc->sym.sny+zz*dc->sym.snz)>>16,
|
||||
xn,yn,zn,xx2,yy2,zz2;
|
||||
xn=d*dc->sym.snx>>15;
|
||||
yn=d*dc->sym.sny>>15;
|
||||
zn=d*dc->sym.snz>>15;
|
||||
@@ -320,11 +271,11 @@ public U0 GrReflect(CDC *dc,I64 *_x,I64 *_y,I64 *_z)
|
||||
yy2=y+yn;
|
||||
zz2=z+zn;
|
||||
if (SqrI64(xx>>16 -dc->sym.sx<<16)+
|
||||
SqrI64(yy>>16 -dc->sym.sy<<16)+
|
||||
SqrI64(zz>>16 -dc->sym.sz<<16)<
|
||||
SqrI64(xx2>>16-dc->sym.sx<<16)+
|
||||
SqrI64(yy2>>16-dc->sym.sy<<16)+
|
||||
SqrI64(zz2>>16-dc->sym.sz<<16)) {
|
||||
SqrI64(yy>>16 -dc->sym.sy<<16)+
|
||||
SqrI64(zz>>16 -dc->sym.sz<<16)<
|
||||
SqrI64(xx2>>16-dc->sym.sx<<16)+
|
||||
SqrI64(yy2>>16-dc->sym.sy<<16)+
|
||||
SqrI64(zz2>>16-dc->sym.sz<<16)) {
|
||||
*_x=xx.i32[1]; *_y=yy.i32[1]; *_z=zz.i32[1];
|
||||
} else {
|
||||
*_x=xx2.i32[1]; *_y=yy2.i32[1]; *_z=zz2.i32[1];
|
||||
@@ -343,7 +294,7 @@ public Bool Circle(U8 *aux_data,
|
||||
F64 len_radians=2*ã)
|
||||
{//Step through circle arc calling callback.
|
||||
I64 i,j,len=Ceil(len_radians*radius),
|
||||
x,y,x1,y1,s1,s2,c;
|
||||
x,y,x1,y1,s1,s2,c;
|
||||
F64 t;
|
||||
if (radius<=0||!step) return TRUE;
|
||||
t=1.0/radius;
|
||||
@@ -387,7 +338,7 @@ public Bool Ellipse(U8 *aux_data,
|
||||
F64 len_radians=2*ã)
|
||||
{//Step through ellipse arc calling callback.
|
||||
I64 i,j,len,
|
||||
x,y,_x,_y,x1,y1,x2,y2, s1,s2,c, s12,s22,c2;
|
||||
x,y,_x,_y,x1,y1,x2,y2, s1,s2,c, s12,s22,c2;
|
||||
F64 t;
|
||||
Bool first=TRUE;
|
||||
if (x_radius<=0 || y_radius<=0 || !step)
|
||||
@@ -432,7 +383,7 @@ public Bool Ellipse(U8 *aux_data,
|
||||
|
||||
for (i=0;i<=len;i+=step) {
|
||||
if ((x>>SCALE2!=_x || y>>SCALE2!=_y || first) &&
|
||||
!(*fp_plot)(aux_data,cx+x>>SCALE2,cy+y>>SCALE2,cz))
|
||||
!(*fp_plot)(aux_data,cx+x>>SCALE2,cy+y>>SCALE2,cz))
|
||||
return FALSE;
|
||||
|
||||
_x=x>>SCALE2; _y=y>>SCALE2; first=FALSE;
|
||||
@@ -459,8 +410,8 @@ public Bool RegPoly(U8 *aux_data,
|
||||
F64 len_radians=2*ã)
|
||||
{//Step through regular polygon calling callback.
|
||||
I64 i,n,x,y,x1,y1,x2,y2,
|
||||
xx1,yy1,xx2,yy2,
|
||||
s1,s2,c, s12,s22,c2;
|
||||
xx1,yy1,xx2,yy2,
|
||||
s1,s2,c, s12,s22,c2;
|
||||
F64 angle_step;
|
||||
|
||||
if (sides<=0 || x_radius<=0 || y_radius<=0)
|
||||
@@ -512,7 +463,7 @@ public Bool RegPoly(U8 *aux_data,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#help_index "Graphics/Data Types;Math/Data Types"
|
||||
#help_index "Graphics/Data Types/D3I32;Math/Data Types/D3I32;Data Types/D3I32"
|
||||
public F64 D3I32Dist(CD3I32 *p1,CD3I32 *p2)
|
||||
{//Dist between p1 and p2.
|
||||
return Sqrt(SqrI64(p1->x-p2->x)+SqrI64(p1->y-p2->y)+SqrI64(p1->z-p2->z));
|
||||
@@ -534,16 +485,17 @@ public I64 D3I32NormSqr(CD3I32 *p)
|
||||
}
|
||||
|
||||
#help_index "Graphics/Math"
|
||||
public Bool Bezier2(U8 *aux_data,CD3I32 *ctrl,Bool (*fp_plot)(U8 *aux,I64 x,I64 y,I64 z),Bool first=TRUE)
|
||||
public Bool Bezier2(U8 *aux_data,CD3I32 *ctrl,
|
||||
Bool (*fp_plot)(U8 *aux,I64 x,I64 y,I64 z),Bool first=TRUE)
|
||||
{//Go in 2nd order bezier calling callback.
|
||||
I64 x,y,z,xx,yy,zz,dx,dy,dz,d_max;
|
||||
F64 x0=ctrl[0].x,y0=ctrl[0].y,z0=ctrl[0].z,
|
||||
x1=ctrl[1].x-x0,y1=ctrl[1].y-y0,z1=ctrl[1].z-z0,
|
||||
x2=ctrl[2].x-x0,y2=ctrl[2].y-y0,z2=ctrl[2].z-z0,
|
||||
t,d=D3I32Dist(&ctrl[0],&ctrl[1])+
|
||||
D3I32Dist(&ctrl[1],&ctrl[2])+
|
||||
D3I32Dist(&ctrl[2],&ctrl[0]),
|
||||
s=0.5/d,t1,t2;
|
||||
x1=ctrl[1].x-x0,y1=ctrl[1].y-y0,z1=ctrl[1].z-z0,
|
||||
x2=ctrl[2].x-x0,y2=ctrl[2].y-y0,z2=ctrl[2].z-z0,
|
||||
t,d=D3I32Dist(&ctrl[0],&ctrl[1])+
|
||||
D3I32Dist(&ctrl[1],&ctrl[2])+
|
||||
D3I32Dist(&ctrl[2],&ctrl[0]),
|
||||
s=0.5/d,t1,t2;
|
||||
xx=x0; yy=y0; zz=z0;
|
||||
if (first && !(*fp_plot)(aux_data,xx,yy,zz))
|
||||
return FALSE;
|
||||
@@ -573,23 +525,24 @@ public Bool Bezier2(U8 *aux_data,CD3I32 *ctrl,Bool (*fp_plot)(U8 *aux,I64 x,I64
|
||||
}
|
||||
x=ctrl[2].x; y=ctrl[2].y; z=ctrl[2].z;
|
||||
if ((xx!=x || yy!=y || zz!=z) &&
|
||||
!(*fp_plot)(aux_data,x,y,z))
|
||||
!(*fp_plot)(aux_data,x,y,z))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
public Bool Bezier3(U8 *aux_data,CD3I32 *ctrl,Bool (*fp_plot)(U8 *aux,I64 x,I64 y,I64 z),Bool first=TRUE)
|
||||
public Bool Bezier3(U8 *aux_data,CD3I32 *ctrl,
|
||||
Bool (*fp_plot)(U8 *aux,I64 x,I64 y,I64 z),Bool first=TRUE)
|
||||
{//Go in 3rd order bezier calling callback.
|
||||
I64 x,y,z,xx,yy,zz,dx,dy,dz,d_max;
|
||||
F64 x0=ctrl[0].x,y0=ctrl[0].y,z0=ctrl[0].z,
|
||||
x1=ctrl[1].x-x0,y1=ctrl[1].y-y0,z1=ctrl[1].z-z0,
|
||||
x2=ctrl[2].x-x0,y2=ctrl[2].y-y0,z2=ctrl[2].z-z0,
|
||||
x3=ctrl[3].x-x0,y3=ctrl[3].y-y0,z3=ctrl[3].z-z0,
|
||||
t,d=D3I32Dist(&ctrl[0],&ctrl[1])+
|
||||
D3I32Dist(&ctrl[1],&ctrl[2])+
|
||||
D3I32Dist(&ctrl[2],&ctrl[3])+
|
||||
D3I32Dist(&ctrl[3],&ctrl[0]),
|
||||
s=0.5/d,nt,t1,t2,t3;
|
||||
x1=ctrl[1].x-x0,y1=ctrl[1].y-y0,z1=ctrl[1].z-z0,
|
||||
x2=ctrl[2].x-x0,y2=ctrl[2].y-y0,z2=ctrl[2].z-z0,
|
||||
x3=ctrl[3].x-x0,y3=ctrl[3].y-y0,z3=ctrl[3].z-z0,
|
||||
t,d=D3I32Dist(&ctrl[0],&ctrl[1])+
|
||||
D3I32Dist(&ctrl[1],&ctrl[2])+
|
||||
D3I32Dist(&ctrl[2],&ctrl[3])+
|
||||
D3I32Dist(&ctrl[3],&ctrl[0]),
|
||||
s=0.5/d,nt,t1,t2,t3;
|
||||
xx=x0; yy=y0; zz=z0;
|
||||
if (first && !(*fp_plot)(aux_data,xx,yy,zz))
|
||||
return FALSE;
|
||||
@@ -621,12 +574,13 @@ public Bool Bezier3(U8 *aux_data,CD3I32 *ctrl,Bool (*fp_plot)(U8 *aux,I64 x,I64
|
||||
}
|
||||
x=ctrl[3].x; y=ctrl[3].y; z=ctrl[3].z;
|
||||
if ((xx!=x || yy!=y || zz!=z) &&
|
||||
!(*fp_plot)(aux_data,x,y,z))
|
||||
!(*fp_plot)(aux_data,x,y,z))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
public Bool BSpline2(U8 *aux_data,CD3I32 *ctrl,I64 cnt,Bool (*fp_plot)(U8 *aux,I64 x,I64 y,I64 z),Bool closed=FALSE)
|
||||
public Bool BSpline2(U8 *aux_data,CD3I32 *ctrl,I64 cnt,
|
||||
Bool (*fp_plot)(U8 *aux,I64 x,I64 y,I64 z),Bool closed=FALSE)
|
||||
{//Go in 2nd order spline calling callback.
|
||||
I64 i,j;
|
||||
CD3I32 *c;
|
||||
@@ -692,7 +646,8 @@ public Bool BSpline2(U8 *aux_data,CD3I32 *ctrl,I64 cnt,Bool (*fp_plot)(U8 *aux,I
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
public Bool BSpline3(U8 *aux_data,CD3I32 *ctrl,I64 cnt,Bool (*fp_plot)(U8 *aux,I64 x,I64 y,I64 z),Bool closed=FALSE)
|
||||
public Bool BSpline3(U8 *aux_data,CD3I32 *ctrl,I64 cnt,
|
||||
Bool (*fp_plot)(U8 *aux,I64 x,I64 y,I64 z),Bool closed=FALSE)
|
||||
{//Go in 3rd order spline calling callback.
|
||||
I64 i,j;
|
||||
F64 x,y,z;
|
||||
@@ -786,10 +741,11 @@ public Bool BSpline3(U8 *aux_data,CD3I32 *ctrl,I64 cnt,Bool (*fp_plot)(U8 *aux,I
|
||||
#define CC_TOP 4
|
||||
#define CC_BOTTOM 8
|
||||
|
||||
public Bool ClipLine(I64 *_x1,I64 *_y1,I64 *_x2,I64 *_y2,I64 left,I64 top,I64 right,I64 bottom)
|
||||
public Bool ClipLine(I64 *_x1,I64 *_y1,I64 *_x2,I64 *_y2,
|
||||
I64 left,I64 top,I64 right,I64 bottom)
|
||||
{//Clip x1,y1 x2,y2 with left,top,right,bottom.
|
||||
I64 x,y,x1=*_x1,y1=*_y1,x2=*_x2,y2=*_y2,
|
||||
cc,cc1,cc2;
|
||||
cc,cc1,cc2;
|
||||
if (y1>bottom)
|
||||
cc1=CC_BOTTOM;
|
||||
else if (y1<top)
|
||||
|
||||
+39
-47
@@ -1,22 +1,14 @@
|
||||
#help_index "Graphics/Color"
|
||||
public I32 gr_rainbow_10[10]=
|
||||
{
|
||||
BLACK,BROWN,RED,LTRED,YELLOW,
|
||||
GREEN,BLUE,PURPLE,LTGRAY,WHITE
|
||||
};
|
||||
public U8 gr_rainbow_10[10]={
|
||||
BLACK,BROWN,RED,LTRED,YELLOW,GREEN,BLUE,PURPLE,LTGRAY,WHITE};
|
||||
|
||||
DefineLstLoad("ST_RAINBOW_10",
|
||||
"BLACK\0BROWN\0RED\0LTRED\0YELLOW\0"
|
||||
"GREEN\0BLUE\0PURPLE\0LTGRAY\0WHITE\0");
|
||||
"BLACK\0BROWN\0RED\0LTRED\0YELLOW\0GREEN\0BLUE\0PURPLE\0LTGRAY\0WHITE\0");
|
||||
|
||||
U0 SetVGAPalette4Indices()
|
||||
{/*4-bit (16 color)
|
||||
There is a level of indirection we wish to identity map.
|
||||
This sets the 16-colors to use
|
||||
the first 16 DAC rgb entries, so
|
||||
we never need to worry about indexes,
|
||||
just DAC palette settings.
|
||||
*/
|
||||
U0 GrPaletteIndicesSet()
|
||||
{//There is a level of indirection that we identity map.
|
||||
// Set 16-colors to use first 16 DAC BGR entries, so we
|
||||
// never need to worry about indexes, just DAC palette settings.
|
||||
I64 i;
|
||||
if (!Bt(&sys_run_level,RLf_VGA)) return;
|
||||
PUSHFD
|
||||
@@ -24,7 +16,7 @@ just DAC palette settings.
|
||||
while (LBts(&sys_semas[SYS_SEMA_VGA],0))
|
||||
Yield;
|
||||
InU8(VGAP_INPUT_STAT); //Rsts attr index/data
|
||||
for (i=0;i<16;i++) {
|
||||
for (i=0;i<NUM_COLORS;i++) {
|
||||
OutU8(VGAP_ATTR_INDEX,i);
|
||||
OutU8(VGAP_ATTR_DATA_WRITE,i);
|
||||
}
|
||||
@@ -35,8 +27,8 @@ just DAC palette settings.
|
||||
POPFD
|
||||
}
|
||||
|
||||
public U0 SetVGAPaletteColor(I64 color_num,CBGR bgr)
|
||||
{//6-bits per b, g and r.
|
||||
public U0 GrPaletteColorSet(I64 color_num,CBGR48 bgr48)
|
||||
{//VGA has 6-bits for blue, for green, and for red.
|
||||
if (!Bt(&sys_run_level,RLf_VGA)) return;
|
||||
PUSHFD
|
||||
CLI
|
||||
@@ -44,16 +36,16 @@ public U0 SetVGAPaletteColor(I64 color_num,CBGR bgr)
|
||||
Yield;
|
||||
OutU8(VGAP_PALETTE_MASK,0xFF);
|
||||
OutU8(VGAP_REG_WRITE,color_num);
|
||||
OutU8(VGAP_PALETTE_DATA,bgr.r>>2);
|
||||
OutU8(VGAP_PALETTE_DATA,bgr.g>>2);
|
||||
OutU8(VGAP_PALETTE_DATA,bgr.b>>2);
|
||||
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);
|
||||
POPFD
|
||||
}
|
||||
|
||||
public CBGR GetVGAPaletteColor(I64 color_num)
|
||||
{//6-bits per b, g and r.
|
||||
CBGR result=0;
|
||||
public CBGR48 GrPaletteColorGet(I64 color_num)
|
||||
{//VGA has 6-bits for blue, for green, and for red.
|
||||
CBGR48 result=0;
|
||||
if (!Bt(&sys_run_level,RLf_VGA)) return 0;
|
||||
PUSHFD
|
||||
CLI
|
||||
@@ -61,41 +53,41 @@ public CBGR GetVGAPaletteColor(I64 color_num)
|
||||
Yield;
|
||||
OutU8(VGAP_PALETTE_MASK,0xFF);
|
||||
OutU8(VGAP_REG_READ,color_num);
|
||||
result.r=InU8(VGAP_PALETTE_DATA)<<2;
|
||||
result.g=InU8(VGAP_PALETTE_DATA)<<2;
|
||||
result.b=InU8(VGAP_PALETTE_DATA)<<2;
|
||||
result.r=0xFFFF<<10*InU8(VGAP_PALETTE_DATA)/0xFC00;
|
||||
result.g=0xFFFF<<10*InU8(VGAP_PALETTE_DATA)/0xFC00;
|
||||
result.b=0xFFFF<<10*InU8(VGAP_PALETTE_DATA)/0xFC00;
|
||||
LBtr(&sys_semas[SYS_SEMA_VGA],0);
|
||||
POPFD
|
||||
return result;
|
||||
}
|
||||
|
||||
public CBGR vga_palette4_std[16]={
|
||||
0x000000,0x0000AA,0x00AA00,0x00AAAA,
|
||||
0xAA0000,0xAA00AA,0xAA5500,0xAAAAAA,
|
||||
0x555555,0x5555FF,0x55FF55,0x55FFFF,
|
||||
0xFF5555,0xFF55FF,0xFFFF55,0xFFFFFF};
|
||||
public CBGR48 gr_palette_std[NUM_COLORS]={
|
||||
0x000000000000,0x00000000AAAA,0x0000AAAA0000,0x0000AAAAAAAA,
|
||||
0xAAAA00000000,0xAAAA0000AAAA,0xAAAA55550000,0xAAAAAAAAAAAA,
|
||||
0x555555555555,0x55555555FFFF,0x5555FFFF5555,0x5555FFFFFFFF,
|
||||
0xFFFF55555555,0xFFFF5555FFFF,0xFFFFFFFF5555,0xFFFFFFFFFFFF};
|
||||
|
||||
public CBGR vga_palette4_gray[16]={
|
||||
0x000000,0x111111,0x222222,0x333333,
|
||||
0x444444,0x555555,0x666666,0x777777,
|
||||
0x888888,0x999999,0xAAAAAA,0xBBBBBB,
|
||||
0xCCCCCC,0xDDDDDD,0xEEEEEE,0xFFFFFF};
|
||||
public CBGR48 gr_palette_gray[NUM_COLORS]={
|
||||
0x000000000000,0x111111111111,0x222222222222,0x333333333333,
|
||||
0x444444444444,0x555555555555,0x666666666666,0x777777777777,
|
||||
0x888888888888,0x999999999999,0xAAAAAAAAAAAA,0xBBBBBBBBBBBB,
|
||||
0xCCCCCCCCCCCC,0xDDDDDDDDDDDD,0xEEEEEEEEEEEE,0xFFFFFFFFFFFF};
|
||||
|
||||
public U0 GetVGAPalette4(CBGR *bgr)
|
||||
{//4-bit (16 color)
|
||||
public U0 GrPaletteGet(CBGR48 *bgr48)
|
||||
{//16 colors
|
||||
I64 i;
|
||||
for (i=0;i<16;i++)
|
||||
bgr[i]=GetVGAPaletteColor(i);
|
||||
for (i=0;i<NUM_COLORS;i++)
|
||||
bgr48[i]=GrPaletteColorGet(i);
|
||||
}
|
||||
|
||||
public U0 SetVGAPalette4(CBGR *bgr)
|
||||
{//4-bit (16 color)
|
||||
public U0 GrPaletteSet(CBGR48 *bgr48)
|
||||
{//16 colors
|
||||
I64 i;
|
||||
for (i=0;i<16;i++)
|
||||
SetVGAPaletteColor(i,bgr[i]);
|
||||
for (i=0;i<NUM_COLORS;i++)
|
||||
GrPaletteColorSet(i,bgr48[i]);
|
||||
}
|
||||
|
||||
public U0 SetStdPalette()
|
||||
public U0 PaletteSetStd()
|
||||
{//Activate std palette.
|
||||
SetVGAPalette4(vga_palette4_std);
|
||||
GrPaletteSet(gr_palette_std);
|
||||
}
|
||||
+93
-83
@@ -1,6 +1,7 @@
|
||||
#help_index "Graphics"
|
||||
|
||||
public Bool GrClamp(CDC *dc=gr.dc,I64 *left,I64 *top,I64 *right,I64 *bottom,I64 width=0,I64 height=0)
|
||||
public Bool GrClamp(CDC *dc=gr.dc,I64 *left,I64 *top,I64 *right,I64 *bottom,
|
||||
I64 width=0,I64 height=0)
|
||||
{//Returns screen, not window coordinates.
|
||||
CTask *win_task;
|
||||
*left=0;
|
||||
@@ -29,7 +30,8 @@ public Bool GrClamp(CDC *dc=gr.dc,I64 *left,I64 *top,I64 *right,I64 *bottom,I64
|
||||
return *left<=*right && *top<=*bottom;
|
||||
}
|
||||
|
||||
Bool DCClipLine(CDC *dc=gr.dc,I64 *x1,I64 *y1,I64 *x2,I64 *y2,I64 width=0,I64 height=0)
|
||||
Bool DCClipLine(CDC *dc=gr.dc,I64 *x1,I64 *y1,I64 *x2,I64 *y2,
|
||||
I64 width=0,I64 height=0)
|
||||
{//Also converts window to screen coordinates
|
||||
I64 left,top,right,bottom;
|
||||
CTask *win_task;
|
||||
@@ -63,15 +65,15 @@ public Bool GrPlot(CDC *dc=gr.dc,I64 x,I64 y)
|
||||
x+=win_task->pix_left+win_task->scroll_x;
|
||||
y+=win_task->pix_top+win_task->scroll_y;
|
||||
if (win_task->pix_left<=x<=win_task->pix_right &&
|
||||
win_task->pix_top <=y<=win_task->pix_bottom &&
|
||||
0<=x<dc->width && 0<=y<dc->height &&
|
||||
(win_task->next_task==sys_winmgr_task ||
|
||||
dc->flags&DCF_ON_TOP ||
|
||||
!IsPixCovered0(win_task,x,y)))
|
||||
win_task->pix_top <=y<=win_task->pix_bottom &&
|
||||
0<=x<dc->width && 0<=y<dc->height &&
|
||||
(win_task->next_task==sys_winmgr_task ||
|
||||
dc->flags&DCF_ON_TOP ||
|
||||
!IsPixCovered0(win_task,x,y)))
|
||||
GrPlot0(dc,x,y);
|
||||
} else
|
||||
if (0<=x<dc->width && 0<=y<dc->height)
|
||||
GrPlot0(dc,x,y);
|
||||
GrPlot0(dc,x,y);
|
||||
dc->depth_buf=db;
|
||||
return TRUE;
|
||||
}
|
||||
@@ -94,15 +96,15 @@ Bool GrPlot1(CDC *dc=gr.dc,I64 x,I64 y)
|
||||
x+=win_task->pix_left+win_task->scroll_x;
|
||||
y+=win_task->pix_top+win_task->scroll_y;
|
||||
if (win_task->pix_left<=x<=win_task->pix_right &&
|
||||
win_task->pix_top <=y<=win_task->pix_bottom &&
|
||||
0<=x<dc->width && 0<=y<dc->height &&
|
||||
(win_task->next_task==sys_winmgr_task ||
|
||||
dc->flags&DCF_ON_TOP ||
|
||||
!IsPixCovered0(win_task,x,y)))
|
||||
win_task->pix_top <=y<=win_task->pix_bottom &&
|
||||
0<=x<dc->width && 0<=y<dc->height &&
|
||||
(win_task->next_task==sys_winmgr_task ||
|
||||
dc->flags&DCF_ON_TOP ||
|
||||
!IsPixCovered0(win_task,x,y)))
|
||||
GrPlot0(dc,x,y);
|
||||
} else
|
||||
if (0<=x<dc->width && 0<=y<dc->height)
|
||||
GrPlot0(dc,x,y);
|
||||
GrPlot0(dc,x,y);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -115,15 +117,15 @@ public I64 GrPeek(CDC *dc=gr.dc,I64 x,I64 y)
|
||||
x+=win_task->pix_left+win_task->scroll_x;
|
||||
y+=win_task->pix_top+win_task->scroll_y;
|
||||
if (!(win_task->pix_left<=x<=win_task->pix_right) ||
|
||||
!(win_task->pix_top <=y<=win_task->pix_bottom) ||
|
||||
!(0<=x<dc->width) || !(0<=y<dc->height) ||
|
||||
win_task->next_task!=sys_winmgr_task &&
|
||||
!(dc->flags&DCF_ON_TOP) &&
|
||||
IsPixCovered0(win_task,x,y))
|
||||
!(win_task->pix_top <=y<=win_task->pix_bottom) ||
|
||||
!(0<=x<dc->width) || !(0<=y<dc->height) ||
|
||||
win_task->next_task!=sys_winmgr_task &&
|
||||
!(dc->flags&DCF_ON_TOP) &&
|
||||
IsPixCovered0(win_task,x,y))
|
||||
return -1;
|
||||
} else
|
||||
if (!(0<=x<dc->width) || !(0<=y<dc->height))
|
||||
return -1;
|
||||
return -1;
|
||||
return GrPeek0(dc,x,y);
|
||||
}
|
||||
|
||||
@@ -171,7 +173,7 @@ I64 GrFloodFillRay(CDC *dc,I64 x,I64 y,I64 z,I32 *db)
|
||||
//Returns cnt of pixs changed
|
||||
I64 result=0;
|
||||
//We don't dynamically calculate the size to avoid
|
||||
//fragmentation of memory.
|
||||
//fragmentation of memory.
|
||||
CFFRay *f_dc=MAlloc(sizeof(CFFRay)*0x80000),*f=f_dc;
|
||||
f->x=x;
|
||||
f->y=y;
|
||||
@@ -234,11 +236,12 @@ I64 GrFloodFillRay(CDC *dc,I64 x,I64 y,I64 z,I32 *db)
|
||||
return result;
|
||||
}
|
||||
|
||||
public I64 GrFloodFill(CDC *dc=gr.dc,I64 x,I64 y,Bool not_color=FALSE,I64 z=0,I32 *db=NULL)
|
||||
public I64 GrFloodFill(CDC *dc=gr.dc,I64 x,I64 y,
|
||||
Bool not_color=FALSE,I64 z=0,I32 *db=NULL)
|
||||
{//2D. Ignore z and db.
|
||||
//not_color=TRUE means fill up to everything which is not the current color.
|
||||
//not_color=FALSE means fill all parts equal to the color under the point.
|
||||
//Returns cnt of pixs changed
|
||||
//not_color=FALSE means fill all parts equal to the color under the point.
|
||||
//Returns cnt of pixs changed
|
||||
I64 result=0,j,old_flags=dc->flags;
|
||||
CColorROPU32 old_color2=dc->color2;
|
||||
CDC *old_brush;
|
||||
@@ -254,14 +257,14 @@ public I64 GrFloodFill(CDC *dc=gr.dc,I64 x,I64 y,Bool not_color=FALSE,I64 z=0,I3
|
||||
dc->color2=j;
|
||||
if (dc->color.c1.rop&ROPBF_DITHER) {
|
||||
if (dc->color2.c0.color==dc->color.c0.color &&
|
||||
dc->color.c0.color==dc->color.c1.color)
|
||||
dc->color.c0.color==dc->color.c1.color)
|
||||
goto ff_done;
|
||||
} else if (dc->color2.c0.color==dc->color.c0.color)
|
||||
goto ff_done;
|
||||
dc->flags&=~DCF_FILL_NOT_COLOR;
|
||||
}
|
||||
if (not_color && j!=dc->color2 ||
|
||||
!not_color)
|
||||
!not_color)
|
||||
result=GrFloodFillRay(dc,x,y,z,db);
|
||||
}
|
||||
ff_done:
|
||||
@@ -282,7 +285,7 @@ public Bool GrPlot3B(CDC *dc=gr.dc,I64 x,I64 y,I64 z)
|
||||
}
|
||||
if (dc->flags & DCF_SYMMETRY) {
|
||||
_x=x; _y=y; _z=z;
|
||||
GrReflect(dc,&_x,&_y,&_z);
|
||||
DCReflect(dc,&_x,&_y,&_z);
|
||||
dc->flags&=~DCF_SYMMETRY;
|
||||
dc->db_z=_z;
|
||||
GrPlot1(dc,_x,_y);
|
||||
@@ -302,7 +305,7 @@ gr_done:
|
||||
|
||||
public Bool GrPlot3(CDC *dc=gr.dc,I64 x,I64 y,I64 z)
|
||||
{//3D. Clipping and transformation and pen width.
|
||||
I64 _x,_y,_z,i,j,w,dist;
|
||||
I64 _x,_y,_z,i,j,w;
|
||||
CColorROPU32 old_color=dc->color;
|
||||
Bool record,was_transform=FALSE,was_symmetry=FALSE;
|
||||
CTask *win_task;
|
||||
@@ -313,7 +316,7 @@ public Bool GrPlot3(CDC *dc=gr.dc,I64 x,I64 y,I64 z)
|
||||
}
|
||||
if (dc->flags & DCF_SYMMETRY) {
|
||||
_x=x; _y=y; _z=z;
|
||||
GrReflect(dc,&_x,&_y,&_z);
|
||||
DCReflect(dc,&_x,&_y,&_z);
|
||||
dc->flags&=~DCF_SYMMETRY;
|
||||
GrPlot3(dc,_x,_y,_z);
|
||||
was_symmetry=TRUE;
|
||||
@@ -341,8 +344,10 @@ public Bool GrPlot3(CDC *dc=gr.dc,I64 x,I64 y,I64 z)
|
||||
}
|
||||
} else {
|
||||
if (dc->color.c0.rop==ROPB_COLLISION) {
|
||||
if (dc->color.c0.color!=dc->bkcolor.c0.color && dc->color.c0.color!=TRANSPARENT)
|
||||
record=GrBlot3(dc,x-w,y-w,z,gr.collision_pen_brushes[dc->pen_width]);
|
||||
if (dc->color.c0.color!=dc->bkcolor.c0.color &&
|
||||
dc->color.c0.color!=TRANSPARENT)
|
||||
record=GrBlot3(dc,x-w,y-w,z,
|
||||
gr.collision_pen_brushes[dc->pen_width]);
|
||||
else
|
||||
record=FALSE;
|
||||
} else
|
||||
@@ -362,7 +367,8 @@ public Bool GrPlot3(CDC *dc=gr.dc,I64 x,I64 y,I64 z)
|
||||
}
|
||||
} else {
|
||||
if (dc->color.c0.rop==ROPB_COLLISION) {
|
||||
if (dc->color.c0.color!=dc->bkcolor.c0.color && dc->color.c0.color!=TRANSPARENT)
|
||||
if (dc->color.c0.color!=dc->bkcolor.c0.color &&
|
||||
dc->color.c0.color!=TRANSPARENT)
|
||||
record=GrBlot(dc,x-w,y-w,gr.collision_pen_brushes[dc->pen_width]);
|
||||
else
|
||||
record=FALSE;
|
||||
@@ -376,13 +382,8 @@ public Bool GrPlot3(CDC *dc=gr.dc,I64 x,I64 y,I64 z)
|
||||
x+=win_task->pix_left+win_task->scroll_x;
|
||||
y+=win_task->pix_top+win_task->scroll_y;
|
||||
}
|
||||
if (dc->flags & DCF_LOCATE_NEAREST) {
|
||||
dist=DistSqrI64(x,y,dc->cur_x,dc->cur_y);
|
||||
if (dist<dc->nearest_dist) {
|
||||
dc->nearest_sprite_elem_num=dc->cur_sprite_elem_num;
|
||||
dc->nearest_dist=dist;
|
||||
}
|
||||
}
|
||||
if (dc->flags & DCF_LOCATE_NEAREST)
|
||||
dc->dist=DistSqrI64(x,y,dc->cur_x,dc->cur_y);
|
||||
if (dc->flags & DCF_RECORD_EXTENTS) {
|
||||
if (x-w<dc->min_x) dc->min_x=x-w;
|
||||
if (y-w<dc->min_y) dc->min_y=y-w;
|
||||
@@ -417,9 +418,9 @@ Bool GrLinePlot0(CDC *dc,I64 x,I64 y,I64 z)
|
||||
{//This is a callback.
|
||||
CTask *win_task=dc->win_task;
|
||||
if (!(dc->flags & DCF_SCREEN_BITMAP) ||
|
||||
win_task->next_task==sys_winmgr_task ||
|
||||
dc->flags&DCF_ON_TOP ||
|
||||
!IsPixCovered0(win_task,x,y)) {
|
||||
win_task->next_task==sys_winmgr_task ||
|
||||
dc->flags&DCF_ON_TOP ||
|
||||
!IsPixCovered0(win_task,x,y)) {
|
||||
dc->db_z=z;
|
||||
GrPlot0(dc,x,y);
|
||||
}
|
||||
@@ -433,7 +434,8 @@ Bool GrLinePlot(CDC *dc,I64 x,I64 y,I64 z)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
public Bool GrLine(CDC *dc=gr.dc,I64 x1,I64 y1,I64 x2,I64 y2,I64 step=1,I64 start=0)
|
||||
public Bool GrLine(CDC *dc=gr.dc,I64 x1,I64 y1,I64 x2,I64 y2,
|
||||
I64 step=1,I64 start=0)
|
||||
{//2D. Clipping but not transformation.
|
||||
Bool result=FALSE;
|
||||
I32 *db=dc->depth_buf;
|
||||
@@ -469,7 +471,8 @@ public Bool GrEllipse(CDC *dc=gr.dc,
|
||||
Bool result;
|
||||
I32 *db=dc->depth_buf;
|
||||
dc->depth_buf=NULL;
|
||||
result=Ellipse(dc,cx,cy,0,x_radius,y_radius,&GrLinePlot,rot_angle,step,start_radians,len_radians);
|
||||
result=Ellipse(dc,cx,cy,0,x_radius,y_radius,&GrLinePlot,
|
||||
rot_angle,step,start_radians,len_radians);
|
||||
dc->depth_buf=db;
|
||||
return result;
|
||||
}
|
||||
@@ -486,7 +489,7 @@ public Bool GrRegPoly(CDC *dc=gr.dc,
|
||||
I32 *db=dc->depth_buf;
|
||||
dc->depth_buf=NULL;
|
||||
result=RegPoly(dc,cx,cy,0,x_radius,y_radius,sides,
|
||||
&GrLinePlot,rot_angle,step,start_radians,len_radians);
|
||||
&GrLinePlot,rot_angle,step,start_radians,len_radians);
|
||||
dc->depth_buf=db;
|
||||
return result;
|
||||
}
|
||||
@@ -511,7 +514,8 @@ public Bool Gr3BSpline(CDC *dc=gr.dc,CD3I32 *ctrl,I64 cnt,Bool closed=FALSE)
|
||||
return BSpline3(dc,ctrl,cnt,&GrLinePlot,closed);
|
||||
}
|
||||
|
||||
public Bool GrLine3(CDC *dc=gr.dc,I64 x1,I64 y1,I64 z1,I64 x2,I64 y2,I64 z2,I64 step=1,I64 start=0)
|
||||
public Bool GrLine3(CDC *dc=gr.dc,I64 x1,I64 y1,I64 z1,I64 x2,I64 y2,I64 z2,
|
||||
I64 step=1,I64 start=0)
|
||||
{//3D. Transformation with pen width.
|
||||
I64 _x1,_y1,_z1,_x2,_y2,_z2;
|
||||
Bool result=FALSE,was_transform=FALSE,was_symmetry=FALSE;
|
||||
@@ -523,11 +527,12 @@ public Bool GrLine3(CDC *dc=gr.dc,I64 x1,I64 y1,I64 z1,I64 x2,I64 y2,I64 z2,I64
|
||||
}
|
||||
if (dc->flags & DCF_SYMMETRY) {
|
||||
_x1=x1; _y1=y1; _z1=z1;
|
||||
GrReflect(dc,&_x1,&_y1,&_z1);
|
||||
DCReflect(dc,&_x1,&_y1,&_z1);
|
||||
_x2=x2; _y2=y2; _z2=z2;
|
||||
GrReflect(dc,&_x2,&_y2,&_z2);
|
||||
DCReflect(dc,&_x2,&_y2,&_z2);
|
||||
dc->flags&=~DCF_SYMMETRY;
|
||||
if (step==1 && !start && !dc->brush && dc->pen_width<2 && !dc->depth_buf) {//TODO: clip z for depth buf
|
||||
if (step==1 && !start && !dc->brush && dc->pen_width<2 &&
|
||||
!dc->depth_buf) {//TODO: clip z for depth buf
|
||||
if (DCClipLine(dc,&_x1,&_y1,&_x2,&_y2))
|
||||
result=Line(dc,_x1,_y1,0,_x2,_y2,0,&GrLinePlot0,step,start);
|
||||
} else
|
||||
@@ -536,7 +541,8 @@ public Bool GrLine3(CDC *dc=gr.dc,I64 x1,I64 y1,I64 z1,I64 x2,I64 y2,I64 z2,I64
|
||||
if (dc->flags&DCF_JUST_MIRROR)
|
||||
goto gr_done;
|
||||
}
|
||||
if (step==1 && !start && !dc->brush && dc->pen_width<2 && !dc->depth_buf) {//TODO: clip z for depth buf
|
||||
if (step==1 && !start && !dc->brush && dc->pen_width<2 &&
|
||||
!dc->depth_buf) {//TODO: clip z for depth buf
|
||||
if (DCClipLine(dc,&x1,&y1,&x2,&y2))
|
||||
result|=Line(dc,x1,y1,0,x2,y2,0,&GrLinePlot0,step,start);
|
||||
} else
|
||||
@@ -628,10 +634,11 @@ public Bool GrEllipse3(CDC *dc=gr.dc,
|
||||
m2*=Abs(Sin(a2-a1));
|
||||
|
||||
result=Ellipse(dc,cx,cy,cz,
|
||||
m1/0x10000,m2/0x10000,&GrPlot3,-a1,step,start_radians,len_radians);
|
||||
m1/0x10000,m2/0x10000,&GrPlot3,-a1,step,start_radians,len_radians);
|
||||
dc->flags|=DCF_TRANSFORMATION;
|
||||
} else
|
||||
result=Ellipse(dc,cx,cy,cz,x_radius,y_radius,&GrPlot3,rot_angle,step,start_radians,len_radians);
|
||||
result=Ellipse(dc,cx,cy,cz,x_radius,y_radius,&GrPlot3,
|
||||
rot_angle,step,start_radians,len_radians);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -639,9 +646,11 @@ public Bool GrCircle3(CDC *dc=gr.dc,I64 cx,I64 cy,I64 cz,I64 radius,
|
||||
I64 step=1,F64 start_radians=0,F64 len_radians=2*ã)
|
||||
{//3D. Transformation with pen width.
|
||||
if (dc->flags & DCF_TRANSFORMATION)
|
||||
return GrEllipse3(dc,cx,cy,cz,radius,radius,0,step,start_radians,len_radians);
|
||||
return GrEllipse3(dc,cx,cy,cz,radius,radius,0,step,
|
||||
start_radians,len_radians);
|
||||
else
|
||||
return Circle(dc,cx,cy,cz,radius,&GrPlot3,step,start_radians,len_radians);
|
||||
return Circle(dc,cx,cy,cz,radius,&GrPlot3,step,
|
||||
start_radians,len_radians);
|
||||
}
|
||||
|
||||
public Bool GrRegPoly3(CDC *dc=gr.dc,
|
||||
@@ -690,27 +699,29 @@ public Bool GrRegPoly3(CDC *dc=gr.dc,
|
||||
m2*=Abs(Sin(a2-a1));
|
||||
|
||||
result=RegPoly(dc,cx,cy,cz,
|
||||
m1/0x10000,m2/0x10000,sides,&GrPlot3,-a1,step,start_radians,len_radians);
|
||||
m1/0x10000,m2/0x10000,sides,&GrPlot3,-a1,
|
||||
step,start_radians,len_radians);
|
||||
dc->flags|=DCF_TRANSFORMATION;
|
||||
} else
|
||||
result=RegPoly(dc,cx,cy,cz,x_radius,y_radius,sides,&GrPlot3,rot_angle,step,start_radians,len_radians);
|
||||
result=RegPoly(dc,cx,cy,cz,x_radius,y_radius,sides,&GrPlot3,
|
||||
rot_angle,step,start_radians,len_radians);
|
||||
return result;
|
||||
}
|
||||
|
||||
public I64 GrFloodFill3(CDC *dc=gr.dc,I64 x1,I64 y1,I64 z1,Bool not_color=FALSE)
|
||||
{//3D. Transformation.
|
||||
//not_color=TRUE means fill up to everything which is not the current color.
|
||||
//not_color=FALSE means fill all parts equal to the color under the point.
|
||||
//Returns cnt of pixs changed
|
||||
//not_color=FALSE means fill all parts equal to the color under the point.
|
||||
//Returns cnt of pixs changed
|
||||
I64 result,old_flags=dc->flags,
|
||||
_x,_y,_z;
|
||||
_x,_y,_z;
|
||||
if (dc->flags & DCF_TRANSFORMATION) {
|
||||
(*dc->transform)(dc,&x1,&y1,&z1);
|
||||
dc->flags&=~DCF_TRANSFORMATION;
|
||||
}
|
||||
if (dc->flags & DCF_SYMMETRY) {
|
||||
_x=x1; _y=y1; _z=z1;
|
||||
GrReflect(dc,&_x,&_y,&_z);
|
||||
DCReflect(dc,&_x,&_y,&_z);
|
||||
dc->flags&=~DCF_SYMMETRY;
|
||||
result=GrFloodFill(dc,_x,_y,not_color,_z,dc->depth_buf);
|
||||
if (dc->flags&DCF_JUST_MIRROR)
|
||||
@@ -725,16 +736,16 @@ gr_done:
|
||||
#help_index "Graphics;Graphics/Device Contexts"
|
||||
|
||||
public I64 GrBlot3(CDC *dc=gr.dc,I64 x1,I64 y1,I64 z1,CDC *img)
|
||||
{//3D. Clipping and transformation. Uses $LK,"fixed-point",A="FI:::/Demo/Lectures/FixedPoint.CPP"$.
|
||||
{//3D. Clipping and transformation.
|
||||
CColorROPU32 old_color=dc->color;
|
||||
I64 color,reg i,j,w=img->width,h=img->height,
|
||||
d1,dx1,dy1,dz1,
|
||||
reg d2,dx2,dy2,dz2,
|
||||
adx1,ady1,adz1,
|
||||
adx2,ady2,adz2,
|
||||
x2,y2,z2,x3,y3,z3,
|
||||
dw,reg dh,x,y,_x1,_y1,_z1,_x2,_y2,_z2,_x3,_y3,_z3,
|
||||
last_x,last_y,result=0;
|
||||
d1,dx1,dy1,dz1,
|
||||
reg d2,dx2,dy2,dz2,
|
||||
adx1,ady1,adz1,
|
||||
adx2,ady2,adz2,
|
||||
x2,y2,z2,x3,y3,z3,
|
||||
dw,reg dh,x,y,_x1,_y1,_z1,_x2,_y2,_z2,_x3,_y3,_z3,
|
||||
last_x,last_y,result=0;
|
||||
Bool first;
|
||||
CDC *old_brush=dc->brush;
|
||||
|
||||
@@ -748,11 +759,11 @@ public I64 GrBlot3(CDC *dc=gr.dc,I64 x1,I64 y1,I64 z1,CDC *img)
|
||||
}
|
||||
if (dc->flags & DCF_SYMMETRY) {
|
||||
_x1=x1; _y1=y1; _z1=z1;
|
||||
GrReflect(dc,&_x1,&_y1,&_z1);
|
||||
DCReflect(dc,&_x1,&_y1,&_z1);
|
||||
_x2=x2; _y2=y2; _z2=z2;
|
||||
GrReflect(dc,&_x2,&_y2,&_z2);
|
||||
DCReflect(dc,&_x2,&_y2,&_z2);
|
||||
_x3=x3; _y3=y3; _z3=z3;
|
||||
GrReflect(dc,&_x3,&_y3,&_z3);
|
||||
DCReflect(dc,&_x3,&_y3,&_z3);
|
||||
dx1=_x2-_x1; dy1=_y2-_y1; dz1=_z2-_z1;
|
||||
dx2=_x3-_x1; dy2=_y3-_y1; dz2=_z3-_z1;
|
||||
adx1=AbsI64(dx1); ady1=AbsI64(dy1); adz1=AbsI64(dz1);
|
||||
@@ -944,7 +955,7 @@ public Bool Gr2Bezier3(CDC *dc=gr.dc,CD3I32 *ctrl)
|
||||
{//2nd order. Clipping and transform and pen width.
|
||||
Bool result=FALSE;
|
||||
I64 i,x,y,z,
|
||||
old_flags=dc->flags;
|
||||
old_flags=dc->flags;
|
||||
CD3I32 *ctrl2=NULL,*ctrl3=NULL;
|
||||
if (dc->flags & DCF_TRANSFORMATION) {
|
||||
ctrl2=MAlloc(sizeof(CD3I32)*3);
|
||||
@@ -966,7 +977,7 @@ public Bool Gr2Bezier3(CDC *dc=gr.dc,CD3I32 *ctrl)
|
||||
x=ctrl[i].x;
|
||||
y=ctrl[i].y;
|
||||
z=ctrl[i].z;
|
||||
GrReflect(dc,&x,&y,&z);
|
||||
DCReflect(dc,&x,&y,&z);
|
||||
ctrl3[i].x=x;
|
||||
ctrl3[i].y=y;
|
||||
ctrl3[i].z=z;
|
||||
@@ -989,7 +1000,7 @@ public Bool Gr3Bezier3(CDC *dc=gr.dc,CD3I32 *ctrl)
|
||||
{//3rd order. Clipping and transform and pen width.
|
||||
Bool result=FALSE;
|
||||
I64 i,x,y,z,
|
||||
old_flags=dc->flags;
|
||||
old_flags=dc->flags;
|
||||
CD3I32 *ctrl2=NULL,*ctrl3=NULL;
|
||||
if (dc->flags & DCF_TRANSFORMATION) {
|
||||
ctrl2=MAlloc(sizeof(CD3I32)*4);
|
||||
@@ -1011,7 +1022,7 @@ public Bool Gr3Bezier3(CDC *dc=gr.dc,CD3I32 *ctrl)
|
||||
x=ctrl[i].x;
|
||||
y=ctrl[i].y;
|
||||
z=ctrl[i].z;
|
||||
GrReflect(dc,&x,&y,&z);
|
||||
DCReflect(dc,&x,&y,&z);
|
||||
ctrl3[i].x=x;
|
||||
ctrl3[i].y=y;
|
||||
ctrl3[i].z=z;
|
||||
@@ -1034,7 +1045,7 @@ public I64 Gr2BSpline3(CDC *dc=gr.dc,CD3I32 *ctrl,I64 cnt,Bool closed=FALSE)
|
||||
{//2nd order. Clipping and transform and pen width.
|
||||
Bool result=FALSE;
|
||||
I64 i,x,y,z,
|
||||
old_flags=dc->flags;
|
||||
old_flags=dc->flags;
|
||||
CD3I32 *ctrl2=NULL,*ctrl3=NULL;
|
||||
if (dc->flags & DCF_TRANSFORMATION) {
|
||||
ctrl2=MAlloc(sizeof(CD3I32)*cnt);
|
||||
@@ -1056,7 +1067,7 @@ public I64 Gr2BSpline3(CDC *dc=gr.dc,CD3I32 *ctrl,I64 cnt,Bool closed=FALSE)
|
||||
x=ctrl[i].x;
|
||||
y=ctrl[i].y;
|
||||
z=ctrl[i].z;
|
||||
GrReflect(dc,&x,&y,&z);
|
||||
DCReflect(dc,&x,&y,&z);
|
||||
ctrl3[i].x=x;
|
||||
ctrl3[i].y=y;
|
||||
ctrl3[i].z=z;
|
||||
@@ -1079,7 +1090,7 @@ public Bool Gr3BSpline3(CDC *dc=gr.dc,CD3I32 *ctrl,I64 cnt,Bool closed=FALSE)
|
||||
{//3rd order. Clipping and transform and pen width.
|
||||
Bool result=FALSE;
|
||||
I64 i,x,y,z,
|
||||
old_flags=dc->flags;
|
||||
old_flags=dc->flags;
|
||||
CD3I32 *ctrl2=NULL,*ctrl3=NULL;
|
||||
if (dc->flags & DCF_TRANSFORMATION) {
|
||||
ctrl2=MAlloc(sizeof(CD3I32)*cnt);
|
||||
@@ -1101,7 +1112,7 @@ public Bool Gr3BSpline3(CDC *dc=gr.dc,CD3I32 *ctrl,I64 cnt,Bool closed=FALSE)
|
||||
x=ctrl[i].x;
|
||||
y=ctrl[i].y;
|
||||
z=ctrl[i].z;
|
||||
GrReflect(dc,&x,&y,&z);
|
||||
DCReflect(dc,&x,&y,&z);
|
||||
ctrl3[i].x=x;
|
||||
ctrl3[i].y=y;
|
||||
ctrl3[i].z=z;
|
||||
@@ -1121,17 +1132,16 @@ gr_done:
|
||||
}
|
||||
|
||||
public I64 GrFillTri0(CDC *dc=gr.dc,CD3I32 *p1,CD3I32 *p2,CD3I32 *p4)
|
||||
{//3D. Uses $LK,"fixed-point",A="FI:::/Demo/Lectures/FixedPoint.CPP"$.
|
||||
//Returns cnt of pixs changed
|
||||
{//3D. Returns cnt of pixs changed
|
||||
I64 x1,x2,y,z1,z2,dx1,dy1,dz1,dx2,dy2,dz2,result=0,i,y_min,y_max;
|
||||
CTask *win_task;
|
||||
//p1 is min x
|
||||
//p1 is min x
|
||||
if (p4->x<p2->x)
|
||||
SwapI64(&p4,&p2);
|
||||
if (p2->x<p1->x)
|
||||
SwapI64(&p2,&p1);
|
||||
|
||||
//p2y<=p4y
|
||||
//p2y<=p4y
|
||||
if (p4->y<p2->y)
|
||||
SwapI64(&p4,&p2);
|
||||
|
||||
|
||||
+96
-99
@@ -1,87 +1,84 @@
|
||||
#help_index "Graphics/Screen"
|
||||
|
||||
U0 GrUpdateWins()
|
||||
U0 GrUpdateTaskODEs(CTask *task)
|
||||
{
|
||||
sys_task_being_screen_updated=task;
|
||||
try
|
||||
ODEsUpdate(task);
|
||||
catch {
|
||||
LBts(&task->win_inhibit,WIf_SELF_ODE);
|
||||
"Exception in WinMgr: Update Task ODEs\n";
|
||||
PutExcept;
|
||||
Sleep(3000);
|
||||
VGAFlush;
|
||||
}
|
||||
sys_task_being_screen_updated=NULL;
|
||||
}
|
||||
|
||||
U0 GrUpdateTaskWin(CTask *task)
|
||||
{ //Draw core#0 task win.
|
||||
CDC *dc;
|
||||
CD3I64 saved_scroll;
|
||||
sys_task_being_screen_updated=task;
|
||||
try {
|
||||
if (!Bt(&task->display_flags,DISPLAYf_NO_BORDER))
|
||||
TextBorder(Fs,task->win_left,task->win_right,task->win_top,
|
||||
task->win_bottom,task->border_attr,task==sys_focus_task);
|
||||
TextRect(task->win_left,task->win_right,
|
||||
task->win_top,task->win_bottom,task->text_attr<<8);
|
||||
if (task==sys_winmgr_task) {
|
||||
if (gr.fp_wall_paper)
|
||||
(*gr.fp_wall_paper)(task);
|
||||
} else if (!(task->win_inhibit&WIF_SELF_DOC))
|
||||
DocUpdateTaskDocs(task);
|
||||
if (TaskValidate(task)) {
|
||||
if (task->draw_it) {
|
||||
dc=DCAlias(gr.dc2,task);
|
||||
(*task->draw_it)(task,dc);
|
||||
DCDel(dc);
|
||||
}
|
||||
if (TaskValidate(task)) {
|
||||
WinScrollNull(task,&saved_scroll);
|
||||
DrawCtrls(task);
|
||||
WinScrollRestore(task,&saved_scroll);
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
if (task!=Fs && TaskValidate(task)) {
|
||||
LBtr(&task->display_flags,DISPLAYf_SHOW);
|
||||
"Exception in WinMgr: Update Task Win\n";
|
||||
PutExcept;
|
||||
Sleep(3000);
|
||||
VGAFlush;
|
||||
}
|
||||
}
|
||||
sys_task_being_screen_updated=NULL;
|
||||
}
|
||||
|
||||
U0 GrUpdateTasks()
|
||||
{//Only called by WinMgr
|
||||
I64 i;
|
||||
CTask *task,*task1;
|
||||
CD3I64 saved_scroll;
|
||||
CDC *dc;
|
||||
Preempt(OFF);
|
||||
try {
|
||||
winmgr.ode_time=0;
|
||||
if (Bt(&sys_semas[SYS_SEMA_UPDATE_WIN_Z_BUF],0))
|
||||
WinZBufUpdate;
|
||||
task1=task=sys_winmgr_task;
|
||||
do {
|
||||
if (!TaskValidate(task))
|
||||
break;
|
||||
sys_task_being_screen_updated=task;
|
||||
Preempt(ON);
|
||||
ODEsUpdate(task);
|
||||
Preempt(OFF);
|
||||
if (!TaskValidate(task))
|
||||
break;
|
||||
do { //Loop through core#0 tasks.
|
||||
if (!TaskValidate(task)) break;
|
||||
if (Bt(&task->display_flags,DISPLAYf_SHOW) &&
|
||||
Bt(gr.win_uncovered_bitmap,task->win_z_num))
|
||||
try {
|
||||
if (!Bt(&task->display_flags,DISPLAYf_NO_BORDER))
|
||||
TextBorder(Fs,task->win_left,task->win_right,task->win_top,
|
||||
task->win_bottom,task->border_attr,task==sys_focus_task);
|
||||
TextRect(task->win_left,task->win_right,
|
||||
task->win_top,task->win_bottom,task->text_attr<<8);
|
||||
Preempt(ON);
|
||||
if (task==sys_winmgr_task) {
|
||||
if (gr.fp_wall_paper)
|
||||
(*gr.fp_wall_paper)(task);
|
||||
} else if (!(task->win_inhibit&WIF_SELF_DOC))
|
||||
DocUpdateTaskDocs(task);
|
||||
if (TaskValidate(task)) {
|
||||
if (task->draw_it) {
|
||||
dc=DCAlias(gr.dc2,task);
|
||||
(*task->draw_it)(task,dc);
|
||||
DCDel(dc);
|
||||
}
|
||||
if (TaskValidate(task)) {
|
||||
Preempt(OFF);
|
||||
WinScrollNull(task,&saved_scroll);
|
||||
DrawCtrls(task);
|
||||
WinScrollRestore(task,&saved_scroll);
|
||||
}
|
||||
}
|
||||
Preempt(OFF);
|
||||
} catch {
|
||||
if (task!=Fs && TaskValidate(task)) {
|
||||
LBtr(&task->display_flags,DISPLAYf_SHOW);
|
||||
"Exception in WinMgr: DrawIt\n";
|
||||
PutExcept;
|
||||
Sleep(3000);
|
||||
VGAFlush;
|
||||
}
|
||||
}
|
||||
if (!TaskValidate(task))
|
||||
break;
|
||||
Bt(gr.win_uncovered_bitmap,task->win_z_num))
|
||||
GrUpdateTaskWin(task);
|
||||
if (!TaskValidate(task)) break;
|
||||
task=task->next_task;
|
||||
} while (task!=task1);
|
||||
|
||||
for (i=1;i<mp_cnt;i++) {
|
||||
for (i=0;i<mp_cnt;i++) { //Loop through all cores.
|
||||
task1=task=cpu_structs[i].seth_task;
|
||||
do {
|
||||
if (!TaskValidate(task))
|
||||
break;
|
||||
try {
|
||||
sys_task_being_screen_updated=task;
|
||||
Preempt(ON);
|
||||
ODEsUpdate(task);
|
||||
Preempt(OFF);
|
||||
} catch {
|
||||
LBts(&task->win_inhibit,WIf_SELF_ODE);
|
||||
"Exception in WinMgr: ODE\n";
|
||||
PutExcept;
|
||||
Sleep(3000);
|
||||
VGAFlush;
|
||||
}
|
||||
if (!TaskValidate(task))
|
||||
break;
|
||||
if (!TaskValidate(task)) break;
|
||||
GrUpdateTaskODEs(task);
|
||||
if (!TaskValidate(task)) break;
|
||||
task=task->next_task;
|
||||
} while (task!=task1);
|
||||
}
|
||||
@@ -91,7 +88,7 @@ U0 GrUpdateWins()
|
||||
}
|
||||
winmgr.last_ode_time=winmgr.ode_time;
|
||||
ode_alloced_factor=LowPass1(0.1,ode_alloced_factor,
|
||||
Clamp(Gs->idle_factor-0.1,0.2,0.8),1/winmgr.fps);
|
||||
Clamp(Gs->idle_factor-0.1,0.2,0.8),1/winmgr.fps);
|
||||
sys_task_being_screen_updated=NULL;
|
||||
}
|
||||
|
||||
@@ -109,7 +106,7 @@ U0 GrFixZoomScale()
|
||||
|
||||
public U0 GrScaleZoom(F64 scale)
|
||||
{//Multiply zoom factor larger or smaller.
|
||||
Bool old_preempt=Preempt(OFF);
|
||||
Bool old_preempt=Preempt;
|
||||
F64 s=gr.screen_zoom;
|
||||
gr.screen_zoom=gr.screen_zoom*scale;
|
||||
GrFixZoomScale;
|
||||
@@ -130,12 +127,12 @@ U0 GrZoomInScreen()
|
||||
{
|
||||
GrFixZoomScale;
|
||||
I64 plane,row,col,k,l,
|
||||
d2=gr.zoomed_dc->width>>3/gr.screen_zoom,
|
||||
d4=gr.zoomed_dc->width_internal>>3,
|
||||
d5=d4-d2*gr.screen_zoom,
|
||||
d3=gr.zoomed_dc->height/gr.screen_zoom,
|
||||
d6=(gr.zoomed_dc->height-d3)*gr.dc1->width_internal>>3,
|
||||
d7=gr.zoomed_dc->height%gr.screen_zoom*d4;
|
||||
d2=gr.zoomed_dc->width>>3/gr.screen_zoom,
|
||||
d4=gr.zoomed_dc->width_internal>>3,
|
||||
d5=d4-d2*gr.screen_zoom,
|
||||
d3=gr.zoomed_dc->height/gr.screen_zoom,
|
||||
d6=(gr.zoomed_dc->height-d3)*gr.dc1->width_internal>>3,
|
||||
d7=gr.zoomed_dc->height%gr.screen_zoom*d4;
|
||||
U8 *src,*src2,*dst,*src3,*map=gr.screen_zoom_tables[gr.screen_zoom];
|
||||
|
||||
src=gr.dc1->body+gr.sx>>3+gr.sy*gr.dc1->width_internal>>3;
|
||||
@@ -171,8 +168,8 @@ U0 GrZoomInScreen()
|
||||
U0 GrUpdateTextBG()
|
||||
{
|
||||
I64 reg RSI *dst=gr.dc2->body,reg R13 c,row,col,
|
||||
num_rows=TEXT_ROWS,num_cols=TEXT_COLS,i,j,cur_ch,
|
||||
reg R12 w1=gr.dc2->width_internal,w2=-7*w1+8,w3=7*w1,w4=0;
|
||||
num_rows=TEXT_ROWS,num_cols=TEXT_COLS,i,j,cur_ch,
|
||||
reg R12 w1=gr.dc2->width_internal,w2=-7*w1+8,w3=7*w1,w4=0;
|
||||
U32 *src=gr.text_base;
|
||||
Bool blink_flag=Blink;
|
||||
U8 *dst2=dst;
|
||||
@@ -235,21 +232,21 @@ U0 GrUpdateTextBG()
|
||||
cur_ch.u8[1]=cur_ch.u8[1]<<4+cur_ch.u8[1]>>4;
|
||||
}
|
||||
c=gr.to_8_colors[cur_ch.u8[1]>>4];
|
||||
MOV U64 [RSI],R13
|
||||
ADD RSI,R12
|
||||
MOV U64 [RSI],R13
|
||||
ADD RSI,R12
|
||||
MOV U64 [RSI],R13
|
||||
ADD RSI,R12
|
||||
MOV U64 [RSI],R13
|
||||
ADD RSI,R12
|
||||
MOV U64 [RSI],R13
|
||||
ADD RSI,R12
|
||||
MOV U64 [RSI],R13
|
||||
ADD RSI,R12
|
||||
MOV U64 [RSI],R13
|
||||
ADD RSI,R12
|
||||
MOV U64 [RSI],R13
|
||||
MOV U64 [RSI],R13
|
||||
ADD RSI,R12
|
||||
MOV U64 [RSI],R13
|
||||
ADD RSI,R12
|
||||
MOV U64 [RSI],R13
|
||||
ADD RSI,R12
|
||||
MOV U64 [RSI],R13
|
||||
ADD RSI,R12
|
||||
MOV U64 [RSI],R13
|
||||
ADD RSI,R12
|
||||
MOV U64 [RSI],R13
|
||||
ADD RSI,R12
|
||||
MOV U64 [RSI],R13
|
||||
ADD RSI,R12
|
||||
MOV U64 [RSI],R13
|
||||
dst(U8 *)+=w2;
|
||||
}
|
||||
src+=w4;
|
||||
@@ -261,8 +258,8 @@ U0 GrUpdateTextFG()
|
||||
{//See $LK,"TextBase Layer",A="HI:TextBase Layer"$.
|
||||
U32 *src=gr.text_base;
|
||||
I64 i,j,cur_ch,*dst=gr.dc2->body,
|
||||
w1=gr.dc2->width_internal,w2=7*w1,w4=0,
|
||||
num_rows=TEXT_ROWS,num_cols=TEXT_COLS,row,col;
|
||||
w1=gr.dc2->width_internal,w2=7*w1,w4=0,
|
||||
num_rows=TEXT_ROWS,num_cols=TEXT_COLS,row,col;
|
||||
U8 *dst_start=gr.dc2->body,*dst_end=dst_start+w1*gr.dc2->height-7*w1-8;
|
||||
Bool blink_flag=Blink;
|
||||
|
||||
@@ -408,14 +405,14 @@ U0 GrUpdateScreen()
|
||||
CDC *dc;
|
||||
Preempt(ON);
|
||||
if (!Bt(&sys_run_level,RLf_VGA)) //if text mode
|
||||
GrUpdateWins;
|
||||
GrUpdateTasks;
|
||||
else {
|
||||
GrUpdateTextBG;
|
||||
GrUpdateTextFG;
|
||||
GrUpdateWins;
|
||||
GrUpdateTasks;
|
||||
DCBlotColor8(gr.dc2,gr.dc);
|
||||
}
|
||||
Preempt(OFF);
|
||||
Preempt;
|
||||
|
||||
dc=DCAlias(gr.dc2,Fs);
|
||||
dc->flags|=DCF_ON_TOP;
|
||||
@@ -427,7 +424,7 @@ U0 GrUpdateScreen()
|
||||
GrUpdateTextModeText;
|
||||
else {
|
||||
DCBlotColor4(gr.dc1->body,gr.dc2->body,gr.dc_cache->body,
|
||||
gr.dc2->height*gr.dc2->width_internal>>3);
|
||||
gr.dc2->height*gr.dc2->width_internal>>3);
|
||||
GrUpdateVGAGraphics;
|
||||
}
|
||||
}
|
||||
+57
-47
@@ -1,25 +1,18 @@
|
||||
#help_index "Graphics/Sprite"
|
||||
#help_index "Graphics/Sprite;Sprites"
|
||||
/*
|
||||
$LK,"CSprite",A="MN:CSprite"$s are stored as a sequence of var
|
||||
length operations with a 1-byte type leading
|
||||
each operation. The types available are lsted
|
||||
here, $LK,"SPT_PT",A="MN:SPT_PT"$. They are stored, one after another,
|
||||
in a chunk of memory terminated by a type $LK,"SPT_END",A="MN:SPT_END"$.
|
||||
|
||||
length operations with a 1-byte $LK,"type",A="MN:SPT_PT"$ leading
|
||||
each operation. They are stored, one after another,
|
||||
in a chunk of memory terminated by a $LK,"zero",A="MN:SPT_END"$.
|
||||
$LK,"Sprite3",A="MN:Sprite3"$() shows how the $LK,"CSprite",A="MN:CSprite"$ unions are used.
|
||||
It's kind-of a mess using a union.
|
||||
|
||||
$LK,"SpriteElemSize",A="MN:SpriteElemSize"$() will return the size of a single
|
||||
element, while $LK,"SpriteSize",A="MN:SpriteSize"$() will return the size
|
||||
of an entire lst. Look at $LK,"sprite_elem_base_sizes",A="MN:sprite_elem_base_sizes"$.
|
||||
|
||||
See $LK,"SpriteElem2Code",A="MN:SpriteElem2Code"$() to infer the raw storage
|
||||
format. They are stored as raw binary values
|
||||
when saved to files, not text code.
|
||||
of an entire list. Look at $LK,"sprite_elem_base_sizes",A="MN:sprite_elem_base_sizes"$.
|
||||
|
||||
See $MA-X+PU,"::/Apps/GrModels",LM="Cd(\"::/Apps/GrModels\");Dir;View;\n"$ for an example of
|
||||
making CSprite by hand. Those are type
|
||||
$LK,"SPT_MESH",A="MN:SPT_MESH"$, one of the most complicated.
|
||||
making CSprite by hand. It uses $LK,"SPT_MESH",A="MN:SPT_MESH"$,
|
||||
one of the most complicated.
|
||||
*/
|
||||
|
||||
public U0 Sprite3(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *elems,Bool just_one=FALSE)
|
||||
@@ -35,8 +28,11 @@ public U0 Sprite3(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *elems,Bool just_one=FALSE)
|
||||
CD3I32 *p;
|
||||
CGrSym old_sym;
|
||||
MemCpy(&old_sym,&dc->sym,sizeof(CGrSym));
|
||||
if (dc->flags & DCF_LOCATE_NEAREST) {
|
||||
dc->nearest_sprite_elem_num=0;
|
||||
dc->dist=dc->nearest_dist=MAX_I64;
|
||||
}
|
||||
while (tempg->type) {
|
||||
dc->cur_sprite_elem_num=cur_sprite_elem_num++;
|
||||
switch (tempg->type) {
|
||||
case SPT_COLOR:
|
||||
dc->color=dc->color&~(COLORROP_COLORS_MASK|ROPF_DITHER)|tempg->c.color;
|
||||
@@ -48,7 +44,7 @@ public U0 Sprite3(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *elems,Bool just_one=FALSE)
|
||||
break;
|
||||
case SPT_WIDTH:
|
||||
dc->pen_width=tempg->w.width;
|
||||
GrScalePenWidth(dc);
|
||||
DCPenWidthScale(dc);
|
||||
break;
|
||||
case SPT_TRANSFORM_ON:
|
||||
if (!(dc->flags&DCF_TRANSFORMATION)) {
|
||||
@@ -92,13 +88,17 @@ public U0 Sprite3(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *elems,Bool just_one=FALSE)
|
||||
y+=tempg->p.y1;
|
||||
break;
|
||||
case SPT_LINE:
|
||||
GrLine3(dc,tempg->pp.x1+x,tempg->pp.y1+y,z,tempg->pp.x2+x,tempg->pp.y2+y,z);
|
||||
GrLine3(dc,tempg->pp.x1+x,tempg->pp.y1+y,z,
|
||||
tempg->pp.x2+x,tempg->pp.y2+y,z);
|
||||
break;
|
||||
case SPT_ARROW:
|
||||
GrArrow3(dc,tempg->pp.x1+x,tempg->pp.y1+y,z,tempg->pp.x2+x,tempg->pp.y2+y,z);
|
||||
GrArrow3(dc,tempg->pp.x1+x,tempg->pp.y1+y,z,
|
||||
tempg->pp.x2+x,tempg->pp.y2+y,z);
|
||||
break;
|
||||
case SPT_PLANAR_SYMMETRY:
|
||||
if (GrSetSymmetry3(dc,tempg->pp.x1+x,tempg->pp.y1+y,z,tempg->pp.x2+x,tempg->pp.y2+y,z,tempg->pp.x2+x,tempg->pp.y2+y,z+1))
|
||||
if (DCSymmetry3Set(dc,tempg->pp.x1+x,tempg->pp.y1+y,z,
|
||||
tempg->pp.x2+x,tempg->pp.y2+y,z,
|
||||
tempg->pp.x2+x,tempg->pp.y2+y,z+1))
|
||||
dc->flags|=DCF_SYMMETRY;
|
||||
else
|
||||
dc->flags&=~DCF_SYMMETRY;
|
||||
@@ -114,22 +114,25 @@ public U0 Sprite3(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *elems,Bool just_one=FALSE)
|
||||
Free(img);
|
||||
break;
|
||||
case SPT_RECT:
|
||||
GrRect3(dc,tempg->pp.x1+x,tempg->pp.y1+y,z,tempg->pp.x2-tempg->pp.x1,tempg->pp.y2-tempg->pp.y1);
|
||||
GrRect3(dc,tempg->pp.x1+x,tempg->pp.y1+y,z,
|
||||
tempg->pp.x2-tempg->pp.x1,tempg->pp.y2-tempg->pp.y1);
|
||||
break;
|
||||
case SPT_ROTATED_RECT:
|
||||
x1=tempg->ppa.x1+x;
|
||||
y1=tempg->ppa.y1+y;
|
||||
z1=z;
|
||||
GrRot(dc->r,&x1,&y1,&z1);
|
||||
Mat4x4MulXYZ(dc->r,&x1,&y1,&z1);
|
||||
old_r=dc->r;
|
||||
dc->flags|=DCF_TRANSFORMATION;
|
||||
r2=GrRotZNew(-tempg->ppa.angle);
|
||||
GrSetTranslation(r2,x1,y1,z1);
|
||||
GrSetRotMat(dc,GrMulMat(old_r,r2));
|
||||
GrRect3(dc,0,0,0,tempg->ppa.x2-tempg->ppa.x1,tempg->ppa.y2-tempg->ppa.y1);
|
||||
r2=Mat4x4IdentNew;
|
||||
Mat4x4RotZ(r2,-tempg->ppa.angle);
|
||||
Mat4x4TranslationEqu(r2,x1,y1,z1);
|
||||
DCMat4x4Set(dc,Mat4x4MulMat4x4New(old_r,r2));
|
||||
GrRect3(dc,0,0,0,
|
||||
tempg->ppa.x2-tempg->ppa.x1,tempg->ppa.y2-tempg->ppa.y1);
|
||||
Free(dc->r);
|
||||
Free(r2);
|
||||
GrSetRotMat(dc,old_r);
|
||||
DCMat4x4Set(dc,old_r);
|
||||
dc->flags=dc->flags&~DCF_TRANSFORMATION|old_flags;
|
||||
break;
|
||||
case SPT_CIRCLE:
|
||||
@@ -137,11 +140,11 @@ public U0 Sprite3(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *elems,Bool just_one=FALSE)
|
||||
break;
|
||||
case SPT_ELLIPSE:
|
||||
GrEllipse3(dc,tempg->pwha.x1+x,tempg->pwha.y1+y,z,tempg->pwha.width,
|
||||
tempg->pwha.height,tempg->pwha.angle);
|
||||
tempg->pwha.height,tempg->pwha.angle);
|
||||
break;
|
||||
case SPT_POLYGON:
|
||||
GrRegPoly3(dc,tempg->pwhas.x1+x,tempg->pwhas.y1+y,z,tempg->pwhas.width,
|
||||
tempg->pwhas.height,tempg->pwhas.sides,tempg->pwhas.angle);
|
||||
tempg->pwhas.height,tempg->pwhas.sides,tempg->pwhas.angle);
|
||||
break;
|
||||
case SPT_POLYLINE:
|
||||
ptr=&tempg->nu.u;
|
||||
@@ -202,7 +205,7 @@ public U0 Sprite3(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *elems,Bool just_one=FALSE)
|
||||
p->z+=z;
|
||||
}
|
||||
Gr3Mesh(dc,tempg->mu.vertex_cnt,&tempg->mu.u,tempg->mu.tri_cnt,
|
||||
(&tempg->mu.u)(U8 *)+sizeof(CD3I32)*tempg->mu.vertex_cnt);
|
||||
(&tempg->mu.u)(U8 *)+sizeof(CD3I32)*tempg->mu.vertex_cnt);
|
||||
p=&tempg->mu.u;
|
||||
for (i=0;i<tempg->mu.vertex_cnt;i++,p++) {
|
||||
p->x-=x;
|
||||
@@ -230,7 +233,7 @@ public U0 Sprite3(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *elems,Bool just_one=FALSE)
|
||||
p->z+=z1;
|
||||
}
|
||||
Gr3Mesh(dc,tempg->pmu.vertex_cnt,&tempg->pmu.u,tempg->pmu.tri_cnt,
|
||||
(&tempg->pmu.u)(U8 *)+sizeof(CD3I32)*tempg->pmu.vertex_cnt);
|
||||
(&tempg->pmu.u)(U8 *)+sizeof(CD3I32)*tempg->pmu.vertex_cnt);
|
||||
p=&tempg->pmu.u;
|
||||
for (i=0;i<tempg->pmu.vertex_cnt;i++,p++) {
|
||||
p->x-=x1;
|
||||
@@ -244,6 +247,11 @@ public U0 Sprite3(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *elems,Bool just_one=FALSE)
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (dc->flags & DCF_LOCATE_NEAREST && dc->dist<dc->nearest_dist) {
|
||||
dc->nearest_dist=dc->dist;
|
||||
dc->nearest_sprite_elem_num=cur_sprite_elem_num;
|
||||
}
|
||||
cur_sprite_elem_num++;
|
||||
if (just_one) break;
|
||||
tempg(U8 *)+=SpriteElemSize(tempg);
|
||||
}
|
||||
@@ -257,7 +265,7 @@ public U0 Sprite3(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *elems,Bool just_one=FALSE)
|
||||
public U0 Sprite3B(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *elems)
|
||||
{//Plot a sprite into a CDC, post transform xyz translation.
|
||||
I64 old_x=dc->x,old_y=dc->y,old_z=dc->z,
|
||||
old_flags=dc->flags&DCF_TRANSFORMATION;
|
||||
old_flags=dc->flags&DCF_TRANSFORMATION;
|
||||
dc->x=x; dc->y=y; dc->z=z;
|
||||
dc->flags|=DCF_TRANSFORMATION;
|
||||
Sprite3(dc,0,0,0,elems);
|
||||
@@ -267,14 +275,13 @@ public U0 Sprite3B(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *elems)
|
||||
|
||||
public U0 SpriteMat3B(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *elems,I64 *m)
|
||||
{//Plot rotated by matrix.
|
||||
I64 *old_r=dc->r,old_m[16],
|
||||
old_flags=dc->flags&DCF_TRANSFORMATION;
|
||||
I64 r[16],*old_r=dc->r,old_m[16],
|
||||
old_flags=dc->flags&DCF_TRANSFORMATION;
|
||||
MemCpy(old_m,m,16*sizeof(I64));
|
||||
dc->flags|=DCF_TRANSFORMATION;
|
||||
GrAddTranslation(m,x,y,z);
|
||||
dc->r=GrMulMat(old_r,m);
|
||||
Mat4x4TranslationAdd(m,x,y,z);
|
||||
dc->r=Mat4x4MulMat4x4Equ(r,old_r,m);
|
||||
Sprite3(dc,0,0,0,elems);
|
||||
Free(dc->r);
|
||||
dc->r=old_r;
|
||||
MemCpy(m,old_m,16*sizeof(I64));
|
||||
dc->flags=dc->flags&~DCF_TRANSFORMATION|old_flags;
|
||||
@@ -282,23 +289,26 @@ public U0 SpriteMat3B(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *elems,I64 *m)
|
||||
|
||||
public U0 SpriteX3B(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *elems,F64 è=0)
|
||||
{//Plot rotated around X axis.
|
||||
I64 *r=GrRotXNew(è);
|
||||
I64 r[16];
|
||||
Mat4x4IdentEqu(r);
|
||||
Mat4x4RotX(r,è);
|
||||
SpriteMat3B(dc,x,y,z,elems,r);
|
||||
Free(r);
|
||||
}
|
||||
|
||||
public U0 SpriteY3B(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *elems,F64 ê=0)
|
||||
{//Plot rotated around Y axis.
|
||||
I64 *r=GrRotYNew(ê);
|
||||
I64 r[16];
|
||||
Mat4x4IdentEqu(r);
|
||||
Mat4x4RotY(r,ê);
|
||||
SpriteMat3B(dc,x,y,z,elems,r);
|
||||
Free(r);
|
||||
}
|
||||
|
||||
public U0 SpriteZ3B(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *elems,F64 é=0)
|
||||
{//Plot rotated around Z axis.
|
||||
I64 *r=GrRotZNew(é);
|
||||
I64 r[16];
|
||||
Mat4x4IdentEqu(r);
|
||||
Mat4x4RotZ(r,é);
|
||||
SpriteMat3B(dc,x,y,z,elems,r);
|
||||
Free(r);
|
||||
}
|
||||
|
||||
public U0 SpriteExtents(U8 *elems,I64 *min_x=NULL,I64 *max_x=NULL,
|
||||
@@ -340,14 +350,14 @@ public U8 *SpriteInterpolate(U8 *elems0,U8 *elems1,F64 t)
|
||||
CD3I32 *p0,*p1,*pr;
|
||||
U8 *result;
|
||||
CSprite *tempg0=elems0-offset(CSprite.start),
|
||||
*tempg1=elems1-offset(CSprite.start),*tempgr;
|
||||
*tempg1=elems1-offset(CSprite.start),*tempgr;
|
||||
if (t<0.5) {
|
||||
i=SpriteSize(elems0),
|
||||
result=MAlloc(i);
|
||||
result=MAlloc(i);
|
||||
MemCpy(result,elems0,i);
|
||||
} else {
|
||||
i=SpriteSize(elems1),
|
||||
result=MAlloc(i);
|
||||
result=MAlloc(i);
|
||||
MemCpy(result,elems1,i);
|
||||
}
|
||||
tempgr=result-offset(CSprite.start);
|
||||
@@ -443,10 +453,10 @@ public U8 *SpriteInterpolate(U8 *elems0,U8 *elems1,F64 t)
|
||||
return result;
|
||||
}
|
||||
|
||||
#help_index "Graphics/Sprite;DolDoc/Output"
|
||||
#help_index "Graphics/Sprite;DolDoc/Output;StdOut/DolDoc"
|
||||
public CDocEntry *DocSprite(CDoc *doc=NULL,U8 *elems,U8 *fmt=NULL)
|
||||
{//Put a sprite into a document. You can, optionally, supply a fmt string
|
||||
//for $LK,"DolDoc",A="FI:::/Doc/DolDocOverview.TXT"$ cmd with a %d for the bin_num.
|
||||
//for $LK,"DolDoc",A="FI:::/Doc/DolDocOverview.TXT"$ cmd with a %d for the bin_num.
|
||||
I64 size;
|
||||
U8 *st;
|
||||
Bool unlock;
|
||||
|
||||
+20
-13
@@ -2,9 +2,9 @@
|
||||
#help_file "::/Doc/TextBase"
|
||||
|
||||
asm {
|
||||
USE64
|
||||
//************************************
|
||||
_TEXT_CHAR:://Bool TextChar(CTask *task,Bool allow_border=FALSE,I64 x,I64 y,I64 d);
|
||||
_TEXT_CHAR::
|
||||
//Bool TextChar(CTask *task,Bool allow_border=FALSE,I64 x,I64 y,I64 d);
|
||||
//Must be called 30fps in Fs->draw_it() callback.
|
||||
PUSH RBP
|
||||
MOV RBP,RSP
|
||||
@@ -81,7 +81,8 @@ _TEXT_CHAR:://Bool TextChar(CTask *task,Bool allow_border=FALSE,I64 x,I64 y,I64
|
||||
POP RBP
|
||||
RET1 40
|
||||
//************************************
|
||||
_TEXT_LEN_STR:://Bool TextLenStr(CTask *task,I64 x,I64 y,I64 len,I64 attr,U8 *s)
|
||||
_TEXT_LEN_STR::
|
||||
//Bool TextLenStr(CTask *task,I64 x,I64 y,I64 len,I64 attr,U8 *s)
|
||||
//Must be called 30fps in Fs->draw_it() callback.
|
||||
PUSH RBP
|
||||
MOV RBP,RSP
|
||||
@@ -156,7 +157,8 @@ _TEXT_LEN_STR:://Bool TextLenStr(CTask *task,I64 x,I64 y,I64 len,I64 attr,U8 *s)
|
||||
POP RBP
|
||||
RET1 48
|
||||
//************************************
|
||||
_TEXT_LEN_ATTR_STR:://Bool TextLenAttrStr(CTask *task,I64 x,I64 y,I64 len,U32 *_attr)
|
||||
_TEXT_LEN_ATTR_STR::
|
||||
//Bool TextLenAttrStr(CTask *task,I64 x,I64 y,I64 len,U32 *_attr)
|
||||
//Must be called 30fps in Fs->draw_it() callback.
|
||||
PUSH RBP
|
||||
MOV RBP,RSP
|
||||
@@ -307,23 +309,28 @@ _TEXT_LEN_ATTR:://Bool TextLenAttr(CTask *task,I64 x,I64 y,I64 len,I64 attr)
|
||||
POP RBP
|
||||
RET1 40
|
||||
}
|
||||
public _extern _TEXT_CHAR Bool TextChar(CTask *task,Bool allow_border=FALSE,I64 x,I64 y,I64 d); //Plot char. Must be called 30fps in Fs->draw_it() callback.
|
||||
public _extern _TEXT_LEN_STR Bool TextLenStr(CTask *task,I64 x,I64 y,I64 len,I64 attr,U8 *s); //Plot str with len. Must be called 30fps in Fs->draw_it() callback.
|
||||
public _extern _TEXT_LEN_ATTR_STR Bool TextLenAttrStr(CTask *task,I64 x,I64 y,I64 len,U32 *_attr); //Plot attr str with len. Must be called 30fps in Fs->draw_it() callback.
|
||||
public _extern _TEXT_LEN_ATTR Bool TextLenAttr(CTask *task,I64 x,I64 y,I64 len,I64 attr); //Plot attrs with len. Must be called 30fps in Fs->draw_it() callback.
|
||||
public _extern _TEXT_CHAR Bool TextChar(CTask *task,Bool allow_border=FALSE,
|
||||
I64 x,I64 y,I64 d); //Plot char. 30fps in Fs->draw_it() callback.
|
||||
public _extern _TEXT_LEN_STR Bool TextLenStr(CTask *task,I64 x,I64 y,I64 len,
|
||||
I64 attr,U8 *s); //Plot str with len. 30fps in Fs->draw_it() callback.
|
||||
public _extern _TEXT_LEN_ATTR_STR Bool TextLenAttrStr(CTask *task,I64 x,I64 y,
|
||||
I64 len,U32 *_attr); //Plot attr str with len. 30fps in Fs->draw_it() callback.
|
||||
public _extern _TEXT_LEN_ATTR Bool TextLenAttr(CTask *task,I64 x,I64 y,I64 len,
|
||||
I64 attr); //Plot attrs with len. 30fps in Fs->draw_it() callback.
|
||||
|
||||
public U0 TextPrint(CTask *task,I64 x,I64 y,I64 attr,U8 *fmt,...)
|
||||
{//Plot chars. Must be called 30fps in Fs->draw_it() callback.
|
||||
{//Plot chars. 30fps in Fs->draw_it() callback.
|
||||
//You probably want $LK,"GrPrint",A="MN:GrPrint"$() or just $LK,"Print",A="MN:Print"$().
|
||||
U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
|
||||
TextLenStr(task,x,y,StrLen(buf),attr<<8,buf);
|
||||
Free(buf);
|
||||
}
|
||||
|
||||
public U0 TextBorder(CTask *task=NULL,I64 l,I64 r,I64 t,I64 b,I64 attr,Bool solid)
|
||||
{//Plot border square. Must be called 30fps in Fs->draw_it() callback.
|
||||
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.
|
||||
//Set task=sys_winmgr_task for no clipping.
|
||||
//Set task=sys_winmgr_task for no clipping.
|
||||
I64 i;
|
||||
if (!task) task=Fs;
|
||||
attr<<=8;
|
||||
@@ -357,7 +364,7 @@ public U0 TextBorder(CTask *task=NULL,I64 l,I64 r,I64 t,I64 b,I64 attr,Bool soli
|
||||
}
|
||||
|
||||
public U0 TextRect(I64 l,I64 r,I64 t,I64 b,I64 d)
|
||||
{//Fill text rect. Must be called 30fps in Fs->draw_it() callback.
|
||||
{//Fill text rect. 30fps in Fs->draw_it() callback.
|
||||
I64 y,w;
|
||||
if (l>r || t>b) return;
|
||||
if (t<0) t=0;
|
||||
|
||||
+21
-18
@@ -1,4 +1,4 @@
|
||||
#help_index "Graphics/Sprite"
|
||||
#help_index "Graphics/Sprite;Sprites"
|
||||
|
||||
#define GBM_EXIT 0
|
||||
#define GBM_MAIN_MENU 1
|
||||
@@ -43,7 +43,7 @@ GrInit4;
|
||||
I64 PopUpSpriteBitMap(CColorROPU32 color,I64 width)
|
||||
{
|
||||
I64 i;
|
||||
U8 *st1,*st2,buf[136];
|
||||
U8 *st1,*st2,buf[STR_LEN];
|
||||
CDoc *doc=DocNew;
|
||||
|
||||
Color2Str(buf,color);
|
||||
@@ -98,11 +98,12 @@ U0 GrBitMapEdPrepPersistentDC(CDC *dc,I64 xx1,I64 yy1,CDC *img)
|
||||
GrBlot(dc,xx1,yy1,img);
|
||||
}
|
||||
|
||||
U0 GrBitMapEdTrimToExtents(CDC **_img,I64 *_xx1,I64 *_yy1,I64 *_xx2,I64 *_yy2,CColorROPU32 bkcolor)
|
||||
U0 GrBitMapEdTrimToExtents(CDC **_img,I64 *_xx1,I64 *_yy1,
|
||||
I64 *_xx2,I64 *_yy2,CColorROPU32 bkcolor)
|
||||
{
|
||||
CDC *img=*_img;
|
||||
I64 i,c,
|
||||
x1=0,y1=0,x2=img->width-1,y2=img->height-1; //inclusive
|
||||
x1=0,y1=0,x2=img->width-1,y2=img->height-1; //inclusive
|
||||
while (y1<y2) {
|
||||
for (i=x1;i<=x2;i++) {
|
||||
c=GrPeek(img,i,y1);
|
||||
@@ -111,7 +112,7 @@ U0 GrBitMapEdTrimToExtents(CDC **_img,I64 *_xx1,I64 *_yy1,I64 *_xx2,I64 *_yy2,CC
|
||||
y1++;
|
||||
}
|
||||
|
||||
tr_y2:
|
||||
tr_y2:
|
||||
while (y1<y2) {
|
||||
for (i=x1;i<=x2;i++) {
|
||||
c=GrPeek(img,i,y2);
|
||||
@@ -120,7 +121,7 @@ tr_y2:
|
||||
y2--;
|
||||
}
|
||||
|
||||
tr_x1:
|
||||
tr_x1:
|
||||
while (x1<x2) {
|
||||
for (i=y1;i<=y2;i++) {
|
||||
c=GrPeek(img,x1,i);
|
||||
@@ -129,7 +130,7 @@ tr_x1:
|
||||
x1++;
|
||||
}
|
||||
|
||||
tr_x2:
|
||||
tr_x2:
|
||||
while (x1<x2) {
|
||||
for (i=y1;i<=y2;i++) {
|
||||
c=GrPeek(img,x2,i);
|
||||
@@ -138,14 +139,15 @@ tr_x2:
|
||||
x2--;
|
||||
}
|
||||
|
||||
tr_done:
|
||||
tr_done:
|
||||
*_img=DCExtract(img,x1,y1,x2,y2);
|
||||
*_xx1+=x1; *_yy1+=y1;
|
||||
*_xx2+=x2-(img->width-1); *_yy2+=y2-(img->height-1); //not inclusive
|
||||
DCDel(img);
|
||||
}
|
||||
|
||||
U0 GrBitMapEdAddOutline(CDC *img,I64 width,CColorROPU32 color,CColorROPU32 bkcolor)
|
||||
U0 GrBitMapEdAddOutline(CDC *img,I64 width,
|
||||
CColorROPU32 color,CColorROPU32 bkcolor)
|
||||
{
|
||||
I64 i,j,k,c;
|
||||
CColorROPU32 old_color;
|
||||
@@ -197,10 +199,11 @@ 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 SpriteBitMapEd(CDoc *,CDocEntry *doc_e,CDC *dc,I64 *_xx1,I64 *_yy1,
|
||||
I64 *_xx2,I64 *_yy2,CDC **_img,CColorROPU32 bkcolor)
|
||||
{
|
||||
I64 i,j,mode=GBM_LINE,color=BLACK,width=1,msg_code,a1,a2,x1,y1,x11,y11,x22,y22,
|
||||
result,xx1=*_xx1,yy1=*_yy1,xx2=*_xx2,yy2=*_yy2,
|
||||
I64 i,j,mode=GBM_LINE,color=BLACK,width=1,msg_code,a1,a2,x1,y1,x11,y11,
|
||||
x22,y22,result,xx1=*_xx1,yy1=*_yy1,xx2=*_xx2,yy2=*_yy2,
|
||||
old_de_flags=doc_e->de_flags;
|
||||
Bool down=FALSE;
|
||||
U8 *st=NULL;
|
||||
@@ -220,8 +223,8 @@ I64 SpriteBitMapEd(CDoc *,CDocEntry *doc_e,CDC *dc,I64 *_xx1,I64 *_yy1,I64 *_xx2
|
||||
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(&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)) {
|
||||
switch (msg_code) {
|
||||
case MSG_KEY_DOWN:
|
||||
switch (a1) {
|
||||
@@ -232,7 +235,7 @@ I64 SpriteBitMapEd(CDoc *,CDocEntry *doc_e,CDC *dc,I64 *_xx1,I64 *_yy1,I64 *_xx2
|
||||
result=GE_CONT;
|
||||
goto bm_key_up_done;
|
||||
case 'c': //eye-dropper
|
||||
dc2=DCCaptureScreen(FALSE);
|
||||
dc2=DCScreenCapture(FALSE);
|
||||
color=GrPeek(dc2,ip.pos.x,ip.pos.y)^15;//Mouse cursor is XORed.
|
||||
DCDel(dc2);
|
||||
break;
|
||||
@@ -299,14 +302,14 @@ bm_menu:
|
||||
|
||||
case GBM_SAVE_BMP:
|
||||
*filename.name=0;
|
||||
if (DocFormDo(&filename) && *filename.name)
|
||||
if (DocForm(&filename) && *filename.name)
|
||||
BMPWrite(filename.name,img);
|
||||
goto bm_menu;
|
||||
|
||||
case GBM_SAVE_GRA:
|
||||
*filename.name=0;
|
||||
if (DocFormDo(&filename) && *filename.name)
|
||||
GRAWrite(filename.name,img);
|
||||
if (DocForm(&filename) && *filename.name)
|
||||
GRAWrite(filename.name,img,DCSF_COMPRESSED|DCSF_PALETTE_GET);
|
||||
goto bm_menu;
|
||||
|
||||
case GBM_DITHER_COLOR:
|
||||
|
||||
+162
-159
@@ -1,8 +1,8 @@
|
||||
#help_index "Graphics/Sprite"
|
||||
#help_index "Graphics/Sprite;Sprites"
|
||||
|
||||
U0 SpriteElem2Code(CDoc *doc,CSprite *tempg)
|
||||
{
|
||||
U8 buf1[256],buf2[136];
|
||||
U8 buf1[STR_LEN],buf2[STR_LEN];
|
||||
I32 *ptr;
|
||||
I64 i,j,k,col,width_internal;
|
||||
CD3I32 *p;
|
||||
@@ -12,11 +12,12 @@ U0 SpriteElem2Code(CDoc *doc,CSprite *tempg)
|
||||
switch (tempg->type) {
|
||||
case SPT_COLOR:
|
||||
DocPrint(doc,"{%s}",
|
||||
Color2Str(buf1,tempg->c.color));
|
||||
Color2Str(buf1,tempg->c.color));
|
||||
break;
|
||||
case SPT_DITHER_COLOR:
|
||||
DocPrint(doc,"{%s}",
|
||||
Color2Str(buf2,ROPF_DITHER|tempg->d.dither_color.u8[0]|tempg->d.dither_color.u8[1]<<COLORROP_BITS));
|
||||
Color2Str(buf2,ROPF_DITHER|tempg->d.dither_color.u8[0]|
|
||||
tempg->d.dither_color.u8[1]<<COLORROP_BITS));
|
||||
break;
|
||||
case SPT_TRANSFORM_ON:
|
||||
DocPrint(doc,"{ON}");
|
||||
@@ -27,16 +28,17 @@ U0 SpriteElem2Code(CDoc *doc,CSprite *tempg)
|
||||
case SPT_LINE:
|
||||
case SPT_ARROW:
|
||||
case SPT_PLANAR_SYMMETRY:
|
||||
DocPrint(doc,"{(%d,%d),(%d,%d)}",tempg->pp.x1,tempg->pp.y1,tempg->pp.x2,tempg->pp.y2);
|
||||
DocPrint(doc,"{(%d,%d),(%d,%d)}",tempg->pp.x1,tempg->pp.y1,
|
||||
tempg->pp.x2,tempg->pp.y2);
|
||||
break;
|
||||
case SPT_RECT:
|
||||
DocPrint(doc,"{(%d,%d):(%d,%d)}",tempg->pp.x1,tempg->pp.y1,
|
||||
tempg->pp.x2-tempg->pp.x1,tempg->pp.y2-tempg->pp.y1);
|
||||
tempg->pp.x2-tempg->pp.x1,tempg->pp.y2-tempg->pp.y1);
|
||||
break;
|
||||
case SPT_ROTATED_RECT:
|
||||
DocPrint(doc,"{(%d,%d):(%d,%d),%0.4f}",tempg->ppa.x1,tempg->ppa.y1,
|
||||
tempg->ppa.x2-tempg->ppa.x1,tempg->ppa.y2-tempg->ppa.y1,
|
||||
180/ã*Wrap(tempg->ppa.angle));
|
||||
tempg->ppa.x2-tempg->ppa.x1,tempg->ppa.y2-tempg->ppa.y1,
|
||||
180/ã*Wrap(tempg->ppa.angle));
|
||||
break;
|
||||
case SPT_PT:
|
||||
case SPT_FLOOD_FILL:
|
||||
@@ -54,12 +56,13 @@ U0 SpriteElem2Code(CDoc *doc,CSprite *tempg)
|
||||
break;
|
||||
case SPT_ELLIPSE:
|
||||
DocPrint(doc,"{(%d,%d):(%d,%d),%0.4f}",tempg->pwha.x1,tempg->pwha.y1,
|
||||
tempg->pwha.width,tempg->pwha.height,180/ã*Wrap(tempg->pwha.angle));
|
||||
tempg->pwha.width,tempg->pwha.height,180/ã*Wrap(tempg->pwha.angle));
|
||||
break;
|
||||
case SPT_POLYGON:
|
||||
DocPrint(doc,"{%d,(%d,%d):(%d,%d),%0.4f}",tempg->pwhas.sides,
|
||||
tempg->pwhas.x1,tempg->pwhas.y1,tempg->pwhas.width,tempg->pwhas.height,
|
||||
180/ã*Wrap(tempg->pwhas.angle));
|
||||
tempg->pwhas.x1,tempg->pwhas.y1,
|
||||
tempg->pwhas.width,tempg->pwhas.height,
|
||||
180/ã*Wrap(tempg->pwhas.angle));
|
||||
break;
|
||||
case SPT_TEXT:
|
||||
case SPT_TEXT_BOX:
|
||||
@@ -109,7 +112,7 @@ U0 SpriteElem2Code(CDoc *doc,CSprite *tempg)
|
||||
break;
|
||||
case SPT_BITMAP:
|
||||
DocPrint(doc,"{(%d,%d):(%d,%d),\n",tempg->pwhu.x1,tempg->pwhu.y1,
|
||||
tempg->pwhu.width,tempg->pwhu.height);
|
||||
tempg->pwhu.width,tempg->pwhu.height);
|
||||
width_internal=(tempg->pwhu.width+7)&~7;
|
||||
if (width_internal<80)
|
||||
k=width_internal;
|
||||
@@ -148,7 +151,7 @@ U0 SpriteElem2Code(CDoc *doc,CSprite *tempg)
|
||||
tri=p;
|
||||
for (i=0;i<tempg->mu.tri_cnt;i++,tri++) {
|
||||
DocPrint(doc,"(%s,%d,%d,%d)",Color2Str(buf1,tri->color),
|
||||
tri->nums[0],tri->nums[1],tri->nums[2]);
|
||||
tri->nums[0],tri->nums[1],tri->nums[2]);
|
||||
if (i+1<tempg->mu.tri_cnt) DocPrint(doc,",");
|
||||
if (++col>=3 && i+1<tempg->mu.tri_cnt) {
|
||||
DocPrint(doc,"\n");
|
||||
@@ -173,7 +176,7 @@ U0 SpriteElem2Code(CDoc *doc,CSprite *tempg)
|
||||
tri=p;
|
||||
for (i=0;i<tempg->pmu.tri_cnt;i++,tri++) {
|
||||
DocPrint(doc,"(%s,%d,%d,%d)",Color2Str(buf1,tri->color),
|
||||
tri->nums[0],tri->nums[1],tri->nums[2]);
|
||||
tri->nums[0],tri->nums[1],tri->nums[2]);
|
||||
if (i+1<tempg->pmu.tri_cnt) DocPrint(doc,",");
|
||||
if (++col>=3 && i+1<tempg->pmu.tri_cnt) {
|
||||
DocPrint(doc,"\n");
|
||||
@@ -195,7 +198,7 @@ public U0 Sprite2Code(CDoc *doc=NULL,U8 *elems)
|
||||
}
|
||||
}
|
||||
|
||||
CSprite *Code2SpriteElem(CLex *lx,I64 type)
|
||||
CSprite *Code2SpriteElem(CCmpCtrl *cc,I64 type)
|
||||
{
|
||||
I64 i,num1,num2,size;
|
||||
CSprite *result,g;
|
||||
@@ -209,10 +212,10 @@ CSprite *Code2SpriteElem(CLex *lx,I64 type)
|
||||
sub_switch_start:
|
||||
case SPT_COLOR:
|
||||
case SPT_DITHER_COLOR:
|
||||
st=LexFirstRem(lx,"}");
|
||||
st=LexFirstRem(cc,"}");
|
||||
color=Str2ColorU32(st);
|
||||
Free(st);
|
||||
Lex(lx); //Skip color
|
||||
Lex(cc); //Skip color
|
||||
g.c.color=color.c0.color;
|
||||
if (color&ROPF_DITHER) {
|
||||
g.d.dither_color.u8[1]=color.c1.color;
|
||||
@@ -222,8 +225,8 @@ CSprite *Code2SpriteElem(CLex *lx,I64 type)
|
||||
break;
|
||||
case SPT_TRANSFORM_ON:
|
||||
case SPT_TRANSFORM_OFF:
|
||||
Lex(lx); //Skip {
|
||||
if (LexExpressionI64(lx))
|
||||
Lex(cc); //Skip {
|
||||
if (LexExpressionI64(cc))
|
||||
g.type=SPT_TRANSFORM_ON;
|
||||
else
|
||||
g.type=SPT_TRANSFORM_OFF;
|
||||
@@ -231,44 +234,44 @@ CSprite *Code2SpriteElem(CLex *lx,I64 type)
|
||||
case SPT_LINE:
|
||||
case SPT_ARROW:
|
||||
case SPT_PLANAR_SYMMETRY:
|
||||
Lex(lx); //Skip {
|
||||
Lex(cc); //Skip {
|
||||
g.type=type;
|
||||
LexD2I32(lx,&g.pp.x1);
|
||||
if (lx->token!=',')
|
||||
LexExcept(lx,"expecting ',' at ");
|
||||
Lex(lx); //Skip ,
|
||||
LexD2I32(lx,&g.pp.x2);
|
||||
LexD2I32(cc,&g.pp.x1);
|
||||
if (cc->token!=',')
|
||||
LexExcept(cc,"expecting ',' at ");
|
||||
Lex(cc); //Skip ,
|
||||
LexD2I32(cc,&g.pp.x2);
|
||||
break;
|
||||
case SPT_RECT:
|
||||
case SPT_ROTATED_RECT:
|
||||
Lex(lx); //Skip {
|
||||
LexD2I32(lx,&g.pp.x1);
|
||||
if (lx->token!=':')
|
||||
LexExcept(lx,"expecting ':' at ");
|
||||
Lex(lx); //Skip :
|
||||
LexD2I32(lx,&g.pp.x2);
|
||||
Lex(cc); //Skip {
|
||||
LexD2I32(cc,&g.pp.x1);
|
||||
if (cc->token!=':')
|
||||
LexExcept(cc,"expecting ':' at ");
|
||||
Lex(cc); //Skip :
|
||||
LexD2I32(cc,&g.pp.x2);
|
||||
g.ppa.x2+=g.pp.x1;
|
||||
g.ppa.y2+=g.pp.y1;
|
||||
if (lx->token==',') {
|
||||
Lex(lx); //Skip ,
|
||||
g.ppa.angle=ã/180*LexExpressionF64(lx);
|
||||
if (cc->token==',') {
|
||||
Lex(cc); //Skip ,
|
||||
g.ppa.angle=ã/180*LexExpressionF64(cc);
|
||||
g.type=SPT_ROTATED_RECT;
|
||||
} else
|
||||
g.type=SPT_RECT;
|
||||
break;
|
||||
case SPT_PT:
|
||||
case SPT_SHIFT:
|
||||
Lex(lx); //Skip {
|
||||
Lex(cc); //Skip {
|
||||
g.type=type;
|
||||
LexD2I32(lx,&g.p.x1);
|
||||
LexD2I32(cc,&g.p.x1);
|
||||
break;
|
||||
case SPT_FLOOD_FILL:
|
||||
case SPT_FLOOD_FILL_NOT:
|
||||
Lex(lx); //Skip {
|
||||
LexD2I32(lx,&g.p.x1);
|
||||
if (lx->token==',') {
|
||||
Lex(lx); //Skip ,
|
||||
i=LexExpressionI64(lx);
|
||||
Lex(cc); //Skip {
|
||||
LexD2I32(cc,&g.p.x1);
|
||||
if (cc->token==',') {
|
||||
Lex(cc); //Skip ,
|
||||
i=LexExpressionI64(cc);
|
||||
} else
|
||||
i=0;
|
||||
if (i)
|
||||
@@ -277,36 +280,36 @@ CSprite *Code2SpriteElem(CLex *lx,I64 type)
|
||||
g.type=SPT_FLOOD_FILL;
|
||||
break;
|
||||
case SPT_WIDTH:
|
||||
Lex(lx); //Skip {
|
||||
g.w.width=LexExpressionI64(lx);
|
||||
Lex(cc); //Skip {
|
||||
g.w.width=LexExpressionI64(cc);
|
||||
g.type=SPT_WIDTH;
|
||||
break;
|
||||
case SPT_CIRCLE:
|
||||
Lex(lx); //Skip {
|
||||
Lex(cc); //Skip {
|
||||
g.type=SPT_CIRCLE;
|
||||
LexD2I32(lx,&g.pr.x1);
|
||||
if (lx->token!=':')
|
||||
LexExcept(lx,"expecting ':' at ");
|
||||
Lex(lx); //Skip :
|
||||
g.pr.radius=LexExpressionI64(lx);
|
||||
LexD2I32(cc,&g.pr.x1);
|
||||
if (cc->token!=':')
|
||||
LexExcept(cc,"expecting ':' at ");
|
||||
Lex(cc); //Skip :
|
||||
g.pr.radius=LexExpressionI64(cc);
|
||||
break;
|
||||
case SPT_POLYGON:
|
||||
Lex(lx); //Skip {
|
||||
g.pwhas.sides=LexExpressionI64(lx);
|
||||
if (lx->token!=',')
|
||||
LexExcept(lx,"expecting ',' at ");
|
||||
Lex(cc); //Skip {
|
||||
g.pwhas.sides=LexExpressionI64(cc);
|
||||
if (cc->token!=',')
|
||||
LexExcept(cc,"expecting ',' at ");
|
||||
case SPT_ELLIPSE:
|
||||
Lex(lx); //Skip {
|
||||
Lex(cc); //Skip {
|
||||
g.type=type;
|
||||
LexD2I32(lx,&g.pwha.x1);
|
||||
if (lx->token!=':')
|
||||
LexExcept(lx,"expecting ':' at ");
|
||||
Lex(lx); //Skip :
|
||||
LexD2I32(lx,&g.pwha.width);
|
||||
if (lx->token!=',')
|
||||
LexExcept(lx,"expecting ',' at ");
|
||||
Lex(lx); //Skip ,
|
||||
g.pwha.angle=ã/180*LexExpressionF64(lx);
|
||||
LexD2I32(cc,&g.pwha.x1);
|
||||
if (cc->token!=':')
|
||||
LexExcept(cc,"expecting ':' at ");
|
||||
Lex(cc); //Skip :
|
||||
LexD2I32(cc,&g.pwha.width);
|
||||
if (cc->token!=',')
|
||||
LexExcept(cc,"expecting ',' at ");
|
||||
Lex(cc); //Skip ,
|
||||
g.pwha.angle=ã/180*LexExpressionF64(cc);
|
||||
break;
|
||||
sub_switch_end:
|
||||
size=SpriteElemSize(&g)+offset(CSprite.start);
|
||||
@@ -316,15 +319,15 @@ CSprite *Code2SpriteElem(CLex *lx,I64 type)
|
||||
case SPT_TEXT:
|
||||
case SPT_TEXT_BOX:
|
||||
case SPT_TEXT_DIAMOND:
|
||||
Lex(lx); //Skip {
|
||||
Lex(cc); //Skip {
|
||||
g.type=type;
|
||||
LexD2I32(lx,&g.ps.x1);
|
||||
if (lx->token!=',')
|
||||
LexExcept(lx,"expecting ',' at ");
|
||||
if (Lex(lx)==TK_STR) //Skip ,
|
||||
st=LexExtStr(lx);
|
||||
LexD2I32(cc,&g.ps.x1);
|
||||
if (cc->token!=',')
|
||||
LexExcept(cc,"expecting ',' at ");
|
||||
if (Lex(cc)==TK_STR) //Skip ,
|
||||
st=LexExtStr(cc);
|
||||
else
|
||||
LexExcept(lx,"expecting string at ");
|
||||
LexExcept(cc,"expecting string at ");
|
||||
size=SpriteElemQuedBaseSize(type);
|
||||
i=StrLen(st)+1;
|
||||
result=MAlloc(size+i);
|
||||
@@ -333,19 +336,19 @@ CSprite *Code2SpriteElem(CLex *lx,I64 type)
|
||||
Free(st);
|
||||
break;
|
||||
case SPT_POLYLINE:
|
||||
Lex(lx); //Skip {
|
||||
Lex(cc); //Skip {
|
||||
g.type=SPT_POLYLINE;
|
||||
QueInit(&rootp);
|
||||
while (lx->token=='(') {
|
||||
while (cc->token=='(') {
|
||||
tempp=CAlloc(sizeof(CQueD3I32));
|
||||
LexD2I32(lx,&tempp->p);
|
||||
LexD2I32(cc,&tempp->p);
|
||||
QueIns(tempp,rootp.last);
|
||||
g.nu.num++;
|
||||
if (lx->token==',')
|
||||
Lex(lx); //Skip ,
|
||||
if (cc->token==',')
|
||||
Lex(cc); //Skip ,
|
||||
}
|
||||
if (g.nu.num<2)
|
||||
LexExcept(lx,"expecting point at ");
|
||||
LexExcept(cc,"expecting point at ");
|
||||
size=SpriteElemQuedBaseSize(SPT_POLYLINE);
|
||||
result=MAlloc(size+g.nu.num*sizeof(CD2I32));
|
||||
MemCpy(result,&g,size);
|
||||
@@ -363,21 +366,21 @@ CSprite *Code2SpriteElem(CLex *lx,I64 type)
|
||||
case SPT_BSPLINE3:
|
||||
case SPT_BSPLINE2_CLOSED:
|
||||
case SPT_BSPLINE3_CLOSED:
|
||||
Lex(lx); //Skip {
|
||||
Lex(cc); //Skip {
|
||||
QueInit(&rootp);
|
||||
while (lx->token=='(') {
|
||||
while (cc->token=='(') {
|
||||
tempp=CAlloc(sizeof(CQueD3I32));
|
||||
LexD3I32(lx,&tempp->p);
|
||||
LexD3I32(cc,&tempp->p);
|
||||
QueIns(tempp,rootp.last);
|
||||
g.nu.num++;
|
||||
if (lx->token==',')
|
||||
Lex(lx); //Skip ,
|
||||
if (cc->token==',')
|
||||
Lex(cc); //Skip ,
|
||||
}
|
||||
if (g.nu.num<2)
|
||||
LexExcept(lx,"expecting point at ");
|
||||
LexExcept(cc,"expecting point at ");
|
||||
size=SpriteElemQuedBaseSize(type);
|
||||
result=MAlloc(size+g.nu.num*sizeof(CD3I32));
|
||||
if (LexExpressionI64(lx)) {
|
||||
if (LexExpressionI64(cc)) {
|
||||
if (type==SPT_BSPLINE2||type==SPT_BSPLINE2_CLOSED)
|
||||
g.type=SPT_BSPLINE2_CLOSED;
|
||||
else
|
||||
@@ -400,21 +403,21 @@ CSprite *Code2SpriteElem(CLex *lx,I64 type)
|
||||
}
|
||||
break;
|
||||
case SPT_POLYPT:
|
||||
Lex(lx); //Skip {
|
||||
LexD2I32(lx,&g.npu.x);
|
||||
if (lx->token!=',')
|
||||
LexExcept(lx,"expecting ',' at ");
|
||||
Lex(cc); //Skip {
|
||||
LexD2I32(cc,&g.npu.x);
|
||||
if (cc->token!=',')
|
||||
LexExcept(cc,"expecting ',' at ");
|
||||
tempv=QueVectU8New;
|
||||
while (TRUE) {
|
||||
if (!(i=LexGetChar(lx)))
|
||||
LexExcept(lx,"expecting '}' at ");
|
||||
if (!(i=LexGetChar(cc)))
|
||||
LexExcept(cc,"expecting '}' at ");
|
||||
if (i=='}')
|
||||
break;
|
||||
if ('0'<=i<='7')
|
||||
QueVectU8Put(tempv,g.npu.num++,i-'0');
|
||||
}
|
||||
Bts(&lx->flags,Lf_USE_LAST_U16);
|
||||
Lex(lx); //Load '}'
|
||||
Bts(&cc->flags,CCf_USE_LAST_U16);
|
||||
Lex(cc); //Load '}'
|
||||
g.type=SPT_POLYPT;
|
||||
size=SpriteElemQuedBaseSize(SPT_POLYPT);
|
||||
result=CAlloc(size+(g.npu.num*3+7)>>3);
|
||||
@@ -425,19 +428,19 @@ CSprite *Code2SpriteElem(CLex *lx,I64 type)
|
||||
QueVectU8Del(tempv);
|
||||
break;
|
||||
case SPT_BITMAP:
|
||||
Lex(lx); //Skip {
|
||||
LexD2I32(lx,&g.pwhu.x1);
|
||||
if (lx->token!=':')
|
||||
LexExcept(lx,"expecting ':' at ");
|
||||
Lex(lx); //Skip :
|
||||
LexD2I32(lx,&g.pwhu.width);
|
||||
if (lx->token!=',')
|
||||
LexExcept(lx,"expecting ',' at ");
|
||||
Lex(cc); //Skip {
|
||||
LexD2I32(cc,&g.pwhu.x1);
|
||||
if (cc->token!=':')
|
||||
LexExcept(cc,"expecting ':' at ");
|
||||
Lex(cc); //Skip :
|
||||
LexD2I32(cc,&g.pwhu.width);
|
||||
if (cc->token!=',')
|
||||
LexExcept(cc,"expecting ',' at ");
|
||||
tempv=QueVectU8New;
|
||||
num1=0;
|
||||
while (TRUE) {
|
||||
if (!(i=ToUpper(LexGetChar(lx))))
|
||||
LexExcept(lx,"expecting '}' at ");
|
||||
if (!(i=ToUpper(LexGetChar(cc))))
|
||||
LexExcept(cc,"expecting '}' at ");
|
||||
if (i=='}')
|
||||
break;
|
||||
if ('0'<=i<='9')
|
||||
@@ -449,8 +452,8 @@ CSprite *Code2SpriteElem(CLex *lx,I64 type)
|
||||
else if (i=='_')
|
||||
QueVectU8Put(tempv,num1++,0);
|
||||
}
|
||||
Bts(&lx->flags,Lf_USE_LAST_U16);
|
||||
Lex(lx); //Load '}'
|
||||
Bts(&cc->flags,CCf_USE_LAST_U16);
|
||||
Lex(cc); //Load '}'
|
||||
g.type=SPT_BITMAP;
|
||||
size=SpriteElemQuedBaseSize(SPT_BITMAP);
|
||||
result=CAlloc(size+num1);
|
||||
@@ -462,62 +465,62 @@ CSprite *Code2SpriteElem(CLex *lx,I64 type)
|
||||
break;
|
||||
case SPT_MESH:
|
||||
case SPT_SHIFTABLE_MESH:
|
||||
Lex(lx); //Skip {
|
||||
if (LexExpressionI64(lx)) {
|
||||
Lex(cc); //Skip {
|
||||
if (LexExpressionI64(cc)) {
|
||||
g.type=SPT_SHIFTABLE_MESH;
|
||||
if (lx->token!=',')
|
||||
LexExcept(lx,"expecting ',' at ");
|
||||
Lex(lx); //Skip ,
|
||||
LexD3I32(lx,&g.pmu.x);
|
||||
if (lx->token!=':')
|
||||
LexExcept(lx,"expecting ':' at ");
|
||||
Lex(lx); //Skip :
|
||||
if (cc->token!=',')
|
||||
LexExcept(cc,"expecting ',' at ");
|
||||
Lex(cc); //Skip ,
|
||||
LexD3I32(cc,&g.pmu.x);
|
||||
if (cc->token!=':')
|
||||
LexExcept(cc,"expecting ':' at ");
|
||||
Lex(cc); //Skip :
|
||||
} else {
|
||||
g.type=SPT_MESH;
|
||||
if (lx->token!=',')
|
||||
LexExcept(lx,"expecting ',' at ");
|
||||
Lex(lx); //Skip ,
|
||||
if (cc->token!=',')
|
||||
LexExcept(cc,"expecting ',' at ");
|
||||
Lex(cc); //Skip ,
|
||||
}
|
||||
num1=0;
|
||||
QueInit(&rootp);
|
||||
while (lx->token=='(') {
|
||||
while (cc->token=='(') {
|
||||
tempp=CAlloc(sizeof(CQueD3I32));
|
||||
LexD3I32(lx,&tempp->p);
|
||||
LexD3I32(cc,&tempp->p);
|
||||
QueIns(tempp,rootp.last);
|
||||
num1++;
|
||||
if (lx->token==',')
|
||||
Lex(lx); //Skip ,
|
||||
if (cc->token==',')
|
||||
Lex(cc); //Skip ,
|
||||
}
|
||||
if (lx->token!=':')
|
||||
LexExcept(lx,"expecting ':' at ");
|
||||
Lex(lx); //Skip :
|
||||
if (cc->token!=':')
|
||||
LexExcept(cc,"expecting ':' at ");
|
||||
Lex(cc); //Skip :
|
||||
num2=0;
|
||||
QueInit(&roott);
|
||||
while (lx->token=='(') {
|
||||
while (cc->token=='(') {
|
||||
tempt=CAlloc(sizeof(CQueMeshTri));
|
||||
st=LexFirstRem(lx,",");
|
||||
st=LexFirstRem(cc,",");
|
||||
tempt->color=Str2ColorU32(st);
|
||||
Free(st);
|
||||
Lex(lx); //Skip color
|
||||
if (lx->token!=',')
|
||||
LexExcept(lx,"expecting ',' at ");
|
||||
Lex(lx); //Skip ,
|
||||
tempt->nums[0]=LexExpressionI64(lx);
|
||||
if (lx->token!=',')
|
||||
LexExcept(lx,"expecting ',' at ");
|
||||
Lex(lx); //Skip ,
|
||||
tempt->nums[1]=LexExpressionI64(lx);
|
||||
if (lx->token!=',')
|
||||
LexExcept(lx,"expecting ',' at ");
|
||||
Lex(lx); //Skip ,
|
||||
tempt->nums[2]=LexExpressionI64(lx);
|
||||
if (lx->token!=')')
|
||||
LexExcept(lx,"expecting ')' at ");
|
||||
Lex(lx); //Skip )
|
||||
Lex(cc); //Skip color
|
||||
if (cc->token!=',')
|
||||
LexExcept(cc,"expecting ',' at ");
|
||||
Lex(cc); //Skip ,
|
||||
tempt->nums[0]=LexExpressionI64(cc);
|
||||
if (cc->token!=',')
|
||||
LexExcept(cc,"expecting ',' at ");
|
||||
Lex(cc); //Skip ,
|
||||
tempt->nums[1]=LexExpressionI64(cc);
|
||||
if (cc->token!=',')
|
||||
LexExcept(cc,"expecting ',' at ");
|
||||
Lex(cc); //Skip ,
|
||||
tempt->nums[2]=LexExpressionI64(cc);
|
||||
if (cc->token!=')')
|
||||
LexExcept(cc,"expecting ')' at ");
|
||||
Lex(cc); //Skip )
|
||||
QueIns(tempt,roott.last);
|
||||
num2++;
|
||||
if (lx->token==',')
|
||||
Lex(lx); //Skip ,
|
||||
if (cc->token==',')
|
||||
Lex(cc); //Skip ,
|
||||
}
|
||||
if (g.type==SPT_MESH) {
|
||||
g.mu.vertex_cnt=num1;
|
||||
@@ -549,10 +552,10 @@ CSprite *Code2SpriteElem(CLex *lx,I64 type)
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (lx->token!='}')
|
||||
LexExcept(lx,"expecting '}' at ");
|
||||
if (Lex(lx)!=';')
|
||||
LexExcept(lx,"expecting ';' at ");
|
||||
if (cc->token!='}')
|
||||
LexExcept(cc,"expecting '}' at ");
|
||||
if (Lex(cc)!=';')
|
||||
LexExcept(cc,"expecting ';' at ");
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -561,24 +564,24 @@ public U8 *Code2Sprite(CDoc *doc,I64 *_size=NULL)
|
||||
CSprite root;
|
||||
U8 *result;
|
||||
Bool okay=TRUE,unlock_doc=DocLock(doc);
|
||||
CLex *lx=LexNew(,LF_DONT_FREE_BUF);
|
||||
CHashTable *old_hash_table_lst=lx->htc.hash_table_lst;
|
||||
CCmpCtrl *cc=CmpCtrlNew(,CCF_DONT_FREE_BUF);
|
||||
CHashTable *old_hash_table_lst=cc->htc.hash_table_lst;
|
||||
CHashGeneric *temph;
|
||||
I64 i,size=0;
|
||||
QueInit(&root);
|
||||
LexAttachDoc(lx,,doc);
|
||||
LexAttachDoc(cc,,doc);
|
||||
try {
|
||||
do {
|
||||
lx->htc.hash_table_lst=NULL;
|
||||
if (Lex(lx)==TK_IDENT && //Skip ;
|
||||
(temph=HashFind(lx->cur_str,gr.sprite_hash,SPHT_ELEM_CODE))) {
|
||||
cc->htc.hash_table_lst=NULL;
|
||||
if (Lex(cc)==TK_IDENT && //Skip ;
|
||||
(temph=HashFind(cc->cur_str,gr.sprite_hash,SPHT_ELEM_CODE))) {
|
||||
i=temph->user_data0;
|
||||
lx->htc.hash_table_lst=old_hash_table_lst;
|
||||
if (Lex(lx)=='{') //Skip ident
|
||||
QueIns(Code2SpriteElem(lx,i),root.last);
|
||||
} else if (lx->token)
|
||||
LexExcept(lx,"expecting sprite element type name at ");
|
||||
} while (lx->token);
|
||||
cc->htc.hash_table_lst=old_hash_table_lst;
|
||||
if (Lex(cc)=='{') //Skip ident
|
||||
QueIns(Code2SpriteElem(cc,i),root.last);
|
||||
} else if (cc->token)
|
||||
LexExcept(cc,"expecting sprite element type name at ");
|
||||
} while (cc->token);
|
||||
okay=TRUE;
|
||||
} catch {
|
||||
Fs->catch_except=TRUE;
|
||||
@@ -587,7 +590,7 @@ public U8 *Code2Sprite(CDoc *doc,I64 *_size=NULL)
|
||||
if (unlock_doc)
|
||||
DocUnlock(doc);
|
||||
if (okay) {
|
||||
LexDel(lx); //TODO: can crash
|
||||
CmpCtrlDel(cc); //TODO: can crash
|
||||
result=SpriteQue2Sprite(&root,&size);
|
||||
} else {
|
||||
result=NULL;
|
||||
|
||||
+83
-72
@@ -1,4 +1,4 @@
|
||||
#help_index "Graphics/Sprite"
|
||||
#help_index "Graphics/Sprite;Sprites"
|
||||
|
||||
Bool SpritePolyPtPlot(CSprite *root,I64 x,I64 y,I64)
|
||||
{
|
||||
@@ -10,7 +10,8 @@ Bool SpritePolyPtPlot(CSprite *root,I64 x,I64 y,I64)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
CSprite *SpriteElemNum2QueEntry(CSprite *root,I64 elem_num,I64 *_x=NULL,I64 *_y=NULL)
|
||||
CSprite *SpriteElemNum2QueEntry(CSprite *root,I64 elem_num,
|
||||
I64 *_x=NULL,I64 *_y=NULL)
|
||||
{
|
||||
I64 xx=0,yy=0;
|
||||
CSprite *result=root->next;
|
||||
@@ -30,8 +31,8 @@ CSprite *Sprite2SpriteQue(U8 *elems)
|
||||
{
|
||||
I64 s;
|
||||
CSprite *result=CAlloc(sizeof(CSprite)),
|
||||
*tempg=elems-offset(CSprite.start),*tempg1;
|
||||
result->next=result->last=result;
|
||||
*tempg=elems-offset(CSprite.start),*tempg1;
|
||||
QueInit(result);
|
||||
while (tempg->type) {
|
||||
tempg1=MAlloc(SpriteElemSize(tempg)+offset(CSprite.start));
|
||||
s=SpriteElemSize(tempg);
|
||||
@@ -151,16 +152,16 @@ CSprite *SpriteTransformCircle(I64 r[4][4],CSprite *tempg)
|
||||
tempg1->type=SPT_ELLIPSE;
|
||||
|
||||
x=tempg->pr.x1; y=tempg->pr.y1; z=0;
|
||||
GrRot(r,&x,&y,&z);
|
||||
Mat4x4MulXYZ(r,&x,&y,&z);
|
||||
tempg1->pwha.x1=x;
|
||||
tempg1->pwha.y1=y;
|
||||
|
||||
x=radius; y=0; z=0;
|
||||
GrRot(r,&x,&y,&z);
|
||||
Mat4x4MulXYZ(r,&x,&y,&z);
|
||||
R2P(&m1,&a1,x,y);
|
||||
|
||||
x=0; y=radius; z=0;
|
||||
GrRot(r,&x,&y,&z);
|
||||
Mat4x4MulXYZ(r,&x,&y,&z);
|
||||
m2=Sqrt(x*x+y*y);
|
||||
|
||||
tempg1->pwha.width =ToI64(m1)/0x10000;
|
||||
@@ -181,7 +182,7 @@ CSprite *SpriteTransformEllipse(I64 r[4][4],CSprite *tempg)
|
||||
tempg1->pwhas.sides=tempg->pwhas.sides;
|
||||
|
||||
x=tempg->pwha.x1; y=tempg->pwha.y1; z=0;
|
||||
GrRot(r,&x,&y,&z);
|
||||
Mat4x4MulXYZ(r,&x,&y,&z);
|
||||
tempg1->pwha.x1=x;
|
||||
tempg1->pwha.y1=y;
|
||||
|
||||
@@ -191,13 +192,13 @@ CSprite *SpriteTransformEllipse(I64 r[4][4],CSprite *tempg)
|
||||
x=x_radius*c;
|
||||
y=x_radius*s;
|
||||
z=0;
|
||||
GrRot(r,&x,&y,&z);
|
||||
Mat4x4MulXYZ(r,&x,&y,&z);
|
||||
R2P(&m1,&a1,x,y);
|
||||
|
||||
x=-y_radius*s;
|
||||
y=y_radius*c;
|
||||
z=0;
|
||||
GrRot(r,&x,&y,&z);
|
||||
Mat4x4MulXYZ(r,&x,&y,&z);
|
||||
R2P(&m2,&a2,x,y);
|
||||
m2*=Abs(Sin(a2-a1));
|
||||
|
||||
@@ -214,13 +215,13 @@ CSprite *SpriteTransformRect(I64 r[4][4],CSprite *tempg,F64
|
||||
{
|
||||
I64 x,y,z,w,h;
|
||||
F64 m1,a1,m2,a2,s,c,
|
||||
x_radius=(tempg->pp.x2-tempg->pp.x1)<<16,
|
||||
y_radius=(tempg->pp.y2-tempg->pp.y1)<<16;
|
||||
x_radius=(tempg->pp.x2-tempg->pp.x1)<<16,
|
||||
y_radius=(tempg->pp.y2-tempg->pp.y1)<<16;
|
||||
CSprite *tempg1=CAlloc(SpriteElemQuedBaseSize(SPT_ROTATED_RECT));
|
||||
tempg1->type=SPT_ROTATED_RECT;
|
||||
|
||||
x=tempg->pp.x1; y=tempg->pp.y1; z=0;
|
||||
GrRot(r,&x,&y,&z);
|
||||
Mat4x4MulXYZ(r,&x,&y,&z);
|
||||
tempg1->ppa.x1=x;
|
||||
tempg1->ppa.y1=y;
|
||||
|
||||
@@ -230,13 +231,13 @@ CSprite *SpriteTransformRect(I64 r[4][4],CSprite *tempg,F64
|
||||
x=x_radius*c;
|
||||
y=x_radius*s;
|
||||
z=0;
|
||||
GrRot(r,&x,&y,&z);
|
||||
Mat4x4MulXYZ(r,&x,&y,&z);
|
||||
R2P(&m1,&a1,x,y);
|
||||
|
||||
x=-y_radius*s;
|
||||
y=y_radius*c;
|
||||
z=0;
|
||||
GrRot(r,&x,&y,&z);
|
||||
Mat4x4MulXYZ(r,&x,&y,&z);
|
||||
R2P(&m2,&a2,x,y);
|
||||
m2*=Abs(Sin(a2-a1));
|
||||
|
||||
@@ -259,13 +260,13 @@ CSprite *SpriteTransformBitmap(I64 r[4][4],CSprite *tempg)
|
||||
CSprite *tempg1;
|
||||
|
||||
x=0; y=0; z=0;
|
||||
GrRot(r,&x,&y,&z);
|
||||
Mat4x4MulXYZ(r,&x,&y,&z);
|
||||
minx=maxx=x;
|
||||
miny=maxy=y;
|
||||
minz=maxz=z;
|
||||
|
||||
x=0; y=tempg->pwhu.height; z=0;
|
||||
GrRot(r,&x,&y,&z);
|
||||
Mat4x4MulXYZ(r,&x,&y,&z);
|
||||
if (x<minx) minx=x;
|
||||
if (x>maxx) maxx=x;
|
||||
if (y<minx) miny=y;
|
||||
@@ -274,7 +275,7 @@ CSprite *SpriteTransformBitmap(I64 r[4][4],CSprite *tempg)
|
||||
if (z>maxx) maxz=z;
|
||||
|
||||
x=tempg->pwhu.width; y=0; z=0;
|
||||
GrRot(r,&x,&y,&z);
|
||||
Mat4x4MulXYZ(r,&x,&y,&z);
|
||||
if (x<minx) minx=x;
|
||||
if (x>maxx) maxx=x;
|
||||
if (y<minx) miny=y;
|
||||
@@ -283,7 +284,7 @@ CSprite *SpriteTransformBitmap(I64 r[4][4],CSprite *tempg)
|
||||
if (z>maxx) maxz=z;
|
||||
|
||||
x=tempg->pwhu.width; y=tempg->pwhu.height; z=0;
|
||||
GrRot(r,&x,&y,&z);
|
||||
Mat4x4MulXYZ(r,&x,&y,&z);
|
||||
if (x<minx) minx=x;
|
||||
if (x>maxx) maxx=x;
|
||||
if (y<minx) miny=y;
|
||||
@@ -304,7 +305,7 @@ CSprite *SpriteTransformBitmap(I64 r[4][4],CSprite *tempg)
|
||||
GrRect(tempb,0,0,maxx-minx+1,maxy-miny+1);
|
||||
|
||||
Free(tempb->r);
|
||||
GrSetRotMat(tempb,r);
|
||||
DCMat4x4Set(tempb,r);
|
||||
tempb->flags|=DCF_TRANSFORMATION;
|
||||
|
||||
tempb->x=-minx;
|
||||
@@ -321,12 +322,12 @@ CSprite *SpriteTransformBitmap(I64 r[4][4],CSprite *tempg)
|
||||
tempg1->type=tempg->type;
|
||||
|
||||
x=tempg->pwhu.x1; y=tempg->pwhu.y1; z=0;
|
||||
GrRot(r,&x,&y,&z);
|
||||
Mat4x4MulXYZ(r,&x,&y,&z);
|
||||
tempg1->pwhu.x1=x;
|
||||
tempg1->pwhu.y1=y;
|
||||
|
||||
x=0; y=0; z=0;
|
||||
GrRot(r,&x,&y,&z);
|
||||
Mat4x4MulXYZ(r,&x,&y,&z);
|
||||
tempg1->pwhu.x1+=minx-x;
|
||||
tempg1->pwhu.y1+=miny-y;
|
||||
|
||||
@@ -336,21 +337,21 @@ CSprite *SpriteTransformBitmap(I64 r[4][4],CSprite *tempg)
|
||||
U0 SpriteTransform(I64 r[4][4],CSprite *root)
|
||||
{
|
||||
I64 i,j,k,num,
|
||||
x,y,z,x1,y1,z1,x2,y2,z2,x3,y3,z3;
|
||||
x,y,z,x1,y1,z1,x2,y2,z2,x3,y3,z3;
|
||||
I32 *ptr;
|
||||
CD3I32 *p;
|
||||
CSprite *tempg=root->next,root2,*tempg1,*tempg2,*tempg3;
|
||||
while (tempg!=root) {
|
||||
switch (tempg->type) {
|
||||
case SPT_WIDTH:
|
||||
tempg->w.width*=Sqrt(GrRotNormSqr65536(r))/65536;
|
||||
tempg->w.width*=Sqrt(Mat4x4NormSqr65536(r))/65536;
|
||||
if (tempg->w.width<0) tempg->w.width=0;
|
||||
break;
|
||||
case SPT_PLANAR_SYMMETRY:
|
||||
case SPT_ARROW:
|
||||
case SPT_LINE:
|
||||
x=tempg->pp.x2; y=tempg->pp.y2; z=0;
|
||||
GrRot(r,&x,&y,&z);
|
||||
Mat4x4MulXYZ(r,&x,&y,&z);
|
||||
tempg->pp.x2=x;
|
||||
tempg->pp.y2=y;
|
||||
case SPT_PT:
|
||||
@@ -360,7 +361,7 @@ U0 SpriteTransform(I64 r[4][4],CSprite *root)
|
||||
case SPT_TEXT_BOX:
|
||||
case SPT_TEXT_DIAMOND:
|
||||
x=tempg->p.x1; y=tempg->p.y1; z=0;
|
||||
GrRot(r,&x,&y,&z);
|
||||
Mat4x4MulXYZ(r,&x,&y,&z);
|
||||
tempg->p.x1=x;
|
||||
tempg->p.y1=y;
|
||||
break;
|
||||
@@ -404,7 +405,7 @@ U0 SpriteTransform(I64 r[4][4],CSprite *root)
|
||||
ptr=&tempg->nu.u;
|
||||
for (i=0;i<tempg->nu.num;i++) {
|
||||
x=ptr[i<<1]; y=ptr[i<<1+1]; z=0;
|
||||
GrRot(r,&x,&y,&z);
|
||||
Mat4x4MulXYZ(r,&x,&y,&z);
|
||||
ptr[i<<1]=x;
|
||||
ptr[i<<1+1]=y;
|
||||
}
|
||||
@@ -413,7 +414,7 @@ U0 SpriteTransform(I64 r[4][4],CSprite *root)
|
||||
QueInit(&root2);
|
||||
x=tempg->npu.x; y=tempg->npu.y; z=0;
|
||||
x1=x; y1=y; z1=z; //unrotated cur coordinates
|
||||
GrRot(r,&x,&y,&z);
|
||||
Mat4x4MulXYZ(r,&x,&y,&z);
|
||||
ptr=&tempg->npu.u;
|
||||
k=tempg->npu.num*3;
|
||||
x2=x; y2=y; z2=z; //rotated start coordinates
|
||||
@@ -423,7 +424,7 @@ U0 SpriteTransform(I64 r[4][4],CSprite *root)
|
||||
x1+=gr_x_offsets[j];
|
||||
y1+=gr_y_offsets[j];
|
||||
x=x1; y=y1; z=z1;
|
||||
GrRot(r,&x,&y,&z);
|
||||
Mat4x4MulXYZ(r,&x,&y,&z);
|
||||
Line(&root2,x3-x2,y3-y2,0,x-x2,y-y2,0,&SpritePolyPtPlot);
|
||||
x3=x; y3=y; z3=z;
|
||||
}
|
||||
@@ -454,8 +455,8 @@ U0 SpriteTransform(I64 r[4][4],CSprite *root)
|
||||
while (tempg1!=&root2) {
|
||||
tempg2=tempg1->next;
|
||||
BFieldOrU32(ptr,i,
|
||||
polypt_map[SignI64(tempg1->p.x1-x3)+1+
|
||||
3*(SignI64(tempg1->p.y1-y3)+1)]);
|
||||
polypt_map[SignI64(tempg1->p.x1-x3)+1+
|
||||
3*(SignI64(tempg1->p.y1-y3)+1)]);
|
||||
i+=3;
|
||||
x3=tempg1->p.x1;y3=tempg1->p.y1;
|
||||
QueRem(tempg1);
|
||||
@@ -476,7 +477,7 @@ U0 SpriteTransform(I64 r[4][4],CSprite *root)
|
||||
p=&tempg->nu.u;
|
||||
for (i=0;i<tempg->nu.num;i++,p++) {
|
||||
x=p->x; y=p->y; z=p->z;
|
||||
GrRot(r,&x,&y,&z);
|
||||
Mat4x4MulXYZ(r,&x,&y,&z);
|
||||
p->x=x;
|
||||
p->y=y;
|
||||
p->z=z;
|
||||
@@ -484,14 +485,14 @@ U0 SpriteTransform(I64 r[4][4],CSprite *root)
|
||||
break;
|
||||
case SPT_SHIFTABLE_MESH:
|
||||
x=tempg->pmu.x; y=tempg->pmu.y; z=tempg->pmu.z;
|
||||
GrRot(r,&x,&y,&z);
|
||||
Mat4x4MulXYZ(r,&x,&y,&z);
|
||||
tempg->pmu.x=x;
|
||||
tempg->pmu.y=y;
|
||||
tempg->pmu.z=z;
|
||||
p=&tempg->pmu.u;
|
||||
for (i=0;i<tempg->pmu.vertex_cnt;i++,p++) {
|
||||
x=p->x; y=p->y; z=p->z;
|
||||
GrRot(r,&x,&y,&z);
|
||||
Mat4x4MulXYZ(r,&x,&y,&z);
|
||||
p->x=x;
|
||||
p->y=y;
|
||||
p->z=z;
|
||||
@@ -501,7 +502,7 @@ U0 SpriteTransform(I64 r[4][4],CSprite *root)
|
||||
p=&tempg->mu.u;
|
||||
for (i=0;i<tempg->mu.vertex_cnt;i++,p++) {
|
||||
x=p->x; y=p->y; z=p->z;
|
||||
GrRot(r,&x,&y,&z);
|
||||
Mat4x4MulXYZ(r,&x,&y,&z);
|
||||
p->x=x;
|
||||
p->y=y;
|
||||
p->z=z;
|
||||
@@ -518,7 +519,7 @@ CSprite *SpriteSideBar2SpriteQue(CDoc *doc,CSprite *root,I64 *_cur_elem_num)
|
||||
CDocEntry *doc_e=doc->root.next;
|
||||
Bool found=FALSE;
|
||||
I64 num=0;
|
||||
result->next=result->last=result;
|
||||
QueInit(result);
|
||||
while (doc_e!=doc) {
|
||||
if (doc_e->type_u8==DOCT_MENU_VAL && doc_e->left_exp>=0) {
|
||||
tempg=SpriteElemNum2QueEntry(root,doc_e->left_exp);
|
||||
@@ -549,11 +550,12 @@ U0 SpriteSideBarPickNew(CDoc *doc,CSprite *root,I64 old_num)
|
||||
U8 *st;
|
||||
|
||||
DocPrint(doc,"$$PURPLE$$$$TX+CX,\"Sprite SideBar\"$$\n"
|
||||
"$$LK+PU+CX,\"Click for Help\",A=\"FI:::/Doc/SpriteSideBar.TXT.Z\"$$\n\n");
|
||||
"$$LK+PU+CX,\"Click for Help\","
|
||||
"A=\"FI:::/Doc/SpriteSideBar.TXT.Z\"$$\n\n");
|
||||
|
||||
tempg=root->next;
|
||||
while (tempg!=root) {
|
||||
st=SpriteElem2OneLineSummary(tempg);
|
||||
st=SpriteElem2Summary(tempg);
|
||||
if (cur_elem_num==old_num) {
|
||||
DocPrint(doc,"$$LTRED$$");
|
||||
doc_e=DocPrint(doc,"$$MU-UL,\"%Q\",LE=%d$$\n",st,cur_elem_num++);
|
||||
@@ -616,11 +618,12 @@ Bool SpriteEdText(CSprite **_root,I64 *_cur_elem_num)
|
||||
CDoc *doc=DocNew,*doc2,*old_put=DocPut;
|
||||
StrPrint(doc->filename.name,"AI:0x%X",doc);
|
||||
DocPrint(doc,"//$$PURPLE$$$$TX+CX,\"Sprite Edit as Text\"$$$$FG$$\n"
|
||||
"//$$LK+PU+CX,\"Click for Help\",A=\"FI:::/Doc/SpriteEdText.TXT.Z\"$$\n\n");
|
||||
"//$$LK+PU+CX,\"Click for Help\","
|
||||
"A=\"FI:::/Doc/SpriteEdText.TXT.Z\"$$\n\n");
|
||||
Sprite2Code(doc,elems);
|
||||
Free(elems);
|
||||
while (TRUE) {
|
||||
if (result=PopUpPrint("DocDo(0x%X,0x%X);",doc,0)) {
|
||||
if (result=PopUpPrint("DocEd(0x%X,0x%X);",doc,0)) {
|
||||
Fs->put_doc=doc2=DocNew;
|
||||
"$$WW,1$$";
|
||||
if (elems=Code2Sprite(doc)) {
|
||||
@@ -633,7 +636,7 @@ Bool SpriteEdText(CSprite **_root,I64 *_cur_elem_num)
|
||||
*_cur_elem_num=QueCnt(root); //TODO: Might want to improve this.
|
||||
break;
|
||||
} else {
|
||||
PopUpPrint("DocDo(0x%X,0x%X);",doc2,0);
|
||||
PopUpPrint("DocEd(0x%X,0x%X);",doc2,0);
|
||||
DocDel(doc2);
|
||||
Fs->put_doc=old_put;
|
||||
}
|
||||
@@ -681,7 +684,8 @@ I64 PopUpSpriteEd(CSprite **_root,I64 *_cur_elem_num)
|
||||
"$$MU-UL,\"Set Origin\",LE=GED_SET_ORIGIN$$\n"
|
||||
"$$MU-UL,\"Shift Origin\",LE=GED_SHIFT_ORIGIN$$\n"
|
||||
"$$MU-UL,\"Insert Shift SubOrigin\",LE=GED_SHIFT_SUB_ORIGIN$$\n"
|
||||
"$$MU-UL,\"Pick or Delete Objects Graphically\",LE=GED_PICK_GRAPHICALLY$$\n"
|
||||
"$$MU-UL,\"Pick or Delete Objects Graphically\","
|
||||
"LE=GED_PICK_GRAPHICALLY$$\n"
|
||||
"$$MU-UL,\"Delete\",LE=GED_DELETE$$\n"
|
||||
"$$MU-UL,\"Insert Clipboard Sprite's\",LE=GED_INS_CLIPBOARD$$\n"
|
||||
"\n$$PURPLE$$$$MU-UL,\"+] Sprite Main Menu\",LE=GED_MAIN_MENU$$$$LTBLUE$$\n"
|
||||
@@ -721,6 +725,19 @@ U0 SpritePtQueNew(U8 *elems,I64 x,I64 y,CEdSprite *root)
|
||||
QueInit(root);
|
||||
while (tempg->type) {
|
||||
switch (tempg->type) {
|
||||
case SPT_ELLIPSE:
|
||||
case SPT_POLYGON:
|
||||
temppe=CAlloc(sizeof(CEdSprite));
|
||||
temppe->type=GSPT_WIDTH_HEIGHT;
|
||||
temppe->xx=x;
|
||||
temppe->yy=y;
|
||||
temppe->x=&tempg->pwha.x1;
|
||||
temppe->y=&tempg->pwha.y1;
|
||||
temppe->w=&tempg->pwha.width;
|
||||
temppe->h=&tempg->pwha.height;
|
||||
temppe->num=num;
|
||||
QueIns(temppe,root->last);
|
||||
goto pq_x1_y1;
|
||||
case SPT_RECT:
|
||||
case SPT_ROTATED_RECT:
|
||||
case SPT_LINE:
|
||||
@@ -742,6 +759,7 @@ U0 SpritePtQueNew(U8 *elems,I64 x,I64 y,CEdSprite *root)
|
||||
case SPT_FLOOD_FILL:
|
||||
case SPT_FLOOD_FILL_NOT:
|
||||
case SPT_CIRCLE:
|
||||
pq_x1_y1:
|
||||
temppe=CAlloc(sizeof(CEdSprite));
|
||||
temppe->type=GSPT_SIMPLE_PT;
|
||||
temppe->xx=x;
|
||||
@@ -755,19 +773,6 @@ U0 SpritePtQueNew(U8 *elems,I64 x,I64 y,CEdSprite *root)
|
||||
x+=tempg->p.x1;
|
||||
y+=tempg->p.y1;
|
||||
break;
|
||||
case SPT_ELLIPSE:
|
||||
case SPT_POLYGON:
|
||||
temppe=CAlloc(sizeof(CEdSprite));
|
||||
temppe->type=GSPT_WIDTH_HEIGHT;
|
||||
temppe->xx=x;
|
||||
temppe->yy=y;
|
||||
temppe->x=&tempg->pwha.x1;
|
||||
temppe->y=&tempg->pwha.y1;
|
||||
temppe->w=&tempg->pwha.width;
|
||||
temppe->h=&tempg->pwha.height;
|
||||
temppe->num=num;
|
||||
QueIns(temppe,root->last);
|
||||
break;
|
||||
case SPT_POLYLINE:
|
||||
ptr=&tempg->nu.u;
|
||||
for (i=0;i<tempg->nu.num;i++) {
|
||||
@@ -888,10 +893,11 @@ Bool SpriteShiftPts(U8 *elems,I64 x,I64 y,I64 *_cur_elem_num,I64 mode)
|
||||
SpritePtQueNew(elems,x,y,&root);
|
||||
cur_elem_num=0;
|
||||
if (root.next!=&root) {
|
||||
old_preempt=Preempt(OFF);
|
||||
old_preempt=Preempt;
|
||||
while (TRUE) {
|
||||
SpriteCtrlPtsDraw(dc,&root); //has WinMgrSync
|
||||
switch (msg_code=ScanMsg(&a1,&a2,1<<MSG_IP_R_UP|1<<MSG_IP_L_DOWN|1<<MSG_KEY_DOWN)) {
|
||||
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 (mode) {
|
||||
case GED_SHIFT_PTS:
|
||||
@@ -901,10 +907,12 @@ Bool SpriteShiftPts(U8 *elems,I64 x,I64 y,I64 *_cur_elem_num,I64 mode)
|
||||
while (temppe!=&root) {
|
||||
switch (temppe->type) {
|
||||
case GSPT_SIMPLE_PT:
|
||||
dd=SqrI64(*temppe->x+temppe->xx-xx)+SqrI64(*temppe->y+temppe->yy-yy);
|
||||
dd=SqrI64(*temppe->x+temppe->xx-xx)+
|
||||
SqrI64(*temppe->y+temppe->yy-yy);
|
||||
break;
|
||||
case GSPT_WIDTH_HEIGHT:
|
||||
dd=SqrI64(*temppe->x+*temppe->w+temppe->xx-xx)+SqrI64(*temppe->y+*temppe->h+temppe->yy-yy);
|
||||
dd=SqrI64(*temppe->x+*temppe->w+temppe->xx-xx)+
|
||||
SqrI64(*temppe->y+*temppe->h+temppe->yy-yy);
|
||||
break;
|
||||
}
|
||||
if (dd<best_dd) {
|
||||
@@ -936,12 +944,12 @@ Bool SpriteShiftPts(U8 *elems,I64 x,I64 y,I64 *_cur_elem_num,I64 mode)
|
||||
switch (temppe->type) {
|
||||
case GSPT_SIMPLE_PT:
|
||||
if (xx<=*temppe->x+temppe->xx<=xx2 &&
|
||||
yy<=*temppe->y+temppe->yy<=yy2)
|
||||
yy<=*temppe->y+temppe->yy<=yy2)
|
||||
temppe->flags|=GSPF_SELECTED;
|
||||
break;
|
||||
case GSPT_WIDTH_HEIGHT:
|
||||
if (xx<=*temppe->x+*temppe->w+temppe->xx<=xx2 &&
|
||||
yy<=*temppe->y+*temppe->h+temppe->yy<=yy2)
|
||||
yy<=*temppe->y+*temppe->h+temppe->yy<=yy2)
|
||||
temppe->flags|=GSPF_SELECTED;
|
||||
break;
|
||||
}
|
||||
@@ -969,7 +977,7 @@ Bool SpriteShiftPts(U8 *elems,I64 x,I64 y,I64 *_cur_elem_num,I64 mode)
|
||||
}
|
||||
break;
|
||||
case MSG_KEY_DOWN:
|
||||
gs_key:
|
||||
gs_key:
|
||||
switch (a1.u8[0]) {
|
||||
case CH_SHIFT_ESC:
|
||||
result=FALSE;
|
||||
@@ -1001,7 +1009,8 @@ gs_done:
|
||||
return result;
|
||||
}
|
||||
|
||||
I64 SpriteEd(CDoc *doc,CDocEntry *doc_e,I64 x,I64 y,CSprite **_root,I64 *_cur_elem_num)
|
||||
I64 SpriteEd(CDoc *doc,CDocEntry *doc_e,I64 x,I64 y,
|
||||
CSprite **_root,I64 *_cur_elem_num)
|
||||
{
|
||||
CDocEntry *doc_e2;
|
||||
CDocBin *tempb;
|
||||
@@ -1023,15 +1032,16 @@ I64 SpriteEd(CDoc *doc,CDocEntry *doc_e,I64 x,I64 y,CSprite **_root,I64 *_cur_el
|
||||
StrCpy(Fs->task_title,DefineSub(i,"ST_SPRITE_ED_MENU"));
|
||||
switch (i) {
|
||||
case GED_PICK_GRAPHICALLY:
|
||||
AcctOneTimePopUp(ARf_CSPRITE_PICK_GRAPHICALLY,
|
||||
RegOneTimePopUp(ARf_CSPRITE_PICK_GRAPHICALLY,
|
||||
"You can delete elements by\n"
|
||||
"holding $$GREEN$$Delete$$FG$$ and clicking.\n");
|
||||
doc_e->de_flags=old_de_flags;
|
||||
doc->cur_sprite=tempb->data;
|
||||
doc->cur_sprite_elem_num=0;
|
||||
doc->nearest_sprite_elem_num=0;
|
||||
del_down=FALSE;
|
||||
do {
|
||||
msg_code=GetMsg(&a1,&a2,1<<MSG_IP_L_UP|1<<MSG_IP_R_UP|1<<MSG_KEY_DOWN|1<<MSG_KEY_UP);
|
||||
msg_code=GetMsg(&a1,&a2,
|
||||
1<<MSG_IP_L_UP|1<<MSG_IP_R_UP|1<<MSG_KEY_DOWN|1<<MSG_KEY_UP);
|
||||
if (a2.u8[0]==SC_DELETE&& !(a2&SCF_IP_L_DOWN)) {
|
||||
if (msg_code==MSG_KEY_DOWN)
|
||||
del_down=TRUE;
|
||||
@@ -1039,8 +1049,9 @@ I64 SpriteEd(CDoc *doc,CDocEntry *doc_e,I64 x,I64 y,CSprite **_root,I64 *_cur_el
|
||||
del_down=FALSE;
|
||||
}
|
||||
if (msg_code==MSG_IP_L_UP && kbd.scan_code&SCF_DELETE ||
|
||||
msg_code==MSG_KEY_DOWN && a2&SCF_IP_L_DOWN && a2.u8[0]==SC_DELETE) {
|
||||
*_cur_elem_num=doc->cur_sprite_elem_num;
|
||||
msg_code==MSG_KEY_DOWN && a2&SCF_IP_L_DOWN &&
|
||||
a2.u8[0]==SC_DELETE) {
|
||||
*_cur_elem_num=doc->nearest_sprite_elem_num;
|
||||
cur_elem=SpriteElemNum2QueEntry(*_root,*_cur_elem_num);
|
||||
if (cur_elem!=*_root) {
|
||||
QueRem(cur_elem);
|
||||
@@ -1048,12 +1059,12 @@ I64 SpriteEd(CDoc *doc,CDocEntry *doc_e,I64 x,I64 y,CSprite **_root,I64 *_cur_el
|
||||
SpriteEdUpdate(doc,tempb,*_root);
|
||||
}
|
||||
doc->cur_sprite=tempb->data;
|
||||
doc->cur_sprite_elem_num=0;
|
||||
doc->nearest_sprite_elem_num=0;
|
||||
if (msg_code==MSG_KEY_DOWN)
|
||||
GetMsg(&a1,&a2,1<<MSG_IP_L_UP);
|
||||
}
|
||||
} while (del_down || msg_code!=MSG_IP_L_UP && msg_code!=MSG_IP_R_UP);
|
||||
*_cur_elem_num=doc->cur_sprite_elem_num;
|
||||
*_cur_elem_num=doc->nearest_sprite_elem_num;
|
||||
doc->cur_sprite=NULL;
|
||||
break;
|
||||
case GED_SET_ORIGIN:
|
||||
@@ -1076,7 +1087,7 @@ I64 SpriteEd(CDoc *doc,CDocEntry *doc_e,I64 x,I64 y,CSprite **_root,I64 *_cur_el
|
||||
break;
|
||||
case GED_SHIFT_PTS:
|
||||
case GED_SHIFT_RECTS:
|
||||
AcctOneTimePopUp(ARf_CSPRITE_PTS_RECTANGLES,
|
||||
RegOneTimePopUp(ARf_CSPRITE_PTS_RECTANGLES,
|
||||
"You can switch between points\n"
|
||||
"and rectangles with '$$GREEN$$p$$FG$$' and '$$GREEN$$r$$FG$$'.\n"
|
||||
"Press '$$GREEN$$r$$FG$$' after one rectangle\n"
|
||||
@@ -1115,7 +1126,7 @@ I64 SpriteEd(CDoc *doc,CDocEntry *doc_e,I64 x,I64 y,CSprite **_root,I64 *_cur_el
|
||||
*_cur_elem_num+=1;
|
||||
break;
|
||||
case GED_INS_CLIPBOARD:
|
||||
AcctOneTimePopUp(ARf_CSPRITE_INS_CLIPBOARD,
|
||||
RegOneTimePopUp(ARf_CSPRITE_INS_CLIPBOARD,
|
||||
"You will probably want to shift around\n"
|
||||
"the location of element groups. Use\n"
|
||||
"'Insert shift sub-origin' after picking the\n"
|
||||
|
||||
+47
-29
@@ -1,4 +1,4 @@
|
||||
#help_index "Graphics/Sprite"
|
||||
#help_index "Graphics/Sprite;Sprites"
|
||||
|
||||
#define SPT_MENU -2
|
||||
#define SPT_INS_SCREEN_BITMAP -3
|
||||
@@ -37,12 +37,17 @@ I64 PopUpSpriteMain(CSprite **_root,I64 *_cur_elem_num)
|
||||
"$$MU-UL,\"BSpline2 Closed\",LE=SPT_BSPLINE2_CLOSED$$\n"
|
||||
"$$MU-UL,\"BSpline3 Closed\",LE=SPT_BSPLINE3_CLOSED$$\n"
|
||||
"$$MU-UL,\"Insert Screen-Captured BitMap\",LE=SPT_INS_SCREEN_BITMAP$$\n"
|
||||
"$$MU-UL,\"Insert Transparent Screen-Captured BitMap\",LE=SPT_INS_TRANSPARENT_SCREEN_BITMAP$$\n"
|
||||
"$$MU-UL,\"Insert Transparent Screen-Captured BitMap\","
|
||||
"LE=SPT_INS_TRANSPARENT_SCREEN_BITMAP$$\n"
|
||||
"$$PURPLE$$$$MU-UL,\"+] Create or Edit 3D Mesh\",LE=SPT_MESH$$\n"
|
||||
"$$MU-UL,\"+] Create or Edit Shiftable 3D Mesh\",LE=SPT_SHIFTABLE_MESH$$\n"
|
||||
"$$MU-UL,\"+] Convert to BitMap or Edit BitMap\",LE=SPT_BITMAP$$$$LTBLUE$$\n"
|
||||
"\n$$MU-UL,\"Transform On (for use with 3D icons)\",LE=SPT_TRANSFORM_ON$$\n"
|
||||
"$$MU-UL,\"Transform Off (for use with 3D icons)\",LE=SPT_TRANSFORM_OFF$$\n"
|
||||
"$$MU-UL,\"+] Create or Edit Shiftable 3D Mesh\","
|
||||
"LE=SPT_SHIFTABLE_MESH$$\n"
|
||||
"$$MU-UL,\"+] Convert to BitMap or Edit BitMap\","
|
||||
"LE=SPT_BITMAP$$$$LTBLUE$$\n"
|
||||
"\n$$MU-UL,\"Transform On (for use with 3D icons)\","
|
||||
"LE=SPT_TRANSFORM_ON$$\n"
|
||||
"$$MU-UL,\"Transform Off (for use with 3D icons)\","
|
||||
"LE=SPT_TRANSFORM_OFF$$\n"
|
||||
"\n"
|
||||
"$$PURPLE$$$$MU-UL,\"+] Sprite Edit Menu\",LE=SPT_ED_MENU$$$$LTBLUE$$\n"
|
||||
"$$MU-UL,\"Exit Sprite\",LE=SPT_EXIT$$\n"
|
||||
@@ -86,7 +91,8 @@ Bool PopUpExtents(I64 *_x1,I64 *_x2,I64 *_y1,I64 *_y2)
|
||||
return i;
|
||||
}
|
||||
|
||||
U0 SpriteSetSettings(CDC *dc,CSprite *root,I64 cur_elem_num,CColorROPU32 *_color,I64 *_width,I64 x,I64 y)
|
||||
U0 SpriteSetSettings(CDC *dc,CSprite *root,
|
||||
I64 cur_elem_num,CColorROPU32 *_color,I64 *_width,I64 x,I64 y)
|
||||
{
|
||||
CSprite *tempg;
|
||||
*_color=BLACK;
|
||||
@@ -101,14 +107,15 @@ U0 SpriteSetSettings(CDC *dc,CSprite *root,I64 cur_elem_num,CColorROPU32 *_color
|
||||
break;
|
||||
case SPT_DITHER_COLOR:
|
||||
dc->color=*_color=
|
||||
tempg->d.dither_color.u8[0]|
|
||||
tempg->d.dither_color.u8[1]<<COLORROP_BITS|ROPF_DITHER;
|
||||
tempg->d.dither_color.u8[0]|
|
||||
tempg->d.dither_color.u8[1]<<COLORROP_BITS|ROPF_DITHER;
|
||||
break;
|
||||
case SPT_WIDTH:
|
||||
dc->pen_width=*_width=tempg->w.width;
|
||||
break;
|
||||
case SPT_PLANAR_SYMMETRY:
|
||||
if (GrSetSymmetry3(dc,tempg->pp.x1+x,tempg->pp.y1+y,0,tempg->pp.x2+x,tempg->pp.y2+y,0,tempg->pp.x2+x,tempg->pp.y2+y,1))
|
||||
if (DCSymmetry3Set(dc,tempg->pp.x1+x,tempg->pp.y1+y,0,
|
||||
tempg->pp.x2+x,tempg->pp.y2+y,0,tempg->pp.x2+x,tempg->pp.y2+y,1))
|
||||
dc->flags|=DCF_SYMMETRY;
|
||||
else
|
||||
dc->flags&=~DCF_SYMMETRY;
|
||||
@@ -133,13 +140,13 @@ U0 SpriteScreenInit(CDC *dc,I64,I64)
|
||||
yy=-dc->sym.snx*8192;
|
||||
dc->color=RED;
|
||||
GrLine3(dc,dc->sym.sx-xx.i32[1],dc->sym.sy-yy.i32[1],0,
|
||||
dc->sym.sx+xx.i32[1],dc->sym.sy+yy.i32[1],0,3,0);
|
||||
dc->sym.sx+xx.i32[1],dc->sym.sy+yy.i32[1],0,3,0);
|
||||
dc->color=WHITE;
|
||||
GrLine3(dc,dc->sym.sx-xx.i32[1],dc->sym.sy-yy.i32[1],0,
|
||||
dc->sym.sx+xx.i32[1],dc->sym.sy+yy.i32[1],0,3,1);
|
||||
dc->sym.sx+xx.i32[1],dc->sym.sy+yy.i32[1],0,3,1);
|
||||
dc->color=BLACK;
|
||||
GrLine3(dc,dc->sym.sx-xx.i32[1],dc->sym.sy-yy.i32[1],0,
|
||||
dc->sym.sx+xx.i32[1],dc->sym.sy+yy.i32[1],0,3,2);
|
||||
dc->sym.sx+xx.i32[1],dc->sym.sy+yy.i32[1],0,3,2);
|
||||
dc->flags|=DCF_SYMMETRY;
|
||||
}
|
||||
dc->color=old_color;
|
||||
@@ -178,7 +185,8 @@ I64 SpriteMainEd(CDoc *doc,CDocEntry *doc_e,I64 x,I64 y)
|
||||
SpriteSetSettings(dc,root,cur_elem_num,&color,&width,x,y);
|
||||
DCFill;
|
||||
if (eletype==SPT_MENU) {
|
||||
Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_FOCUS-WIF_SELF_BORDER-WIF_SELF_GRAB_SCROLL;
|
||||
Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_FOCUS
|
||||
-WIF_SELF_BORDER-WIF_SELF_GRAB_SCROLL;
|
||||
if (winmgr.fps<10)
|
||||
doc_e->de_flags|=DOCEF_DONT_DRAW;
|
||||
StrCpy(Fs->task_title,old_task_title);
|
||||
@@ -191,7 +199,7 @@ I64 SpriteMainEd(CDoc *doc,CDocEntry *doc_e,I64 x,I64 y)
|
||||
switch (eletype) {
|
||||
case SPT_FLOOD_FILL:
|
||||
case SPT_FLOOD_FILL_NOT:
|
||||
AcctOneTimePopUp(ARf_FLOODFILL,
|
||||
RegOneTimePopUp(ARf_FLOODFILL,
|
||||
ST_WARN_ST "This is affected by what's underneath\n"
|
||||
"when it is drawn. You will probably want to\n"
|
||||
"convert it to a bitmap.\n\n"
|
||||
@@ -200,7 +208,7 @@ I64 SpriteMainEd(CDoc *doc,CDocEntry *doc_e,I64 x,I64 y)
|
||||
"brush strokes look cool.\n");
|
||||
break;
|
||||
case SPT_PLANAR_SYMMETRY:
|
||||
AcctOneTimePopUp(ARf_PLANAR_SYMMETRY,
|
||||
RegOneTimePopUp(ARf_PLANAR_SYMMETRY,
|
||||
"Right-click to turn-off symmetry.\n");
|
||||
break;
|
||||
}
|
||||
@@ -489,7 +497,7 @@ ei_restart:
|
||||
result=GE_ABORT;
|
||||
goto ei_done;
|
||||
}
|
||||
msg_code=GetMsg(&a1,&a2,1<<MSG_KEY_DOWN | 1<<MSG_IP_L_DOWN | 1<<MSG_IP_R_UP);
|
||||
msg_code=GetMsg(&a1,&a2,1<<MSG_KEY_DOWN|1<<MSG_IP_L_DOWN|1<<MSG_IP_R_UP);
|
||||
if (msg_code==MSG_IP_R_UP) {
|
||||
if (eletype==SPT_PLANAR_SYMMETRY) {
|
||||
tempg=CAlloc(SpriteElemQuedBaseSize(SPT_PLANAR_SYMMETRY));
|
||||
@@ -510,7 +518,7 @@ ei_restart:
|
||||
result=GE_ABORT;
|
||||
goto ei_done;
|
||||
case 'c': //eye-dropper
|
||||
dc3=DCCaptureScreen(FALSE);
|
||||
dc3=DCScreenCapture(FALSE);
|
||||
color=GrPeek(dc3,ip.pos.x,ip.pos.y)^15;//Mouse cursor is XORed.
|
||||
DCDel(dc3);
|
||||
tempg=MAlloc(SpriteElemQuedBaseSize(SPT_COLOR));
|
||||
@@ -627,8 +635,10 @@ ei_restart:
|
||||
dc2->pen_width=1;
|
||||
do {
|
||||
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);
|
||||
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);
|
||||
SpriteScreenInit(dc,x,y);
|
||||
@@ -657,10 +667,12 @@ ei_restart:
|
||||
GrScaleZoom(1.0/i);
|
||||
WinMgrSync(2,TRUE);
|
||||
|
||||
dc3=DCCaptureScreen;
|
||||
dc3=DCScreenCapture;
|
||||
img=DCExtract(dc3,
|
||||
Fs->pix_left+Fs->scroll_x+xx1,Fs->pix_top+Fs->scroll_y+yy1,
|
||||
Fs->pix_left+Fs->scroll_x+xx2-1,Fs->pix_top+Fs->scroll_y+yy2-1);
|
||||
Fs->pix_left+Fs->scroll_x+xx1,
|
||||
Fs->pix_top+Fs->scroll_y+yy1,
|
||||
Fs->pix_left+Fs->scroll_x+xx2-1,
|
||||
Fs->pix_top+Fs->scroll_y+yy2-1);
|
||||
if (eletype==SPT_INS_TRANSPARENT_SCREEN_BITMAP)
|
||||
DCColorChg(img,bm_bkcolor);
|
||||
GrScaleZoom(i);
|
||||
@@ -669,7 +681,8 @@ ei_restart:
|
||||
DCDel(dc3);
|
||||
dc2->pen_width=old_width;
|
||||
eletype=SPT_MENU;
|
||||
Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_FOCUS-WIF_SELF_BORDER-WIF_SELF_GRAB_SCROLL;
|
||||
Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_FOCUS
|
||||
-WIF_SELF_BORDER-WIF_SELF_GRAB_SCROLL;
|
||||
break;
|
||||
case SPT_CIRCLE:
|
||||
do {
|
||||
@@ -823,7 +836,8 @@ ei_restart:
|
||||
} while (msg_code!=MSG_IP_R_UP);
|
||||
case SPT_POLYLINE:
|
||||
if (num>1) {
|
||||
tempg=CAlloc(SpriteElemQuedBaseSize(SPT_POLYLINE)+num*sizeof(CD2I32));
|
||||
tempg=CAlloc(SpriteElemQuedBaseSize(SPT_POLYLINE)+
|
||||
num*sizeof(CD2I32));
|
||||
ptr=&tempg->nu.u;
|
||||
tempg2=root2.next;
|
||||
for (i=0;i<num;i++) {
|
||||
@@ -850,7 +864,8 @@ ei_restart:
|
||||
case SPT_BSPLINE2_CLOSED:
|
||||
case SPT_BSPLINE3_CLOSED:
|
||||
if (num>2) {
|
||||
tempg=CAlloc(SpriteElemQuedBaseSize(eletype)+num*sizeof(CD3I32));
|
||||
tempg=CAlloc(SpriteElemQuedBaseSize(eletype)+
|
||||
num*sizeof(CD3I32));
|
||||
p=&tempg->nu.u;
|
||||
tempg2=root2.next;
|
||||
for (i=0;i<num;i++) {
|
||||
@@ -973,7 +988,8 @@ ei_bitmap:
|
||||
insert_pt=root->next=root->last=root;
|
||||
cur_elem_num=1;
|
||||
} else {
|
||||
SpriteSetSettings(img,root,cur_elem_num,&color,&width,-(xx1-x),-(yy1-y));
|
||||
SpriteSetSettings(img,root,cur_elem_num,&color,&width,
|
||||
-(xx1-x),-(yy1-y));
|
||||
Sprite3(img,-(xx1-x),-(yy1-y),0,&tempg1->start,TRUE);
|
||||
insert_pt=tempg1->next;
|
||||
QueRem(tempg1);
|
||||
@@ -981,7 +997,8 @@ ei_bitmap:
|
||||
}
|
||||
MemCpy(&tempg->pwhu.u,img->body,((xx2-xx1+7)&~7)*(yy2-yy1));
|
||||
|
||||
switch (i=SpriteBitMapEd(doc,doc_e,dc,&xx1,&yy1,&xx2,&yy2,&img,bm_bkcolor)) {
|
||||
switch (i=SpriteBitMapEd(doc,doc_e,dc,&xx1,&yy1,
|
||||
&xx2,&yy2,&img,bm_bkcolor)) {
|
||||
case GE_EXIT:
|
||||
case GE_CONT:
|
||||
Free(tempg);
|
||||
@@ -1042,7 +1059,8 @@ ei_shiftable_mesh:
|
||||
old_mesh=NULL;
|
||||
}
|
||||
if (mesh=SpriteMeshEd(old_mesh,&size,TRUE)) {
|
||||
tempg=MAlloc(SpriteElemQuedBaseSize(SPT_SHIFTABLE_MESH)-sizeof(I32)*2+size);
|
||||
tempg=MAlloc(SpriteElemQuedBaseSize(SPT_SHIFTABLE_MESH)
|
||||
-sizeof(I32)*2+size);
|
||||
tempg->type=SPT_SHIFTABLE_MESH;
|
||||
MemCpy(&tempg->pmu.vertex_cnt,mesh,size);
|
||||
Free(mesh);
|
||||
|
||||
+145
-120
@@ -13,7 +13,7 @@ class CMeshEdVertex
|
||||
CD3I32 p; //World coordinates of the point.
|
||||
U0 end;
|
||||
CD3I32 p0,
|
||||
pt; //Transformed coordinates. (Screen)
|
||||
pt; //Transformed coordinates. (Screen)
|
||||
I32 num,flags;
|
||||
};
|
||||
|
||||
@@ -58,7 +58,8 @@ CMeshEdVertex *MeshVertexNew(CMeshFrame *e,I64 x,I64 y,I64 z)
|
||||
return tempv;
|
||||
}
|
||||
|
||||
CMeshEdTri *MeshTriNew(CMeshFrame *e,CColorROPU32 color,CMeshEdVertex *v1,CMeshEdVertex *v2,CMeshEdVertex *v3)
|
||||
CMeshEdTri *MeshTriNew(CMeshFrame *e,CColorROPU32 color,
|
||||
CMeshEdVertex *v1,CMeshEdVertex *v2,CMeshEdVertex *v3)
|
||||
{
|
||||
static I64 cpu_num=0;
|
||||
CMeshEdTri *tempt=CAlloc(sizeof(CMeshEdTri));
|
||||
@@ -201,7 +202,7 @@ U0 MeshVertexSelectRect(CMeshFrame *e,I64 mode,I64 x1,I64 x2,I64 y1,I64 y2)
|
||||
if (y1>y2) SwapI64(&y1,&y2);
|
||||
while (tempv!=&e->vertex_root) {
|
||||
if (x1<=tempv->pt.x<=x2 &&
|
||||
y1<=tempv->pt.y<=y2) {
|
||||
y1<=tempv->pt.y<=y2) {
|
||||
if (mode==MESH_AND)
|
||||
tempv->flags&=~VF_SELECTED;
|
||||
else
|
||||
@@ -219,11 +220,11 @@ U0 MeshTriSelectRect(CMeshFrame *e,I64 mode,I64 x1,I64 x2,I64 y1,I64 y2)
|
||||
if (y1>y2) SwapI64(&y1,&y2);
|
||||
while (tempt!=&e->tri_root) {
|
||||
if (x1<=tempt->t[0]->pt.x<=x2 &&
|
||||
y1<=tempt->t[0]->pt.y<=y2 &&
|
||||
x1<=tempt->t[1]->pt.x<=x2 &&
|
||||
y1<=tempt->t[1]->pt.y<=y2 &&
|
||||
x1<=tempt->t[2]->pt.x<=x2 &&
|
||||
y1<=tempt->t[2]->pt.y<=y2) {
|
||||
y1<=tempt->t[0]->pt.y<=y2 &&
|
||||
x1<=tempt->t[1]->pt.x<=x2 &&
|
||||
y1<=tempt->t[1]->pt.y<=y2 &&
|
||||
x1<=tempt->t[2]->pt.x<=x2 &&
|
||||
y1<=tempt->t[2]->pt.y<=y2) {
|
||||
if (mode==MESH_AND)
|
||||
tempt->flags&=~TF_SELECTED;
|
||||
else
|
||||
@@ -233,12 +234,12 @@ U0 MeshTriSelectRect(CMeshFrame *e,I64 mode,I64 x1,I64 x2,I64 y1,I64 y2)
|
||||
tempt->flags&=~TF_SELECTED;
|
||||
else if (mode==MESH_AND) {
|
||||
if (x1<=tempt->t[0]->pt.x<=x2 &&
|
||||
y1<=tempt->t[0]->pt.y<=y2 ||
|
||||
x1<=tempt->t[1]->pt.x<=x2 &&
|
||||
y1<=tempt->t[1]->pt.y<=y2 ||
|
||||
x1<=tempt->t[2]->pt.x<=x2 &&
|
||||
y1<=tempt->t[2]->pt.y<=y2)
|
||||
tempt->flags&=~TF_SELECTED;
|
||||
y1<=tempt->t[0]->pt.y<=y2 ||
|
||||
x1<=tempt->t[1]->pt.x<=x2 &&
|
||||
y1<=tempt->t[1]->pt.y<=y2 ||
|
||||
x1<=tempt->t[2]->pt.x<=x2 &&
|
||||
y1<=tempt->t[2]->pt.y<=y2)
|
||||
tempt->flags&=~TF_SELECTED;
|
||||
}
|
||||
}
|
||||
tempt=tempt->next;
|
||||
@@ -313,7 +314,7 @@ U0 MeshTransformSelect(CMeshFrame *e)
|
||||
while (tempv!=&e->vertex_root) {
|
||||
if (tempv->flags&VF_SELECTED) {
|
||||
x=tempv->p.x; y=tempv->p.y; z=tempv->p.z;
|
||||
GrRot(r,&x,&y,&z);
|
||||
Mat4x4MulXYZ(r,&x,&y,&z);
|
||||
tempv->p.x=x; tempv->p.y=y; tempv->p.z=z;
|
||||
}
|
||||
tempv=tempv->next;
|
||||
@@ -352,9 +353,9 @@ U0 MeshCurSnap(CMeshFrame *e)
|
||||
I64 x1,y1,z1,x2,y2,z2;
|
||||
if (e->w2s) {
|
||||
x1=e->cur_snap<<16; y1=0; z1=0;
|
||||
GrRot(e->w2s,&x1,&y1,&z1);
|
||||
Mat4x4MulXYZ(e->w2s,&x1,&y1,&z1);
|
||||
x2=0; y2=e->cur_snap<<16; z2=0;
|
||||
GrRot(e->w2s,&x2,&y2,&z2);
|
||||
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);
|
||||
@@ -378,26 +379,26 @@ U0 MeshScaleZoom(CMeshFrame *e,F64 scale)
|
||||
U0 MPDrawIt(CMeshFrame *e)
|
||||
{//Multiprocessing draw it, called by each core.
|
||||
|
||||
//Makes a copy of e->dc so we can change dc->color member and stuff.
|
||||
//Makes a copy of e->dc so we can change dc->color member and stuff.
|
||||
CDC *dc=DCAlias(e->dc,e->dc->win_task);
|
||||
|
||||
CMeshEdTri *tempt=e->tri_root.next;
|
||||
I64 i,*old_r=dc->r;
|
||||
|
||||
//$LK,"DCAlias",A="MN:DCAlias"$() alllocs a new identity rotation matrix.
|
||||
//We want e->dc's rotation matrix.
|
||||
//$LK,"DCAlias",A="MN:DCAlias"$() alllocs a new identity rotation matrix.
|
||||
//We want e->dc's rotation matrix.
|
||||
dc->r=e->dc->r;
|
||||
|
||||
MemCpy(&dc->ls,&e->dc->ls,sizeof(CD3I32));
|
||||
|
||||
//... and translation (shift) vals.
|
||||
//... and translation (shift) vals.
|
||||
dc->x=e->dc->x;
|
||||
dc->y=e->dc->y;
|
||||
dc->z=e->dc->z;
|
||||
dc->flags|=DCF_TRANSFORMATION;
|
||||
|
||||
if (e->grid_on)
|
||||
//Draw grid with different cores.
|
||||
//Draw grid with different cores.
|
||||
for (i=-500+25*Gs->num;i<=500;i+=25*mp_cnt) {
|
||||
if (i) {
|
||||
dc->color=DKGRAY;
|
||||
@@ -432,7 +433,8 @@ U0 MPDrawIt(CMeshFrame *e)
|
||||
dc->color=ROPF_DITHER+RED<<16+WHITE;
|
||||
GrFillTri0(dc,&tempt->t[0]->pt,&tempt->t[1]->pt,&tempt->t[2]->pt);
|
||||
} else {
|
||||
(*dc->lighting)(dc,&tempt->t[0]->pt,&tempt->t[1]->pt,&tempt->t[2]->pt,tempt->mt.color);
|
||||
(*dc->lighting)(dc,&tempt->t[0]->pt,&tempt->t[1]->pt,
|
||||
&tempt->t[2]->pt,tempt->mt.color);
|
||||
GrFillTri0(dc,&tempt->t[0]->pt,&tempt->t[1]->pt,&tempt->t[2]->pt);
|
||||
}
|
||||
}
|
||||
@@ -440,7 +442,7 @@ U0 MPDrawIt(CMeshFrame *e)
|
||||
}
|
||||
dc->r=old_r;
|
||||
|
||||
//e->dc's depth buf was copied but we don't want it freed during $LK,"DCDel",A="MN:DCDel"$().
|
||||
//e->dc's depth buf was copied but we don't want it freed during $LK,"DCDel",A="MN:DCDel"$().
|
||||
dc->depth_buf=NULL;
|
||||
|
||||
DCDel(dc);
|
||||
@@ -451,14 +453,14 @@ I64 *MeshW2S(CMeshFrame *e,CTask *task)
|
||||
{//World to screen coordinate transform matrix.
|
||||
CCtrl *c=CtrlFindUnique(task,CTRLT_VIEWING_ANGLES);
|
||||
CViewAngles *s=c->state;
|
||||
I64 *r=GrIdentNew(task);
|
||||
GrScaleEqu(r,e->view_scale);
|
||||
GrRotZEqu(r,s->az);
|
||||
GrRotYEqu(r,s->ay);
|
||||
I64 *r=Mat4x4IdentNew(task);
|
||||
Mat4x4Scale(r,e->view_scale);
|
||||
Mat4x4RotZ(r,s->az);
|
||||
Mat4x4RotY(r,s->ay);
|
||||
if (e->flip_y)
|
||||
GrRotXEqu(r,s->ax);
|
||||
Mat4x4RotX(r,s->ax);
|
||||
else
|
||||
GrRotXEqu(r,s->ax+ã);
|
||||
Mat4x4RotX(r,s->ax+ã);
|
||||
return r;
|
||||
}
|
||||
|
||||
@@ -466,14 +468,14 @@ I64 *MeshS2W(CMeshFrame *e,CTask *task)
|
||||
{//Screen to world coordinate transform matrix.
|
||||
CCtrl *c=CtrlFindUnique(task,CTRLT_VIEWING_ANGLES);
|
||||
CViewAngles *s=c->state;
|
||||
I64 *r=GrIdentNew(task);
|
||||
I64 *r=Mat4x4IdentNew(task);
|
||||
if (e->flip_y)
|
||||
GrRotXEqu(r,-s->ax);
|
||||
Mat4x4RotX(r,-s->ax);
|
||||
else
|
||||
GrRotXEqu(r,-(s->ax+ã));
|
||||
GrRotYEqu(r,-s->ay);
|
||||
GrRotZEqu(r,-s->az);
|
||||
GrScaleEqu(r,1/e->view_scale);
|
||||
Mat4x4RotX(r,-(s->ax+ã));
|
||||
Mat4x4RotY(r,-s->ay);
|
||||
Mat4x4RotZ(r,-s->az);
|
||||
Mat4x4Scale(r,1/e->view_scale);
|
||||
return r;
|
||||
}
|
||||
|
||||
@@ -483,32 +485,34 @@ I64 *MeshSetW2S(CMeshFrame *e,CTask *task)
|
||||
e->w2s=MeshW2S(e,task);
|
||||
Free(e->s2w);
|
||||
e->s2w=MeshS2W(e,task);
|
||||
return MAllocIdentical(e->w2s,task); //returned matrix is assigned to dc->r and will be freed by $LK,"DCDel",A="MN:DCDel"$().
|
||||
//returned matrix is assigned to dc->r and will be freed by $LK,"DCDel",A="MN:DCDel"$().
|
||||
return Mat4x4New(e->w2s,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,
|
||||
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->my_ip_z,
|
||||
i,x2,y2,z2;
|
||||
GrRot(e->w2s,&x,&y,&z); //screen of Z vect
|
||||
Mat4x4MulXYZ(e->w2s,&x,&y,&z); //screen of Z vect
|
||||
|
||||
//Converges onto a solution for zc, an unknown.
|
||||
//Converges onto a solution for zc, an unknown.
|
||||
for (i=0;i<128;i++) {
|
||||
x_shadow=xc-x; //Shadow of mouse cursor on xy plane
|
||||
y_shadow=yc-y;
|
||||
z_shadow=zc-z;
|
||||
GrRot(e->s2w,&x_shadow,&y_shadow,&z_shadow);
|
||||
Mat4x4MulXYZ(e->s2w,&x_shadow,&y_shadow,&z_shadow);
|
||||
x2=0; y2=0; z2=-z_shadow;
|
||||
GrRot(e->w2s,&x2,&y2,&z2);
|
||||
Mat4x4MulXYZ(e->w2s,&x2,&y2,&z2);
|
||||
zc+=Round(Sqrt(x2*x2+y2*y2+z2*z2))*SignI64(z2);
|
||||
}
|
||||
|
||||
x=xc-x;
|
||||
y=yc-y;
|
||||
z=zc-z;
|
||||
GrRot(e->s2w,&x,&y,&z);
|
||||
Mat4x4MulXYZ(e->s2w,&x,&y,&z);
|
||||
x=RoundI64(x,e->cur_snap);
|
||||
y=RoundI64(y,e->cur_snap);
|
||||
z=RoundI64(e->my_ip_z,e->cur_snap);
|
||||
@@ -552,7 +556,7 @@ U0 MeshClipboardCopy(CMeshFrame *e)
|
||||
}
|
||||
while (tempt!=&e->tri_root) {
|
||||
if (tempt->flags&TF_SELECTED &&
|
||||
tempt->t[0]->copy && tempt->t[1]->copy && tempt->t[2]->copy) {
|
||||
tempt->t[0]->copy && tempt->t[1]->copy && tempt->t[2]->copy) {
|
||||
tempt2=ACAlloc(sizeof(CMeshEdTri));
|
||||
tempt2->t[0]=tempt->t[0]->copy;
|
||||
tempt2->t[1]=tempt->t[1]->copy;
|
||||
@@ -620,7 +624,8 @@ U0 MeshClipboardPaste(CMeshFrame *e)
|
||||
}
|
||||
|
||||
while (tempt2!=&sys_clipboard_tri_root) {
|
||||
tempt=MeshTriNew(e,tempt2->mt.color,tempt2->t[0]->copy,tempt2->t[1]->copy,tempt2->t[2]->copy);
|
||||
tempt=MeshTriNew(e,tempt2->mt.color,tempt2->t[0]->copy,
|
||||
tempt2->t[1]->copy,tempt2->t[2]->copy);
|
||||
tempt->flags|=TF_SELECTED;
|
||||
tempt2=tempt2->next;
|
||||
}
|
||||
@@ -646,16 +651,16 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
dc->flags|=DCF_TRANSFORMATION;
|
||||
|
||||
Free(dc->r); //Set rotmat doesn't free old dc->r matrix.
|
||||
GrSetRotMat(dc,MeshSetW2S(e,task));
|
||||
DCMat4x4Set(dc,MeshSetW2S(e,task));
|
||||
|
||||
dc->x=e->cx;
|
||||
dc->y=e->cy;
|
||||
//z-vals less than zero are in front of screen and not drawn.
|
||||
//we want to shift all Z-vals into a drawable range.
|
||||
//GR_Z_ALL is set to half of the Z-range which is an I32.
|
||||
//we want to shift all Z-vals into a drawable range.
|
||||
//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 input pointer (mouse).
|
||||
MeshCursorW(e,task,&x,&y,&z);
|
||||
dc->ls.x=x;
|
||||
dc->ls.y=y;
|
||||
@@ -665,7 +670,7 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
dc->ls.y*=d;
|
||||
dc->ls.z*=d;
|
||||
|
||||
DCAllocDepthBuf(dc);
|
||||
DCDepthBufAlloc(dc);
|
||||
|
||||
tempv=e->vertex_root.next;
|
||||
while (tempv!=&e->vertex_root) {
|
||||
@@ -694,9 +699,11 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
if (tempv->flags&VF_SELECTED) {
|
||||
if (e->mode=='t') {
|
||||
if (Blink(10)) //This blinks at 10 Hz.
|
||||
dc->color=ROPF_DITHER+e->cur_color.c0.color<<16+e->cur_color.c0.color^8;
|
||||
dc->color=ROPF_DITHER+e->cur_color.c0.color<<16+
|
||||
e->cur_color.c0.color^8;
|
||||
else
|
||||
dc->color=ROPF_DITHER+(e->cur_color.c0.color^8)<<16+e->cur_color.c0.color;
|
||||
dc->color=ROPF_DITHER+(e->cur_color.c0.color^8)<<16+
|
||||
e->cur_color.c0.color;
|
||||
} else {
|
||||
if (Blink)
|
||||
dc->color=ROPF_DITHER+RED<<16+WHITE;
|
||||
@@ -713,7 +720,8 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
task->win_inhibit=WIF_SELF_DOC;
|
||||
} else {
|
||||
MeshCurSnap(e);
|
||||
task->win_inhibit=WIG_TASK_DFT|WIF_SELF_DOC-WIF_SELF_FOCUS-WIF_SELF_BORDER-WIF_SELF_CTRLS-WIF_FOCUS_TASK_MENU-WIF_SELF_GRAB_SCROLL;
|
||||
task->win_inhibit=WIG_TASK_DFT|WIF_SELF_DOC-WIF_SELF_FOCUS-WIF_SELF_BORDER
|
||||
-WIF_SELF_CTRLS-WIF_FOCUS_TASK_MENU-WIF_SELF_GRAB_SCROLL;
|
||||
}
|
||||
|
||||
MeshCursorW(e,task,&x,&y,&z);
|
||||
@@ -808,8 +816,8 @@ I64 MeshSize(CMeshFrame *e)
|
||||
tempt=tempt->next;
|
||||
}
|
||||
return sizeof(I32)*2+
|
||||
(offset(CMeshEdVertex.end)-offset(CMeshEdVertex.start))*e->vertex_cnt+
|
||||
(offset(CMeshEdTri.end)-offset(CMeshEdTri.start))*e->tri_cnt;
|
||||
(offset(CMeshEdVertex.end)-offset(CMeshEdVertex.start))*e->vertex_cnt+
|
||||
(offset(CMeshEdTri.end)-offset(CMeshEdTri.start))*e->tri_cnt;
|
||||
}
|
||||
|
||||
I32 *MeshSave(CMeshFrame *e,I64 *_size=NULL)
|
||||
@@ -824,7 +832,8 @@ I32 *MeshSave(CMeshFrame *e,I64 *_size=NULL)
|
||||
|
||||
e->vertex_cnt=0;
|
||||
while (tempv!=&e->vertex_root) {
|
||||
MemCpy(dst,&tempv->start,offset(CMeshEdVertex.end)-offset(CMeshEdVertex.start));
|
||||
MemCpy(dst,&tempv->start,offset(CMeshEdVertex.end)
|
||||
-offset(CMeshEdVertex.start));
|
||||
dst+=offset(CMeshEdVertex.end)-offset(CMeshEdVertex.start);
|
||||
tempv=tempv->next;
|
||||
}
|
||||
@@ -869,10 +878,10 @@ U0 MeshUpdateMenu(CMeshFrame *e)
|
||||
I32 *SpriteMeshEd(I32 *root=NULL,I64 *_size=NULL,Bool flip_y=FALSE)
|
||||
{/*Fmt for mesh:
|
||||
{
|
||||
I32 vertex_cnt;
|
||||
I32 tri_cnt;
|
||||
CD3I32 vertices[];
|
||||
CMeshTri tris[];
|
||||
I32 vertex_cnt;
|
||||
I32 tri_cnt;
|
||||
CD3I32 vertices[];
|
||||
CMeshTri tris[];
|
||||
}
|
||||
|
||||
If root points to a mesh, it will load it.
|
||||
@@ -906,58 +915,58 @@ $WW,0$*/
|
||||
s->cz=GREEN;
|
||||
|
||||
MenuPush(
|
||||
"File {"
|
||||
" Abort(,CH_SHIFT_ESC);"
|
||||
" Exit(,CH_ESC);"
|
||||
"}"
|
||||
"Edit {"
|
||||
" Delete(,,SC_DELETE);"
|
||||
" DelLast(,CH_BACKSPACE);"
|
||||
" Cut(,CH_CTRLX);"
|
||||
" Copy(,CH_CTRLC);"
|
||||
" Paste(,CH_CTRLV);"
|
||||
" SelectAll(,'A');"
|
||||
" UnSelectAll(,'U');"
|
||||
" SelectRect(,'a');"
|
||||
" UnSelectRect(,'u');"
|
||||
" OrSelectRect(,'o');"
|
||||
" JumpToZ(,'j');"
|
||||
" FlipTri(,'f');"
|
||||
"}"
|
||||
"Mode {"
|
||||
" PlaceVertex(,'v');"
|
||||
" MoveVertex(,'m');"
|
||||
" MoveVertexZ(,'M');"
|
||||
" MakeTri(,'t');"
|
||||
"}"
|
||||
"Settings {"
|
||||
" Color(,'c');"
|
||||
" Snap(,'s');"
|
||||
"}"
|
||||
"View {"
|
||||
" ZoomIn(,'z');"
|
||||
" ZoomOut(,'Z');"
|
||||
" NullAngles(,'n');"
|
||||
" FlipY(,'y');"
|
||||
" Grid(,'g');"
|
||||
" Vertex(,'V');"
|
||||
" ToggleBorder(,CH_CTRLB);"
|
||||
"}"
|
||||
"Transforms {"
|
||||
" Transform(,'T');"
|
||||
" SwapXY(,'1');"
|
||||
" SwapXZ(,'2');"
|
||||
" SwapYZ(,'3');"
|
||||
" InvertX(,'4');"
|
||||
" InvertY(,'5');"
|
||||
" InvertZ(,'6');"
|
||||
" FlipTri(,'F');"
|
||||
"}");
|
||||
"File {"
|
||||
" Abort(,CH_SHIFT_ESC);"
|
||||
" Exit(,CH_ESC);"
|
||||
"}"
|
||||
"Edit {"
|
||||
" Delete(,,SC_DELETE);"
|
||||
" DelLast(,CH_BACKSPACE);"
|
||||
" Cut(,CH_CTRLX);"
|
||||
" Copy(,CH_CTRLC);"
|
||||
" Paste(,CH_CTRLV);"
|
||||
" SelectAll(,'A');"
|
||||
" UnSelectAll(,'U');"
|
||||
" SelectRect(,'a');"
|
||||
" UnSelectRect(,'u');"
|
||||
" OrSelectRect(,'o');"
|
||||
" JumpToZ(,'j');"
|
||||
" FlipTri(,'f');"
|
||||
"}"
|
||||
"Mode {"
|
||||
" PlaceVertex(,'v');"
|
||||
" MoveVertex(,'m');"
|
||||
" MoveVertexZ(,'M');"
|
||||
" MakeTri(,'t');"
|
||||
"}"
|
||||
"Settings {"
|
||||
" Color(,'c');"
|
||||
" Snap(,'s');"
|
||||
"}"
|
||||
"View {"
|
||||
" ZoomIn(,'z');"
|
||||
" ZoomOut(,'Z');"
|
||||
" NullAngles(,'n');"
|
||||
" FlipY(,'y');"
|
||||
" Grid(,'g');"
|
||||
" Vertex(,'V');"
|
||||
" ToggleBorder(,CH_CTRLB);"
|
||||
"}"
|
||||
"Transforms {"
|
||||
" Transform(,'T');"
|
||||
" SwapXY(,'1');"
|
||||
" SwapXZ(,'2');"
|
||||
" SwapYZ(,'3');"
|
||||
" InvertX(,'4');"
|
||||
" InvertY(,'5');"
|
||||
" InvertZ(,'6');"
|
||||
" FlipTri(,'F');"
|
||||
"}");
|
||||
|
||||
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
|
||||
AutoComplete;
|
||||
Preempt(OFF); //We don't really want window update while modifying links
|
||||
AcctOneTimePopUp(ARf_MESH_ED,
|
||||
Preempt; //We don't really want window update while modifying links
|
||||
RegOneTimePopUp(ARf_MESH_ED,
|
||||
"$$GREEN$$Right Mouse$$FG$$: Hold and move to shift cursor z\n"
|
||||
"$$GREEN$$'j'$$FG$$: Jump cursor Z to nearest vertex's Z\n"
|
||||
"$$GREEN$$'v'$$FG$$: Place Vertex Mode\n"
|
||||
@@ -968,7 +977,8 @@ $WW,0$*/
|
||||
"$$GREEN$$'s'$$FG$$: Set snap\n"
|
||||
"\nSee menu at top of screen for more.\n");
|
||||
|
||||
Fs->win_inhibit=WIG_TASK_DFT|WIF_SELF_DOC-WIF_SELF_FOCUS-WIF_SELF_BORDER-WIF_SELF_CTRLS-WIF_FOCUS_TASK_MENU-WIF_SELF_GRAB_SCROLL;
|
||||
Fs->win_inhibit=WIG_TASK_DFT|WIF_SELF_DOC-WIF_SELF_FOCUS-WIF_SELF_BORDER
|
||||
-WIF_SELF_CTRLS-WIF_FOCUS_TASK_MENU-WIF_SELF_GRAB_SCROLL;
|
||||
Fs->horz_scroll.pos=0;
|
||||
Fs->vert_scroll.pos=0;
|
||||
MeshInit(&e,flip_y);
|
||||
@@ -982,7 +992,8 @@ $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(&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);
|
||||
gm_restart:
|
||||
switch (msg_code) {
|
||||
case MSG_KEY_DOWN:
|
||||
@@ -999,7 +1010,9 @@ gm_restart:
|
||||
if (MeshSelectCnt(&e))
|
||||
MeshClipboardDel(&e);
|
||||
else if (e.mode!='t')
|
||||
MeshVertexDel(&e,MeshVertexFindScrPt(&e,ip.presnap.x-Fs->pix_left-Fs->scroll_x,ip.presnap.y-Fs->pix_top-Fs->scroll_y));
|
||||
MeshVertexDel(&e,MeshVertexFindScrPt(&e,
|
||||
ip.presnap.x-Fs->pix_left-Fs->scroll_x,
|
||||
ip.presnap.y-Fs->pix_top-Fs->scroll_y));
|
||||
MeshVertexSelectAll(&e,FALSE);
|
||||
MeshTriSelectAll(&e,FALSE);
|
||||
vn=0;
|
||||
@@ -1071,7 +1084,9 @@ gm_restart:
|
||||
i=MESH_AND;
|
||||
else
|
||||
i=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(&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) {
|
||||
Beep; Beep;
|
||||
goto gm_restart;
|
||||
}
|
||||
@@ -1079,7 +1094,9 @@ gm_restart:
|
||||
e.x2=a1; e.y2=a2;
|
||||
e.select_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);
|
||||
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) {
|
||||
@@ -1159,7 +1176,9 @@ gm_restart:
|
||||
case 'j':
|
||||
if (moving)
|
||||
MeshVertexIgnoreSet(&e,TRUE);
|
||||
if (tempv=MeshVertexFindScrPt(&e,ip.pos.x-Fs->pix_left-Fs->scroll_x,ip.pos.y-Fs->pix_top-Fs->scroll_y)) {
|
||||
if (tempv=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.my_ip_z=RoundI64(tempv->p.z,e.cur_snap);
|
||||
} else {
|
||||
@@ -1212,7 +1231,7 @@ gm_restart:
|
||||
case 'm':
|
||||
if (!moving) {
|
||||
if (!MeshSelectCnt(&e) &&
|
||||
(tempv=MeshVertexFindScrPt(&e,a1,a2))) {
|
||||
(tempv=MeshVertexFindScrPt(&e,a1,a2))) {
|
||||
tempv->flags|=VF_SELECTED;
|
||||
e.my_ip_z=RoundI64(tempv->p.z,e.cur_snap);
|
||||
}
|
||||
@@ -1229,7 +1248,7 @@ gm_restart:
|
||||
case 'M':
|
||||
if (!adjusting_z && !moving) {
|
||||
if (!MeshSelectCnt(&e) &&
|
||||
(tempv=MeshVertexFindScrPt(&e,a1,a2))) {
|
||||
(tempv=MeshVertexFindScrPt(&e,a1,a2))) {
|
||||
tempv->flags|=VF_SELECTED;
|
||||
e.my_ip_z=RoundI64(tempv->p.z,e.cur_snap);
|
||||
}
|
||||
@@ -1262,7 +1281,9 @@ gm_restart:
|
||||
case 'M':
|
||||
if (moving) {
|
||||
if (adjusting_z) {
|
||||
e.my_ip_z=RoundI64(Sign(p0b.y-ip.presnap.y)*Sqrt(Sqr(p0b.x-ip.presnap.x)+Sqr(p0b.y-ip.presnap.y))+p0b.z,e.cur_snap);
|
||||
e.my_ip_z=RoundI64(Sign(p0b.y-ip.presnap.y)
|
||||
*Sqrt(Sqr(p0b.x-ip.presnap.x)+Sqr(p0b.y-ip.presnap.y))
|
||||
+p0b.z,e.cur_snap);
|
||||
Snd(0);
|
||||
adjusting_z=FALSE;
|
||||
MeshCursorW(&e,Fs,&x,&y,&z);
|
||||
@@ -1317,7 +1338,9 @@ gm_restart:
|
||||
break;
|
||||
case MSG_IP_R_UP:
|
||||
if (e.mode!='M' && adjusting_z) {
|
||||
e.my_ip_z=RoundI64(Sign(p0b.y-ip.presnap.y)*Sqrt(Sqr(p0b.x-ip.presnap.x)+Sqr(p0b.y-ip.presnap.y))+p0b.z,e.cur_snap);
|
||||
e.my_ip_z=RoundI64(Sign(p0b.y-ip.presnap.y)
|
||||
*Sqrt(Sqr(p0b.x-ip.presnap.x)+Sqr(p0b.y-ip.presnap.y))
|
||||
+p0b.z,e.cur_snap);
|
||||
Snd(0);
|
||||
adjusting_z=FALSE;
|
||||
if (moving) {
|
||||
@@ -1332,7 +1355,9 @@ gm_restart:
|
||||
break;
|
||||
case MSG_IP_MOVE:
|
||||
if (adjusting_z) {
|
||||
e.my_ip_z=RoundI64(Sign(p0b.y-ip.presnap.y)*Sqrt(Sqr(p0b.x-ip.presnap.x)+Sqr(p0b.y-ip.presnap.y))+p0b.z,e.cur_snap);
|
||||
e.my_ip_z=RoundI64(Sign(p0b.y-ip.presnap.y)
|
||||
*Sqrt(Sqr(p0b.x-ip.presnap.x)+Sqr(p0b.y-ip.presnap.y))
|
||||
+p0b.z,e.cur_snap);
|
||||
Snd(ClampI64(3*e.my_ip_z+1500,0,15000));
|
||||
}
|
||||
if (moving) {
|
||||
|
||||
+47
-43
@@ -1,40 +1,39 @@
|
||||
#help_index "Graphics/Sprite"
|
||||
#help_index "Graphics/Sprite;Sprites"
|
||||
#help_file "::/Doc/Sprite"
|
||||
|
||||
U8 polypt_map[9]={0,1,2,3,0,4,5,6,7};
|
||||
|
||||
I64 sprite_elem_base_sizes[SPT_NUM_TYPES]=
|
||||
{
|
||||
sizeof(CSpriteBase), //SPT_END
|
||||
sizeof(CSpriteColor), //SPT_COLOR
|
||||
sizeof(CSpriteDitherColor), //SPT_DITHER_COLOR
|
||||
sizeof(CSpriteWidth), //SPT_WIDTH
|
||||
sizeof(CSpritePtPt), //SPT_PLANAR_SYMMETRY
|
||||
sizeof(CSpriteBase), //SPT_TRANSFORM_ON
|
||||
sizeof(CSpriteBase), //SPT_TRANSFORM_OFF
|
||||
sizeof(CSpritePt), //SPT_SHIFT
|
||||
sizeof(CSpritePt), //SPT_PT
|
||||
sizeof(CSpriteNumPtU8s), //SPT_POLYPT
|
||||
sizeof(CSpritePtPt), //SPT_LINE
|
||||
sizeof(CSpriteNumU8s), //SPT_POLYLINE
|
||||
sizeof(CSpritePtPt), //SPT_RECT
|
||||
sizeof(CSpritePtPtAng), //SPT_ROTATED_RECT
|
||||
sizeof(CSpritePtRad), //SPT_CIRCLE
|
||||
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(CSpritePt), //SPT_FLOOD_FILL
|
||||
sizeof(CSpritePt), //SPT_FLOOD_FILL_NOT
|
||||
sizeof(CSpritePtWHU8s), //SPT_BITMAP
|
||||
sizeof(CSpriteMeshU8s), //SPT_MESH
|
||||
sizeof(CSpritePtMeshU8s), //SPT_SHIFTABLE_MESH
|
||||
sizeof(CSpritePtPt), //SPT_ARROW
|
||||
sizeof(CSpritePtStr), //SPT_TEXT
|
||||
sizeof(CSpritePtStr), //SPT_TEXT_BOX
|
||||
sizeof(CSpritePtStr), //SPT_TEXT_DIAMOND
|
||||
I64 sprite_elem_base_sizes[SPT_NUM_TYPES]={
|
||||
sizeof(CSpriteBase), //SPT_END
|
||||
sizeof(CSpriteColor), //SPT_COLOR
|
||||
sizeof(CSpriteDitherColor), //SPT_DITHER_COLOR
|
||||
sizeof(CSpriteW), //SPT_WIDTH
|
||||
sizeof(CSpritePtPt), //SPT_PLANAR_SYMMETRY
|
||||
sizeof(CSpriteBase), //SPT_TRANSFORM_ON
|
||||
sizeof(CSpriteBase), //SPT_TRANSFORM_OFF
|
||||
sizeof(CSpritePt), //SPT_SHIFT
|
||||
sizeof(CSpritePt), //SPT_PT
|
||||
sizeof(CSpriteNumPtU8s), //SPT_POLYPT
|
||||
sizeof(CSpritePtPt), //SPT_LINE
|
||||
sizeof(CSpriteNumU8s), //SPT_POLYLINE
|
||||
sizeof(CSpritePtPt), //SPT_RECT
|
||||
sizeof(CSpritePtPtAng), //SPT_ROTATED_RECT
|
||||
sizeof(CSpritePtRad), //SPT_CIRCLE
|
||||
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(CSpritePt), //SPT_FLOOD_FILL
|
||||
sizeof(CSpritePt), //SPT_FLOOD_FILL_NOT
|
||||
sizeof(CSpritePtWHU8s), //SPT_BITMAP
|
||||
sizeof(CSpriteMeshU8s), //SPT_MESH
|
||||
sizeof(CSpritePtMeshU8s), //SPT_SHIFTABLE_MESH
|
||||
sizeof(CSpritePtPt), //SPT_ARROW
|
||||
sizeof(CSpritePtStr), //SPT_TEXT
|
||||
sizeof(CSpritePtStr), //SPT_TEXT_BOX
|
||||
sizeof(CSpritePtStr), //SPT_TEXT_DIAMOND
|
||||
};
|
||||
|
||||
I64 SpriteElemQuedBaseSize(I64 type)
|
||||
@@ -67,10 +66,12 @@ I64 SpriteElemSize(CSprite *tempg)
|
||||
i+=tempg->nu.num*sizeof(CD3I32);
|
||||
break;
|
||||
case SPT_MESH:
|
||||
i+=tempg->mu.vertex_cnt*sizeof(CD3I32)+tempg->mu.tri_cnt*sizeof(CMeshTri);
|
||||
i+=tempg->mu.vertex_cnt*sizeof(CD3I32)+
|
||||
tempg->mu.tri_cnt*sizeof(CMeshTri);
|
||||
break;
|
||||
case SPT_SHIFTABLE_MESH:
|
||||
i+=tempg->pmu.vertex_cnt*sizeof(CD3I32)+tempg->pmu.tri_cnt*sizeof(CMeshTri);
|
||||
i+=tempg->pmu.vertex_cnt*sizeof(CD3I32)+
|
||||
tempg->pmu.tri_cnt*sizeof(CMeshTri);
|
||||
break;
|
||||
}
|
||||
return i;
|
||||
@@ -101,9 +102,9 @@ public U8 *DC2Sprite(CDC *tempb)
|
||||
{//Convert device context to sprite.
|
||||
CSprite *tempg;
|
||||
tempg=CAlloc(sprite_elem_base_sizes[SPT_BITMAP]+
|
||||
tempb->width_internal*tempb->height+
|
||||
sprite_elem_base_sizes[SPT_END])
|
||||
(U8 *)-offset(CSprite.start);
|
||||
tempb->width_internal*tempb->height+
|
||||
sprite_elem_base_sizes[SPT_END])
|
||||
(U8 *)-offset(CSprite.start);
|
||||
tempg->type=SPT_BITMAP;
|
||||
tempg->pwhu.width=tempb->width;
|
||||
tempg->pwhu.height=tempb->height;
|
||||
@@ -113,9 +114,9 @@ public U8 *DC2Sprite(CDC *tempb)
|
||||
return tempg(U8 *)+offset(CSprite.start);
|
||||
}
|
||||
|
||||
public U8 *SpriteElem2OneLineSummary(CSprite *tempg)
|
||||
public U8 *SpriteElem2Summary(CSprite *tempg)
|
||||
{//Study $LK,"::/Demo/Graphics/SpriteText.CPP"$.
|
||||
U8 buf[256],buf2[136];
|
||||
U8 buf[STR_LEN],buf2[STR_LEN];
|
||||
I32 *ptr;
|
||||
StrPrint(buf,"%Z",tempg->type,"ST_SPRITE_ELEM_TYPES");
|
||||
switch (tempg->type) {
|
||||
@@ -123,7 +124,8 @@ public U8 *SpriteElem2OneLineSummary(CSprite *tempg)
|
||||
CatPrint(buf," %s",Color2Str(buf2,tempg->c.color));
|
||||
break;
|
||||
case SPT_DITHER_COLOR:
|
||||
CatPrint(buf," %s",Color2Str(buf2,ROPF_DITHER|tempg->d.dither_color.u8[0]|tempg->d.dither_color.u8[1]<<COLORROP_BITS));
|
||||
CatPrint(buf," %s",Color2Str(buf2,ROPF_DITHER|tempg->d.dither_color.u8[0]|
|
||||
tempg->d.dither_color.u8[1]<<COLORROP_BITS));
|
||||
break;
|
||||
case SPT_PT:
|
||||
case SPT_FLOOD_FILL:
|
||||
@@ -136,7 +138,8 @@ public U8 *SpriteElem2OneLineSummary(CSprite *tempg)
|
||||
case SPT_PLANAR_SYMMETRY:
|
||||
case SPT_RECT:
|
||||
case SPT_ROTATED_RECT:
|
||||
CatPrint(buf," (%d,%d),(%d,%d)",tempg->pp.x1,tempg->pp.y1,tempg->pp.x2,tempg->pp.y2);
|
||||
CatPrint(buf," (%d,%d),(%d,%d)",tempg->pp.x1,tempg->pp.y1,
|
||||
tempg->pp.x2,tempg->pp.y2);
|
||||
break;
|
||||
case SPT_CIRCLE:
|
||||
CatPrint(buf," (%d,%d):%dR",tempg->pr.x1,tempg->pr.y1,tempg->pr.radius);
|
||||
@@ -157,7 +160,8 @@ public U8 *SpriteElem2OneLineSummary(CSprite *tempg)
|
||||
case SPT_ELLIPSE:
|
||||
case SPT_POLYGON:
|
||||
case SPT_BITMAP:
|
||||
CatPrint(buf," (%d,%d):%dW,%dH",tempg->pwhu.x1,tempg->pwhu.y1,tempg->pwhu.width,tempg->pwhu.height);
|
||||
CatPrint(buf," (%d,%d):%dW,%dH",tempg->pwhu.x1,tempg->pwhu.y1,
|
||||
tempg->pwhu.width,tempg->pwhu.height);
|
||||
break;
|
||||
case SPT_BSPLINE2:
|
||||
case SPT_BSPLINE3:
|
||||
|
||||
+39
-36
@@ -11,7 +11,8 @@ CTask *MenuTask()
|
||||
|
||||
CMenuEntry *sys_cur_submenu_entry=NULL;
|
||||
|
||||
public CMenuEntry *MenuSubEntryFind(CMenuEntry *haystack_first,U8 *needle_entry_name)
|
||||
public CMenuEntry *MenuSubEntryFind(
|
||||
CMenuEntry *haystack_first,U8 *needle_entry_name)
|
||||
{//You probably don't need this. Use dir / and $LK,"MenuEntryFind",A="MN:MenuEntryFind"$().
|
||||
while (haystack_first) {
|
||||
if (!StrCmp(haystack_first->name,needle_entry_name))
|
||||
@@ -40,43 +41,43 @@ public CMenuEntry *MenuEntryFind(CMenu *haystack_menu,U8 *needle_full_name)
|
||||
return tempse;
|
||||
}
|
||||
|
||||
CMenuEntry *MenuNewSub(CLex *lx,CTask *task)
|
||||
CMenuEntry *MenuNewSub(CCmpCtrl *cc,CTask *task)
|
||||
{
|
||||
CMenuEntry *tempme=NULL,*tempse;
|
||||
if (lx->token==TK_IDENT) {
|
||||
if (cc->token==TK_IDENT) {
|
||||
tempme=CAlloc(sizeof(CMenuEntry),task);
|
||||
if (StrLen(lx->cur_str)>31)
|
||||
lx->cur_str[31]=0;
|
||||
StrCpy(tempme->name,lx->cur_str);
|
||||
if (Lex(lx)=='(') {
|
||||
if (StrLen(cc->cur_str)>31)
|
||||
cc->cur_str[31]=0;
|
||||
StrCpy(tempme->name,cc->cur_str);
|
||||
if (Lex(cc)=='(') {
|
||||
tempme->msg_code=MSG_KEY_DOWN_UP;
|
||||
if (Lex(lx)!=',' && lx->token!=')')
|
||||
tempme->msg_code=LexExpressionI64(lx);
|
||||
if (lx->token==',')
|
||||
Lex(lx);
|
||||
if (lx->token!=',' && lx->token!=')')
|
||||
tempme->a1=LexExpressionI64(lx);
|
||||
if (lx->token==',')
|
||||
Lex(lx);
|
||||
if (lx->token!=',' && lx->token!=')')
|
||||
tempme->a2=LexExpressionI64(lx);
|
||||
if (lx->token!=')')
|
||||
LexExcept(lx,"missing ')' at ");
|
||||
if (Lex(lx)!=';')
|
||||
LexExcept(lx,"missing ';' at");
|
||||
Lex(lx); //Skip ;
|
||||
} else if (lx->token=='{') {
|
||||
Lex(lx); //Skip {
|
||||
if (Lex(cc)!=',' && cc->token!=')')
|
||||
tempme->msg_code=LexExpressionI64(cc);
|
||||
if (cc->token==',')
|
||||
Lex(cc);
|
||||
if (cc->token!=',' && cc->token!=')')
|
||||
tempme->a1=LexExpressionI64(cc);
|
||||
if (cc->token==',')
|
||||
Lex(cc);
|
||||
if (cc->token!=',' && cc->token!=')')
|
||||
tempme->a2=LexExpressionI64(cc);
|
||||
if (cc->token!=')')
|
||||
LexExcept(cc,"missing ')' at ");
|
||||
if (Lex(cc)!=';')
|
||||
LexExcept(cc,"missing ';' at");
|
||||
Lex(cc); //Skip ;
|
||||
} else if (cc->token=='{') {
|
||||
Lex(cc); //Skip {
|
||||
tempme->dir=TRUE;
|
||||
tempse=&tempme->sub;
|
||||
while (tempse && lx->token!='}')
|
||||
tempse=tempse->next=MenuNewSub(lx,task);
|
||||
if (lx->token!='}')
|
||||
LexExcept(lx,"missing '}' at ");
|
||||
while (tempse && cc->token!='}')
|
||||
tempse=tempse->next=MenuNewSub(cc,task);
|
||||
if (cc->token!='}')
|
||||
LexExcept(cc,"missing '}' at ");
|
||||
else
|
||||
Lex(lx); //Skip }
|
||||
Lex(cc); //Skip }
|
||||
} else
|
||||
LexExcept(lx,"expecting '{' at ");
|
||||
LexExcept(cc,"expecting '{' at ");
|
||||
}
|
||||
return tempme;
|
||||
}
|
||||
@@ -85,17 +86,17 @@ public CMenu *MenuNew(U8 *st,I64 flags=0,CTask *task=NULL)
|
||||
{//Parse a menu. You probably don't need this.
|
||||
CMenu *m;
|
||||
CMenuEntry *tempse;
|
||||
CLex *lx=LexNew(st,LF_DONT_FREE_BUF);
|
||||
CCmpCtrl *cc=CmpCtrlNew(st,CCF_DONT_FREE_BUF);
|
||||
if (!task) task=Fs;
|
||||
Lex(lx);
|
||||
Lex(cc);
|
||||
m=CAlloc(sizeof(CMenu),task);
|
||||
m->task=task;
|
||||
m->flags=flags;
|
||||
m->attr =BLUE<<4+YELLOW;
|
||||
tempse=&m->sub;
|
||||
while (tempse)
|
||||
tempse=tempse->next=MenuNewSub(lx,task);
|
||||
LexDel(lx);
|
||||
tempse=tempse->next=MenuNewSub(cc,task);
|
||||
CmpCtrlDel(cc);
|
||||
return m;
|
||||
}
|
||||
|
||||
@@ -203,7 +204,8 @@ U0 DrawMenu(CDC *dc)
|
||||
else
|
||||
i=m->attr;
|
||||
if (y0<=y1<y0+FONT_HEIGHT) {
|
||||
if (tempse->msg_code==MSG_KEY_DOWN||tempse->msg_code==MSG_KEY_DOWN_UP) {
|
||||
if (tempse->msg_code==MSG_KEY_DOWN||
|
||||
tempse->msg_code==MSG_KEY_DOWN_UP) {
|
||||
if (!tempse->a2)
|
||||
tempse->a2=Char2ScanCode(tempse->a1);
|
||||
st=ScanCode2KeyName(tempse->a2);
|
||||
@@ -215,7 +217,8 @@ U0 DrawMenu(CDC *dc)
|
||||
GrPrint(dc,x0,y0,"%s",tempse->name);
|
||||
if (st) {
|
||||
dc->color=i>>4;
|
||||
GrRect(dc,x0+w,y0-FONT_HEIGHT,(StrLen(st)+1)*FONT_WIDTH,FONT_HEIGHT*3);
|
||||
GrRect(dc,x0+w,y0-FONT_HEIGHT,
|
||||
(StrLen(st)+1)*FONT_WIDTH,FONT_HEIGHT*3);
|
||||
dc->color=i&15;
|
||||
GrPrint(dc,x0+w,y0,"%s",st);
|
||||
Free(st);
|
||||
|
||||
@@ -16,12 +16,13 @@ class CFileSND
|
||||
//#define MAX_SND_FILE_DATA 0x0007FF00
|
||||
#define MAX_SND_FILE_DATA 0x7FFFFF00
|
||||
|
||||
public I64 SndFileCreate(U8 *base_filename,F64 normalized_vol=1.0,F64 averaging=0.0,I64 waveform=WF_SQUARE,
|
||||
F64 reverb_delay=0,F64 reverb_intensity=0,F64 time_shift=0)
|
||||
public I64 SndFileCreate(U8 *base_filename,F64 normalized_vol=1.0,
|
||||
F64 averaging=0.0,I64 waveform=WF_SQUARE,
|
||||
F64 reverb_delay=0,F64 reverb_intensity=0,F64 time_shift=0)
|
||||
{//Use "snd.record" flag to start or stop recording, then call this routine.
|
||||
//Averaging should be a num from 0.0 to 0.999.
|
||||
//Vol should be from 0.0 to 1.0.
|
||||
//Set reverb_delay to like 0.3 sec and reverb_intensity to like 0.4.
|
||||
//Vol should be from 0.0 to 1.0.
|
||||
//Set reverb_delay to like 0.3 sec and reverb_intensity to like 0.4.
|
||||
I64 i,k,cnt,cnt2,level,file_num;
|
||||
F64 avg,dt;
|
||||
CFileSND *s;
|
||||
@@ -78,14 +79,14 @@ public I64 SndFileCreate(U8 *base_filename,F64 normalized_vol=1.0,F64 averaging=
|
||||
avg=0;
|
||||
for (i=0;i<cnt-1;i++)
|
||||
s->body[i]=avg=LowPass1(averaging,avg,s->body[i],1.0);
|
||||
}
|
||||
}
|
||||
|
||||
//Reverb
|
||||
if (reverb_intensity) {
|
||||
if (dt=reverb_delay*SNDFILE_SAMPLE_RATE)
|
||||
for (i=dt;i<cnt;i++)
|
||||
s->body[i]+=reverb_intensity*s->body[i-dt];
|
||||
}
|
||||
}
|
||||
|
||||
//Get rid of D.C. component
|
||||
for (k=0;k<3;k++) {
|
||||
@@ -95,7 +96,7 @@ public I64 SndFileCreate(U8 *base_filename,F64 normalized_vol=1.0,F64 averaging=
|
||||
level/=cnt-1;
|
||||
for (i=0;i<cnt-1;i++)
|
||||
s->body[i]=ClampI64(s->body[i]-level,MIN_I16,MAX_I16);
|
||||
}
|
||||
}
|
||||
|
||||
for (i=0;i<cnt-1;i++)
|
||||
s->body[i]=EndianU16(s->body[i]);
|
||||
|
||||
@@ -126,8 +126,8 @@ public U0 SndWaveAddBuf(CSndWaveCtrl *swc,U8 *buf,I64 num_samples,
|
||||
F64 _freq,I64 _waveform=WF_SQUARE,F64 _amp=1.0,F64 _left=1.0, F64 _right=1.0)
|
||||
{//Add waveform to buffer.
|
||||
//num_samples is multiplied by channels to get buf_len.
|
||||
//left,right range from 0.0-1.0
|
||||
//Supports 16,24 and 32 bits
|
||||
//left,right range from 0.0-1.0
|
||||
//Supports 16,24 and 32 bits
|
||||
I64 reg i,reg j,reg k;
|
||||
F64 a,f,amp,reg phase;
|
||||
if (!swc) return;
|
||||
@@ -195,7 +195,7 @@ public U0 SndWaveAddBuf(CSndWaveCtrl *swc,U8 *buf,I64 num_samples,
|
||||
}
|
||||
break;
|
||||
}
|
||||
//left channel
|
||||
//left channel
|
||||
k=j*_left;
|
||||
if (swc->sample_bits==16) {
|
||||
k>>=16;
|
||||
@@ -205,7 +205,7 @@ public U0 SndWaveAddBuf(CSndWaveCtrl *swc,U8 *buf,I64 num_samples,
|
||||
k&=0xFFFFFF00;
|
||||
buf(I32 *)[i++]+=k;
|
||||
}
|
||||
//right channel
|
||||
//right channel
|
||||
if (swc->channels==2) {
|
||||
k=j*_right;
|
||||
if (swc->sample_bits==16) {
|
||||
|
||||
+23
-23
@@ -20,7 +20,7 @@ public class CMusicGlbls
|
||||
|
||||
#help_index "Snd/Music;Time/Seconds"
|
||||
public F64 tM()
|
||||
{//Time in seconds synchronized to music subsystem.
|
||||
{//Time in seconds synced to music subsystem.
|
||||
return (cnts.jiffies+music.tM_correction)/JIFFY_FREQ;
|
||||
}
|
||||
|
||||
@@ -98,37 +98,37 @@ U8 *MusicSetNoteLen(U8 *st)
|
||||
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.
|
||||
Octaves are entered with a digit and
|
||||
stay set until changed.
|
||||
|
||||
Durations are entered with
|
||||
'w' whole note
|
||||
'h' half note
|
||||
'q' quarter note
|
||||
'e' eighth note
|
||||
't' sets to 2/3rds the current duration
|
||||
'.' sets to 1.5 times the current duration
|
||||
durations stay set until changed.
|
||||
Durations are entered with
|
||||
'w' whole note
|
||||
'h' half note
|
||||
'q' quarter note
|
||||
'e' eighth note
|
||||
't' sets to 2/3rds the current duration
|
||||
'.' sets to 1.5 times the current duration
|
||||
durations stay set until changed.
|
||||
|
||||
'(' tie, placed before the note to be extended
|
||||
'(' tie, placed before the note to be extended
|
||||
|
||||
$LK,"music.meter_top",A="MN:CMusicGlbls"$,$LK,"music.meter_bottom",A="MN:CMusicGlbls"$ is set with
|
||||
"M3/4"
|
||||
"M4/4"
|
||||
etc.
|
||||
$LK,"music.meter_top",A="MN:CMusicGlbls"$,$LK,"music.meter_bottom",A="MN:CMusicGlbls"$ is set with
|
||||
"M3/4"
|
||||
"M4/4"
|
||||
etc.
|
||||
|
||||
Sharp and flat are done with '#' or 'b'.
|
||||
Sharp and flat are done with '#' or 'b'.
|
||||
|
||||
The var music.stacatto_factor can
|
||||
be set to a range from 0.0 to 1.0.
|
||||
The var music.stacatto_factor can
|
||||
be set to a range from 0.0 to 1.0.
|
||||
|
||||
The var music.tempo is quarter-notes
|
||||
per second. It defaults to
|
||||
2.5 and gets faster when bigger.
|
||||
The var music.tempo is quarter-notes
|
||||
per second. It defaults to
|
||||
2.5 and gets faster when bigger.
|
||||
*/
|
||||
U8 *word,*last_st;
|
||||
I64 note,i=0,timeout_val,timeout_val2;
|
||||
Bool tie,old_preempt=Preempt(OFF);
|
||||
Bool tie,old_preempt=Preempt;
|
||||
F64 f,d,on_jiffies,off_jiffies;
|
||||
music.play_note_num=0;
|
||||
while (*st) {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
public CTaskSettings *SettingsPush(CTask *task=NULL,I64 flags=0)
|
||||
{//Typically, called at start of an application.
|
||||
//It saves many settings so they can be restored
|
||||
//at the end of the application with $LK,"SettingsPop",A="MN:SettingsPop"$().
|
||||
//at the end of the application with $LK,"SettingsPop",A="MN:SettingsPop"$().
|
||||
|
||||
CTaskSettings *tempse;
|
||||
CDoc *doc;
|
||||
@@ -12,7 +12,7 @@ public CTaskSettings *SettingsPush(CTask *task=NULL,I64 flags=0)
|
||||
tempse=CAlloc(sizeof(CTaskSettings),task);
|
||||
tempse->cur_dir=CurDir(task,task);
|
||||
tempse->draw_it=task->draw_it;
|
||||
GetVGAPalette4(tempse->palette4);
|
||||
GrPaletteGet(tempse->palette);
|
||||
tempse->task_end_cb=task->task_end_cb;
|
||||
|
||||
if (!(flags&TSF_SAME_SONG)) {
|
||||
@@ -81,14 +81,14 @@ U0 SettingsPop2(CTask *task,CTaskSettings *tempse)
|
||||
task->title_src =tempse->title_src;
|
||||
StrCpy(task->task_title,tempse->task_title);
|
||||
AutoComplete(tempse->autocomplete);
|
||||
SetVGAPalette4(tempse->palette4);
|
||||
GrPaletteSet(tempse->palette);
|
||||
Snd(0);
|
||||
}
|
||||
|
||||
public U0 SettingsPop(CTask *task=NULL,I64 flags=0)
|
||||
{//Typically, called at end of an application.
|
||||
CTaskSettings *tempse;
|
||||
Bool old_preempt=Preempt(OFF);
|
||||
Bool old_preempt=Preempt;
|
||||
if (!task) task=Fs;
|
||||
if (!TaskValidate(task)) {
|
||||
Preempt(old_preempt);
|
||||
|
||||
+12
-10
@@ -1,22 +1,22 @@
|
||||
#help_index "Training"
|
||||
#help_index "Help System"
|
||||
|
||||
public U0 PressKeyHelp(CTask *task=NULL)
|
||||
{//Jump to key handlers src for key presses.
|
||||
I64 a1=0,a2=0;
|
||||
Bool old_preempt=Preempt(OFF);
|
||||
Bool old_preempt=Preempt;
|
||||
CTask *old_hash=Fs->hash_table;
|
||||
if (!task) task=Fs;
|
||||
|
||||
/*
|
||||
/*
|
||||
This feature is a burden in code. It would be nice to lst key
|
||||
cmds for all applications, but it makes the code too ugly.
|
||||
*/
|
||||
task=Fs;
|
||||
task=Fs;
|
||||
|
||||
Fs->hash_table=task->hash_table;
|
||||
"Press keys to show handler code.\n"
|
||||
"<SHIFT-ESC> to exit.\n"
|
||||
"Do not press <CTRL-ALT-keys>.\n";
|
||||
"<SHIFT-ESC> to exit.\n"
|
||||
"Do not press <CTRL-ALT-keys>.\n";
|
||||
while (a1!=CH_ESC && a1!=CH_SHIFT_ESC) {
|
||||
GetMsg(&a1,&a2,1<<MSG_KEY_DOWN);
|
||||
*keydev.desc=0;
|
||||
@@ -63,7 +63,7 @@ U0 KeyMapCtrlAltFamily()
|
||||
|
||||
for (i=0;i<26;i++) {
|
||||
if (keydev.fp_ctrl_alt_let_cbs[i] &&
|
||||
keydev.ctrl_alt_let_descs[i]) {
|
||||
keydev.ctrl_alt_let_descs[i]) {
|
||||
a2=Char2ScanCode(i+'a')+SCF_CTRL+SCF_ALT;
|
||||
st2=ScanCode2KeyName(a2);
|
||||
st=SrcEdLink(keydev.fp_ctrl_alt_let_cbs[i],256);
|
||||
@@ -155,7 +155,7 @@ U0 KeyMapFamily2(U8 **entries,U8 *family,CTask *task,I64 scf)
|
||||
Free(st);
|
||||
st=SrcEdLink(keydev.handler,256);
|
||||
entries[i]=MStrPrint("%20s $$LK,\"%s\",A=\"%s\"$$\n",
|
||||
st2,keydev.desc,st);
|
||||
st2,keydev.desc,st);
|
||||
Free(st);
|
||||
Free(st2);
|
||||
}
|
||||
@@ -187,16 +187,18 @@ public U0 KeyMap(CTask *task=NULL)
|
||||
This feature is a burden in code. It would be nice to lst key
|
||||
cmds for all applications, but it makes the code too ugly.
|
||||
*/
|
||||
task=Fs;
|
||||
task=Fs;
|
||||
|
||||
DocMax;
|
||||
KeyMapFamily("",task,0);
|
||||
KeyMapFamily("CTRL",task,SCF_CTRL);
|
||||
KeyMapFamily("ALT",task,SCF_ALT);
|
||||
KeyMapCtrlAltFamily;
|
||||
"\n$$MA-X+PU,T=\"Click for help on key pressed\",LM=\"PressKeyHelp(0x%X);\"$$\n",task;
|
||||
"\n$$MA-X+PU,\"Click for help on key pressed\","
|
||||
"LM=\"PressKeyHelp(0x%X);\"$$\n",task;
|
||||
}
|
||||
|
||||
#help_index "Help System/Training"
|
||||
public U0 TipOfDay(U8 *tip_file="::/Doc/Tips.TXT")
|
||||
{//Print random tip-of-day from ::/Doc/Tips.TXT.
|
||||
I64 i=RandU16;
|
||||
|
||||
+28
-22
@@ -97,20 +97,24 @@ U0 DiffSelect(CDoc *doc,I64 *_df_flags,I64 j1_lo,I64 j1_hi,
|
||||
use_file1=FALSE;
|
||||
break;
|
||||
case DS_REMAINDER_1:
|
||||
*_df_flags=*_df_flags&~DF_REMAINDER_ALL_FILE2|DF_REMAINDER_ALL_FILE1|DF_NO_MORE_PMTS_THIS_FILE;
|
||||
*_df_flags=*_df_flags&~DF_REMAINDER_ALL_FILE2|
|
||||
DF_REMAINDER_ALL_FILE1|DF_NO_MORE_PMTS_THIS_FILE;
|
||||
break;
|
||||
case DS_REMAINDER_2:
|
||||
*_df_flags=*_df_flags&~DF_REMAINDER_ALL_FILE1|DF_REMAINDER_ALL_FILE2|DF_NO_MORE_PMTS_THIS_FILE;
|
||||
*_df_flags=*_df_flags&~DF_REMAINDER_ALL_FILE1|
|
||||
DF_REMAINDER_ALL_FILE2|DF_NO_MORE_PMTS_THIS_FILE;
|
||||
break;
|
||||
case DS_ABORT_FILE:
|
||||
*_df_flags|=DF_DONT_MODIFIED|DF_ABORT_FILE|DF_NO_MORE_PMTS_THIS_FILE;
|
||||
*_df_flags|=DF_DONT_MODIFIED|DF_ABORT_FILE|
|
||||
DF_NO_MORE_PMTS_THIS_FILE;
|
||||
break;
|
||||
default:
|
||||
*_df_flags|=DF_DONT_MODIFIED|DF_ABORT_ALL_FILES|DF_NO_MORE_PMTS_THIS_FILE;
|
||||
*_df_flags|=DF_DONT_MODIFIED|DF_ABORT_ALL_FILES|
|
||||
DF_NO_MORE_PMTS_THIS_FILE;
|
||||
}
|
||||
}
|
||||
if (*_df_flags & DF_REMAINDER_ALL_FILE2 &&
|
||||
!(*_df_flags & (DF_DONT_MODIFIED|DF_REMAINDER_ALL_FILE1)))
|
||||
!(*_df_flags & (DF_DONT_MODIFIED|DF_REMAINDER_ALL_FILE1)))
|
||||
use_file1=FALSE;
|
||||
if (!use_file1) {
|
||||
*_df_flags|=DF_MODIFIED;
|
||||
@@ -141,13 +145,13 @@ Bool DiffSub(CDoc *doc,I64 *_df_flags,I64 j1_lo,I64 j1_hi,I64 j2_lo,I64 j2_hi,
|
||||
CDocEntry **doc_unsorted1,CDocEntry **doc_unsorted2)
|
||||
{
|
||||
I64 i,i1=0,i2=0,i2b,j1,j2,n,
|
||||
best_j1,best_j2,best_score=0,score;
|
||||
best_j1,best_j2,best_score=0,score;
|
||||
Bool result=FALSE;
|
||||
|
||||
if (j1_lo>=j1_hi || j2_lo>=j2_hi) {
|
||||
if (j1_lo<j1_hi || j2_lo<j2_hi) {
|
||||
DiffSelect(doc,_df_flags,j1_lo,j1_hi,j2_lo,j2_hi,cnt1,cnt2,
|
||||
doc_unsorted1,doc_unsorted2);
|
||||
doc_unsorted1,doc_unsorted2);
|
||||
return TRUE;
|
||||
} else
|
||||
return FALSE;
|
||||
@@ -157,7 +161,7 @@ Bool DiffSub(CDoc *doc,I64 *_df_flags,I64 j1_lo,I64 j1_hi,I64 j2_lo,I64 j2_hi,
|
||||
while (i1<cnt1 && i2<cnt2) {
|
||||
if (!(j1_lo<=doc_sorted1[i1]->user_data<j1_hi)) //user_data is the new y
|
||||
i1++;
|
||||
else if (!(j2_lo<=doc_sorted2[i2]->user_data<j2_hi)) //user_data is the new y
|
||||
else if (!(j2_lo<=doc_sorted2[i2]->user_data<j2_hi)) //user_data is new y
|
||||
i2++;
|
||||
else {
|
||||
i=StrCmp(doc_sorted1[i1]->tag,doc_sorted2[i2]->tag);
|
||||
@@ -177,7 +181,7 @@ Bool DiffSub(CDoc *doc,I64 *_df_flags,I64 j1_lo,I64 j1_hi,I64 j2_lo,I64 j2_hi,
|
||||
n=j2_hi-j2;
|
||||
while (score<n) {
|
||||
if (!StrCmp(doc_unsorted1[j1+score]->tag,
|
||||
doc_unsorted2[j2+score]->tag))
|
||||
doc_unsorted2[j2+score]->tag))
|
||||
score++;
|
||||
else
|
||||
break;
|
||||
@@ -199,14 +203,15 @@ Bool DiffSub(CDoc *doc,I64 *_df_flags,I64 j1_lo,I64 j1_hi,I64 j2_lo,I64 j2_hi,
|
||||
}
|
||||
if (!best_score) {
|
||||
DiffSelect(doc,_df_flags,j1_lo,j1_hi,j2_lo,j2_hi,cnt1,cnt2,
|
||||
doc_unsorted1,doc_unsorted2);
|
||||
doc_unsorted1,doc_unsorted2);
|
||||
return TRUE;
|
||||
} else {
|
||||
if (DiffSub(doc,_df_flags,j1_lo,best_j1,j2_lo,best_j2,cnt1,cnt2,
|
||||
doc_sorted1,doc_sorted2,doc_unsorted1,doc_unsorted2))
|
||||
doc_sorted1,doc_sorted2,doc_unsorted1,doc_unsorted2))
|
||||
result=TRUE;
|
||||
if (DiffSub(doc,_df_flags,best_j1+best_score,j1_hi,best_j2+best_score,j2_hi,cnt1,cnt2,
|
||||
doc_sorted1,doc_sorted2,doc_unsorted1,doc_unsorted2))
|
||||
if (DiffSub(doc,_df_flags,best_j1+best_score,j1_hi,best_j2+best_score,
|
||||
j2_hi,cnt1,cnt2,
|
||||
doc_sorted1,doc_sorted2,doc_unsorted1,doc_unsorted2))
|
||||
result=TRUE;
|
||||
return result;
|
||||
}
|
||||
@@ -215,12 +220,13 @@ Bool DiffSub(CDoc *doc,I64 *_df_flags,I64 j1_lo,I64 j1_hi,I64 j2_lo,I64 j2_hi,
|
||||
Bool DiffBins(CDoc *doc1,CDoc *doc2)
|
||||
{
|
||||
CDocBin *tempb1=doc1->bin_root.next,
|
||||
*tempb2=doc2->bin_root.next;
|
||||
*tempb2=doc2->bin_root.next;
|
||||
|
||||
if (tempb1->last->last->num!=tempb2->last->last->num)
|
||||
return TRUE;
|
||||
while (tempb1!=&doc1->bin_root) {
|
||||
if (tempb1->size!=tempb2->size || MemCmp(tempb1->data,tempb2->data,tempb1->size))
|
||||
if (tempb1->size!=tempb2->size ||
|
||||
MemCmp(tempb1->data,tempb2->data,tempb1->size))
|
||||
return TRUE;
|
||||
tempb1=tempb1->next;
|
||||
tempb2=tempb2->next;
|
||||
@@ -232,7 +238,7 @@ public Bool Diff(U8 *dst_file,U8 *src_file,I64 *_df_flags=NULL)
|
||||
{//Report differences between two files and merge differences
|
||||
//from src_file to dst_file. Don't use _df_flags arg. (Used by $LK,"Merge",A="MN:Merge"$().)
|
||||
CDoc *doc1=DocRead(dst_file,DOCF_PLAIN_TEXT_WITH_TABS|DOCF_NO_CURSOR),
|
||||
*doc2=DocRead(src_file,DOCF_PLAIN_TEXT_WITH_TABS|DOCF_NO_CURSOR);
|
||||
*doc2=DocRead(src_file,DOCF_PLAIN_TEXT_WITH_TABS|DOCF_NO_CURSOR);
|
||||
CDocEntry *doc_e,**doc_sorted1,**doc_sorted2,**doc_unsorted1,**doc_unsorted2;
|
||||
I64 i,cnt1=0,cnt2=0,df_flags;
|
||||
Bool result=FALSE;
|
||||
@@ -286,7 +292,7 @@ public Bool Diff(U8 *dst_file,U8 *src_file,I64 *_df_flags=NULL)
|
||||
QSortI64(doc_sorted2,cnt2,&DiffEntriesCompare);
|
||||
|
||||
result=DiffSub(doc1,&df_flags,0,cnt1,0,cnt2,cnt1,cnt2,
|
||||
doc_sorted1,doc_sorted2,doc_unsorted1,doc_unsorted2);
|
||||
doc_sorted1,doc_sorted2,doc_unsorted1,doc_unsorted2);
|
||||
if (df_flags&DF_MODIFIED && !(df_flags&DF_DONT_MODIFIED))
|
||||
DocWrite(doc1);
|
||||
|
||||
@@ -315,11 +321,11 @@ public U0 ZipRep(U8 *files_find_mask="/*",U8 *fu_flags=NULL,
|
||||
Bool just_text_not_graphics=TRUE)
|
||||
{//Report file compressibility.
|
||||
//Dft is just src files. (Used to spot
|
||||
//src files with redundancy in them.)
|
||||
//src files with redundancy in them.)
|
||||
I64 i=0,cnt,size,fuf_flags=0;
|
||||
CDirEntry *tempde,*tempde1,**sort_buf;
|
||||
U8 *buf;
|
||||
CArcCompress *ac;
|
||||
CArcCompress *arc;
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+F+S");
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||
tempde=tempde1=FilesFind(files_find_mask,fuf_flags);
|
||||
@@ -330,10 +336,10 @@ public U0 ZipRep(U8 *files_find_mask="/*",U8 *fu_flags=NULL,
|
||||
buf=FileRead(tempde->full_name,&size);
|
||||
if (just_text_not_graphics)
|
||||
size=StrLen(buf);
|
||||
ac=CompressBuf(buf,size);
|
||||
arc=CompressBuf(buf,size);
|
||||
Free(buf);
|
||||
tempde->user_data(F64)=100.0*ac->compressed_size/ac->expanded_size;
|
||||
Free(ac);
|
||||
tempde->user_data(F64)=100.0*arc->compressed_size/arc->expanded_size;
|
||||
Free(arc);
|
||||
tempde=tempde->next;
|
||||
}
|
||||
QSortI64(sort_buf,cnt,&ZRepCompare);
|
||||
|
||||
+111
-89
@@ -1,5 +1,7 @@
|
||||
#help_index "Graphics/Windows BMP Files"
|
||||
|
||||
#define NUM_BMP_COLORS 16
|
||||
|
||||
class CFileBMP
|
||||
{
|
||||
U16 type;
|
||||
@@ -21,26 +23,34 @@ class CFileBMP
|
||||
|
||||
U0 end;
|
||||
|
||||
CBGR palette[16];
|
||||
CBGR24 palette[NUM_BMP_COLORS];
|
||||
};
|
||||
|
||||
public CFileBMP *BMP4To(CDC *dc)
|
||||
{//To Windows 4-bit BMP.
|
||||
U8 *src,*ptr;
|
||||
I64 x,y,w=dc->width>>1,
|
||||
size=sizeof(CFileBMP)+dc->width*dc->height>>1;
|
||||
CFileBMP *r =CAlloc(size);
|
||||
r->type ='BM';
|
||||
r->planes =1;
|
||||
r->file_size =size;
|
||||
r->data_offset=sizeof(CFileBMP);
|
||||
r->header_size=offset(CFileBMP.end)-offset(CFileBMP.header_size);
|
||||
r->width =dc->width;
|
||||
r->height =dc->height;
|
||||
r->bit_cnt =4;
|
||||
r->image_size =dc->width*dc->height>>1;
|
||||
GetVGAPalette4(r->palette);
|
||||
ptr=r(U8 *)+r->data_offset;
|
||||
CBGR48 palette[NUM_COLORS];
|
||||
I64 i,x,y,w=dc->width>>1,
|
||||
size=sizeof(CFileBMP)+dc->width*dc->height>>1;
|
||||
CFileBMP *bmp =CAlloc(size);
|
||||
bmp->type ='BM';
|
||||
bmp->planes =1;
|
||||
bmp->file_size =size;
|
||||
bmp->data_offset=sizeof(CFileBMP);
|
||||
bmp->header_size=offset(CFileBMP.end)-offset(CFileBMP.header_size);
|
||||
bmp->width =dc->width;
|
||||
bmp->height =dc->height;
|
||||
bmp->bit_cnt =4;
|
||||
bmp->image_size =dc->width*dc->height>>1;
|
||||
GrPaletteGet(palette);
|
||||
#assert NUM_COLORS==NUM_BMP_COLORS
|
||||
for (i=0;i<NUM_BMP_COLORS;i++) {
|
||||
bmp->palette[i].b=palette[i].b>>8;
|
||||
bmp->palette[i].g=palette[i].g>>8;
|
||||
bmp->palette[i].r=palette[i].r>>8;
|
||||
bmp->palette[i].pad=0;
|
||||
}
|
||||
ptr=bmp(U8 *)+bmp->data_offset;
|
||||
for (y=dc->height-1;y>=0;y--) {
|
||||
src=y*dc->width_internal+dc->body;
|
||||
for (x=0;x<w;x++) {
|
||||
@@ -49,24 +59,32 @@ public CFileBMP *BMP4To(CDC *dc)
|
||||
ptr++;
|
||||
}
|
||||
}
|
||||
return r;
|
||||
return bmp;
|
||||
}
|
||||
|
||||
public CFileBMP *BMPRLE4To(CDC *dc)
|
||||
{//To Windows RLE4 bit BMP.
|
||||
U8 *src,*ptr,*start;
|
||||
I64 x,y,w=dc->width,cnt,pattern;
|
||||
CFileBMP *r =CAlloc(sizeof(CFileBMP)+2*(dc->width+1)*dc->height);
|
||||
r->type ='BM';
|
||||
r->planes =1;
|
||||
r->data_offset=sizeof(CFileBMP);
|
||||
r->header_size=offset(CFileBMP.end)-offset(CFileBMP.header_size);
|
||||
r->width =dc->width;
|
||||
r->height =dc->height;
|
||||
r->bit_cnt =4;
|
||||
r->compression=2; //RLE4
|
||||
GetVGAPalette4(r->palette);
|
||||
start=ptr=r(U8 *)+r->data_offset;
|
||||
I64 i,x,y,w=dc->width,cnt,pattern;
|
||||
CBGR48 palette[NUM_COLORS];
|
||||
CFileBMP *bmp =CAlloc(sizeof(CFileBMP)+2*(dc->width+1)*dc->height);
|
||||
bmp->type ='BM';
|
||||
bmp->planes =1;
|
||||
bmp->data_offset=sizeof(CFileBMP);
|
||||
bmp->header_size=offset(CFileBMP.end)-offset(CFileBMP.header_size);
|
||||
bmp->width =dc->width;
|
||||
bmp->height =dc->height;
|
||||
bmp->bit_cnt =4;
|
||||
bmp->compression=2; //RLE4
|
||||
GrPaletteGet(palette);
|
||||
#assert NUM_COLORS==NUM_BMP_COLORS
|
||||
for (i=0;i<NUM_BMP_COLORS;i++) {
|
||||
bmp->palette[i].b=palette[i].b>>8;
|
||||
bmp->palette[i].g=palette[i].g>>8;
|
||||
bmp->palette[i].r=palette[i].r>>8;
|
||||
bmp->palette[i].pad=0;
|
||||
}
|
||||
start=ptr=bmp(U8 *)+bmp->data_offset;
|
||||
for (y=dc->height-1;y>=0;y--) {
|
||||
src=y*dc->width_internal+dc->body;
|
||||
x=0;
|
||||
@@ -97,28 +115,28 @@ public CFileBMP *BMPRLE4To(CDC *dc)
|
||||
}
|
||||
*ptr(U16 *)++=0;
|
||||
}
|
||||
r->image_size=ptr-start;
|
||||
r->file_size=sizeof(CFileBMP)+r->image_size;
|
||||
return r;
|
||||
bmp->image_size=ptr-start;
|
||||
bmp->file_size=sizeof(CFileBMP)+bmp->image_size;
|
||||
return bmp;
|
||||
}
|
||||
|
||||
public CFileBMP *BMP24To(CDC *dc)
|
||||
{//To Windows 24-bit BMP.
|
||||
U8 *src;
|
||||
I64 i,x,y,size=offset(CFileBMP.end)+dc->width*dc->height*sizeof(CRGB);
|
||||
CBGR *bgr;
|
||||
CFileBMP *r =CAlloc(size);
|
||||
r->type ='BM';
|
||||
r->planes =1;
|
||||
r->file_size =size;
|
||||
r->data_offset=offset(CFileBMP.end);
|
||||
r->header_size=offset(CFileBMP.end)-offset(CFileBMP.header_size);
|
||||
r->width =dc->width;
|
||||
r->height =dc->height;
|
||||
r->bit_cnt =32;
|
||||
r->image_size =dc->width*dc->height<<2;
|
||||
I64 i,x,y,size=offset(CFileBMP.end)+dc->width*dc->height*sizeof(CBGR24);
|
||||
CBGR24 *bgr;
|
||||
CFileBMP *bmp =CAlloc(size);
|
||||
bmp->type ='BM';
|
||||
bmp->planes =1;
|
||||
bmp->file_size =size;
|
||||
bmp->data_offset=offset(CFileBMP.end);
|
||||
bmp->header_size=offset(CFileBMP.end)-offset(CFileBMP.header_size);
|
||||
bmp->width =dc->width;
|
||||
bmp->height =dc->height;
|
||||
bmp->bit_cnt =32;
|
||||
bmp->image_size =dc->width*dc->height<<2;
|
||||
|
||||
bgr=r(U8 *)+r->data_offset;
|
||||
bgr=bmp(U8 *)+bmp->data_offset;
|
||||
for (y=dc->height-1;y>=0;y--) {
|
||||
src=y*dc->width_internal+dc->body;
|
||||
for (x=0;x<dc->width;x++) {
|
||||
@@ -134,48 +152,49 @@ public CFileBMP *BMP24To(CDC *dc)
|
||||
bgr(U8 *)+=4;
|
||||
}
|
||||
}
|
||||
return r;
|
||||
return bmp;
|
||||
}
|
||||
|
||||
public I64 BMPWrite(U8 *filename,CDC *dc,I64 bits=4)
|
||||
{//Window's BMP Files.
|
||||
I64 size;
|
||||
CFileBMP *r;
|
||||
CFileBMP *bmp;
|
||||
if (bits==4) {
|
||||
if (IsDotZ(filename)) //.Z compression is better than RLE
|
||||
r=BMP4To(dc);
|
||||
bmp=BMP4To(dc);
|
||||
else {
|
||||
r=BMPRLE4To(dc);
|
||||
if (r->file_size>sizeof(CFileBMP)+dc->width*dc->height>>1) {
|
||||
Free(r);
|
||||
r=BMP4To(dc);
|
||||
bmp=BMPRLE4To(dc);
|
||||
if (bmp->file_size>sizeof(CFileBMP)+dc->width*dc->height>>1) {
|
||||
Free(bmp);
|
||||
bmp=BMP4To(dc);
|
||||
}
|
||||
}
|
||||
} else if (bits==24)
|
||||
r=BMP24To(dc);
|
||||
bmp=BMP24To(dc);
|
||||
else {
|
||||
"Format Not Supported.\n";
|
||||
return 0;
|
||||
}
|
||||
size=r->file_size;
|
||||
FileWrite(filename,r,r->file_size);
|
||||
Free(r);
|
||||
size=bmp->file_size;
|
||||
FileWrite(filename,bmp,bmp->file_size);
|
||||
Free(bmp);
|
||||
return size;
|
||||
}
|
||||
|
||||
U8 *BMPPaletteNew(CFileBMP *r)
|
||||
U8 *BMPPaletteNew(CFileBMP *bmp)
|
||||
{
|
||||
I64 i,j,best,score,best_score;
|
||||
CBGR palette[16];
|
||||
U8 *result=CAlloc(16*sizeof(U8));
|
||||
GetVGAPalette4(palette);
|
||||
for (i=0;i<16;i++) {
|
||||
CBGR48 palette[NUM_COLORS];
|
||||
U8 *result=CAlloc(NUM_BMP_COLORS*sizeof(U8));
|
||||
GrPaletteGet(palette);
|
||||
#assert NUM_COLORS==NUM_BMP_COLORS
|
||||
for (i=0;i<NUM_BMP_COLORS;i++) {
|
||||
best=i;
|
||||
best_score=MAX_I64;
|
||||
for (j=0;j<16;j++) {
|
||||
score=SqrI64(r->palette[i].r-palette[j].r)+
|
||||
SqrI64(r->palette[i].g-palette[j].g)+
|
||||
SqrI64(r->palette[i].b-palette[j].b);
|
||||
for (j=0;j<NUM_BMP_COLORS;j++) {
|
||||
score=SqrI64(bmp->palette[i].r-palette[j].r>>8)+
|
||||
SqrI64(bmp->palette[i].g-palette[j].g>>8)+
|
||||
SqrI64(bmp->palette[i].b-palette[j].b>>8);
|
||||
if (score<best_score) {
|
||||
best=j;
|
||||
best_score=score;
|
||||
@@ -186,9 +205,9 @@ U8 *BMPPaletteNew(CFileBMP *r)
|
||||
return result;
|
||||
}
|
||||
|
||||
U8 ms_paint_palette[16]={0,4,2,6,1,5,3,8,7,12,10,14,9,13,11,15};
|
||||
U8 ms_paint_palette[NUM_BMP_COLORS]={0,4,2,6,1,5,3,8,7,12,10,14,9,13,11,15};
|
||||
|
||||
I64 BMP24Color(CBGR *ptr,Bool dither_probability)
|
||||
I64 BMP24Color(CBGR24 *ptr,Bool dither_probability)
|
||||
{
|
||||
I64 result,k;
|
||||
if (dither_probability) {
|
||||
@@ -216,28 +235,29 @@ I64 BMP24Color(CBGR *ptr,Bool dither_probability)
|
||||
return result;
|
||||
}
|
||||
|
||||
public CDC *BMPRead(U8 *filename,Bool dither_probability=FALSE,Bool use_ms_paint_palette=FALSE)
|
||||
public CDC *BMPRead(U8 *filename,Bool dither_probability=FALSE,
|
||||
Bool use_ms_paint_palette=FALSE)
|
||||
{//Window's BMP Files.
|
||||
I64 i,j,cnt;
|
||||
U8 *palette_map,*ptr;
|
||||
Bool rle;
|
||||
CFileBMP *r;
|
||||
CFileBMP *bmp;
|
||||
CDC *result=NULL;
|
||||
if (ptr=FileRead(filename)) {
|
||||
r=ptr;
|
||||
if (0<r->width<MAX_I32 && 0<r->height<MAX_I32) {
|
||||
result=DCNew(r->width,r->height);
|
||||
ptr+=r->data_offset;
|
||||
if (r->compression==2)
|
||||
bmp=ptr;
|
||||
if (0<bmp->width<MAX_I32 && 0<bmp->height<MAX_I32) {
|
||||
result=DCNew(bmp->width,bmp->height);
|
||||
ptr+=bmp->data_offset;
|
||||
if (bmp->compression==2)
|
||||
rle=TRUE;
|
||||
else
|
||||
rle=FALSE;
|
||||
if (use_ms_paint_palette)
|
||||
palette_map=ms_paint_palette;
|
||||
else
|
||||
palette_map=BMPPaletteNew(r);
|
||||
if (r->bit_cnt==4) {
|
||||
for (i=r->height-1;i>=0;i--)
|
||||
palette_map=BMPPaletteNew(bmp);
|
||||
if (bmp->bit_cnt==4) {
|
||||
for (i=bmp->height-1;i>=0;i--)
|
||||
if (rle) {//We don't support full RLE4, just our own subset
|
||||
j=0;
|
||||
while (cnt=*ptr++) {
|
||||
@@ -261,7 +281,7 @@ public CDC *BMPRead(U8 *filename,Bool dither_probability=FALSE,Bool use_ms_paint
|
||||
}
|
||||
ptr++;
|
||||
} else
|
||||
for (j=0;j<(r->width+7)&~7;) {
|
||||
for (j=0;j<(bmp->width+7)&~7;) {
|
||||
result->color=palette_map[*ptr&15];
|
||||
GrPlot(result,j+1,i);
|
||||
result->color=palette_map[*ptr>>4];
|
||||
@@ -271,19 +291,19 @@ public CDC *BMPRead(U8 *filename,Bool dither_probability=FALSE,Bool use_ms_paint
|
||||
}
|
||||
if (!use_ms_paint_palette)
|
||||
Free(palette_map);
|
||||
} else if (r->bit_cnt==24) {
|
||||
for (i=r->height-1;i>=0;i--) {
|
||||
for (j=0;j<r->width;j++,ptr+=3) {
|
||||
} else if (bmp->bit_cnt==24) {
|
||||
for (i=bmp->height-1;i>=0;i--) {
|
||||
for (j=0;j<bmp->width;j++,ptr+=3) {
|
||||
result->color=BMP24Color(ptr,dither_probability);
|
||||
GrPlot(result,j,i);
|
||||
}
|
||||
ptr+=r->width&3;
|
||||
ptr+=bmp->width&3;
|
||||
}
|
||||
if (!use_ms_paint_palette)
|
||||
Free(palette_map);
|
||||
} else if (r->bit_cnt>=32) {
|
||||
for (i=r->height-1;i>=0;i--)
|
||||
for (j=0;j<r->width;j++,ptr+=4) {
|
||||
} else if (bmp->bit_cnt>=32) {
|
||||
for (i=bmp->height-1;i>=0;i--)
|
||||
for (j=0;j<bmp->width;j++,ptr+=4) {
|
||||
result->color=BMP24Color(ptr,dither_probability);
|
||||
GrPlot(result,j,i);
|
||||
}
|
||||
@@ -296,13 +316,15 @@ public CDC *BMPRead(U8 *filename,Bool dither_probability=FALSE,Bool use_ms_paint
|
||||
}
|
||||
} else
|
||||
"Invalid BMP File\n";
|
||||
Free(r);
|
||||
Free(bmp);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
#help_index "Graphics/Sprite;Graphics/Windows BMP Files;DolDoc/Output"
|
||||
public U0 DocBMP(CDoc *doc=NULL,U8 *filename,Bool dither_probability=FALSE,Bool use_ms_paint_palette=FALSE)
|
||||
#help_index "Graphics/Sprite;Graphics/Windows BMP Files;"\
|
||||
"DolDoc/Output;StdOut/DolDoc"
|
||||
public U0 DocBMP(CDoc *doc=NULL,U8 *filename,Bool dither_probability=FALSE,
|
||||
Bool use_ms_paint_palette=FALSE)
|
||||
{//Put a BMP file into a document as a sprite.
|
||||
CDC *dc=BMPRead(filename,dither_probability,use_ms_paint_palette);
|
||||
CSprite *elems=DC2Sprite(dc);
|
||||
@@ -312,9 +334,9 @@ public U0 DocBMP(CDoc *doc=NULL,U8 *filename,Bool dither_probability=FALSE,Bool
|
||||
}
|
||||
|
||||
#help_index "Graphics/Windows BMP Files;Graphics/Screen"
|
||||
public I64 BMPCaptureScreen(U8 *filename,I64 bits=4,Bool include_zoom=TRUE)
|
||||
public I64 BMPScreenCapture(U8 *filename,I64 bits=4,Bool include_zoom=TRUE)
|
||||
{//Capture screen as BMP file.
|
||||
CDC *dc=DCCaptureScreen(include_zoom);
|
||||
CDC *dc=DCScreenCapture(include_zoom);
|
||||
I64 size=BMPWrite(filename,dc,bits);
|
||||
DCDel(dc);
|
||||
return size;
|
||||
|
||||
+54
-44
@@ -1,34 +1,36 @@
|
||||
#help_index "Cmd Line (Typically)"
|
||||
|
||||
#define GRF_REPLACE 0
|
||||
#define GRF_SKIP 1
|
||||
#define GRF_ALL 2
|
||||
#define GRF_ED 3
|
||||
#define GRF_ABORT_FILE 4
|
||||
#define GRF_SKIP_FILE 5
|
||||
#define FND_REPLACE 0
|
||||
#define FND_SKIP 1
|
||||
#define FND_ALL 2
|
||||
#define FND_ED 3
|
||||
#define FND_ABORT_FILE 4
|
||||
#define FND_SKIP_FILE 5
|
||||
|
||||
I64 PopUpGrepMenu()
|
||||
I64 PopUpFindMenu()
|
||||
{
|
||||
I64 i;
|
||||
CDoc *doc=DocNew;
|
||||
DocPrint(doc,"$$CM+LX,2,4$$$$BT,\"REPLACE\",LE=GRF_REPLACE$$"
|
||||
"$$CM+LX,22,0$$$$BT,\"SKIP\",LE=GRF_SKIP$$"
|
||||
"$$CM+LX,2,4$$$$BT,\"ALL\",LE=GRF_ALL$$"
|
||||
DocPrint(doc,"$$CM+LX,2,4$$$$BT,\"REPLACE\",LE=FND_REPLACE$$"
|
||||
"$$CM+LX,22,0$$$$BT,\"SKIP\",LE=FND_SKIP$$"
|
||||
"$$CM+LX,2,4$$$$BT,\"ALL\",LE=FND_ALL$$"
|
||||
"$$CM+LX,22,0$$$$BT,\"ABORT ALL\",LE=DOCM_CANCEL$$"
|
||||
"$$CM+LX,2,4$$$$BT,\"EDIT\",LE=GRF_ED$$"
|
||||
"$$CM+LX,22,0$$$$BT,\"ABORT FILE\",LE=GRF_ABORT_FILE$$"
|
||||
"$$CM+LX,2,4$$$$BT,\"SKIP FILE\",LE=GRF_SKIP_FILE$$\n");
|
||||
"$$CM+LX,2,4$$$$BT,\"EDIT\",LE=FND_ED$$"
|
||||
"$$CM+LX,22,0$$$$BT,\"ABORT FILE\",LE=FND_ABORT_FILE$$"
|
||||
"$$CM+LX,2,4$$$$BT,\"SKIP FILE\",LE=FND_SKIP_FILE$$\n");
|
||||
i=PopUpMenu(doc);
|
||||
DocDel(doc);
|
||||
return i;
|
||||
}
|
||||
|
||||
I64 GrepFile(U8 *needle_str,U8 *haystack_filename,I64 *_fuf_flags,U8 *replace_text)
|
||||
{
|
||||
I64 FindFile(U8 *needle_str,U8 *haystack_filename,
|
||||
I64 *_fuf_flags,U8 *replace_text)
|
||||
{//Have you confused with $LK,"FileFind",A="MN:FileFind"$()?
|
||||
Bool first_on_line,write_this_file=FALSE,cont=!Bt(_fuf_flags,FUf_CANCEL);
|
||||
U8 *src,*dst,*dst2,*name_buf=NULL;
|
||||
I64 i,j,plen,rlen,dlen,cnt=0,old_flags,ss_flags;
|
||||
CDoc *cur_l,*doc=DocRead(haystack_filename,DOCF_PLAIN_TEXT_WITH_TABS|DOCF_NO_CURSOR);
|
||||
CDoc *cur_l,*doc=DocRead(haystack_filename,
|
||||
DOCF_PLAIN_TEXT_WITH_TABS|DOCF_NO_CURSOR);
|
||||
CDocEntry *doc_e;
|
||||
|
||||
if (Bt(_fuf_flags,FUf_IGNORE))
|
||||
@@ -67,22 +69,22 @@ I64 GrepFile(U8 *needle_str,U8 *haystack_filename,I64 *_fuf_flags,U8 *replace_te
|
||||
}
|
||||
if (Bt(_fuf_flags,FUf_REPLACE)) {
|
||||
if (Bt(_fuf_flags,FUf_ALL))
|
||||
i=GRF_ALL;
|
||||
i=FND_ALL;
|
||||
else {
|
||||
i=PopUpGrepMenu;
|
||||
i=PopUpFindMenu;
|
||||
if (i<0) {
|
||||
LBts(_fuf_flags,FUf_CANCEL);
|
||||
cont=FALSE;
|
||||
write_this_file=FALSE;
|
||||
} else if (i==GRF_ALL)
|
||||
} else if (i==FND_ALL)
|
||||
LBts(_fuf_flags,FUf_ALL);
|
||||
else if (i==GRF_ABORT_FILE) {
|
||||
else if (i==FND_ABORT_FILE) {
|
||||
cont=FALSE;
|
||||
write_this_file=FALSE;
|
||||
} else if (i==GRF_SKIP_FILE)
|
||||
} else if (i==FND_SKIP_FILE)
|
||||
cont=FALSE;
|
||||
}
|
||||
if (i==GRF_REPLACE || i==GRF_ALL) {
|
||||
if (i==FND_REPLACE || i==FND_ALL) {
|
||||
dlen=StrLen(doc_e->tag);
|
||||
dst=MAlloc(dlen+1+rlen-plen);
|
||||
dst2=dst;
|
||||
@@ -106,12 +108,12 @@ I64 GrepFile(U8 *needle_str,U8 *haystack_filename,I64 *_fuf_flags,U8 *replace_te
|
||||
write_this_file=TRUE;
|
||||
} else {
|
||||
src++;
|
||||
if (i==GRF_ED) {
|
||||
if (i==FND_ED) {
|
||||
Free(name_buf);
|
||||
name_buf=StrNew(doc->filename.name);
|
||||
doc->flags&=~DOCF_NO_CURSOR;
|
||||
doc->cur_entry=doc_e;
|
||||
doc->cur_data_col=doc_e->min_col;
|
||||
doc->cur_col=doc_e->min_col;
|
||||
DocWrite(doc);
|
||||
DocDel(doc);
|
||||
"Wrote:%s\n",name_buf;
|
||||
@@ -140,7 +142,8 @@ I64 GrepFile(U8 *needle_str,U8 *haystack_filename,I64 *_fuf_flags,U8 *replace_te
|
||||
return cnt;
|
||||
}
|
||||
|
||||
public I64 Find(U8 *needle_str,U8 *files_find_mask="*",U8 *fu_flags=NULL,U8 *replace_text=NULL)
|
||||
public I64 Find(U8 *needle_str,U8 *files_find_mask="*",
|
||||
U8 *fu_flags=NULL,U8 *replace_text=NULL)
|
||||
{/*Find occurrences of a string in files.
|
||||
This does not do regular expressions.
|
||||
Anyway, it's good for searching and replacing.
|
||||
@@ -149,11 +152,11 @@ Let's say it stands for global replace ;-)
|
||||
"+r" =recurse
|
||||
"+i" =ignore case
|
||||
"+l" =whole labels only.
|
||||
This will check for a nonlabel character before
|
||||
and after. If you have a var, "dd" and don't
|
||||
want to match words like "Add", you
|
||||
set this flag and it will see that the characters
|
||||
before or after "ll" are label characters.
|
||||
This will check for a nonlabel character before
|
||||
and after. If you have a var, "dd" and don't
|
||||
want to match words like "Add", you
|
||||
set this flag and it will see that the characters
|
||||
before or after "dd" are label characters.
|
||||
"+lb"=only checks for label chars before.
|
||||
"+la"=only checks for label chars after.
|
||||
*/
|
||||
@@ -161,21 +164,24 @@ Let's say it stands for global replace ;-)
|
||||
CDirEntry *tempde,*tempde1;
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+i+f+F+T");
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||
if (fuf_flags&~(FUG_FILES_FIND|FUF_IGNORE|FUF_ALL|FUF_WHOLE_LABELS|FUF_WHOLE_LABELS_BEFORE|FUF_WHOLE_LABELS_AFTER))
|
||||
if (fuf_flags&~(FUG_FILES_FIND|FUF_IGNORE|FUF_ALL|
|
||||
FUF_WHOLE_LABELS|FUF_WHOLE_LABELS_BEFORE|FUF_WHOLE_LABELS_AFTER))
|
||||
throw('FUF');
|
||||
LBEqu(&fuf_flags,FUf_REPLACE,replace_text);
|
||||
tempde=tempde1=FilesFind(files_find_mask,fuf_flags&FUG_FILES_FIND);
|
||||
fuf_flags&=FUF_ALL|FUF_REPLACE|FUF_IGNORE|FUF_WHOLE_LABELS|FUF_WHOLE_LABELS_BEFORE|FUF_WHOLE_LABELS_AFTER;
|
||||
fuf_flags&=FUF_ALL|FUF_REPLACE|FUF_IGNORE|FUF_WHOLE_LABELS|
|
||||
FUF_WHOLE_LABELS_BEFORE|FUF_WHOLE_LABELS_AFTER;
|
||||
while (tempde && !Bt(&fuf_flags,FUf_CANCEL)) {
|
||||
cnt+=GrepFile(needle_str,tempde->full_name,&fuf_flags,replace_text);
|
||||
cnt+=FindFile(needle_str,tempde->full_name,&fuf_flags,replace_text);
|
||||
tempde=tempde->next;
|
||||
}
|
||||
DirTreeDel(tempde1);
|
||||
return cnt;
|
||||
}
|
||||
|
||||
public I64 FileOcc(U8 *needle_str,U8 *files_find_mask="*",U8 *fu_flags="+r+i+l")
|
||||
{/*Report occurrences of a string in files.
|
||||
public I64 FileOcc(U8 *needle_str,
|
||||
U8 *files_find_mask="*",U8 *fu_flags="+r+i+l")
|
||||
{/*Silently return occurrences of a string in files.
|
||||
"+r"=recurse
|
||||
"+i"=ignore case
|
||||
"+l"=whole labels only.
|
||||
@@ -189,22 +195,22 @@ public I64 FileOcc(U8 *needle_str,U8 *files_find_mask="*",U8 *fu_flags="+r+i+l")
|
||||
return cnt;
|
||||
}
|
||||
|
||||
class CGrep
|
||||
class CFind
|
||||
{
|
||||
U8 find_text[136] fmtstr "$$DA-P,135,A=\"FIND :%s\"$$\n";
|
||||
U8 replace_text[136] fmtstr "$$DA-P,135,A=\"REPLACE :%s\"$$\n";
|
||||
U8 find_text[STR_LEN] fmtstr "$$DA-P,STR_LEN-1,A=\"FIND :%s\"$$\n";
|
||||
U8 replace_text[STR_LEN] fmtstr "$$DA-P,STR_LEN-1,A=\"REPLACE :%s\"$$\n";
|
||||
Bool replace fmtstr "$$CB,\"REPLACE\"$$\n";
|
||||
Bool match_case fmtstr "$$CB,\"MATCH CASE\"$$\n";
|
||||
Bool whole_labels fmtstr "$$CB,\"WHOLE LABELS\"$$\n";
|
||||
U8 filemask[136] fmtstr "$$DA-P,135,A=\"FILE MASK :%s\"$$\n";
|
||||
U8 filemask[STR_LEN] fmtstr "$$DA-P,STR_LEN-1,A=\"FILE MASK :%s\"$$\n";
|
||||
Bool recurse fmtstr "$$CB,\"RECURSE\"$$\n";
|
||||
};
|
||||
|
||||
I64 GrepWiz()
|
||||
I64 FindWiz()
|
||||
{
|
||||
CDoc *doc;
|
||||
U8 buf[32],*dir,*st;
|
||||
CGrep *g=CAlloc(sizeof(CGrep));
|
||||
CFind *g=CAlloc(sizeof(CFind));
|
||||
I64 result=0;
|
||||
g->recurse=TRUE;
|
||||
StrCpy(g->filemask,FILEMASK_TXT);
|
||||
@@ -215,7 +221,7 @@ I64 GrepWiz()
|
||||
g->match_case=doc->find_replace->match_case;
|
||||
g->whole_labels=doc->find_replace->whole_labels;
|
||||
}
|
||||
if (DocFormDo(g,,0,"$$PURPLE$$$$TX+CX,\"Find\"$$\n$$FG$$")) {
|
||||
if (DocForm(g,,0,"$$PURPLE$$$$TX+CX,\"Find\"$$\n$$FG$$")) {
|
||||
if (doc) {
|
||||
StrCpy(doc->find_replace->find_text,g->find_text);
|
||||
StrCpy(doc->find_replace->replace_text,g->replace_text);
|
||||
@@ -233,9 +239,13 @@ I64 GrepWiz()
|
||||
if (g->whole_labels)
|
||||
CatPrint(buf,"+l");
|
||||
if (g->replace)
|
||||
st=MStrPrint("\"$$$$WW+H,1$$$$\";Cd(\"%s\");Find(\"%Q\",\"%Q\",\"%Q\",\"%Q\");UserTaskCont;",dir,g->find_text,g->filemask,buf,g->replace_text);
|
||||
st=MStrPrint("\"$$$$WW+H,1$$$$\";Cd(\"%s\");"
|
||||
"Find(\"%Q\",\"%Q\",\"%Q\",\"%Q\");UserTaskCont;",
|
||||
dir,g->find_text,g->filemask,buf,g->replace_text);
|
||||
else
|
||||
st=MStrPrint("\"$$$$WW+H,1$$$$\";Cd(\"%s\");Find(\"%Q\",\"%Q\",\"%Q\");UserTaskCont;",dir,g->find_text,g->filemask,buf);
|
||||
st=MStrPrint("\"$$$$WW+H,1$$$$\";Cd(\"%s\");"
|
||||
"Find(\"%Q\",\"%Q\",\"%Q\");UserTaskCont;",
|
||||
dir,g->find_text,g->filemask,buf);
|
||||
result=PopUp(st);
|
||||
}
|
||||
Free(dir);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#help_index "Debugging/Heap"
|
||||
#help_file "::/Doc/HeapDbg"
|
||||
|
||||
#define HL_CALLER_DEPTH 4
|
||||
#define HL_HASH_SIZE 0x1000
|
||||
@@ -121,7 +122,7 @@ public U0 HeapLogRep(Bool leave_it=OFF)
|
||||
for (i=0;i<HL_HASH_SIZE;i++) {
|
||||
temphl=heaplog_root[i].next;
|
||||
while (temphl!=&heaplog_root[i]) {
|
||||
//Take snapshot in case modified. (while we work)
|
||||
//Take snapshot in case modified. (while we work)
|
||||
MemCpy(&hl,temphl,sizeof(CHeapLog));
|
||||
"$$PURPLE$$%08X$$FG$$ %08X",MSize(hl.addr),hl.addr;
|
||||
for (j=0;j<HL_CALLER_DEPTH;j++)
|
||||
|
||||
@@ -29,7 +29,7 @@ U0 LineRep2(CDoc *doc,CDirEntry *tempde)
|
||||
DocPrint(doc,"$$ID,-2$$");
|
||||
} else
|
||||
DocPrint(doc,"%8,d $$LK,\"%s\",A=\"FI:%s\"$$\n",
|
||||
tempde->user_data,tempde->name,tempde->full_name);
|
||||
tempde->user_data,tempde->name,tempde->full_name);
|
||||
tempde=tempde->next;
|
||||
}
|
||||
}
|
||||
@@ -61,7 +61,7 @@ I64 SizeRep1(CDirEntry *tempde,I64 *_fuf_flags)
|
||||
if (tempde->attr&RS_ATTR_DIR)
|
||||
i=SizeRep1(tempde->sub,_fuf_flags);
|
||||
else if ((i=tempde->size) && Bt(_fuf_flags,FUf_EXPAND) &&
|
||||
FileAttr(tempde->name)&RS_ATTR_COMPRESSED) {
|
||||
FileAttr(tempde->name)&RS_ATTR_COMPRESSED) {
|
||||
dv=Let2Drv(*tempde->full_name);
|
||||
RBlks(dv,buf,Cluster2Blk(dv,tempde->cluster),1);
|
||||
i=(&buf)(CArcCompress *)->expanded_size;
|
||||
@@ -76,13 +76,14 @@ U0 SizeRep2(CDoc *doc,CDirEntry *tempde)
|
||||
{
|
||||
while (tempde) {
|
||||
if (tempde->attr&RS_ATTR_DIR) {
|
||||
DocPrint(doc,"%10,d $$TR+C,\"%s\"$$\n$$ID,2$$",tempde->user_data,tempde->name);
|
||||
DocPrint(doc,"%10,d $$TR+C,\"%s\"$$\n$$ID,2$$",
|
||||
tempde->user_data,tempde->name);
|
||||
SizeRep2(doc,tempde->sub);
|
||||
DocPrint(doc,"$$ID,-2$$");
|
||||
} else {
|
||||
DocPrint(doc,"%10,d ",tempde->user_data);
|
||||
DocPrint(doc,"$$LK,\"%s\",A=\"FI:%s\"$$\n",
|
||||
tempde->name,tempde->full_name);
|
||||
tempde->name,tempde->full_name);
|
||||
}
|
||||
tempde=tempde->next;
|
||||
}
|
||||
|
||||
+19
-17
@@ -10,7 +10,7 @@ I64 PenBrushesSize()
|
||||
I64 result=0,i;
|
||||
for (i=0;i<GR_NUM_PEN_BRUSHES;i++)
|
||||
result+=DCSize(gr.pen_brushes[i])+DCSize(gr.collision_pen_brushes[i])+
|
||||
DCSize(gr.even_pen_brushes[i])+DCSize(gr.odd_pen_brushes[i]);
|
||||
DCSize(gr.even_pen_brushes[i])+DCSize(gr.odd_pen_brushes[i]);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -70,8 +70,8 @@ I64 BlkDevsSize()
|
||||
if (bd->bd_signature==BD_SIGNATURE_VAL) {
|
||||
if (bd->type==BDT_RAM)
|
||||
"RAMDsk %C\t:%010X Unused:%010X\n",
|
||||
bd->first_drv_let,(bd->max_blk+1)<<BLK_SIZE_BITS,
|
||||
UnusedDrvSpace(bd->first_drv_let);
|
||||
bd->first_drv_let,(bd->max_blk+1)<<BLK_SIZE_BITS,
|
||||
UnusedDrvSpace(bd->first_drv_let);
|
||||
result+=MSize2(bd->dev_id_record);
|
||||
}
|
||||
}
|
||||
@@ -91,7 +91,7 @@ Bool MemRepTask(CTask *task,Bool override_validate=FALSE)
|
||||
I64 i,j,k,m,n;
|
||||
U8 *st;
|
||||
CDoc *pdoc,*ddoc,*bdoc;
|
||||
CLex *lx;
|
||||
CCmpCtrl *cc;
|
||||
CMathODE *o;
|
||||
CCPU *c;
|
||||
CTask *task1;
|
||||
@@ -104,8 +104,8 @@ Bool MemRepTask(CTask *task,Bool override_validate=FALSE)
|
||||
"$$GREEN$$Task:%010X$$CYAN$$ %-30ts$$FG$$\n$$ID,2$$",task,st;
|
||||
Free(st);
|
||||
"$$PURPLE$$Alloced:%010X Used:%010X$$FG$$\n",
|
||||
TaskMemAlloced(task,override_validate),
|
||||
TaskMemUsed(task,override_validate);
|
||||
TaskMemAlloced(task,override_validate),
|
||||
TaskMemUsed(task,override_validate);
|
||||
"HashTable\t:%010X\n",HashTableSize2(task->hash_table);
|
||||
|
||||
i=UnusedStk(task);
|
||||
@@ -121,10 +121,10 @@ Bool MemRepTask(CTask *task,Bool override_validate=FALSE)
|
||||
if (bdoc=DocBorder(task))
|
||||
"BorderDoc\t:%010X\n",DocSize(bdoc);
|
||||
|
||||
lx=task->next_lex;
|
||||
while (lx!=&task->next_lex) {
|
||||
"Lex\t\t:%010X\n",LexSize(lx);
|
||||
lx=lx->next;
|
||||
cc=task->next_lex;
|
||||
while (cc!=&task->next_lex) {
|
||||
"Lex\t\t:%010X\n",CmpCtrlSize(cc);
|
||||
cc=cc->next;
|
||||
}
|
||||
|
||||
o=task->next_ode;
|
||||
@@ -167,14 +167,16 @@ Bool MemRepTask(CTask *task,Bool override_validate=FALSE)
|
||||
"Drvs\t:%010X\n",DrvsSize;
|
||||
if (dsk.cache_base)
|
||||
"DskCache\t:%010X\n",
|
||||
MSize2(dsk.cache_base)+MSize2(dsk.cache_hash_table)+MSize2(dsk.cache_ctrl);
|
||||
MSize2(dsk.cache_base)+MSize2(dsk.cache_hash_table)+
|
||||
MSize2(dsk.cache_ctrl);
|
||||
"Clipboard\t:%010X\n",DocSize(sys_clipboard_doc);
|
||||
"AutoComplete:%010X\n",CallExtStr("AutoCompleteSize");
|
||||
"gr.to_8_bits\t:%010X\n",MSize2(gr.to_8_bits);
|
||||
"gr.to_8_colors\t:%010X\n",MSize2(gr.to_8_colors);
|
||||
"gr.text_base\t:%010X\n",MSize2(gr.text_base);
|
||||
"gr.vga_text_cache\t:%010X\n",MSize2(gr.vga_text_cache);
|
||||
"gr.win_z_buf\t:%010X\n",MSize2(gr.win_z_buf)+MSize2(gr.win_uncovered_bitmap);
|
||||
"gr.win_z_buf\t:%010X\n",MSize2(gr.win_z_buf)+
|
||||
MSize2(gr.win_uncovered_bitmap);
|
||||
"gr.dc\t\t:%010X\n",DCSize(gr.dc);
|
||||
"gr.dc1\t\t:%010X\n",DCSize(gr.dc1);
|
||||
"gr.dc2\t\t:%010X\n",DCSize(gr.dc2);
|
||||
@@ -191,7 +193,7 @@ public U0 MemRep()
|
||||
I64 i;
|
||||
CTask *task;
|
||||
CCPU *c;
|
||||
Bool old_preempt=Preempt(OFF);
|
||||
Bool old_preempt=Preempt;
|
||||
CBinFile *bfh=sys_boot_base-sizeof(CBinFile);
|
||||
bfh(I64)+=bfh->file_size-1;
|
||||
|
||||
@@ -207,12 +209,12 @@ public U0 MemRep()
|
||||
|
||||
if (sys_data_bp) {
|
||||
"$$BLACK$$Code Heap:%010X Used:%010X$$FG$$\n",
|
||||
sys_code_bp->alloced_u8s,sys_code_bp->used_u8s;
|
||||
sys_code_bp->alloced_u8s,sys_code_bp->used_u8s;
|
||||
"$$BLACK$$Data Heap:%010X Used:%010X$$FG$$\n",
|
||||
sys_data_bp->alloced_u8s,sys_data_bp->used_u8s;
|
||||
sys_data_bp->alloced_u8s,sys_data_bp->used_u8s;
|
||||
} else
|
||||
"$$BLACK$$Code/Data Heap:%010X Used:%010X$$FG$$\n",
|
||||
sys_code_bp->alloced_u8s,sys_code_bp->used_u8s;
|
||||
sys_code_bp->alloced_u8s,sys_code_bp->used_u8s;
|
||||
|
||||
for (i=0;i<mp_cnt;i++) {
|
||||
c=&cpu_structs[i];
|
||||
@@ -229,7 +231,7 @@ public U0 MemRep()
|
||||
|
||||
"$$GREEN$$Independent Heaps$$FG$$\n$$ID,2$$";
|
||||
"$$BLACK$$dev.uncached_heap:%010X Used:%010X$$FG$$\n",
|
||||
dev.uncached_heap->bp->alloced_u8s,dev.uncached_heap->used_u8s;
|
||||
dev.uncached_heap->bp->alloced_u8s,dev.uncached_heap->used_u8s;
|
||||
"$$ID,-2$$\n";
|
||||
Preempt(old_preempt);
|
||||
}
|
||||
@@ -21,7 +21,7 @@ U0 Merge2(CDirEntry *tempde1,CDirEntry *tempde2,I64 *_fuf_flags,I64 *_df_flags)
|
||||
if (tempde1->attr & RS_ATTR_DIR)
|
||||
Merge2(tempde1->sub,tempde->sub,_fuf_flags,_df_flags);
|
||||
else {
|
||||
if (AbsI64(tempde1->datetime-tempde->datetime)>CDATE_FREQ*2) {//Filedates can shift due to conversion
|
||||
if (AbsI64(tempde1->datetime-tempde->datetime)>CDATE_FREQ*2) {//slop
|
||||
"%s",tempde1->full_name;
|
||||
'\n';
|
||||
if (Bt(_fuf_flags,FUf_DIFF)) {
|
||||
|
||||
@@ -91,7 +91,7 @@ public U0 ProfRep(I64 filter_cnt=1,Bool leave_it=OFF)
|
||||
}
|
||||
if (*last_buf && routine_total>=filter_cnt)
|
||||
"$$GREEN$$%6.2f %08X:%s\n$$FG$$",100*routine_total/total_time,
|
||||
routine_total,last_buf;
|
||||
routine_total,last_buf;
|
||||
"Total Time:%0.6fs\n",total_time/JIFFY_FREQ;
|
||||
if (leave_it) {
|
||||
cpu_structs[pf_cpu].profiler_timer_irq=&ProfTimerInt;
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
#help_index "Cmd Line (Typically)"
|
||||
|
||||
//$LK,"StrUtil",A="MN:StrUtil"$() operations on files
|
||||
|
||||
U0 SUFile(U8 *name,I64 suf_flags,F64 indent_scale_factor)
|
||||
{//String utility on a single file
|
||||
//See $LK,"SU Flags",A="MN:SUF_SINGLE_SPACE"$
|
||||
U8 *dst;
|
||||
Bool chged=FALSE;
|
||||
I64 reduced=0;
|
||||
CDoc *doc=DocRead(name,DOCF_PLAIN_TEXT_WITH_TABS | DOCF_NO_CURSOR);
|
||||
CDocEntry *doc_e=doc->root.next;
|
||||
while (doc_e!=doc) {
|
||||
if (doc_e->type_u8==DOCT_TEXT) {
|
||||
dst=MStrUtil(doc_e->tag,suf_flags,indent_scale_factor);
|
||||
if (StrCmp(dst,doc_e->tag)) {
|
||||
reduced+=StrLen(doc_e->tag)-StrLen(dst);
|
||||
chged=TRUE;
|
||||
Free(doc_e->tag);
|
||||
doc_e->tag=dst;
|
||||
} else
|
||||
Free(dst);
|
||||
}
|
||||
doc_e=doc_e->next;
|
||||
}
|
||||
if (chged) {
|
||||
"Reduced %s by %d chars\n",name,reduced;
|
||||
DocWrite(doc);
|
||||
}
|
||||
DocDel(doc);
|
||||
}
|
||||
public U0 SU(U8 *files_find_mask,I64 suf_flags,U8 *fu_flags=NULL,F64 indent_scale_factor=0)
|
||||
{//Apply string utilities to files
|
||||
//You can convert spaces to tabs, for example
|
||||
//or removing trailing spaces on lines.
|
||||
//See $LK,"SUF Flags",A="MN:SUF_SINGLE_SPACE"$
|
||||
I64 fuf_flags=0;
|
||||
CDirEntry *tempde,*tempde1;
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+f+F+T");
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||
tempde=tempde1=FilesFind(files_find_mask,fuf_flags);
|
||||
while (tempde) {
|
||||
SUFile(tempde->full_name,suf_flags,indent_scale_factor);
|
||||
tempde=tempde->next;
|
||||
}
|
||||
DirTreeDel(tempde1);
|
||||
}
|
||||
public U0 S2T(U8 *files_find_mask,U8 *fu_flags=NULL)
|
||||
{//Spaces to tabs.
|
||||
//Use "Hard Space" (SHIFT-SPACE) for spaces
|
||||
//in string consts in your code.
|
||||
SU(files_find_mask,SUF_S2T|SUF_REM_TRAILING,fu_flags);
|
||||
}
|
||||
@@ -0,0 +1,200 @@
|
||||
#help_index "Cmd Line (Typically)"
|
||||
|
||||
I64 DECompare(CDocEntry *e1,CDocEntry *e2)
|
||||
{
|
||||
return StrCmp(e1->tag,e2->tag);
|
||||
}
|
||||
|
||||
public I64 Sort(U8 *_in_name,U8 *_out_name=NULL,Bool unique=FALSE)
|
||||
{//Sort lines of a text file. Removes blank lines.
|
||||
U8 *in_name,*out_name,*st;
|
||||
CDoc *doc;
|
||||
CDocEntry *doc_e,*doc_e1,**a;
|
||||
I64 i,cnt=0,result;
|
||||
|
||||
if (!_in_name) return 0;
|
||||
in_name=DftExt(_in_name,"TXT.Z");
|
||||
if (_out_name)
|
||||
out_name=DftExt(_out_name,"TXT.Z");
|
||||
else
|
||||
out_name=StrNew(in_name);
|
||||
|
||||
doc=DocRead(in_name,DOCF_PLAIN_TEXT_WITH_TABS|DOCF_NO_CURSOR);
|
||||
doc_e=doc->root.next;
|
||||
while (doc_e!=doc) {
|
||||
if (doc_e->type_u8==DOCT_TEXT)
|
||||
cnt++;
|
||||
doc_e=doc_e->next;
|
||||
}
|
||||
a=MAlloc(cnt*sizeof(CDocEntry *));
|
||||
doc_e=doc->root.next;
|
||||
i=0;
|
||||
while (doc_e!=doc) {
|
||||
doc_e1=doc_e->next;
|
||||
if (doc_e->type_u8==DOCT_TEXT) {
|
||||
QueRem(doc_e);
|
||||
a[i++]=doc_e;
|
||||
} else
|
||||
DocEntryDel(doc,doc_e);
|
||||
doc_e=doc_e1;
|
||||
}
|
||||
QSortI64(a,cnt,&DECompare);
|
||||
|
||||
result=0;
|
||||
st=NULL;
|
||||
for (i=0;i<cnt;i++) {
|
||||
QueIns(a[i],doc->root.last);
|
||||
if (!unique || !st || StrCmp(a[i]->tag,st)) {
|
||||
st=a[i]->tag;
|
||||
doc->cur_entry=&doc->root;
|
||||
doc->cur_col=0;
|
||||
DocPrint(doc,"\n");
|
||||
result++;
|
||||
} else
|
||||
DocEntryDel(doc,a[i]);
|
||||
}
|
||||
StrCpy(doc->filename.name,out_name);
|
||||
DocWrite(doc);
|
||||
|
||||
Free(a);
|
||||
DocDel(doc);
|
||||
Free(in_name);
|
||||
Free(out_name);
|
||||
return result; //Num Lines
|
||||
}
|
||||
|
||||
I64 DocWordsFile(CDoc *doc_out=NULL,U8 *filename,U32 *chars_bmp)
|
||||
{
|
||||
U8 *ptr,*ptr2;
|
||||
I64 result=0,ch;
|
||||
CDoc *doc_in=DocRead(filename);
|
||||
CDocEntry *doc_e=doc_in->root.next;
|
||||
while (doc_e!=doc_in) {
|
||||
if (doc_e->de_flags & DOCEF_TAG) {
|
||||
ptr=doc_e->tag;
|
||||
while (*ptr) {
|
||||
while (*ptr && !Bt(chars_bmp,*ptr))
|
||||
ptr++;
|
||||
|
||||
ptr2=ptr;
|
||||
while (*ptr && Bt(chars_bmp,*ptr))
|
||||
ptr++;
|
||||
|
||||
ch=*ptr;
|
||||
*ptr=0;
|
||||
if (*ptr2) {
|
||||
DocPrint(doc_out,"%s\n",ptr2);
|
||||
result++;
|
||||
}
|
||||
*ptr=ch;
|
||||
}
|
||||
}
|
||||
doc_e=doc_e->next;
|
||||
}
|
||||
DocDel(doc_in);
|
||||
return result;
|
||||
}
|
||||
public I64 Words(U8 *files_find_mask="*",U32 *chars_bmp=chars_bmp_alpha,
|
||||
U8 *fu_flags=NULL)
|
||||
{//Break file into list of not-unique words.
|
||||
I64 fuf_flags=0,result=0;
|
||||
CDoc *doc_out=DocNew;
|
||||
CDirEntry *tempde,*tempde1;
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+f+F+T");
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||
tempde=tempde1=FilesFind(files_find_mask,fuf_flags);
|
||||
while (tempde) {
|
||||
result+=DocWordsFile(doc_out,tempde->full_name,chars_bmp);
|
||||
tempde=tempde->next;
|
||||
}
|
||||
DirTreeDel(tempde1);
|
||||
DocInsDoc(NULL,doc_out);
|
||||
DocDel(doc_out);
|
||||
return result;
|
||||
}
|
||||
|
||||
I64 LongLinesFile(U8 *filename,I64 cols)
|
||||
{
|
||||
I64 result=0;
|
||||
CDoc *doc=DocRead(filename);
|
||||
CDocEntry *doc_e=doc->root.next;
|
||||
while (doc_e!=doc) {
|
||||
if (doc_e->type_u8==DOCT_NEW_LINE && doc_e->x>=cols+1)
|
||||
result++;
|
||||
doc_e=doc_e->next;
|
||||
}
|
||||
DocDel(doc);
|
||||
if (result) {
|
||||
"%04d ",result;
|
||||
PutFileLink(filename);
|
||||
'\n';
|
||||
}
|
||||
return result;
|
||||
}
|
||||
public I64 LongLines(U8 *files_find_mask="*",I64 cols=80,U8 *fu_flags=NULL)
|
||||
{//Report files with lines of too many cols.
|
||||
I64 result=0,fuf_flags=0;
|
||||
CDirEntry *tempde,*tempde1;
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+f+F+S");
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||
tempde=tempde1=FilesFind(files_find_mask,fuf_flags);
|
||||
while (tempde) {
|
||||
if (LongLinesFile(tempde->full_name,cols))
|
||||
result++;
|
||||
tempde=tempde->next;
|
||||
}
|
||||
DirTreeDel(tempde1);
|
||||
return result;
|
||||
}
|
||||
|
||||
U0 SUFile(U8 *filename,I64 suf_flags,F64 indent_scale_factor)
|
||||
{//String utility on a single file
|
||||
//See $LK,"SU Flags",A="MN:SUF_SINGLE_SPACE"$
|
||||
U8 *dst;
|
||||
Bool chged=FALSE;
|
||||
I64 reduced=0;
|
||||
CDoc *doc=DocRead(filename,DOCF_PLAIN_TEXT_WITH_TABS | DOCF_NO_CURSOR);
|
||||
CDocEntry *doc_e=doc->root.next;
|
||||
while (doc_e!=doc) {
|
||||
if (doc_e->type_u8==DOCT_TEXT) {
|
||||
dst=MStrUtil(doc_e->tag,suf_flags,indent_scale_factor);
|
||||
if (StrCmp(dst,doc_e->tag)) {
|
||||
reduced+=StrLen(doc_e->tag)-StrLen(dst);
|
||||
chged=TRUE;
|
||||
Free(doc_e->tag);
|
||||
doc_e->tag=dst;
|
||||
} else
|
||||
Free(dst);
|
||||
}
|
||||
doc_e=doc_e->next;
|
||||
}
|
||||
if (chged) {
|
||||
"Reduced %s by %d chars\n",filename,reduced;
|
||||
DocWrite(doc);
|
||||
}
|
||||
DocDel(doc);
|
||||
}
|
||||
public U0 SU(U8 *files_find_mask,I64 suf_flags,U8 *fu_flags=NULL,
|
||||
F64 indent_scale_factor=0)
|
||||
{//Apply $LK,"StrUtil",A="MN:StrUtil"$() on files
|
||||
//You can convert spaces to tabs, for example,
|
||||
//or removing trailing spaces on lines.
|
||||
//See $LK,"SUF Flags",A="MN:SUF_SINGLE_SPACE"$.
|
||||
I64 fuf_flags=0;
|
||||
CDirEntry *tempde,*tempde1;
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+f+F+T");
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||
tempde=tempde1=FilesFind(files_find_mask,fuf_flags);
|
||||
while (tempde) {
|
||||
SUFile(tempde->full_name,suf_flags,indent_scale_factor);
|
||||
tempde=tempde->next;
|
||||
}
|
||||
DirTreeDel(tempde1);
|
||||
}
|
||||
|
||||
public U0 S2T(U8 *files_find_mask,U8 *fu_flags=NULL)
|
||||
{//Spaces to tabs.
|
||||
//Use "Hard Space" (SHIFT-SPACE) for spaces
|
||||
//in string consts in your code.
|
||||
SU(files_find_mask,SUF_S2T|SUF_REM_TRAILING,fu_flags);
|
||||
}
|
||||
+64
-43
@@ -2,18 +2,22 @@
|
||||
|
||||
//See $LK,"::/Doc/Credits.TXT"$.
|
||||
|
||||
U0 HtmlPutS(CDoc *doc,I64 u32_attr,I64 *_old_u32_attr,U8 *st,I64 *_col,U8 *style_bitmap=NULL)
|
||||
U0 HtmlPutS(CDoc *doc,I64 u32_attr,I64 *_old_u32_attr,
|
||||
U8 *st,I64 *_col,U8 *style_bitmap=NULL)
|
||||
{
|
||||
U8 *ch,*ptr;
|
||||
u32_attr&=0xFFFFFF00;
|
||||
if (u32_attr&DOCET_INVERT)
|
||||
u32_attr.u8[1]=(u32_attr.u8[1]&15)<<4|u32_attr.u8[1]>>4;
|
||||
if (u32_attr!=*_old_u32_attr) {
|
||||
if (!(u32_attr&DOCET_BLINK) && *_old_u32_attr&DOCET_BLINK)
|
||||
if (!(u32_attr&DOCET_BLINK) &&
|
||||
*_old_u32_attr!=-1 && *_old_u32_attr&DOCET_BLINK)
|
||||
DocPrint(doc,"</blink>");
|
||||
if (*_old_u32_attr!=-1)
|
||||
DocPrint(doc,"</span>");
|
||||
DocPrint(doc,"<span class=c%02X>",u32_attr.u8[1]);
|
||||
if (u32_attr&DOCET_BLINK && !(*_old_u32_attr&DOCET_BLINK))
|
||||
if (u32_attr&DOCET_BLINK &&
|
||||
(*_old_u32_attr==-1 || !(*_old_u32_attr&DOCET_BLINK)))
|
||||
DocPrint(doc,"<blink>");
|
||||
*_old_u32_attr=u32_attr;
|
||||
if (style_bitmap)
|
||||
@@ -120,11 +124,11 @@ public CDoc *Doc2Html(CDoc *doc_in,
|
||||
U8 (*link_cvt)(U8 *link_st)=&TOSLinkCvt1)
|
||||
{//Cvt $LK,"DolDoc",A="FI:::/Doc/DolDocOverview.TXT"$ doc to HTML file.
|
||||
CDocEntry *doc_e,*style,*doc_e2;
|
||||
I64 i,y,old_y=MIN_I64,col,_old_u32_attr=-1,old_attr;
|
||||
I64 i,y,old_y=MIN_I64,col,old_u32_attr=-1,old_attr;
|
||||
U32 *hl,*src;
|
||||
U8 *st,st_2[2],*link_st,*style_bitmap=CAlloc(256/8);
|
||||
CBGR p[16];
|
||||
GetVGAPalette4(p);
|
||||
CBGR48 p[NUM_COLORS];
|
||||
GrPaletteGet(p);
|
||||
CDoc *doc_out=DocNew;
|
||||
Bool unlock_doc_in=DocLock(doc_in),no_bwd;
|
||||
|
||||
@@ -142,19 +146,20 @@ public CDoc *Doc2Html(CDoc *doc_in,
|
||||
if (!body_header) body_header="";
|
||||
if (!body_footer) body_footer="";
|
||||
DocPrint(doc_out,
|
||||
"<!DOCTYPE HTML>\n"
|
||||
"<html>\n"
|
||||
"<head>\n"
|
||||
"<meta http-equiv=\"Content-Type\" content=\"text/html;charset=US-ASCII\">\n"
|
||||
"%s"
|
||||
"<meta name=\"generator\" content=\"TempleOS V%4.2f\">\n"
|
||||
"<style type=\"text/css\">\n",html_header,os_version);
|
||||
"<!DOCTYPE HTML>\n"
|
||||
"<html>\n"
|
||||
"<head>\n"
|
||||
"<meta http-equiv=\"Content-Type\" "
|
||||
"content=\"text/html;charset=US-ASCII\">\n"
|
||||
"%s"
|
||||
"<meta name=\"generator\" content=\"TempleOS V%4.2f\">\n"
|
||||
"<style type=\"text/css\">\n",html_header,os_version);
|
||||
style=doc_out->cur_entry->last;
|
||||
DocPrint(doc_out,
|
||||
"</style>\n"
|
||||
"</head>\n"
|
||||
"<body>\n"
|
||||
"<pre style=\"font-family:courier;font-size:10pt\">\n");
|
||||
"</style>\n"
|
||||
"</head>\n"
|
||||
"<body>\n"
|
||||
"<pre style=\"font-family:courier;font-size:10pt\">\n");
|
||||
DocPrint(doc_out,"%s",body_header);
|
||||
|
||||
doc_e=doc_in->root.next;
|
||||
@@ -167,7 +172,8 @@ public CDoc *Doc2Html(CDoc *doc_in,
|
||||
old_y=y;
|
||||
}
|
||||
while (y<doc_e->y) {
|
||||
HtmlPutS(doc_out,doc_e->settings.final_u32_attr,&_old_u32_attr,"\n",&col,style_bitmap);
|
||||
HtmlPutS(doc_out,doc_e->settings.final_u32_attr,
|
||||
&old_u32_attr,"\n",&col,style_bitmap);
|
||||
if (line_anchors && ++y!=old_y) {
|
||||
DocPrint(doc_out,"<a name=\"l%d\"></a>",y+1);
|
||||
old_y=y;
|
||||
@@ -186,7 +192,8 @@ public CDoc *Doc2Html(CDoc *doc_in,
|
||||
}
|
||||
if (no_bwd)
|
||||
while (col<doc_e->x)
|
||||
HtmlPutS(doc_out,doc_e->settings.final_u32_attr,&_old_u32_attr," ",&col,style_bitmap);
|
||||
HtmlPutS(doc_out,doc_e->settings.final_u32_attr,
|
||||
&old_u32_attr," ",&col,style_bitmap);
|
||||
|
||||
link_st=NULL;
|
||||
if (doc_e->de_flags&DOCEF_HTML_LINK)
|
||||
@@ -197,9 +204,9 @@ public CDoc *Doc2Html(CDoc *doc_in,
|
||||
}
|
||||
|
||||
if (link_st) {
|
||||
if (_old_u32_attr!=-1) {
|
||||
if (old_u32_attr!=-1) {
|
||||
DocPrint(doc_out,"</span>");
|
||||
_old_u32_attr=-1;
|
||||
old_u32_attr=-1;
|
||||
}
|
||||
DocPrint(doc_out,"<a href=\"%s\">",link_st);
|
||||
}
|
||||
@@ -208,40 +215,49 @@ public CDoc *Doc2Html(CDoc *doc_in,
|
||||
case DOCT_TEXT:
|
||||
if (doc_e->de_flags&DOCEF_HIGHLIGHT) {
|
||||
if (doc_e->last==doc_in)
|
||||
MemCpy(&doc_e->settings,&doc_in->settings_root,sizeof(CDocSettings));
|
||||
MemCpy(&doc_e->settings,&doc_in->settings_root,
|
||||
sizeof(CDocSettings));
|
||||
else
|
||||
MemCpy(&doc_e->settings,&doc_e->last->settings,sizeof(CDocSettings));
|
||||
src=hl=DocHighlight(doc_e,doc_e->tag,StrLen(doc_e->tag),doc_e->type&0xFF00);
|
||||
MemCpy(&doc_e->settings,&doc_e->last->settings,
|
||||
sizeof(CDocSettings));
|
||||
src=hl=DocHighlight(doc_e,doc_e->tag,StrLen(doc_e->tag),
|
||||
doc_e->type&0xFF00);
|
||||
while (*src) {
|
||||
st_2[0]=*src&0xFF;
|
||||
HtmlPutS(doc_out,*src++,&_old_u32_attr,st_2,&col,style_bitmap);
|
||||
HtmlPutS(doc_out,*src++,&old_u32_attr,st_2,&col,style_bitmap);
|
||||
}
|
||||
Free(hl);
|
||||
} else
|
||||
HtmlPutS(doc_out,doc_e->settings.final_u32_attr,&_old_u32_attr,doc_e->tag,&col,style_bitmap);
|
||||
HtmlPutS(doc_out,doc_e->settings.final_u32_attr,
|
||||
&old_u32_attr,doc_e->tag,&col,style_bitmap);
|
||||
break;
|
||||
case DOCT_TAB:
|
||||
HtmlPutS(doc_out,doc_e->settings.final_u32_attr,&_old_u32_attr,"\t",&col,style_bitmap);
|
||||
HtmlPutS(doc_out,doc_e->settings.final_u32_attr,
|
||||
&old_u32_attr,"\t",&col,style_bitmap);
|
||||
break;
|
||||
case DOCT_HTML_CODE:
|
||||
if (_old_u32_attr!=-1) {
|
||||
if (old_u32_attr!=-1) {
|
||||
DocPrint(doc_out,"</span>");
|
||||
_old_u32_attr=-1;
|
||||
old_u32_attr=-1;
|
||||
}
|
||||
DocPrint(doc_out,"%s",doc_e->tag);
|
||||
break;
|
||||
case DOCT_SPRITE:
|
||||
HtmlPutS(doc_out,doc_e->settings.final_u32_attr,&_old_u32_attr,doc_e->tag,&col,style_bitmap);
|
||||
HtmlPutS(doc_out,doc_e->settings.final_u32_attr,&_old_u32_attr,"/* Graphics Not Rendered in HTML */",&col,style_bitmap);
|
||||
HtmlPutS(doc_out,doc_e->settings.final_u32_attr,
|
||||
&old_u32_attr,doc_e->tag,&col,style_bitmap);
|
||||
HtmlPutS(doc_out,doc_e->settings.final_u32_attr,
|
||||
&old_u32_attr,"/* Graphics Not Rendered in HTML */",
|
||||
&col,style_bitmap);
|
||||
break;
|
||||
default:
|
||||
if (doc_e->de_flags&DOCEF_TAG)
|
||||
HtmlPutS(doc_out,doc_e->settings.final_u32_attr,&_old_u32_attr,doc_e->tag,&col,style_bitmap);
|
||||
HtmlPutS(doc_out,doc_e->settings.final_u32_attr,
|
||||
&old_u32_attr,doc_e->tag,&col,style_bitmap);
|
||||
}
|
||||
if (link_st) {
|
||||
if (_old_u32_attr!=-1) {
|
||||
if (old_u32_attr!=-1) {
|
||||
DocPrint(doc_out,"</span>");
|
||||
_old_u32_attr=-1;
|
||||
old_u32_attr=-1;
|
||||
}
|
||||
DocPrint(doc_out,"</a>");
|
||||
Free(link_st);
|
||||
@@ -250,14 +266,15 @@ public CDoc *Doc2Html(CDoc *doc_in,
|
||||
doc_e=doc_e->next;
|
||||
}
|
||||
while (y++<doc_e->y) {
|
||||
HtmlPutS(doc_out,doc_e->settings.final_u32_attr,&_old_u32_attr,"\n",&col,style_bitmap);
|
||||
HtmlPutS(doc_out,doc_e->settings.final_u32_attr,
|
||||
&old_u32_attr,"\n",&col,style_bitmap);
|
||||
col=0;
|
||||
}
|
||||
if (_old_u32_attr!=-1) {
|
||||
if (_old_u32_attr&DOCET_BLINK)
|
||||
if (old_u32_attr!=-1) {
|
||||
if (old_u32_attr&DOCET_BLINK)
|
||||
DocPrint(doc_out,"</blink>");
|
||||
DocPrint(doc_out,"</span>");
|
||||
_old_u32_attr=-1;
|
||||
old_u32_attr=-1;
|
||||
}
|
||||
DocPrint(doc_out,"%s",body_footer);
|
||||
DocPrint(doc_out,"</pre></body>\n</html>\n");
|
||||
@@ -265,7 +282,10 @@ public CDoc *Doc2Html(CDoc *doc_in,
|
||||
doc_out->cur_entry=style->next;
|
||||
for (i=0;i<256;i++)
|
||||
if (Bt(style_bitmap,i))
|
||||
DocPrint(doc_out,".c%02X{color:#%02x%02x%02x;background-color:#%02x%02x%02x;}\n",i,p[i&15].r,p[i&15].g,p[i&15].b,p[i/16].r,p[i/16].g,p[i/16].b);
|
||||
DocPrint(doc_out,
|
||||
".c%02X{color:#%02x%02x%02x;background-color:#%02x%02x%02x;}\n",
|
||||
i,p[i&15].r>>8,p[i&15].g>>8,p[i&15].b>>8,
|
||||
p[i/16].r>>8,p[i/16].g>>8,p[i/16].b>>8);
|
||||
doc_out->cur_entry=&doc_out->root;
|
||||
DocRecalc(doc_out);
|
||||
|
||||
@@ -289,13 +309,14 @@ public U0 ToHtml(U8 *_in_name,U8 *_out_name=NULL,U8 *html_header=NULL,
|
||||
WinHorz(0,width-1); //Sets doc width for word wrap.
|
||||
|
||||
in_name=DftExt(_in_name,"CPP.Z"),
|
||||
if (_out_name)
|
||||
out_name=DftExt(_out_name,"html");
|
||||
if (_out_name)
|
||||
out_name=DftExt(_out_name,"html");
|
||||
else
|
||||
out_name=ChgExt(_in_name,"html");
|
||||
out_name=ChgExt(_in_name,"html");
|
||||
|
||||
doc_in=DocRead(in_name);
|
||||
doc_out=Doc2Html(doc_in,html_header,body_header,body_footer,line_anchors,link_cvt);
|
||||
doc_out=Doc2Html(doc_in,html_header,body_header,
|
||||
body_footer,line_anchors,link_cvt);
|
||||
StrCpy(&doc_out->filename.name,out_name);
|
||||
|
||||
SettingsPop;
|
||||
|
||||
@@ -111,10 +111,10 @@ public U0 ToTXT(U8 *_in_name,U8 *_out_name=NULL,I64 width=70)
|
||||
WinHorz(0,width-1); //Sets doc width for word wrap.
|
||||
|
||||
in_name=DftExt(_in_name,"TXT.Z"),
|
||||
if (_out_name)
|
||||
out_name=DftExt(_out_name,"TXT");
|
||||
if (_out_name)
|
||||
out_name=DftExt(_out_name,"TXT");
|
||||
else
|
||||
out_name=ChgExt(_in_name,"TXT");
|
||||
out_name=ChgExt(_in_name,"TXT");
|
||||
|
||||
doc_in=DocRead(in_name);
|
||||
doc_out=Doc2TXT(doc_in);
|
||||
|
||||
Binary file not shown.
+25
-19
@@ -1,9 +1,10 @@
|
||||
#help_index "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,
|
||||
FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE};
|
||||
{0,0,0},{1.0,1.0,1.0},
|
||||
0,(MAX_I32+1)>>3,0.0,GetTSC,0.350,0,0,
|
||||
FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE
|
||||
};
|
||||
|
||||
public CWinMgrGlbls winmgr={0,0,0,WMG_FPS,tS,NULL,NULL,FALSE,FALSE,FALSE};
|
||||
winmgr.t=CAlloc(sizeof(CWinMgrTimingGlbls));
|
||||
@@ -20,19 +21,19 @@ U0 DrawProgressBars(CDC *dc)
|
||||
if (m=sys_progresses[i].max) {
|
||||
dc->color=BLACK;
|
||||
GrRect(dc,
|
||||
(GR_WIDTH-PROGRESS_BAR_WIDTH)/2,
|
||||
(GR_HEIGHT-(NUM_PROGRESS_BARS*2-1-i*4)*PROGRESS_BAR_HEIGHT)/2,
|
||||
PROGRESS_BAR_WIDTH,PROGRESS_BAR_HEIGHT);
|
||||
(GR_WIDTH-PROGRESS_BAR_WIDTH)/2,
|
||||
(GR_HEIGHT-(NUM_PROGRESS_BARS*2-1-i*4)*PROGRESS_BAR_HEIGHT)/2,
|
||||
PROGRESS_BAR_WIDTH,PROGRESS_BAR_HEIGHT);
|
||||
|
||||
dc->color=LTGREEN;
|
||||
n=sys_progresses[i].val;
|
||||
if (n>m)
|
||||
n=m;
|
||||
GrRect(dc,
|
||||
(GR_WIDTH-PROGRESS_BAR_WIDTH)/2+2,
|
||||
(GR_HEIGHT-(NUM_PROGRESS_BARS*2-1-i*4)*PROGRESS_BAR_HEIGHT)/2+2,
|
||||
n*(PROGRESS_BAR_WIDTH-4)/m,
|
||||
PROGRESS_BAR_HEIGHT-4);
|
||||
(GR_WIDTH-PROGRESS_BAR_WIDTH)/2+2,
|
||||
(GR_HEIGHT-(NUM_PROGRESS_BARS*2-1-i*4)*PROGRESS_BAR_HEIGHT)/2+2,
|
||||
n*(PROGRESS_BAR_WIDTH-4)/m,
|
||||
PROGRESS_BAR_HEIGHT-4);
|
||||
|
||||
if (m>1) {
|
||||
dc->color=BLACK;
|
||||
@@ -40,10 +41,14 @@ U0 DrawProgressBars(CDC *dc)
|
||||
if (k>19) k=19;
|
||||
for (j=0;j<=k;j++)
|
||||
GrLine(dc,
|
||||
(GR_WIDTH-PROGRESS_BAR_WIDTH)/2+1+j*(PROGRESS_BAR_WIDTH-4)/ToF64(k+1),
|
||||
(GR_HEIGHT-(NUM_PROGRESS_BARS*2-1-i*4)*PROGRESS_BAR_HEIGHT)/2+4,
|
||||
(GR_WIDTH-PROGRESS_BAR_WIDTH)/2+1+j*(PROGRESS_BAR_WIDTH-4)/ToF64(k+1),
|
||||
(GR_HEIGHT-(NUM_PROGRESS_BARS*2-3-i*4)*PROGRESS_BAR_HEIGHT)/2-4);
|
||||
(GR_WIDTH-PROGRESS_BAR_WIDTH)/2+1+j*
|
||||
(PROGRESS_BAR_WIDTH-4)/ToF64(k+1),
|
||||
(GR_HEIGHT-(NUM_PROGRESS_BARS*2-1-i*4)*
|
||||
PROGRESS_BAR_HEIGHT)/2+4,
|
||||
(GR_WIDTH-PROGRESS_BAR_WIDTH)/2+1+j*
|
||||
(PROGRESS_BAR_WIDTH-4)/ToF64(k+1),
|
||||
(GR_HEIGHT-(NUM_PROGRESS_BARS*2-3-i*4)*
|
||||
PROGRESS_BAR_HEIGHT)/2-4);
|
||||
}
|
||||
|
||||
dc->color=WHITE;
|
||||
@@ -52,8 +57,8 @@ U0 DrawProgressBars(CDC *dc)
|
||||
else
|
||||
st=MStrPrint("%d/%d",n,m);
|
||||
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);
|
||||
(GR_HEIGHT-FONT_HEIGHT-
|
||||
(NUM_PROGRESS_BARS*2-2-i*4)*PROGRESS_BAR_HEIGHT)/2,"%s",st);
|
||||
Free(st);
|
||||
}
|
||||
}
|
||||
@@ -193,7 +198,8 @@ U0 WinIPUpdate()
|
||||
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]);
|
||||
IPVarsUpdate(mouse.pos.x,mouse.pos.y,mouse.pos.z,
|
||||
mouse.buttons[0],mouse.buttons[1]);
|
||||
mouse.evt=FALSE;
|
||||
set=TRUE;
|
||||
}
|
||||
@@ -255,7 +261,7 @@ I64 WinOnTopWindows()
|
||||
return result;
|
||||
}
|
||||
if (Bt(&task->display_flags,DISPLAYf_WIN_ON_TOP) &&
|
||||
task!=sys_winmgr_task->last_task) {
|
||||
task!=sys_winmgr_task->last_task) {
|
||||
TaskQueRem(task);
|
||||
TaskQueIns(task,sys_winmgr_task);
|
||||
result++;
|
||||
@@ -300,7 +306,7 @@ public I64 WinToTop(CTask *task=NULL,Bool update_z_buf=TRUE)
|
||||
task1=task1->next_sibling_task;
|
||||
}
|
||||
if (task->popup_task &&
|
||||
task->popup_task->parent_task==task)
|
||||
task->popup_task->parent_task==task)
|
||||
result+=WinToTop(task->popup_task,FALSE);
|
||||
}
|
||||
POPFD
|
||||
|
||||
+61
-50
@@ -2,13 +2,13 @@
|
||||
|
||||
public U0 WinMgrSync(I64 cnt=1,Bool force=FALSE)
|
||||
{//Wait for win manager to start and finish updating screen.
|
||||
//0 Cnt Sync to WinMgr. (not used)
|
||||
//1 Cnt Wait and Pump Msgs.
|
||||
//2 Cnt Make Sure to do a Full Refresh
|
||||
// and Set Cur Pos.
|
||||
Bool old_preempt=Preempt(OFF),
|
||||
old_full_refresh,
|
||||
old_idle=LBts(&Fs->task_flags,TASKf_IDLE);
|
||||
//0 Cnt Sync to WinMgr. (not used)
|
||||
//1 Cnt Wait and Pump Msgs.
|
||||
//2 Cnt Make Sure to do a Full Refresh
|
||||
// and Set Cur Pos.
|
||||
Bool old_preempt=Preempt,
|
||||
old_full_refresh,
|
||||
old_idle=LBts(&Fs->task_flags,TASKf_IDLE);
|
||||
CDoc *old_doc=DocPut;
|
||||
I64 update_cnt;
|
||||
while (Bt(&sys_semas[SYS_SEMA_REFRESH_IN_PROGRESS],0)) {
|
||||
@@ -51,24 +51,24 @@ I64 WinQueIPMsgs(Bool que)
|
||||
if (old_ip.presnap.x!=ip.presnap.x || old_ip.presnap.y!=ip.presnap.y) {
|
||||
if (que)
|
||||
TaskMsg(task_focus,0,
|
||||
MSG_IP_MOVE,a1,a2,0);
|
||||
MSG_IP_MOVE,a1,a2,0);
|
||||
msg_code=MSG_IP_MOVE;
|
||||
}
|
||||
//TODO que msg for ip.pos.z?
|
||||
//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) {
|
||||
if (que)
|
||||
TaskMsg(task_focus,0,
|
||||
MSG_IP_L_D_DOWN,a1,a2,0);
|
||||
MSG_IP_L_D_DOWN,a1,a2,0);
|
||||
ip.left_down_sent=TRUE;
|
||||
msg_code=MSG_IP_L_D_DOWN;
|
||||
}
|
||||
if (!ip.lb) {
|
||||
if (que)
|
||||
TaskMsg(task_focus,0,
|
||||
MSG_IP_L_D_UP,a1,a2,0);
|
||||
MSG_IP_L_D_UP,a1,a2,0);
|
||||
ip.left_dbl_time=0;
|
||||
msg_code=MSG_IP_L_D_UP;
|
||||
}
|
||||
@@ -76,14 +76,14 @@ I64 WinQueIPMsgs(Bool que)
|
||||
if (!ip.left_down_sent) {
|
||||
if (que)
|
||||
TaskMsg(task_focus,0,
|
||||
MSG_IP_L_DOWN,single_a1,single_a2,0);
|
||||
MSG_IP_L_DOWN,single_a1,single_a2,0);
|
||||
ip.left_down_sent=TRUE;
|
||||
msg_code=MSG_IP_L_DOWN;
|
||||
}
|
||||
if (!ip.lb) {
|
||||
if (que)
|
||||
TaskMsg(task_focus,0,
|
||||
MSG_IP_L_UP,a1,a2,0);
|
||||
MSG_IP_L_UP,a1,a2,0);
|
||||
ip.left_dbl_time=0;
|
||||
msg_code=MSG_IP_L_UP;
|
||||
}
|
||||
@@ -96,16 +96,16 @@ I64 WinQueIPMsgs(Bool que)
|
||||
}
|
||||
} else {
|
||||
if (TaskValidate(task_focus) &&
|
||||
Bt(&task_focus->win_inhibit,WIf_FOCUS_TASK_IP_L_D)) {
|
||||
Bt(&task_focus->win_inhibit,WIf_FOCUS_TASK_IP_L_D)) {
|
||||
if (ip.lb && !ip_last.lb) {
|
||||
if (que)
|
||||
TaskMsg(task_focus,0,
|
||||
MSG_IP_L_DOWN,a1,a2,0);
|
||||
MSG_IP_L_DOWN,a1,a2,0);
|
||||
msg_code=MSG_IP_L_DOWN;
|
||||
} else if (!ip.lb && ip_last.lb) {
|
||||
if (que)
|
||||
TaskMsg(task_focus,0,
|
||||
MSG_IP_L_UP,a1,a2,0);
|
||||
MSG_IP_L_UP,a1,a2,0);
|
||||
msg_code=MSG_IP_L_UP;
|
||||
}
|
||||
} else {
|
||||
@@ -125,14 +125,14 @@ I64 WinQueIPMsgs(Bool que)
|
||||
if (!ip.right_down_sent) {
|
||||
if (que)
|
||||
TaskMsg(task_focus,0,
|
||||
MSG_IP_R_D_DOWN,a1,a2,0);
|
||||
MSG_IP_R_D_DOWN,a1,a2,0);
|
||||
ip.right_down_sent=TRUE;
|
||||
msg_code=MSG_IP_R_D_DOWN;
|
||||
}
|
||||
if (!ip.rb) {
|
||||
if (que)
|
||||
TaskMsg(task_focus,0,
|
||||
MSG_IP_R_D_UP,a1,a2,0);
|
||||
MSG_IP_R_D_UP,a1,a2,0);
|
||||
ip.right_dbl_time=0;
|
||||
msg_code=MSG_IP_R_D_UP;
|
||||
}
|
||||
@@ -140,14 +140,14 @@ I64 WinQueIPMsgs(Bool que)
|
||||
if (!ip.right_down_sent) {
|
||||
if (que)
|
||||
TaskMsg(task_focus,0,
|
||||
MSG_IP_R_DOWN,single_a1,single_a2,0);
|
||||
MSG_IP_R_DOWN,single_a1,single_a2,0);
|
||||
ip.right_down_sent=TRUE;
|
||||
msg_code=MSG_IP_R_DOWN;
|
||||
}
|
||||
if (!ip.rb) {
|
||||
if (que)
|
||||
TaskMsg(task_focus,0,
|
||||
MSG_IP_R_UP,a1,a2,0);
|
||||
MSG_IP_R_UP,a1,a2,0);
|
||||
ip.right_dbl_time=0;
|
||||
msg_code=MSG_IP_R_UP;
|
||||
}
|
||||
@@ -160,16 +160,16 @@ I64 WinQueIPMsgs(Bool que)
|
||||
}
|
||||
} else {
|
||||
if (TaskValidate(task_focus) &&
|
||||
Bt(&task_focus->win_inhibit,WIf_FOCUS_TASK_IP_R_D)) {
|
||||
Bt(&task_focus->win_inhibit,WIf_FOCUS_TASK_IP_R_D)) {
|
||||
if (ip.rb && !ip_last.rb) {
|
||||
if (que)
|
||||
TaskMsg(task_focus,0,
|
||||
MSG_IP_R_DOWN,a1,a2,0);
|
||||
MSG_IP_R_DOWN,a1,a2,0);
|
||||
msg_code=MSG_IP_R_DOWN;
|
||||
} else if (!ip.rb && ip_last.rb) {
|
||||
if (que)
|
||||
TaskMsg(task_focus,0,
|
||||
MSG_IP_R_UP,a1,a2,0);
|
||||
MSG_IP_R_UP,a1,a2,0);
|
||||
msg_code=MSG_IP_R_UP;
|
||||
}
|
||||
} else {
|
||||
@@ -196,7 +196,8 @@ U0 WinCalcIdles()
|
||||
CCPU *c;
|
||||
CWinMgrTimingGlbls *t=winmgr.t;
|
||||
|
||||
if ((t->calc_idle_delta_time=(calc_idle_time=tS)-t->last_calc_idle_time)>.25) {
|
||||
if ((t->calc_idle_delta_time=
|
||||
(calc_idle_time=tS)-t->last_calc_idle_time)>.25) {
|
||||
PUSHFD
|
||||
CLI
|
||||
total_jiffies=cpu_structs[0].total_jiffies;
|
||||
@@ -247,7 +248,7 @@ I64 WinMgrSleep(Bool flush_msgs=FALSE)
|
||||
|
||||
que=TRUE;
|
||||
if (TaskValidate(sys_focus_task) &&
|
||||
!Bt(&sys_focus_task->win_inhibit,WIf_FOCUS_TASK_CTRLS)) {
|
||||
!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)) {
|
||||
@@ -290,12 +291,14 @@ I64 WinMgrSleep(Bool flush_msgs=FALSE)
|
||||
do {
|
||||
KbdMouseHandler(FALSE,TRUE);
|
||||
SleepUntil(MinI64(timeout_val,cnts.jiffies+JIFFY_FREQ/500));
|
||||
} while (cnts.jiffies<timeout_val && !Bt(&sys_semas[SYS_SEMA_FORCE_WINMGR],0));
|
||||
} while (cnts.jiffies<timeout_val &&
|
||||
!Bt(&sys_semas[SYS_SEMA_FORCE_WINMGR],0));
|
||||
LBtr(&sys_semas[SYS_SEMA_FORCE_WINMGR],0);
|
||||
return msg_code;
|
||||
}
|
||||
|
||||
CDoc *WinCursorPosSet(CTask *task,I64 ip_text_x,I64 ip_text_y,Bool set_cursor=TRUE)
|
||||
CDoc *WinCursorPosSet(CTask *task,I64 ip_text_x,
|
||||
I64 ip_text_y,Bool set_cursor=TRUE)
|
||||
{
|
||||
CDoc *result=NULL;
|
||||
Bool unlock;
|
||||
@@ -303,7 +306,7 @@ CDoc *WinCursorPosSet(CTask *task,I64 ip_text_x,I64 ip_text_y,Bool set_cursor=TR
|
||||
if (!task) task=Fs;
|
||||
if (!TaskValidate(task)) return FALSE;
|
||||
if (task->win_top <=ip_text_y<=task->win_bottom &&
|
||||
task->win_left<=ip_text_x<=task->win_right) {
|
||||
task->win_left<=ip_text_x<=task->win_right) {
|
||||
if ((result=DocDisplay(task)) && result->flags&DOCF_DONT_SHOW)
|
||||
result=NULL;
|
||||
else if (set_cursor) {
|
||||
@@ -312,7 +315,7 @@ CDoc *WinCursorPosSet(CTask *task,I64 ip_text_x,I64 ip_text_y,Bool set_cursor=TR
|
||||
result=NULL;
|
||||
else {
|
||||
x0=result->line_start_col;
|
||||
y0=result->cur_top_line_num;
|
||||
y0=result->top_line_num;
|
||||
DocRecalc(result,TRUE);
|
||||
result->x=ip_text_x-task->win_left-task->scroll_x/FONT_WIDTH +x0;
|
||||
result->y=ip_text_y-task->win_top -task->scroll_y/FONT_HEIGHT+y0;
|
||||
@@ -334,9 +337,10 @@ U0 WinChkMoveSize(CTask *task)
|
||||
if (task->win_left!=task->win_old_left || task->win_top!=task->win_old_top)
|
||||
TaskMsg(task,0,MSG_MOVE,task->win_left,task->win_top,0);
|
||||
if (task->win_right-task->win_left!=task->win_old_right-task->win_old_left ||
|
||||
task->win_bottom-task->win_top!=task->win_old_bottom-task->win_old_top)
|
||||
task->win_bottom-task->win_top!=task->win_old_bottom-task->win_old_top)
|
||||
TaskMsg(task,0,
|
||||
MSG_RESIZE,task->win_right-task->win_left+1,task->win_bottom-task->win_top+1,0);
|
||||
MSG_RESIZE,task->win_right-task->win_left+1,
|
||||
task->win_bottom-task->win_top+1,0);
|
||||
task->win_old_left =task->win_left;
|
||||
task->win_old_right =task->win_right;
|
||||
task->win_old_top =task->win_top;
|
||||
@@ -404,11 +408,9 @@ Bool WinKeyNavMenu()
|
||||
if (!sys_cur_submenu_entry)
|
||||
ip.pos.y=new_pos.y=0;
|
||||
}
|
||||
if (sys_cur_submenu_entry) {
|
||||
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);
|
||||
Noise(30,6000,8000);
|
||||
}
|
||||
sys_cur_submenu_entry->a1,sys_cur_submenu_entry->a2,0);
|
||||
winmgr.show_menu=FALSE;
|
||||
ip.pos.x=old_pos.x; ip.pos.y=old_pos.y;
|
||||
return TRUE;
|
||||
@@ -439,7 +441,7 @@ U0 WinMgrTask(I64)
|
||||
try {
|
||||
wmt_start:
|
||||
WinMgrSleep;
|
||||
//We delay freeing in case lingering
|
||||
//We delay freeing in case lingering
|
||||
//references are made to task's.
|
||||
TaskFinishOffDying;
|
||||
|
||||
@@ -497,13 +499,11 @@ wmt_start:
|
||||
winmgr.show_menu=TRUE;
|
||||
while (ip.lb)
|
||||
WinMgrSleep(TRUE);
|
||||
if (sys_cur_submenu_entry) {
|
||||
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);
|
||||
Noise(30,6000,8000);
|
||||
}
|
||||
winmgr.show_menu=FALSE;
|
||||
old_ip.lb=FALSE;
|
||||
goto wmt_start;
|
||||
@@ -513,7 +513,8 @@ wmt_start:
|
||||
|
||||
//grab scroll
|
||||
if (!Bt(&task->win_inhibit,WIf_SELF_GRAB_SCROLL) &&
|
||||
(!TaskValidate(sys_focus_task)||!Bt(&sys_focus_task->win_inhibit,WIf_FOCUS_TASK_GRAB_SCROLL)) &&
|
||||
(!TaskValidate(sys_focus_task)||
|
||||
!Bt(&sys_focus_task->win_inhibit,WIf_FOCUS_TASK_GRAB_SCROLL)) &&
|
||||
kbd.scan_code&SCF_CTRL && TaskValidate(task)) {
|
||||
winmgr.grab_scroll_closed=FALSE;
|
||||
winmgr.grab_scroll=TRUE;
|
||||
@@ -543,7 +544,8 @@ wmt_start:
|
||||
winmgr.grab_scroll=FALSE;
|
||||
|
||||
if (!Bt(&task->win_inhibit,WIf_SELF_CTRLS) &&
|
||||
(!TaskValidate(sys_focus_task)||!Bt(&sys_focus_task->win_inhibit,WIf_FOCUS_TASK_CTRLS))) {
|
||||
(!TaskValidate(sys_focus_task)||
|
||||
!Bt(&sys_focus_task->win_inhibit,WIf_FOCUS_TASK_CTRLS))) {
|
||||
if (ip.lb && !old_ip.lb) {
|
||||
c=task->next_ctrl;
|
||||
while (c!=&task->next_ctrl) {
|
||||
@@ -661,7 +663,8 @@ wmt_start:
|
||||
goto wmt_start;
|
||||
|
||||
if (!Bt(&task->win_inhibit,WIf_SELF_IP_L)&&
|
||||
(!TaskValidate(sys_focus_task)||!Bt(&sys_focus_task->win_inhibit,WIf_FOCUS_TASK_IP_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_text.x,ip.pos_text.y)) {
|
||||
DocLock(doc);
|
||||
@@ -679,7 +682,8 @@ wmt_start:
|
||||
}
|
||||
}
|
||||
if (!Bt(&task->win_inhibit,WIf_SELF_IP_R)&&
|
||||
(!TaskValidate(sys_focus_task)||!Bt(&sys_focus_task->win_inhibit,WIf_FOCUS_TASK_IP_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_text.x,ip.pos_text.y)) {
|
||||
old_ip.rb=TRUE;
|
||||
@@ -688,7 +692,8 @@ 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))) {
|
||||
(!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) {
|
||||
@@ -707,7 +712,8 @@ wmt_start:
|
||||
}
|
||||
}
|
||||
if (!Bt(&task->win_inhibit,WIf_SELF_IP_L)&&
|
||||
(!TaskValidate(sys_focus_task)||!Bt(&sys_focus_task->win_inhibit,WIf_FOCUS_TASK_IP_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_text.x,ip.pos_text.y,FALSE)) {
|
||||
do msg_code=WinMgrSleep;
|
||||
@@ -723,7 +729,8 @@ wmt_start:
|
||||
if (doc_e!=doc) {
|
||||
if (doc_e->de_flags & DOCEF_HAS_BORDER)
|
||||
doc_e->de_flags&=~DOCEF_SOLID_BORDER;
|
||||
if (doc_e->de_flags & (DOCEF_TREE|DOCEF_LST|DOCEF_LINK|DOCEF_CHECK_COLLAPSABLE|
|
||||
if (doc_e->de_flags & (DOCEF_TREE|DOCEF_LST|
|
||||
DOCEF_LINK|DOCEF_CHECK_COLLAPSABLE|
|
||||
DOCEF_LEFT_CB|DOCEF_LEFT_MACRO|DOCEF_LEFT_EXP))
|
||||
TaskMsg(task,0,MSG_KEY_DOWN,CH_SPACE,0,0);
|
||||
}
|
||||
@@ -741,7 +748,8 @@ wmt_start:
|
||||
}
|
||||
|
||||
if (!Bt(&task->win_inhibit,WIf_SELF_IP_R)&&
|
||||
(!TaskValidate(sys_focus_task)||!Bt(&sys_focus_task->win_inhibit,WIf_FOCUS_TASK_IP_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_text.x,ip.pos_text.y,FALSE)) {
|
||||
do msg_code=WinMgrSleep;
|
||||
@@ -773,7 +781,8 @@ 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))) {
|
||||
(!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) {
|
||||
@@ -805,7 +814,8 @@ wmt_start:
|
||||
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);
|
||||
WinVert(ip.pos_text.y-y,
|
||||
task->win_height-1+ip.pos_text.y-y,task);
|
||||
WinChkMoveSize(task);
|
||||
WinMgrSleep;
|
||||
}
|
||||
@@ -813,7 +823,8 @@ wmt_start:
|
||||
old_ip.lb=FALSE;
|
||||
goto wmt_start;
|
||||
}
|
||||
if (task->win_right+1==ip.pos_text.x && task->win_bottom+1==ip.pos_text.y) {
|
||||
if (task->win_right+1==ip.pos_text.x &&
|
||||
task->win_bottom+1==ip.pos_text.y) {
|
||||
if (ip.lb) {
|
||||
WinToTop(task);
|
||||
while (ip.lb && TaskValidate(task)) {
|
||||
|
||||
+13
-13
@@ -11,24 +11,24 @@ U0 InsTime()
|
||||
Bool MyPutKey(I64 ch,I64 sc)
|
||||
{//ch=ASCII; sc=scan_code
|
||||
|
||||
//See $LK,"Char",A="HI:Char"$ for definition of scan codes.
|
||||
//See $LK,"Key Allocations",A="FI:::/Doc/KeyAlloc.TXT"$.
|
||||
//See $LK,"Keyboard Devices",A="HI:Keyboard Devices/System"$.
|
||||
//See $LK,"Char",A="HI:Char"$ for definition of scan codes.
|
||||
//See $LK,"Key Allocations",A="FI:::/Doc/KeyAlloc.TXT"$.
|
||||
//See $LK,"Keyboard Devices",A="HI:Keyboard Devices/System"$.
|
||||
|
||||
//You can customize keys. This routine
|
||||
//is called before the main editor
|
||||
//key handler $LK,"DocPutKey",A="MN:DocPutKey"$().
|
||||
//You can intercept any key.
|
||||
//You can customize keys. This routine
|
||||
//is called before the main editor
|
||||
//key handler $LK,"DocPutKey",A="MN:DocPutKey"$().
|
||||
//You can intercept any key.
|
||||
|
||||
//Return TRUE if you completely
|
||||
//handled the key.
|
||||
//Return TRUE if you completely
|
||||
//handled the key.
|
||||
|
||||
I64 i,sc2=sc.u8[0];
|
||||
U8 *st1,*st2;
|
||||
|
||||
if (SC_F1<=sc2<=SC_F10 &&
|
||||
sc&SCF_ALT &&
|
||||
!(sc & SCF_CTRL)) {
|
||||
sc&SCF_ALT &&
|
||||
!(sc & SCF_CTRL)) {
|
||||
switch (sc2) {
|
||||
case SC_F1:
|
||||
if (sc&SCF_KEY_DESC) {
|
||||
@@ -141,7 +141,7 @@ Bool MyPutKey(I64 ch,I64 sc)
|
||||
DocPrint(sys_clipboard_doc,"$$LK,\"BF:%s\"$$",st1);
|
||||
} else
|
||||
DocPrint(sys_clipboard_doc,"$$LK,\"FL:%s,%d\"$$",
|
||||
st2,DocPut->cur_entry->y+1);
|
||||
st2,DocPut->cur_entry->y+1);
|
||||
Free(st1);
|
||||
Free(st2);
|
||||
}
|
||||
@@ -153,7 +153,7 @@ Bool MyPutKey(I64 ch,I64 sc)
|
||||
i=RandU32;
|
||||
ClipboardDel;
|
||||
DocPrint(sys_clipboard_doc,"$$LK,\"<TODO>\",A=\"FA:%s,ANC%d\"$$",
|
||||
DocPut->filename.name,i);
|
||||
DocPut->filename.name,i);
|
||||
"$$AN,\"<TODO>\",A=\"ANC%d\"$$",i;
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
+6
-6
@@ -4,18 +4,18 @@
|
||||
Cd("/Adam/Boot");;
|
||||
#include "Boot"
|
||||
Cd("/Adam/Utils");;
|
||||
#include "Profiler"
|
||||
#include "Diff"
|
||||
#include "FileBMP"
|
||||
#include "Find"
|
||||
#include "LineRep"
|
||||
#include "Merge"
|
||||
#include "S2T"
|
||||
#include "LinkChk"
|
||||
#include "HeapLog"
|
||||
#include "LineRep"
|
||||
#include "LinkChk"
|
||||
#include "MemRep"
|
||||
#include "Merge"
|
||||
#include "Profiler"
|
||||
#include "StrUtils"
|
||||
#include "ToHtml"
|
||||
#include "ToTXT"
|
||||
#include "FileBMP"
|
||||
|
||||
MapFileLoad("::/Kernel/Kernel");
|
||||
MapFileLoad("::/Compiler/Compiler");
|
||||
|
||||
Loaded 100 of 554 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user