TempleOSCD_150720.ISO
This commit is contained in:
1 parent
401601816c
commit
f8c05f98f4
488 files changed
+22817
-21624
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);};
|
||||
|
||||
+12
-7
@@ -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)
|
||||
@@ -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);
|
||||
|
||||
+23
-64
@@ -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))
|
||||
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);
|
||||
DocPrint(doc,"$$LK,\"%-20s\",A=\"%s\"$$",
|
||||
ptr->str,ptr(CHashSrcSym *)->src_link);
|
||||
if (index)
|
||||
comment=HelpComment(task,ptr,src_link);
|
||||
}
|
||||
Free(src_link);
|
||||
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
|
||||
} else if (ptr->type & HTT_GLBL_VAR)
|
||||
StrPrint(buf,"%010X ",ptr(CHashGlblVar *)->data_addr);
|
||||
} else
|
||||
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);
|
||||
}
|
||||
}
|
||||
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.
|
||||
@@ -397,12 +356,12 @@ public I64 HashDepthRep(CHashTable *table=NULL)
|
||||
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"),
|
||||
|
||||
+1
-1
@@ -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;
|
||||
|
||||
+18
-16
@@ -189,7 +189,8 @@ 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,
|
||||
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;
|
||||
@@ -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",
|
||||
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");
|
||||
}
|
||||
}
|
||||
+7
-4
@@ -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
|
||||
@@ -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;
|
||||
@@ -190,7 +192,8 @@ U0 TaskRepTask(CTask *task,I64 indent)
|
||||
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.
@@ -50,7 +50,8 @@ public U8 *ACDDefGet(U8 *st,I64 def_num=1)
|
||||
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) {
|
||||
@@ -93,7 +94,8 @@ public U8 *ACDDefsGet(U8 *st)
|
||||
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) {
|
||||
@@ -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,8 +68,9 @@ 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);
|
||||
@@ -41,8 +82,8 @@ ncmd_done:
|
||||
|
||||
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;
|
||||
@@ -107,10 +148,10 @@ 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,
|
||||
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,
|
||||
@@ -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.
+4
-3
@@ -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.
|
||||
@@ -36,7 +36,7 @@ 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 &&
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
@@ -108,7 +108,7 @@ 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
|
||||
{//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;
|
||||
@@ -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 {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 {
|
||||
@@ -149,7 +150,8 @@ I64 CDFileCreate2(CFile *out_file,CDirEntry *tempde,
|
||||
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;
|
||||
}
|
||||
@@ -158,7 +160,8 @@ I64 CDFileCreate2(CFile *out_file,CDirEntry *tempde,
|
||||
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) {
|
||||
@@ -323,8 +328,8 @@ 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.
|
||||
@@ -333,9 +338,8 @@ public I64 CDFileCreate(U8 *_filename=NULL,U8 *src_files_find_mask,U8 *fu_flags=
|
||||
*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,
|
||||
@@ -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,7 +508,8 @@ 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);
|
||||
} else {
|
||||
+38
-22
@@ -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)
|
||||
@@ -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;
|
||||
@@ -145,15 +145,21 @@ U0 WinDerivedScrollValsUpdate(CCtrl *c)
|
||||
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,25 +249,33 @@ 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;
|
||||
@@ -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,8 +21,9 @@ 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);
|
||||
@@ -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,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,7 +85,8 @@ 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);
|
||||
|
||||
@@ -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,
|
||||
@@ -184,7 +189,7 @@ CCtrl *SliderNew()
|
||||
" 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");
|
||||
|
||||
|
||||
+4
-2
@@ -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;
|
||||
@@ -185,7 +186,8 @@ 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);
|
||||
|
||||
+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
|
||||
|
||||
+125
-65
@@ -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==')' &&
|
||||
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->lx1->token!=':' ||
|
||||
if (rx->was_new_line && (rx->cc1->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);
|
||||
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:
|
||||
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);
|
||||
@@ -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,7 +438,7 @@ 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);
|
||||
@@ -403,20 +446,24 @@ U0 EdCodeTools2(CDoc *doc,I64 tool_action)
|
||||
st2=DirFile(prj_file),
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
|
||||
+78
-65
@@ -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,7 +916,7 @@ 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,,,
|
||||
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"
|
||||
@@ -938,7 +951,7 @@ 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);
|
||||
@@ -1005,13 +1018,13 @@ U0 EdInsDollarCmd()
|
||||
}
|
||||
}
|
||||
|
||||
#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;
|
||||
}
|
||||
|
||||
+134
-132
@@ -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,7 +24,7 @@ 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 ||
|
||||
@@ -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,11 +97,12 @@ 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->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)
|
||||
@@ -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)
|
||||
} else if (doc->cur_col==doc_ce->min_col && doc_ce->last!=doc)
|
||||
doc_ce=doc_ce->last;
|
||||
} else
|
||||
if (doc_ce->last!=doc)
|
||||
} 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,7 +228,7 @@ 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)||
|
||||
@@ -231,29 +237,26 @@ public U0 EdLineUp(CDoc *doc,I64 sc=MIN_I64)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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) ||
|
||||
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)
|
||||
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->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_data_col;
|
||||
doc_ne->x=doc_ce->x+doc->cur_data_col;
|
||||
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_data_col=doc_ce->min_col;
|
||||
}
|
||||
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 (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,20 +464,19 @@ 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))) {
|
||||
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|
|
||||
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;
|
||||
@@ -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;
|
||||
@@ -572,7 +573,7 @@ ic_overstrike_char:
|
||||
!(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,9 +653,11 @@ 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)) &&
|
||||
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++) {
|
||||
@@ -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,10 +708,10 @@ 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 &&
|
||||
@@ -719,11 +721,11 @@ U0 DocEntryToggle(CDoc *doc)
|
||||
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);
|
||||
|
||||
+39
-31
@@ -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
|
||||
@@ -480,9 +483,11 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
KeyDescSet("God Song");
|
||||
} else {
|
||||
//$LK,"::/Adam/God/HSNotes.TXT"$
|
||||
if (sc & SCF_SHIFT)
|
||||
if (sc & SCF_SHIFT) {
|
||||
DocUnlock(doc);
|
||||
GodDoodle;
|
||||
else
|
||||
DocLock(doc);
|
||||
} else
|
||||
GodSong;
|
||||
}
|
||||
break;
|
||||
@@ -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,7 +700,7 @@ public U0 DocPrintPartial(CDoc *doc,U8 *fmt,...)
|
||||
DocPutKey(doc,ch,0);
|
||||
else
|
||||
while (ch=*ptr) {
|
||||
if (!Bt(chars_bitmap_safe_dollar,ch) ||
|
||||
if (!Bt(chars_bmp_safe_dollar,ch) ||
|
||||
doc->flags & (DOCF_OVERSTRIKE | DOCF_IN_DOLLAR)) {
|
||||
DocPutKey(doc,ch,0);
|
||||
ptr++;
|
||||
@@ -701,7 +708,7 @@ public U0 DocPrintPartial(CDoc *doc,U8 *fmt,...)
|
||||
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;
|
||||
|
||||
+25
-18
@@ -81,7 +81,8 @@ 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)) &&
|
||||
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)) ||
|
||||
@@ -113,12 +114,14 @@ public U8 *DocSave(CDoc *doc,I64 *_size=NULL)
|
||||
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->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=='$$') {
|
||||
@@ -127,7 +130,8 @@ public U8 *DocSave(CDoc *doc,I64 *_size=NULL)
|
||||
*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))
|
||||
@@ -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);
|
||||
@@ -209,16 +214,16 @@ public U0 DocInsDoc(CDoc *doc=NULL,CDoc *doc2)
|
||||
unlock_doc=DocLock(doc),
|
||||
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;
|
||||
@@ -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)
|
||||
@@ -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);
|
||||
|
||||
+45
-36
@@ -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;
|
||||
@@ -193,7 +197,7 @@ public Bool EdFindPaired(CDoc *doc,U8 plus,U8 minus,Bool fwd,Bool abort_on_dbl_c
|
||||
!(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;
|
||||
}
|
||||
}
|
||||
@@ -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)
|
||||
@@ -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++;
|
||||
@@ -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
|
||||
|
||||
+15
-15
@@ -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;
|
||||
|
||||
+10
-10
@@ -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;
|
||||
@@ -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;
|
||||
@@ -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,7 +128,7 @@ 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\"$$",
|
||||
@@ -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);
|
||||
JobResultScan(tempc,&result);
|
||||
Fs->popup_task=NULL;
|
||||
Kill(sys_macro_util_task);
|
||||
sys_macro_util_task=NULL;
|
||||
|
||||
+30
-20
@@ -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))
|
||||
@@ -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)) {
|
||||
@@ -67,10 +67,16 @@ public Bool DocLinkChk(U8 *link_st)
|
||||
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);
|
||||
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;
|
||||
@@ -292,9 +299,10 @@ U8 *DocGetStr2(I64 flags=0)
|
||||
}
|
||||
}
|
||||
//<CTRL-SHIFT-ENTER> is a blank line without entry
|
||||
} while (flags&GSF_WITH_NEW_LINE || ch!='\n' || sc & SCF_CTRL && sc & SCF_SHIFT);
|
||||
} 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) {
|
||||
@@ -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;
|
||||
|
||||
+18
-17
@@ -271,7 +271,7 @@ U0 DocFormFwd(CDoc *doc,Bool giveup=FALSE)
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -298,7 +298,7 @@ U0 DocFormBwd(CDoc *doc,Bool giveup=FALSE)
|
||||
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);
|
||||
@@ -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);
|
||||
@@ -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)
|
||||
@@ -650,7 +650,7 @@ 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.
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
+103
-92
@@ -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);
|
||||
@@ -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 {
|
||||
@@ -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.
|
||||
//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 (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,34 +547,34 @@ 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 &&
|
||||
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
|
||||
@@ -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
|
||||
|
||||
+88
-65
@@ -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,8 +53,10 @@ 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)) &&
|
||||
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);
|
||||
@@ -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,7 +193,7 @@ 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,
|
||||
@@ -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,
|
||||
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,7 +626,7 @@ 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),
|
||||
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);
|
||||
@@ -720,7 +731,8 @@ 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),
|
||||
@@ -731,7 +743,9 @@ public I64 PopUpFile(U8 *filename,Bool warn_ext=TRUE,CTask *parent=NULL,CTask **
|
||||
!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,7 +774,7 @@ 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)
|
||||
@@ -771,15 +786,20 @@ public I64 PopUpColorLighting(U8 *header=NULL)
|
||||
"\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++) {
|
||||
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);
|
||||
|
||||
+98
-73
@@ -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;
|
||||
@@ -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;
|
||||
@@ -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,
|
||||
@@ -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,7 +604,8 @@ 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|
|
||||
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;
|
||||
@@ -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);
|
||||
@@ -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);
|
||||
|
||||
+16
-14
@@ -17,7 +17,8 @@ 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)) {
|
||||
else if (i==k && doc_e->de_flags&DOCEF_TREE &&
|
||||
!StrCmp(doc_e->tag+3,st2)) {
|
||||
if (*st1)
|
||||
break;
|
||||
else {
|
||||
@@ -66,7 +67,7 @@ public Bool DocTreeMake(CDoc *doc,U8 *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,10 +76,11 @@ 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)) {
|
||||
} else if (i==k && doc_e->de_flags&DOCEF_TREE &&
|
||||
!StrCmp(doc_e->tag+3,st2)) {
|
||||
Free(st3);
|
||||
st3=StrNew(st1);
|
||||
j=i;
|
||||
@@ -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;
|
||||
|
||||
+20
-17
@@ -98,13 +98,13 @@ public Bool Copy(U8 *src_files_find_mask,U8 *dst_files_find_mask=".")
|
||||
//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,7 +261,8 @@ 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
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
+8
-4
@@ -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;
|
||||
@@ -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;
|
||||
@@ -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++)
|
||||
|
||||
+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')
|
||||
|
||||
+43
-20
@@ -1,4 +1,4 @@
|
||||
#help_index "God;Graphics/Sprite"
|
||||
#help_index "God;Graphics/Sprite;Sprites"
|
||||
|
||||
U0 GodDoodleDraw(CTask *task,CDC *dc)
|
||||
{
|
||||
@@ -6,13 +6,16 @@ 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,
|
||||
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,
|
||||
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,
|
||||
GrPrint(dc,(task->pix_width-FONT_WIDTH*25)>>1,
|
||||
(task->pix_height-FONT_HEIGHT)>>1,
|
||||
"Press <SPACE> repeatedly.");
|
||||
}
|
||||
}
|
||||
@@ -20,7 +23,8 @@ U0 GodDoodleDraw(CTask *task,CDC *dc)
|
||||
|
||||
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,17 +124,20 @@ 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-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/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-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:
|
||||
@@ -126,7 +149,7 @@ public U8 *GodDoodleSprite()
|
||||
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
+14
-8
@@ -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,11 +19,12 @@ 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 color; //Give one of 0-7 colors.
|
||||
//Colors 8-15 are 0-7 with intensity bit set.
|
||||
I32 nums[3]; //Vertex number
|
||||
};
|
||||
|
||||
@@ -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"$
|
||||
@@ -164,7 +166,10 @@ public class CSpritePtMeshU8s : CSpriteBase
|
||||
#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);
|
||||
|
||||
+167
-151
@@ -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;
|
||||
@@ -414,7 +424,8 @@ here1a:
|
||||
}
|
||||
} 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++;
|
||||
@@ -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;
|
||||
@@ -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)
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
@@ -1590,7 +1613,7 @@ 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;
|
||||
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;
|
||||
|
||||
+30
-19
@@ -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,7 +296,7 @@ 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"$().
|
||||
dc->pen_width=1;
|
||||
@@ -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;
|
||||
|
||||
+82
-60
@@ -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,7 +31,12 @@ 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)+
|
||||
@@ -49,18 +44,19 @@ public I64 GrRotNormSqr65536(I64 r[4][4])
|
||||
SqrI64((r[2][0]*37837+r[2][1]*37837+r[2][2]*37837)>>32);
|
||||
}
|
||||
|
||||
public U0 GrSetRotMat(CDC *dc=NULL,I64 r[4][4])
|
||||
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
|
||||
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;
|
||||
@@ -148,11 +144,12 @@ 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)
|
||||
@@ -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);
|
||||
@@ -377,7 +398,7 @@ 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 asprite.
|
||||
CDC *dc=GRARead(filename);
|
||||
@@ -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;
|
||||
@@ -400,18 +421,19 @@ public CDC *DCCaptureScreen(Bool include_zoom=TRUE,CTask *task=NULL)
|
||||
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);
|
||||
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;
|
||||
|
||||
+5
-5
@@ -132,13 +132,13 @@ U0 WinZBufFill(CTask *task)
|
||||
}
|
||||
|
||||
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.
|
||||
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));
|
||||
|
||||
+54
-98
@@ -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;
|
||||
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;
|
||||
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;
|
||||
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)
|
||||
@@ -269,7 +219,8 @@ 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;
|
||||
@@ -304,7 +255,7 @@ 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,
|
||||
@@ -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,7 +485,8 @@ 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,
|
||||
@@ -578,7 +530,8 @@ public Bool Bezier2(U8 *aux_data,CD3I32 *ctrl,Bool (*fp_plot)(U8 *aux,I64 x,I64
|
||||
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,
|
||||
@@ -626,7 +579,8 @@ public Bool Bezier3(U8 *aux_data,CD3I32 *ctrl,Bool (*fp_plot)(U8 *aux,I64 x,I64
|
||||
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,7 +741,8 @@ 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;
|
||||
|
||||
+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);
|
||||
}
|
||||
+49
-39
@@ -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;
|
||||
@@ -234,7 +236,8 @@ 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.
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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
|
||||
@@ -631,7 +637,8 @@ public Bool GrEllipse3(CDC *dc=gr.dc,
|
||||
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,10 +699,12 @@ 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;
|
||||
}
|
||||
|
||||
@@ -710,7 +721,7 @@ public I64 GrFloodFill3(CDC *dc=gr.dc,I64 x1,I64 y1,I64 z1,Bool not_color=FALSE)
|
||||
}
|
||||
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,7 +736,7 @@ 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,
|
||||
@@ -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);
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
@@ -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,8 +1132,7 @@ 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
|
||||
|
||||
+45
-48
@@ -1,35 +1,31 @@
|
||||
#help_index "Graphics/Screen"
|
||||
|
||||
U0 GrUpdateWins()
|
||||
{//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;
|
||||
U0 GrUpdateTaskODEs(CTask *task)
|
||||
{
|
||||
sys_task_being_screen_updated=task;
|
||||
Preempt(ON);
|
||||
try
|
||||
ODEsUpdate(task);
|
||||
Preempt(OFF);
|
||||
if (!TaskValidate(task))
|
||||
break;
|
||||
if (Bt(&task->display_flags,DISPLAYf_SHOW) &&
|
||||
Bt(gr.win_uncovered_bitmap,task->win_z_num))
|
||||
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);
|
||||
Preempt(ON);
|
||||
if (task==sys_winmgr_task) {
|
||||
if (gr.fp_wall_paper)
|
||||
(*gr.fp_wall_paper)(task);
|
||||
@@ -42,46 +38,47 @@ U0 GrUpdateWins()
|
||||
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";
|
||||
"Exception in WinMgr: Update Task Win\n";
|
||||
PutExcept;
|
||||
Sleep(3000);
|
||||
VGAFlush;
|
||||
}
|
||||
}
|
||||
if (!TaskValidate(task))
|
||||
break;
|
||||
sys_task_being_screen_updated=NULL;
|
||||
}
|
||||
|
||||
U0 GrUpdateTasks()
|
||||
{//Only called by WinMgr
|
||||
I64 i;
|
||||
CTask *task,*task1;
|
||||
try {
|
||||
winmgr.ode_time=0;
|
||||
if (Bt(&sys_semas[SYS_SEMA_UPDATE_WIN_Z_BUF],0))
|
||||
WinZBufUpdate;
|
||||
task1=task=sys_winmgr_task;
|
||||
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))
|
||||
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);
|
||||
}
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
|
||||
+47
-37
@@ -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:
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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],
|
||||
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,
|
||||
@@ -443,7 +453,7 @@ 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.
|
||||
|
||||
+19
-12
@@ -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,21 +309,26 @@ _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.
|
||||
I64 i;
|
||||
@@ -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;
|
||||
|
||||
+16
-13
@@ -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,7 +98,8 @@ 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,
|
||||
@@ -145,7 +146,8 @@ tr_done:
|
||||
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:
|
||||
|
||||
+153
-150
@@ -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;
|
||||
@@ -16,7 +16,8 @@ U0 SpriteElem2Code(CDoc *doc,CSprite *tempg)
|
||||
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,7 +28,8 @@ 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,
|
||||
@@ -58,7 +60,8 @@ U0 SpriteElem2Code(CDoc *doc,CSprite *tempg)
|
||||
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,
|
||||
tempg->pwhas.x1,tempg->pwhas.y1,
|
||||
tempg->pwhas.width,tempg->pwhas.height,
|
||||
180/ã*Wrap(tempg->pwhas.angle));
|
||||
break;
|
||||
case SPT_TEXT:
|
||||
@@ -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;
|
||||
|
||||
+74
-63
@@ -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;
|
||||
@@ -31,7 +32,7 @@ CSprite *Sprite2SpriteQue(U8 *elems)
|
||||
I64 s;
|
||||
CSprite *result=CAlloc(sizeof(CSprite)),
|
||||
*tempg=elems-offset(CSprite.start),*tempg1;
|
||||
result->next=result->last=result;
|
||||
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));
|
||||
|
||||
@@ -220,7 +221,7 @@ CSprite *SpriteTransformRect(I64 r[4][4],CSprite *tempg,F64
|
||||
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;
|
||||
|
||||
@@ -343,14 +344,14 @@ U0 SpriteTransform(I64 r[4][4],CSprite *root)
|
||||
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;
|
||||
}
|
||||
@@ -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) {
|
||||
@@ -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"
|
||||
|
||||
+41
-23
@@ -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;
|
||||
@@ -108,7 +114,8 @@ U0 SpriteSetSettings(CDC *dc,CSprite *root,I64 cur_elem_num,CColorROPU32 *_color
|
||||
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;
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
+66
-41
@@ -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));
|
||||
@@ -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);
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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.
|
||||
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);
|
||||
@@ -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,7 +651,7 @@ 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;
|
||||
@@ -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);
|
||||
@@ -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;
|
||||
}
|
||||
@@ -956,8 +965,8 @@ $WW,0$*/
|
||||
|
||||
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 {
|
||||
@@ -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) {
|
||||
|
||||
+15
-11
@@ -1,14 +1,13 @@
|
||||
#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]=
|
||||
{
|
||||
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(CSpriteW), //SPT_WIDTH
|
||||
sizeof(CSpritePtPt), //SPT_PLANAR_SYMMETRY
|
||||
sizeof(CSpriteBase), //SPT_TRANSFORM_ON
|
||||
sizeof(CSpriteBase), //SPT_TRANSFORM_OFF
|
||||
@@ -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;
|
||||
@@ -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,7 +16,8 @@ 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,
|
||||
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.
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ public U0 Play(U8 *st,U8 *words=NULL)
|
||||
*/
|
||||
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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
+5
-3
@@ -1,9 +1,9 @@
|
||||
#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;
|
||||
|
||||
@@ -194,9 +194,11 @@ task=Fs;
|
||||
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;
|
||||
|
||||
+17
-11
@@ -97,16 +97,20 @@ 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 &&
|
||||
@@ -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);
|
||||
@@ -205,7 +209,8 @@ Bool DiffSub(CDoc *doc,I64 *_df_flags,I64 j1_lo,I64 j1_hi,I64 j2_lo,I64 j2_hi,
|
||||
if (DiffSub(doc,_df_flags,j1_lo,best_j1,j2_lo,best_j2,cnt1,cnt2,
|
||||
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,
|
||||
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;
|
||||
@@ -220,7 +225,8 @@ Bool DiffBins(CDoc *doc1,CDoc *doc2)
|
||||
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;
|
||||
@@ -319,7 +325,7 @@ public U0 ZipRep(U8 *files_find_mask="/*",U8 *fu_flags=NULL,
|
||||
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);
|
||||
|
||||
+110
-88
@@ -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,
|
||||
CBGR48 palette[NUM_COLORS];
|
||||
I64 i,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;
|
||||
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;
|
||||
|
||||
+50
-40
@@ -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.
|
||||
@@ -153,7 +156,7 @@ Let's say it stands for global replace ;-)
|
||||
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.
|
||||
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
|
||||
|
||||
@@ -76,7 +76,8 @@ 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 {
|
||||
|
||||
+10
-8
@@ -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;
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
+51
-30
@@ -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;
|
||||
|
||||
@@ -145,7 +149,8 @@ public CDoc *Doc2Html(CDoc *doc_in,
|
||||
"<!DOCTYPE HTML>\n"
|
||||
"<html>\n"
|
||||
"<head>\n"
|
||||
"<meta http-equiv=\"Content-Type\" content=\"text/html;charset=US-ASCII\">\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);
|
||||
@@ -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);
|
||||
|
||||
@@ -295,7 +315,8 @@ public U0 ToHtml(U8 *_in_name,U8 *_out_name=NULL,U8 *html_header=NULL,
|
||||
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;
|
||||
|
||||
Binary file not shown.
+12
-6
@@ -3,7 +3,8 @@
|
||||
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};
|
||||
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));
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
+34
-23
@@ -6,7 +6,7 @@ public U0 WinMgrSync(I64 cnt=1,Bool force=FALSE)
|
||||
//1 Cnt Wait and Pump Msgs.
|
||||
//2 Cnt Make Sure to do a Full Refresh
|
||||
// and Set Cur Pos.
|
||||
Bool old_preempt=Preempt(OFF),
|
||||
Bool old_preempt=Preempt,
|
||||
old_full_refresh,
|
||||
old_idle=LBts(&Fs->task_flags,TASKf_IDLE);
|
||||
CDoc *old_doc=DocPut;
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
@@ -336,7 +339,8 @@ U0 WinChkMoveSize(CTask *task)
|
||||
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)
|
||||
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);
|
||||
}
|
||||
winmgr.show_menu=FALSE;
|
||||
ip.pos.x=old_pos.x; ip.pos.y=old_pos.y;
|
||||
return TRUE;
|
||||
@@ -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)) {
|
||||
|
||||
+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");
|
||||
|
||||
+4
-4
@@ -6,21 +6,21 @@
|
||||
//These are customized quick commands.
|
||||
//Feel free to add more or change.
|
||||
public I64 F(U8 *needle_str,U8 *fu_flags=NULL)
|
||||
{//Find (Find) all text files.
|
||||
{//Find text in all text files.
|
||||
return Find(needle_str,"/*",fu_flags);
|
||||
}
|
||||
|
||||
public I64 R(U8 *needle_str,U8 *replace_text=NULL,U8 *fu_flags="+l-i")
|
||||
{//Find (Find) and replace string with string in all files.
|
||||
{//Find text and replace in all text files.
|
||||
return Find(needle_str,"/*",fu_flags,replace_text);
|
||||
}
|
||||
|
||||
public I64 FD(U8 *needle_str,U8 *fu_flags=NULL)
|
||||
{//Find (Find) text files in cur dir.
|
||||
{//Find text in cur dir text files.
|
||||
return Find(needle_str,"*",fu_flags);
|
||||
}
|
||||
|
||||
public I64 RD(U8 *needle_str,U8 *replace_text=NULL,U8 *fu_flags="+l-i")
|
||||
{//Find (Find) and replace string with string in cur dir.
|
||||
{//Find text and replace in cur dir text files.
|
||||
return Find(needle_str,"*",fu_flags,replace_text);
|
||||
}
|
||||
@@ -20,10 +20,13 @@ U0 HoldCourt()
|
||||
DocDblBufStart;
|
||||
'\n';
|
||||
accused=RandU32%3;
|
||||
"%s",LstSub(accused,"A man \0A woman \0A child \0");
|
||||
"%s",LstSub(accused,
|
||||
"A man \0A woman \0A child \0");
|
||||
|
||||
crime=RandU32&3;
|
||||
"%s",LstSub(crime,"commits murder\0commits adultery\0commits blasphemy\0commits idolatry\0");
|
||||
"%s",LstSub(crime,
|
||||
"commits murder\0commits adultery\0"
|
||||
"commits blasphemy\0commits idolatry\0");
|
||||
|
||||
if (crime<=1) {
|
||||
'' CH_SPACE;
|
||||
@@ -41,7 +44,7 @@ U0 HoldCourt()
|
||||
"\n\n$$BT,\"Really Punish\",LE=2$$\n\n"
|
||||
"$$LM,0$$";
|
||||
DocDblBufEnd;
|
||||
DocMenuDo(DocPut);
|
||||
DocMenu(DocPut);
|
||||
|
||||
LBEqu(&(DocPut)->flags,DOCf_FORM,old_form);
|
||||
DocBottom;
|
||||
@@ -87,7 +90,7 @@ Bool TakeTurn()
|
||||
"\n\n$$BT,\"Quit\",LE=T_QUIT$$\n\n"
|
||||
"$$LM,0$$";
|
||||
DocDblBufEnd;
|
||||
i=DocMenuDo(DocPut,DOF_DONT_TEXT_ATTR);
|
||||
i=DocMenu(DocPut,DOF_DONT_TEXT_ATTR);
|
||||
|
||||
LBEqu(&(DocPut)->flags,DOCf_FORM,old_form);
|
||||
DocBottom;
|
||||
@@ -146,7 +149,8 @@ U0 TMsg(CDC *dc,U8 *msg)
|
||||
dc->color=BLACK;
|
||||
GrRect(dc,2,GR_HEIGHT-FONT_HEIGHT*3+2,GR_WIDTH-4,FONT_HEIGHT*2-4);
|
||||
dc->color=YELLOW;
|
||||
GrPrint(dc,(GR_WIDTH-StrLen(msg)*FONT_WIDTH)/2,GR_HEIGHT-5*FONT_HEIGHT/2,"%s",msg);
|
||||
GrPrint(dc,(GR_WIDTH-StrLen(msg)*FONT_WIDTH)/2,
|
||||
GR_HEIGHT-5*FONT_HEIGHT/2,"%s",msg);
|
||||
WinMgrSync;
|
||||
if (ScanChar)
|
||||
throw;
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loaded 100 of 488 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user