hschumann2/TempleOS-Source-Code
0847
1 2U8 *tSCB(CDoc *,CDocEntry *,CTask *mem_task)3{//This is called by the window mgr.4//Things would get corrupted5 //if the window mgr used it's own6 //heap, so we use the owning task's heap.7 U8 *st=MAlloc(64,mem_task);8 CDate cdt=tS*CDATE_FREQ;9//Doesn't have to be fixed width!!10 StrPrint(st,"%d=%T",cdt,cdt);11 return st;12}13 14U8 *CurTimeCB(CDoc *,CDocEntry *,CTask *mem_task)15{16 U8 *st=MAlloc(64,mem_task);17 CDate cdt=Now;18 StrPrint(st,"%D %T",cdt,cdt);19 return st;20}21 22U0 DoIt()23{24 CDoc *bdoc=DocBorder,*pdoc=DocPut;25 CDocEntry *doc_e;26 27 DocLock(bdoc);28 DocBottom(bdoc); //Ins at the bottom29 DocPrint(bdoc,"$RED$$CM+BY+LX,5,-3$");30//The DocPrint() routine returns the addr of the last entry.31 doc_e=DocPrint(bdoc,"$TX+TC,\" \"$");32//The TC flag is "has tag callback".33 34 //Flags are explained here:35 //::/Doc/DolDocOverview.DD ::/Doc/Widget.DD36 //Dollar Flags ST_DOC_FLAGS37 doc_e->tag_cb=&tSCB;38 DocPrint(bdoc,"$FG$");39 DocUnlock(bdoc);40 41 //WARNING: If you use the put_doc you42 //run the risk of the user pressing43 //<CTRL-t> or using the clip, both44 //of which will crash. So, you might want45 //to use the border_doc.46 47 DocLock(pdoc);48 DocPrint(pdoc,"$LTRED$");49 doc_e=DocPrint(pdoc,"$TX+TC,\" \"$");50 doc_e->tag_cb=&CurTimeCB;51 DocPrint(pdoc,"$FG$");52 DocUnlock(pdoc);53 54 //Send carriage return, new line, so55 //that the timer string is not part56 //of the next cmd on the cmd line.57 '\n';58}59 60U0 UndoIt()61{//Clear-out entries without a +H hold flag.62 DocClear(Fs->border_doc);63}64 65DoIt;66 