TempleOSCDV3.11.ISO

This commit is contained in:
Terry A. Davis authored and minexew committed 2018-09-08 21:46:29 +02:00
1 parent f8c05f98f4
commit ed64d7e3b8
549 files changed
+10643 -12855

No files matched your search

+215
View File
@@ -0,0 +1,215 @@
#help_index "DolDoc"
I64 DocCharDist(CDoc *doc,I64 x,I64 y)
{
#assert FONT_WIDTH==FONT_HEIGHT
return (SqrI64(doc->x-x)+SqrI64(doc->y-y))*FONT_WIDTH*FONT_WIDTH;
}
U0 DocDelToNum(CDoc *doc,I64 num)
{
CDocEntry *doc_e=doc->root.next,*doc_e2;
while (num-->0 && doc_e!=doc) {
doc_e2=doc_e->next;
if (!(doc_e->de_flags & (DOCEF_HOLD|DOCEF_FILTER_SKIP))) {
if (doc_e==doc->cur_entry) {
doc->cur_entry=doc_e2;
doc->cur_col=doc_e2->min_col;
}
DocEntryDel(doc,doc_e);
}
doc_e=doc_e2;
}
}
U0 DocDelToEntry(CDoc *doc,CDocEntry *clear_entry)
{
CDocEntry *doc_e=doc->root.next,*doc_e2;
while (doc_e!=doc) {
doc_e2=doc_e->next;
if (!(doc_e->de_flags & (DOCEF_HOLD|DOCEF_FILTER_SKIP))) {
if (doc_e==doc->cur_entry) {
doc->cur_entry=doc_e2;
doc->cur_col=doc_e2->min_col;
}
DocEntryDel(doc,doc_e);
}
if (doc_e==clear_entry)
break;
doc_e=doc_e2;
}
}
U0 DocBorderLstDraw(CDoc *doc)
{
CTask *win_task=doc->win_task;
I64 i,y=-1,attr=win_task->border_attr<<8;
U64 ch;
CDoc *templ=doc;
CD3I64 saved_scroll;
while (templ && templ->doc_signature==DOC_SIGNATURE_VAL) {
y+=(Bsr(templ->desc)+7)>>3+1; //StrLen+1
templ=templ->parent_doc;
}
templ=doc;
if (y>win_task->win_height)
y=win_task->win_height;
WinScrollNull(win_task,&saved_scroll);
while (templ && templ->doc_signature==DOC_SIGNATURE_VAL) {
ch=templ->desc;
i=(Bsr(ch)+7)>>3; //StrLen
ch=EndianI64(ch<<((8-i)<<3));
attr=win_task->border_attr<<8;
while (i-- && y>0) {
TextChar(win_task,TRUE,-1,--y,attr+ch&0xFF);
ch>>=8;
}
y--;
templ=templ->parent_doc;
}
WinScrollRestore(win_task,&saved_scroll);
}
public U0 DocTop(CDoc *doc=NULL)
{//Move cursor, cur_entry, to top.
Bool unlock;
if (!doc && !(doc=DocPut))
return;
unlock=DocLock(doc);
doc->cur_entry=doc->root.next;
doc->cur_col=doc->cur_entry->min_col;
doc->x=0;
doc->y=0;
doc->line_start_col=0;
doc->top_line_num=0;
DocFormFwd(doc);
DocRecalc(doc);
if (unlock)
DocUnlock(doc);
}
public U0 DocCenter(CDoc *doc=NULL,I64 recalc=DOC_RECALC)
{//Center win on doc cursor, cur_entry.
Bool unlock;
CTask *task;
if (!doc && !(doc=DocPut))
return;
unlock=DocLock(doc);
task=doc->win_task;
DocRecalc(doc,FALSE,recalc);
if (!(doc->flags&DOCF_BORDER_DOC))
doc->top_line_num=doc->y-(task->win_height+1)>>1;
if (unlock)
DocUnlock(doc);
}
public U0 DocBottom(CDoc *doc=NULL)
{//Move cursor, cur_entry, to bottom.
Bool unlock;
if (!doc && !(doc=DocPut))
return;
unlock=DocLock(doc);
doc->cur_entry=doc;
doc->cur_col=0;
DocRecalc(doc);
if (unlock)
DocUnlock(doc);
}
public U0 DocClear(CDoc *doc=NULL)
{//Clear all doc entries, except +H, hold entries.
Bool unlock;
if (!doc && !(doc=DocPut))
return;
unlock=DocLock(doc);
DocBottom(doc);
DocPrint(doc,"$$CL$$");
DocRecalc(doc);
if (unlock)
DocUnlock(doc);
}
public Bool DocCursor(Bool show=OFF,CDoc *doc=NULL)
{//Show or hide cursor.
if (!doc && !(doc=DocPut))
return FALSE;
return !LBEqu(&doc->flags,DOCf_HIDE_CURSOR,!show);
}
public Bool DocScroll(Bool val=OFF,CDoc *doc=NULL)
{//Turn scroll bars OFF/ON.
if (!doc && !(doc=DocPut))
return FALSE;
return !LBEqu(&doc->flags,DOCf_NO_SCROLL_BARS,!val);
}
public U0 DocCollapse(Bool collapse=TRUE,CDoc *doc=NULL)
{//Collapse or uncollapse all tree widgets.
CDocEntry *doc_e;
Bool unlock;
if (!doc && !(doc=DocPut))
return;
unlock=DocLock(doc);
doc_e=doc->root.next;
while (doc_e!=doc) {
if (doc_e->de_flags&DOCEF_TREE)
BEqu(&doc_e->de_flags,DOCEf_CHECKED_COLLAPSED,collapse);
doc_e=doc_e->next;
}
DocRecalc(doc);
if (unlock)
DocUnlock(doc);
}
#help_index "DolDoc/Cmd Line (Typically);Cmd Line (Typically)"
public I64 DocMax(I64 i=MAX_I64)
{//Set max document entries. (Cmd line buffer.)
//Adjusts the size of the cmd line buf.
//Normally, the cmd line deletes entries
//when more are added and the old scroll up.
//See $LK,"max_entries",A="FF:::/Adam/DolDoc/DocTerm.CPP,max_entries"$.
I64 result;
CDoc *doc;
if (doc=DocPut) {
result=doc->max_entries;
doc->max_entries=i;
return result;
} else
return 0;
}
#help_index "DolDoc/Task;StdOut/Task"
U0 DocUpdateTaskDocs(CTask *task)
{//This is called from $LK,"GrUpdateTaskWin",A="MN:GrUpdateTaskWin"$() by the winmgr at 30fps.
CDrv *dv;
CDoc *doc;
CD3I64 saved_scroll;
I64 border_attr;
if (task->border_src==BDS_CUR_DRV && task->cur_dv) {
border_attr=task->cur_dv->text_attr;
if (border_attr&15!=border_attr>>4)
task->border_attr=border_attr;
}
if (task->title_src==TTS_TASK_NAME)
StrCpy(task->task_title,task->task_name);
if ((doc=DocDisplay(task)) && !(doc->flags&DOCF_DONT_SHOW)) {
if (task->border_src==BDS_ED_FILENAME_DRV)
try {
if (dv=Let2Drv(*doc->filename.name)) {
border_attr=dv->text_attr;
if (border_attr&15!=border_attr>>4)
task->border_attr=border_attr;
}
} catch
Fs->catch_except=TRUE;
if (task->title_src==TTS_ED_FILENAME)
MemCpy(task->task_title,doc->filename.name,TASK_TITLE_LEN);
DocRecalc(doc,TRUE,DOC_RECALC_TO_SCREEN);
}
if ((doc=DocBorder(task)) && !(doc->flags&DOCF_DONT_SHOW)) {
WinScrollNull(task,&saved_scroll);
DocRecalc(doc,FALSE,DOC_RECALC_TO_SCREEN);
WinScrollRestore(task,&saved_scroll);
}
}