TempleOSCD_150720.ISO
This commit is contained in:
1 parent
401601816c
commit
f8c05f98f4
554 files changed
+26046
-24853
No files matched your search
+27
-23
@@ -22,41 +22,45 @@ extern U8 *PopUpPickLst(U8 *lst);
|
||||
#define DHT_DOC_FLAG 2
|
||||
#define DHT_COLOR 4
|
||||
|
||||
//--TEMPLEOS LINK TYPES--
|
||||
// "filename"
|
||||
// "FI:filename"
|
||||
// "FA:haystack_filename,needle_anchor_str"
|
||||
// "FF:haystack_filename,needle_str"
|
||||
// "FF:haystack_filename,needle_str:occurnum"
|
||||
// "FL:filename,linenum"
|
||||
/* See $LK,"TempleOS Link Types",A="MN:ST_LINK_TYPES"$.
|
||||
|
||||
"filename"
|
||||
"FI:filename"
|
||||
"FA:haystack_filename,needle_anchor_str"
|
||||
"FF:haystack_filename,needle_str"
|
||||
"FF:haystack_filename,needle_str:occurnum"
|
||||
"FL:filename,linenum"
|
||||
"MN:SymName"
|
||||
"PI:filename"
|
||||
"PF:haystack_filename,needle_str"
|
||||
"PF:haystack_filename,needle_str:occurnum"
|
||||
"PL:filename,linenum"
|
||||
"BF:haystack_bible_book,needle_str"
|
||||
"DF:word"
|
||||
"DF:word,defnum"
|
||||
"HI:index"
|
||||
"AD:code_address_number"
|
||||
|
||||
To edit a doc structure already in memory. See $LK,"SpriteEdText",A="MN:SpriteEdText"$().
|
||||
"AI:doc_address"
|
||||
"AA:haystack_doc_address,needle_anchor_str"
|
||||
"AF:haystack_doc_address,needle_str"
|
||||
"AF:haystack_doc_address,needle_str:occurnum"
|
||||
"AL:doc_address,linenum"
|
||||
|
||||
*/
|
||||
#define LK_FILE 0
|
||||
#define LK_FILE_ANCHOR 1
|
||||
#define LK_FILE_FIND 2
|
||||
#define LK_FILE_LINE 3
|
||||
// "MN:SymName"
|
||||
#define LK_MAN_PAGE 4
|
||||
// "PI:filename"
|
||||
// "PF:haystack_filename,needle_str"
|
||||
// "PF:haystack_filename,needle_str:occurnum"
|
||||
// "PL:filename,linenum"
|
||||
#define LK_PLAIN 5
|
||||
#define LK_PLAIN_FIND 6
|
||||
#define LK_PLAIN_LINE 7
|
||||
// "BF:haystack_bible_book,needle_str"
|
||||
#define LK_BIBLE_FIND 8
|
||||
// "DF:word"
|
||||
// "DF:word,defnum"
|
||||
#define LK_DEF 9
|
||||
// "HI:index"
|
||||
#define LK_HELP_INDEX 10
|
||||
// "AD:code_address_number"
|
||||
#define LK_ADDR 11
|
||||
//These are to edit a doc structure already in memory.
|
||||
// "AI:doc_address"
|
||||
// "AA:haystack_doc_address,needle_anchor_str"
|
||||
// "AF:haystack_doc_address,needle_str"
|
||||
// "AF:haystack_doc_address,needle_str:occurnum"
|
||||
// "AL:doc_address,linenum"
|
||||
#define LK_DOC 12 //See $LK,"SpriteEdText",A="MN:SpriteEdText"$()
|
||||
#define LK_DOC_ANCHOR 13
|
||||
#define LK_DOC_FIND 14
|
||||
|
||||
+138
-78
@@ -1,5 +1,31 @@
|
||||
#help_index "DolDoc/Misc"
|
||||
|
||||
U0 EdReplaceTroubleOne(CDoc *doc,U8 *st_original,U8 *st_safe,I64 num,
|
||||
Bool to_safe,Bool select)
|
||||
{
|
||||
U8 buf[STR_LEN];
|
||||
StrPrint(buf,st_safe,num);
|
||||
if (to_safe)
|
||||
EdReplace(doc,st_original,buf,select);
|
||||
else
|
||||
EdReplace(doc,buf,st_original,select);
|
||||
}
|
||||
|
||||
U0 EdReplaceTroubleAll(CDoc *doc,Bool to_safe,Bool select)
|
||||
{
|
||||
I64 i=0;
|
||||
EdReplaceTroubleOne(doc,"#assert" ,"//<@%d@>" ,i++,to_safe,select);
|
||||
EdReplaceTroubleOne(doc,"#define" ,"//<@%d@>" ,i++,to_safe,select);
|
||||
EdReplaceTroubleOne(doc,"#include","//<@%d@>" ,i++,to_safe,select);
|
||||
//#if will match #if,#ifdef,#ifndef,#ifaot and #ifjit
|
||||
EdReplaceTroubleOne(doc,"#if" ,"//<@%d@>" ,i++,to_safe,select);
|
||||
EdReplaceTroubleOne(doc,"#endif" ,"//<@%d@>" ,i++,to_safe,select);
|
||||
//Convert #exe to union because we want that indent pattern.
|
||||
EdReplaceTroubleOne(doc,"#exe" ,"union @%d@",i++,to_safe,select);
|
||||
EdReplaceTroubleOne(doc,"'{'" ,"'<@%d@>'" ,i++,to_safe,select);
|
||||
EdReplaceTroubleOne(doc,"'}'" ,"'<@%d@>'" ,i++,to_safe,select);
|
||||
}
|
||||
|
||||
#define C_INDENT_SPACES 2
|
||||
#define ASM_RENUM_SPACING 5
|
||||
|
||||
@@ -14,10 +40,12 @@ I64 PopUpEdFmt()
|
||||
I64 i;
|
||||
CDoc *doc=DocNew;
|
||||
DocPrint(doc,"$$LTBLUE$$$$MU,\"Check Compile\",LE=EF_CHK_COMPILE$$\n"
|
||||
"$$MU,\"Reindent CPP.Z Fun\",LE=EF_REINDENT$$\n"
|
||||
"$$MU,\"Reindent CPP.Z Fun (Beware braces in strings.)\","
|
||||
"LE=EF_REINDENT$$\n"
|
||||
"$$MU,\"Renum Asm Local @@ Labels for Fun\",LE=EF_RENUM_ASM$$\n"
|
||||
"$$MU,\"Insert Template Code: Ctrl Slider\",LE=EF_CTRL_SLIDER$$\n"
|
||||
"$$MU,\"Insert ASCII/Scan Code Hex Codes for key pressed\",LE=EF_CH_SC$$\n\n"
|
||||
"$$MU,\"Insert ASCII/Scan Code Hex Codes for key pressed\","
|
||||
"LE=EF_CH_SC$$\n\n"
|
||||
"$$MU,\"CANCEL\",LE=DOCM_CANCEL$$\n\n"
|
||||
"$$GREEN$$<ALT-BACKSPACE>$$FG$$ to undo if not happy\n"
|
||||
"with the results.\n");
|
||||
@@ -28,7 +56,7 @@ I64 PopUpEdFmt()
|
||||
|
||||
class CRILex
|
||||
{
|
||||
CLex *lx1,*lx2;
|
||||
CCmpCtrl *cc1,*cc2;
|
||||
CQueVectU8 *indent;
|
||||
I64 depth,exp_depth,one_shot;
|
||||
Bool was_new_line,is_not_cont;
|
||||
@@ -38,34 +66,38 @@ I64 EdRILex(CRILex *rx)
|
||||
{
|
||||
rx->is_not_cont=FALSE;
|
||||
I64 i;
|
||||
CLexFile *tempf;
|
||||
do {
|
||||
Lex(rx->lx1);
|
||||
Lex(rx->lx2);
|
||||
i=PrsKeyWord(rx->lx2);
|
||||
if (rx->lx1->token=='\n' && rx->lx2->token==';' || rx->lx2->token=='{' ||
|
||||
rx->lx2->token=='}' || rx->lx2->token==':' || rx->lx2->token==')' &&
|
||||
!rx->exp_depth || i==KW_ELSE || i==KW_CATCH || i==KW_DO)
|
||||
rx->is_not_cont=TRUE;
|
||||
if (rx->was_new_line && (rx->lx1->token!=':' ||
|
||||
i==KW_DFT || i==KW_SUB_SWITCH_START || i==KW_SUB_SWITCH_END)) {
|
||||
QueVectU8Put(rx->indent,rx->lx2->lfns[0].cur_entry->y,rx->depth+rx->one_shot);
|
||||
Lex(rx->cc1);
|
||||
Lex(rx->cc2);
|
||||
i=PrsKeyWord(rx->cc2);
|
||||
if (rx->cc1->token=='\n' && rx->cc2->token==';' || rx->cc2->token=='{' ||
|
||||
rx->cc2->token=='}' || rx->cc2->token==':' || rx->cc2->token==')' &&
|
||||
!rx->exp_depth || i==KW_ELSE || i==KW_CATCH || i==KW_DO)
|
||||
rx->is_not_cont=TRUE;
|
||||
if (rx->was_new_line && (rx->cc1->token!=':' ||
|
||||
i==KW_DFT || i==KW_SUB_SWITCH_START || i==KW_SUB_SWITCH_END)) {
|
||||
tempf=rx->cc2->lex_include_stk;
|
||||
while (tempf->next)
|
||||
tempf=tempf->next;
|
||||
QueVectU8Put(rx->indent,tempf->cur_entry->y,rx->depth+rx->one_shot);
|
||||
rx->one_shot=0;
|
||||
}
|
||||
if (rx->lx2->token=='\n')
|
||||
if (rx->cc2->token=='\n')
|
||||
rx->was_new_line=TRUE;
|
||||
else
|
||||
rx->was_new_line=FALSE;
|
||||
} while (rx->lx1->token=='\n');
|
||||
return rx->lx1->token;
|
||||
} while (rx->cc1->token=='\n');
|
||||
return rx->cc1->token;
|
||||
}
|
||||
|
||||
U0 EdRIExp(CRILex *rx)
|
||||
{
|
||||
if (rx->lx1->token=='(') {
|
||||
if (rx->cc1->token=='(') {
|
||||
if (!rx->exp_depth++)
|
||||
rx->depth+=3;
|
||||
EdRILex(rx);
|
||||
while (rx->lx1->token && rx->lx1->token!=')')
|
||||
while (rx->cc1->token && rx->cc1->token!=')')
|
||||
EdRIExp(rx);
|
||||
if (!--rx->exp_depth) {
|
||||
rx->depth-=3;
|
||||
@@ -79,10 +111,10 @@ U0 EdRIStmt(CRILex *rx,Bool indent)
|
||||
{
|
||||
I64 i;
|
||||
Bool cont;
|
||||
if (rx->lx1->token=='{') {
|
||||
if (rx->cc1->token=='{') {
|
||||
rx->depth++;
|
||||
EdRILex(rx);
|
||||
while (rx->lx1->token && rx->lx1->token!='}')
|
||||
while (rx->cc1->token && rx->cc1->token!='}')
|
||||
EdRIStmt(rx,FALSE);
|
||||
if (--rx->depth<0) rx->depth=0;
|
||||
EdRILex(rx);
|
||||
@@ -90,14 +122,14 @@ U0 EdRIStmt(CRILex *rx,Bool indent)
|
||||
if (indent) rx->depth++;
|
||||
do {
|
||||
cont=FALSE;
|
||||
switch (PrsKeyWord(rx->lx1)) {
|
||||
switch (PrsKeyWord(rx->cc1)) {
|
||||
case KW_IF:
|
||||
EdRILex(rx);
|
||||
EdRIExp(rx);
|
||||
EdRIStmt(rx,TRUE);
|
||||
if (PrsKeyWord(rx->lx1)==KW_ELSE) {
|
||||
if (PrsKeyWord(rx->cc1)==KW_ELSE) {
|
||||
EdRILex(rx);
|
||||
if (PrsKeyWord(rx->lx1)==KW_IF && rx->lx2->token!='\n')
|
||||
if (PrsKeyWord(rx->cc1)==KW_IF && rx->cc2->token!='\n')
|
||||
EdRIStmt(rx,FALSE);
|
||||
else
|
||||
EdRIStmt(rx,TRUE);
|
||||
@@ -106,11 +138,15 @@ U0 EdRIStmt(CRILex *rx,Bool indent)
|
||||
case KW_TRY:
|
||||
EdRILex(rx);
|
||||
EdRIStmt(rx,TRUE);
|
||||
if (PrsKeyWord(rx->lx1)==KW_CATCH) {
|
||||
if (PrsKeyWord(rx->cc1)==KW_CATCH) {
|
||||
EdRILex(rx);
|
||||
EdRIStmt(rx,TRUE);
|
||||
}
|
||||
break;
|
||||
case KW_LOCK:
|
||||
EdRILex(rx);
|
||||
EdRIStmt(rx,TRUE);
|
||||
break;
|
||||
case KW_FOR:
|
||||
case KW_WHILE:
|
||||
EdRILex(rx);
|
||||
@@ -118,49 +154,52 @@ U0 EdRIStmt(CRILex *rx,Bool indent)
|
||||
EdRIStmt(rx,TRUE);
|
||||
break;
|
||||
case KW_ASM:
|
||||
EdRILex(rx);
|
||||
case KW_CLASS:
|
||||
case KW_UNION:
|
||||
if (EdRILex(rx)==TK_IDENT)
|
||||
EdRILex(rx);
|
||||
EdRIStmt(rx,TRUE);
|
||||
break;
|
||||
case KW_DO:
|
||||
EdRILex(rx);
|
||||
EdRIStmt(rx,TRUE);
|
||||
if (PrsKeyWord(rx->lx1)==KW_WHILE) {
|
||||
if (PrsKeyWord(rx->cc1)==KW_WHILE) {
|
||||
EdRILex(rx);
|
||||
EdRIExp(rx);
|
||||
}
|
||||
if (rx->lx1->token==';')
|
||||
if (rx->cc1->token==';')
|
||||
EdRILex(rx);
|
||||
break;
|
||||
case KW_SWITCH:
|
||||
case KW_NOBOUND_SWITCH:
|
||||
EdRILex(rx);
|
||||
EdRIExp(rx);
|
||||
if (rx->lx1->token=='{') {
|
||||
if (rx->cc1->token=='{') {
|
||||
rx->depth++;
|
||||
EdRILex(rx);
|
||||
i=0;
|
||||
while (rx->lx1->token && rx->lx1->token!='}') {
|
||||
switch (PrsKeyWord(rx->lx1)) {
|
||||
while (rx->cc1->token && rx->cc1->token!='}') {
|
||||
switch (PrsKeyWord(rx->cc1)) {
|
||||
case KW_SUB_SWITCH_START:
|
||||
rx->depth+=i; i=0;
|
||||
while (EdRILex(rx) && rx->lx1->token!=':');
|
||||
while (EdRILex(rx) && rx->cc1->token!=':');
|
||||
EdRILex(rx);
|
||||
i++;
|
||||
break;
|
||||
case KW_SUB_SWITCH_END:
|
||||
rx->depth+=i; i=0;
|
||||
if (--rx->depth<0) rx->depth=0;
|
||||
while (EdRILex(rx) && rx->lx1->token!=':');
|
||||
while (EdRILex(rx) && rx->cc1->token!=':');
|
||||
EdRILex(rx);
|
||||
break;
|
||||
case KW_CASE:
|
||||
case KW_DFT:
|
||||
rx->depth+=i; i=0;
|
||||
while (EdRILex(rx) && rx->lx1->token!=':');
|
||||
while (EdRILex(rx) && rx->cc1->token!=':');
|
||||
EdRILex(rx);
|
||||
break;
|
||||
default:
|
||||
if (rx->lx1->token)
|
||||
if (rx->cc1->token)
|
||||
EdRIStmt(rx,TRUE);
|
||||
}
|
||||
}
|
||||
@@ -169,24 +208,25 @@ U0 EdRIStmt(CRILex *rx,Bool indent)
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (rx->lx1->token==TK_IDENT && rx->lx1->hash_entry &&
|
||||
rx->lx1->hash_entry->type&(HTT_OPCODE|HTT_ASM_KEYWORD)) {
|
||||
rx->one_shot=4-rx->depth;
|
||||
if (rx->cc1->token==TK_IDENT && rx->cc1->hash_entry &&
|
||||
rx->cc1->hash_entry->type&(HTT_OPCODE|HTT_ASM_KEYWORD)) {
|
||||
// rx->one_shot=4-rx->depth;
|
||||
do EdRILex(rx);
|
||||
while (rx->lx2->token && rx->lx2->token!='\n');
|
||||
while (rx->cc2->token && rx->cc2->token!='\n');
|
||||
rx->is_not_cont=TRUE;
|
||||
} else {
|
||||
while (rx->lx1->token && rx->lx1->token!=';' && rx->lx1->token!=':') {
|
||||
if (rx->lx2->token=='\n' && !rx->is_not_cont)
|
||||
while (rx->cc1->token && rx->cc1->token!=';' &&
|
||||
rx->cc1->token!=':') {
|
||||
if (rx->cc2->token=='\n' && !rx->is_not_cont)
|
||||
rx->one_shot=3;
|
||||
EdRILex(rx);
|
||||
}
|
||||
if (rx->lx1->token==':')
|
||||
if (rx->cc1->token==':')
|
||||
cont=TRUE;
|
||||
EdRILex(rx);
|
||||
}
|
||||
}
|
||||
} while (cont && rx->lx1->token!='}');
|
||||
} while (cont && rx->cc1->token!='}');
|
||||
if (indent && --rx->depth<0)
|
||||
rx->depth=0;
|
||||
}
|
||||
@@ -197,21 +237,23 @@ CQueVectU8 *EdRICode(CDoc *doc)
|
||||
CQueVectU8 *result;
|
||||
CRILex *rx=CAlloc(sizeof(CRILex));
|
||||
|
||||
rx->lx1=LexNew(,LF_KEEP_NEW_LINES|LF_DONT_FREE_BUF,doc->filename.name);
|
||||
Free(rx->lx1->lfns[0].full_name);
|
||||
LexAttachDoc(rx->lx1,&rx->lx1->lfns[0],doc,,doc->cur_entry,doc->cur_data_col);
|
||||
rx->cc1=CmpCtrlNew(,CCF_KEEP_NEW_LINES|CCF_DONT_FREE_BUF,doc->filename.name);
|
||||
Free(rx->cc1->lex_include_stk->full_name);
|
||||
LexAttachDoc(rx->cc1,rx->cc1->lex_include_stk,doc,,
|
||||
doc->cur_entry,doc->cur_col);
|
||||
|
||||
rx->lx2=LexNew(,LF_KEEP_NEW_LINES|LF_DONT_FREE_BUF,doc->filename.name);
|
||||
Free(rx->lx2->lfns[0].full_name);
|
||||
LexAttachDoc(rx->lx2,&rx->lx2->lfns[0],doc,,doc->cur_entry,doc->cur_data_col);
|
||||
rx->cc2=CmpCtrlNew(,CCF_KEEP_NEW_LINES|CCF_DONT_FREE_BUF,doc->filename.name);
|
||||
Free(rx->cc2->lex_include_stk->full_name);
|
||||
LexAttachDoc(rx->cc2,rx->cc2->lex_include_stk,doc,,
|
||||
doc->cur_entry,doc->cur_col);
|
||||
|
||||
rx->indent=QueVectU8New(doc->cur_entry->y);
|
||||
|
||||
Lex(rx->lx1);
|
||||
Lex(rx->cc1);
|
||||
EdRIStmt(rx,FALSE);
|
||||
|
||||
LexDel(rx->lx1);
|
||||
LexDel(rx->lx2);
|
||||
CmpCtrlDel(rx->cc1);
|
||||
CmpCtrlDel(rx->cc2);
|
||||
result=rx->indent;
|
||||
Free(rx);
|
||||
return result;
|
||||
@@ -284,7 +326,8 @@ class CRenum
|
||||
I64 EdRAGetU8(CDoc *doc)
|
||||
{
|
||||
I64 result=-1;
|
||||
while (doc->cur_entry!=doc && doc->cur_entry->type&DOCET_SELECTED && result<0) {
|
||||
while (doc->cur_entry!=doc &&
|
||||
doc->cur_entry->type&DOCET_SELECTED && result<0) {
|
||||
result=EdCurU8(doc);
|
||||
EdCursorRight(doc);
|
||||
}
|
||||
@@ -307,7 +350,7 @@ U0 EdRACollect(CDoc *doc,CRenum *root)
|
||||
StrCpy(buf,"@@");
|
||||
i=2;
|
||||
while (ch>=0 && i<sizeof(CEdFindText.find_text)) {
|
||||
if (Bt(chars_bitmap_alpha_numeric,ch))
|
||||
if (Bt(chars_bmp_alpha_numeric,ch))
|
||||
buf[i++]=ch;
|
||||
else
|
||||
break;
|
||||
@@ -315,7 +358,7 @@ U0 EdRACollect(CDoc *doc,CRenum *root)
|
||||
}
|
||||
if (i<sizeof(CEdFindText.find_text)) {
|
||||
buf[i++]=0;
|
||||
while (ch>=0 && Bt(chars_bitmap_white_space,ch))
|
||||
while (ch>=0 && Bt(chars_bmp_white_space,ch))
|
||||
ch=EdRAGetU8(doc);
|
||||
if (ch==':') {
|
||||
ch=EdRAGetU8(doc);
|
||||
@@ -327,7 +370,7 @@ U0 EdRACollect(CDoc *doc,CRenum *root)
|
||||
}
|
||||
}
|
||||
}
|
||||
//This is needed because we moved the
|
||||
//This is needed because we moved the
|
||||
//cursor and it didn't recalc.
|
||||
DocRecalc(doc);
|
||||
}
|
||||
@@ -337,7 +380,7 @@ U0 EdRenumAsm(CDoc *doc)
|
||||
Bool unlock=DocLock(doc);
|
||||
I64 num=0;
|
||||
CRenum root,*tempr,*tempr1;
|
||||
U8 buf[sizeof(CEdFindText.find_text)],
|
||||
U8 buf[sizeof(CEdFindText.find_text)],
|
||||
buf2[sizeof(CEdFindText.find_text)];
|
||||
|
||||
QueInit(&root);
|
||||
@@ -367,7 +410,7 @@ U0 EdRenumAsm(CDoc *doc)
|
||||
DocUnlock(doc);
|
||||
}
|
||||
|
||||
U0 EdCodeTools2(CDoc *doc,I64 tool_action)
|
||||
U0 EdCodeTools2(CDoc *doc,I64 tool_action,Bool beep=TRUE)
|
||||
{
|
||||
Bool okay,unlock=DocLock(doc),start_of_line=TRUE;
|
||||
CDocEntry *doc_e,*doc_ne;
|
||||
@@ -395,28 +438,32 @@ U0 EdCodeTools2(CDoc *doc,I64 tool_action)
|
||||
Free(st);
|
||||
WinHorz(Fs->win_left,Fs->win_right, task);
|
||||
WinVert(Fs->win_top, Fs->win_bottom,task);
|
||||
if (ScanResult(tempc,&r)) {
|
||||
if (JobResultScan(tempc,&r)) {
|
||||
st=DirFile(doc->filename.name,,"PRJ.Z");
|
||||
prj_file=FileNameAbs(st,FUF_Z_OR_NOT_Z);
|
||||
Free(st);
|
||||
if (FileFind(prj_file)) {
|
||||
st2=DirFile(prj_file),
|
||||
st=MStrPrint("Cd(\"%s\");",st2);
|
||||
st=MStrPrint("Cd(\"%s\");",st2);
|
||||
Free(st2);
|
||||
tempc=TaskExe(task,Fs,st,1<<SVCf_WAKE_MASTER|1<<SVCf_FOCUS_MASTER|1<<SVCf_FREE_ON_COMPLETE);
|
||||
tempc=TaskExe(task,Fs,st,1<<SVCf_WAKE_MASTER|
|
||||
1<<SVCf_FOCUS_MASTER|1<<SVCf_FREE_ON_COMPLETE);
|
||||
Free(st);
|
||||
st=MStrPrint("\"$$WW,1$$\";Cmp(\"%s\",\"SysTemp\",\"SysTemp\");",prj_file);
|
||||
st=MStrPrint("\"$$WW,1$$\";Cmp(\"%s\",\"SysTemp\",\"SysTemp\");",
|
||||
prj_file);
|
||||
tempc=TaskExe(task,Fs,st,1<<SVCf_WAKE_MASTER|1<<SVCf_FOCUS_MASTER);
|
||||
Free(st);
|
||||
if (ScanResult(tempc,&r))
|
||||
if (JobResultScan(tempc,&r))
|
||||
if (!r) {
|
||||
tempc=TaskExe(task,Fs,
|
||||
"Load(\"SysTemp\",LDF_JUST_LOAD);",1<<SVCf_WAKE_MASTER|1<<SVCf_FOCUS_MASTER);
|
||||
if (ScanResult(tempc,&r))
|
||||
"Load(\"SysTemp\",LDF_JUST_LOAD);",
|
||||
1<<SVCf_WAKE_MASTER|1<<SVCf_FOCUS_MASTER);
|
||||
if (JobResultScan(tempc,&r))
|
||||
okay=TRUE;
|
||||
}
|
||||
tempc=TaskExe(task,Fs,"Del(\"SysTemp.*\");",1<<SVCf_WAKE_MASTER|1<<SVCf_FOCUS_MASTER);
|
||||
ScanResult(tempc,&r);
|
||||
tempc=TaskExe(task,Fs,"Del(\"SysTemp.*\");",
|
||||
1<<SVCf_WAKE_MASTER|1<<SVCf_FOCUS_MASTER);
|
||||
JobResultScan(tempc,&r);
|
||||
} else {
|
||||
Free(prj_file);
|
||||
st=DirFile(doc->filename.name,"Load","CPP.Z");
|
||||
@@ -428,7 +475,7 @@ U0 EdCodeTools2(CDoc *doc,I64 tool_action)
|
||||
st=MStrPrint("\"$$WW,1$$\";ExeFile(\"%s\",TRUE);",doc->filename.name);
|
||||
tempc=TaskExe(task,Fs,st,1<<SVCf_WAKE_MASTER|1<<SVCf_FOCUS_MASTER);
|
||||
Free(st);
|
||||
if (ScanResult(tempc,&r) && r)
|
||||
if (JobResultScan(tempc,&r) && r)
|
||||
okay=TRUE;
|
||||
}
|
||||
Free(prj_file);
|
||||
@@ -445,13 +492,18 @@ U0 EdCodeTools2(CDoc *doc,I64 tool_action)
|
||||
}
|
||||
break;
|
||||
case EF_REINDENT:
|
||||
start_y=doc->cur_entry->y;
|
||||
EdReplaceTroubleAll(doc,TRUE,FALSE);
|
||||
DocLineNumGoTo(doc,start_y+1);
|
||||
if (EdGoToFun(doc,FALSE,FALSE)) {
|
||||
start_y=doc->cur_entry->y;
|
||||
indent=EdRICode(doc);
|
||||
DocUnlock(doc);
|
||||
Snd(2000); Sleep(150); Snd(0);
|
||||
Sleep(100);
|
||||
Snd(2000); Sleep(150); Snd(0);
|
||||
if (beep) {
|
||||
Snd(2000); Sleep(150); Snd(0);
|
||||
Sleep(100);
|
||||
Snd(2000); Sleep(150); Snd(0);
|
||||
}
|
||||
DocLock(doc);
|
||||
EdRemFunLeadingSpace(doc);
|
||||
DocLineNumGoTo(doc,start_y+1);
|
||||
@@ -460,7 +512,8 @@ U0 EdCodeTools2(CDoc *doc,I64 tool_action)
|
||||
while (start_y<=doc_e->y<end_y) {
|
||||
if (doc_e!=doc && doc_e!=doc->cur_entry &&
|
||||
!(doc_e->de_flags&(DOCEG1_DONT_EDIT-DOCEF_SCROLLING_X))) {
|
||||
if (doc_e->type_u8==DOCT_NEW_LINE||doc_e->type_u8==DOCT_SOFT_NEW_LINE)
|
||||
if (doc_e->type_u8==DOCT_NEW_LINE||
|
||||
doc_e->type_u8==DOCT_SOFT_NEW_LINE)
|
||||
start_of_line=TRUE;
|
||||
else {
|
||||
if (start_of_line) {
|
||||
@@ -473,7 +526,8 @@ U0 EdCodeTools2(CDoc *doc,I64 tool_action)
|
||||
doc_ne->x=x;
|
||||
doc_ne->y=doc_e->y;
|
||||
doc_ne->page_line_num=doc_e->page_line_num;
|
||||
MemCpy(&doc_ne->settings,&doc_e->settings,sizeof(CDocSettings));
|
||||
MemCpy(&doc_ne->settings,
|
||||
&doc_e->settings,sizeof(CDocSettings));
|
||||
QueIns(doc_ne,doc_e->last);
|
||||
i-=8;
|
||||
x+=8;
|
||||
@@ -490,7 +544,8 @@ U0 EdCodeTools2(CDoc *doc,I64 tool_action)
|
||||
doc_ne->x=x;
|
||||
doc_ne->y=doc_e->y;
|
||||
doc_ne->page_line_num=doc_e->page_line_num;
|
||||
MemCpy(&doc_ne->settings,&doc_e->settings,sizeof(CDocSettings));
|
||||
MemCpy(&doc_ne->settings,
|
||||
&doc_e->settings,sizeof(CDocSettings));
|
||||
QueIns(doc_ne,doc_e->last);
|
||||
}
|
||||
}
|
||||
@@ -501,6 +556,9 @@ U0 EdCodeTools2(CDoc *doc,I64 tool_action)
|
||||
}
|
||||
QueVectU8Del(indent);
|
||||
}
|
||||
start_y=doc->cur_entry->y;
|
||||
EdReplaceTroubleAll(doc,FALSE,FALSE);
|
||||
DocLineNumGoTo(doc,start_y+1);
|
||||
break;
|
||||
case EF_RENUM_ASM:
|
||||
if (EdGoToFun(doc,FALSE,TRUE)) {
|
||||
@@ -514,9 +572,11 @@ U0 EdCodeTools2(CDoc *doc,I64 tool_action)
|
||||
DocRecalc(doc);
|
||||
}
|
||||
DocUnlock(doc);
|
||||
Snd(2000); Sleep(150); Snd(0);
|
||||
Sleep(100);
|
||||
Snd(2000); Sleep(150); Snd(0);
|
||||
if (beep) {
|
||||
Snd(2000); Sleep(150); Snd(0);
|
||||
Sleep(100);
|
||||
Snd(2000); Sleep(150); Snd(0);
|
||||
}
|
||||
DocLock(doc);
|
||||
EdRenumAsm(doc);
|
||||
}
|
||||
@@ -546,7 +606,7 @@ U0 EdPopUpChSC(I64 *_ch,I64 *_sc)
|
||||
U0 EdChSC(CDoc *doc)
|
||||
{
|
||||
I64 ch,sc;
|
||||
U8 buf[136];
|
||||
U8 buf[STR_LEN];
|
||||
StrPrint(buf,"EdPopUpChSC(%d,%d);",&ch,&sc);
|
||||
PopUp(buf,Fs);
|
||||
if (ch==CH_BACKSPACE)
|
||||
@@ -569,7 +629,7 @@ U0 EdChSC(CDoc *doc)
|
||||
DocPrint(doc,"CH_SPACE,0x%X",sc);
|
||||
else if (ch==CH_SHIFT_SPACE)
|
||||
DocPrint(doc,"CH_SHIFT_SPACE,0x%X",sc);
|
||||
else if (Bt(chars_bitmap_displayable,ch))
|
||||
else if (Bt(chars_bmp_displayable,ch))
|
||||
DocPrint(doc,"'%c',0x%X",ch,sc);
|
||||
else
|
||||
DocPrint(doc,"0x%X,0x%X",ch,sc);
|
||||
|
||||
+86
-73
@@ -151,7 +151,8 @@ class CEdProject
|
||||
hide;
|
||||
};
|
||||
|
||||
Bool GetLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,Bool *_quote,U8 **_html_link)
|
||||
Bool GetLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,
|
||||
Bool *_quote,U8 **_html_link)
|
||||
{
|
||||
I64 i;
|
||||
CEdFileLink *e=CAlloc(sizeof(CEdFileLink));
|
||||
@@ -160,7 +161,7 @@ Bool GetLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,Bool *_quote,U8 **_html
|
||||
e->num=1;
|
||||
switch (type) {
|
||||
case LK_FILE:
|
||||
if (DocFormDo(e,,,,ctrl_L_footer)) {
|
||||
if (DocForm(e,,,,ctrl_L_footer)) {
|
||||
result=TRUE;
|
||||
if (!*e->tag)
|
||||
*_tag=StrNew(e->file);
|
||||
@@ -170,7 +171,7 @@ Bool GetLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,Bool *_quote,U8 **_html
|
||||
}
|
||||
break;
|
||||
case LK_PLAIN:
|
||||
if (DocFormDo(e,,,,ctrl_L_footer)) {
|
||||
if (DocForm(e,,,,ctrl_L_footer)) {
|
||||
result=TRUE;
|
||||
if (!*e->tag)
|
||||
*_tag=StrNew(e->file);
|
||||
@@ -180,7 +181,7 @@ Bool GetLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,Bool *_quote,U8 **_html
|
||||
}
|
||||
break;
|
||||
case LK_FILE_ANCHOR:
|
||||
if (DocFormDo(e,"CEdFileAnchorLink",,,ctrl_L_footer)) {
|
||||
if (DocForm(e,"CEdFileAnchorLink",,,ctrl_L_footer)) {
|
||||
result=TRUE;
|
||||
if (!*e->tag)
|
||||
*_tag=StrNew(e->aux);
|
||||
@@ -190,7 +191,7 @@ Bool GetLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,Bool *_quote,U8 **_html
|
||||
}
|
||||
break;
|
||||
case LK_FILE_FIND:
|
||||
if (DocFormDo(e,"CEdFileFindLink",,,ctrl_L_footer)) {
|
||||
if (DocForm(e,"CEdFileFindLink",,,ctrl_L_footer)) {
|
||||
result=TRUE;
|
||||
if (e->num==1) {
|
||||
if (!*e->tag)
|
||||
@@ -208,7 +209,7 @@ Bool GetLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,Bool *_quote,U8 **_html
|
||||
}
|
||||
break;
|
||||
case LK_PLAIN_FIND:
|
||||
if (DocFormDo(e,"CEdFileFindLink",,,ctrl_L_footer)) {
|
||||
if (DocForm(e,"CEdFileFindLink",,,ctrl_L_footer)) {
|
||||
result=TRUE;
|
||||
if (e->num==1) {
|
||||
if (!*e->tag)
|
||||
@@ -226,7 +227,7 @@ Bool GetLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,Bool *_quote,U8 **_html
|
||||
}
|
||||
break;
|
||||
case LK_FILE_LINE:
|
||||
if (DocFormDo(e,"CEdFileLineLink",,,ctrl_L_footer)) {
|
||||
if (DocForm(e,"CEdFileLineLink",,,ctrl_L_footer)) {
|
||||
result=TRUE;
|
||||
if (!*e->tag)
|
||||
*_tag=StrNew(e->file);
|
||||
@@ -236,7 +237,7 @@ Bool GetLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,Bool *_quote,U8 **_html
|
||||
}
|
||||
break;
|
||||
case LK_PLAIN_LINE:
|
||||
if (DocFormDo(e,"CEdFileLineLink",,,ctrl_L_footer)) {
|
||||
if (DocForm(e,"CEdFileLineLink",,,ctrl_L_footer)) {
|
||||
result=TRUE;
|
||||
if (!*e->tag)
|
||||
*_tag=StrNew(e->file);
|
||||
@@ -246,7 +247,7 @@ Bool GetLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,Bool *_quote,U8 **_html
|
||||
}
|
||||
break;
|
||||
case LK_MAN_PAGE:
|
||||
if (DocFormDo(e,"CEdManPageLink",,,ctrl_L_footer)) {
|
||||
if (DocForm(e,"CEdManPageLink",,,ctrl_L_footer)) {
|
||||
result=TRUE;
|
||||
if (!*e->tag)
|
||||
*_tag=StrNew(e->aux);
|
||||
@@ -256,7 +257,7 @@ Bool GetLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,Bool *_quote,U8 **_html
|
||||
}
|
||||
break;
|
||||
case LK_PLACE_ANCHOR:
|
||||
if (DocFormDo(e,"CEdPlaceAnchor",,,ctrl_L_footer)) {
|
||||
if (DocForm(e,"CEdPlaceAnchor",,,ctrl_L_footer)) {
|
||||
result=TRUE;
|
||||
if (!*e->tag) {
|
||||
if (e->hide)
|
||||
@@ -271,7 +272,7 @@ Bool GetLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,Bool *_quote,U8 **_html
|
||||
case LK_BIBLE_FIND: //TODO
|
||||
i=PopUpPickDefineSub("ST_BIBLE_BOOKS");
|
||||
if (i>=0) {
|
||||
if (DocFormDo(e,"CEdBibleLink",,,ctrl_L_footer)) {
|
||||
if (DocForm(e,"CEdBibleLink",,,ctrl_L_footer)) {
|
||||
result=TRUE;
|
||||
if (!*e->tag)
|
||||
*_tag=MStrPrint("%Z,%s",i,"ST_BIBLE_BOOKS",e->aux);
|
||||
@@ -283,7 +284,7 @@ Bool GetLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,Bool *_quote,U8 **_html
|
||||
break;
|
||||
case LK_DEF:
|
||||
e->num=-1;
|
||||
if (DocFormDo(e,"CEdDefLink",,,ctrl_L_footer)) {
|
||||
if (DocForm(e,"CEdDefLink",,,ctrl_L_footer)) {
|
||||
result=TRUE;
|
||||
if (!*e->tag)
|
||||
*_tag=StrNew(e->aux);
|
||||
@@ -297,7 +298,7 @@ Bool GetLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,Bool *_quote,U8 **_html
|
||||
}
|
||||
break;
|
||||
case LK_HELP_INDEX:
|
||||
if (DocFormDo(e,"CEdManPageLink",,,ctrl_L_footer)) {
|
||||
if (DocForm(e,"CEdManPageLink",,,ctrl_L_footer)) {
|
||||
result=TRUE;
|
||||
if (!*e->tag)
|
||||
*_tag=StrNew(e->aux);
|
||||
@@ -308,7 +309,7 @@ Bool GetLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,Bool *_quote,U8 **_html
|
||||
break;
|
||||
case LK_ADDR:
|
||||
e->num=DFT_ADDR_LINK_BIN_SIZE;
|
||||
if (DocFormDo(e,"CEdAddrLink",,,ctrl_L_footer)) {
|
||||
if (DocForm(e,"CEdAddrLink",,,ctrl_L_footer)) {
|
||||
result=TRUE;
|
||||
if (e->num==DFT_ADDR_LINK_BIN_SIZE) {
|
||||
if (!*e->tag)
|
||||
@@ -363,7 +364,8 @@ U0 EdInsLink()
|
||||
break;
|
||||
default:
|
||||
if (html_link)
|
||||
st=MStrPrint("$$LK%s,\"%Q\",A=\"%Q\",HTML=\"%Q\"$$",pop_up_st,tag,link,html_link);
|
||||
st=MStrPrint("$$LK%s,\"%Q\",A=\"%Q\",HTML=\"%Q\"$$",
|
||||
pop_up_st,tag,link,html_link);
|
||||
else
|
||||
st=MStrPrint("$$LK%s,\"%Q\",A=\"%Q\"$$",pop_up_st,tag,link);
|
||||
}
|
||||
@@ -442,7 +444,7 @@ U0 EdInsPageSetting()
|
||||
CEdPageSetting1 *e=CAlloc(sizeof(CEdPageSetting1));
|
||||
if (type>=0) {
|
||||
if (type==DOCT_RIGHT_MARGIN||type==DOCT_PAGE_LEN) {
|
||||
if (DocFormDo(e(CEdPageSetting2 *))) {
|
||||
if (DocForm(e(CEdPageSetting2 *))) {
|
||||
if (e->winrel) {
|
||||
if (*e->val)
|
||||
"$$%Z+WR,%s$$",type,"ST_DOC_CMDS",e->val;
|
||||
@@ -456,7 +458,7 @@ U0 EdInsPageSetting()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (DocFormDo(e)) {
|
||||
if (DocForm(e)) {
|
||||
if (*e->val)
|
||||
"$$%Z,%s$$",type,"ST_DOC_CMDS",e->val;
|
||||
else
|
||||
@@ -506,18 +508,23 @@ class CEdDollarText
|
||||
underline fmtstr "$$CB,\"Underline\"$$\n",
|
||||
tree fmtstr "$$CB,\"Tree\"$$\n",
|
||||
collapsed fmtstr "$$CB,\"Collapsed\"$$\n";
|
||||
U8 scroll_x [512] fmtstr "$$DA-P,511,A=\"Scroll X Length Expression:%s\"$$\n",
|
||||
shift_x [512] fmtstr "$$DA-P,511,A=\"X Offset Expression :%s\"$$\n",
|
||||
shift_y [512] fmtstr "$$DA-P,511,A=\"Y Offset Expression :%s\"$$\n",
|
||||
define_str[512] fmtstr "$$DA-P,511,A=\"Define Str :%s\"$$\n",
|
||||
html_link[512] fmtstr "$$DA-P,511,A=\"Html Link :%s\"$$\n";
|
||||
U8 scroll_x [512]
|
||||
fmtstr "$$DA-P,511,A=\"Scroll X Length Expression:%s\"$$\n",
|
||||
shift_x [512]
|
||||
fmtstr "$$DA-P,511,A=\"X Offset Expression :%s\"$$\n",
|
||||
shift_y [512]
|
||||
fmtstr "$$DA-P,511,A=\"Y Offset Expression :%s\"$$\n",
|
||||
define_str[512]
|
||||
fmtstr "$$DA-P,511,A=\"Define Str :%s\"$$\n",
|
||||
html_link[512]
|
||||
fmtstr "$$DA-P,511,A=\"Html Link :%s\"$$\n";
|
||||
};
|
||||
|
||||
U0 EdInsDollarText()
|
||||
{
|
||||
U8 *st,buf[512];
|
||||
CEdDollarText *e=CAlloc(sizeof(CEdDollarText));
|
||||
if (DocFormDo(e,,,,ctrl_L_footer)) {
|
||||
if (DocForm(e,,,,ctrl_L_footer)) {
|
||||
*buf=0;
|
||||
if (e->left_x ) CatPrint(buf,"+LX");
|
||||
if (e->center_x) CatPrint(buf,"+CX");
|
||||
@@ -561,7 +568,7 @@ class CEdSong
|
||||
U0 EdInsSong()
|
||||
{
|
||||
CEdSong *e=CAlloc(sizeof(CEdSong));
|
||||
if (DocFormDo(e,,,,ctrl_L_footer))
|
||||
if (DocForm(e,,,,ctrl_L_footer))
|
||||
"$$SO,\"%Q\",A=\"%s\"$$",e->tag,e->song;
|
||||
Free(e);
|
||||
}
|
||||
@@ -574,7 +581,7 @@ class CEdHighlight
|
||||
U0 EdInsHighlight()
|
||||
{
|
||||
CEdHighlight *e=CAlloc(sizeof(CEdHighlight));
|
||||
if (DocFormDo(e,,,,ctrl_L_footer))
|
||||
if (DocForm(e,,,,ctrl_L_footer))
|
||||
"$$HL,%d$$",e->highlight_on;
|
||||
Free(e);
|
||||
}
|
||||
@@ -587,16 +594,19 @@ class CEdHtmlCode
|
||||
U0 EdInsHtml()
|
||||
{
|
||||
CEdHtmlCode *e=CAlloc(sizeof(CEdHtmlCode));
|
||||
if (DocFormDo(e,,,,ctrl_L_footer))
|
||||
if (DocForm(e,,,,ctrl_L_footer))
|
||||
"$$HC,\"%Q\"$$",e->tag;
|
||||
Free(e);
|
||||
}
|
||||
|
||||
class CEdMacroMenu
|
||||
{
|
||||
U8 tag[512] fmtstr "$$DA-P,511,A=\"Tag Text :%s\"$$\n",
|
||||
left_macro[512] fmtstr "$$DA-P,511,A=\"Left Click Macro :%s\"$$\n",
|
||||
left_exp[512] fmtstr "$$DA-P,511,A=\"Left Click Expression :%s\"$$\n";
|
||||
U8 tag[512]
|
||||
fmtstr "$$DA-P,511,A=\"Tag Text :%s\"$$\n",
|
||||
left_macro[512]
|
||||
fmtstr "$$DA-P,511,A=\"Left Click Macro :%s\"$$\n",
|
||||
left_exp[512]
|
||||
fmtstr "$$DA-P,511,A=\"Left Click Expression :%s\"$$\n";
|
||||
Bool popup fmtstr "$$CB,\"PopUp\"$$\n",
|
||||
left_is_auto fmtstr "$$CB,\"Left is AutoStr\"$$\n",
|
||||
left_x fmtstr "$$CB,\"Left X \"$$\n",
|
||||
@@ -607,9 +617,12 @@ class CEdMacroMenu
|
||||
invert fmtstr "$$CB,\"Invert\"$$\n",
|
||||
underline fmtstr "$$CB,\"Underline\"$$\n",
|
||||
escape fmtstr "$$CB,\"Escape\"$$\n";
|
||||
U8 scroll_x[512] fmtstr "$$DA-P,511,A=\"Scroll X Length Expression:%s\"$$\n",
|
||||
shift_x[512] fmtstr "$$DA-P,511,A=\"X Offset Expression :%s\"$$\n",
|
||||
shift_y[512] fmtstr "$$DA-P,511,A=\"Y Offset Expression :%s\"$$\n";
|
||||
U8 scroll_x[512]
|
||||
fmtstr "$$DA-P,511,A=\"Scroll X Length Expression:%s\"$$\n",
|
||||
shift_x[512]
|
||||
fmtstr "$$DA-P,511,A=\"X Offset Expression :%s\"$$\n",
|
||||
shift_y[512]
|
||||
fmtstr "$$DA-P,511,A=\"Y Offset Expression :%s\"$$\n";
|
||||
};
|
||||
|
||||
U0 EdInsMacroMenu(Bool is_macro)
|
||||
@@ -618,7 +631,7 @@ U0 EdInsMacroMenu(Bool is_macro)
|
||||
CEdMacroMenu *e=CAlloc(sizeof(CEdMacroMenu));
|
||||
e->underline=TRUE;
|
||||
e->escape=TRUE;
|
||||
if (DocFormDo(e,,,,ctrl_L_footer)) {
|
||||
if (DocForm(e,,,,ctrl_L_footer)) {
|
||||
*buf=0;
|
||||
if (e->popup) CatPrint(buf,"+PU-X");
|
||||
if (e->left_x ) CatPrint(buf,"+LX");
|
||||
@@ -682,7 +695,7 @@ U0 EdInsButton()
|
||||
U8 *st,buf[512];
|
||||
CEdButton *e=CAlloc(sizeof(CEdButton));
|
||||
e->escape=TRUE;
|
||||
if (DocFormDo(e,,,,ctrl_L_footer)) {
|
||||
if (DocForm(e,,,,ctrl_L_footer)) {
|
||||
*buf=0;
|
||||
if (e->popup) CatPrint(buf,"+PU-X");
|
||||
if (e->left_x ) CatPrint(buf,"+LX");
|
||||
@@ -741,7 +754,7 @@ U0 EdInsCursorMovement()
|
||||
{
|
||||
U8 buf[512];
|
||||
CEdCursorMovement *e=CAlloc(sizeof(CEdCursorMovement));
|
||||
if (DocFormDo(e,,,,ctrl_L_footer)) {
|
||||
if (DocForm(e,,,,ctrl_L_footer)) {
|
||||
*buf=0;
|
||||
if (e->left_x ) CatPrint(buf,"+LX");
|
||||
if (e->center_x) CatPrint(buf,"+CX");
|
||||
@@ -785,7 +798,7 @@ U0 EdInsData()
|
||||
e->term=TRUE;
|
||||
e->len=512;
|
||||
e->type=RT_I64;
|
||||
if (DocFormDo(e,,,,ctrl_L_footer)) {
|
||||
if (DocForm(e,,,,ctrl_L_footer)) {
|
||||
*buf=0;
|
||||
if (e->type==RT_I64)
|
||||
*raw_type=0;
|
||||
@@ -815,7 +828,7 @@ U0 EdInsCheckBox()
|
||||
U8 *st,buf[512],raw_type[16];
|
||||
CEdCheckBox *e=CAlloc(sizeof(CEdCheckBox));
|
||||
e->type=RT_I8;
|
||||
if (DocFormDo(e,,,,ctrl_L_footer)) {
|
||||
if (DocForm(e,,,,ctrl_L_footer)) {
|
||||
*buf=0;
|
||||
if (e->type==RT_I8)
|
||||
*raw_type=0;
|
||||
@@ -842,7 +855,7 @@ U0 EdInsLst()
|
||||
U8 *st1,*st2,buf[512],raw_type[16];
|
||||
CEdLst *e=CAlloc(sizeof(CEdLst));
|
||||
e->type=RT_I64;
|
||||
if (DocFormDo(e,,,,ctrl_L_footer)) {
|
||||
if (DocForm(e,,,,ctrl_L_footer)) {
|
||||
*buf=0;
|
||||
if (e->type==RT_I64)
|
||||
*raw_type=0;
|
||||
@@ -879,7 +892,7 @@ U0 EdInsHexEd()
|
||||
e->cnt=128;
|
||||
e->cols=4;
|
||||
e->zero=TRUE;
|
||||
if (DocFormDo(e,,,,ctrl_L_footer)) {
|
||||
if (DocForm(e,,,,ctrl_L_footer)) {
|
||||
*buf=0;
|
||||
if (!e->zero) CatPrint(buf,"-Z");
|
||||
if (e->refresh) CatPrint(buf,"+RD");
|
||||
@@ -903,18 +916,18 @@ U0 EdInsBinary(I64 bin_num,I64 type)
|
||||
StrPrint(e->tag,"<%d>",bin_num);
|
||||
e->bin_num=bin_num;
|
||||
e->bin_ptr_link_bin_num=1;
|
||||
if (DocFormDo(e,,,
|
||||
"Note: Normally, you enter no file,\n"
|
||||
"just a bin num. If You enter a\n"
|
||||
"file, enter a file bin num or a file\n"
|
||||
"bin tag.\n\n",ctrl_L_footer)) {
|
||||
if (DocForm(e,,,
|
||||
"Note: Normally, you enter no file,\n"
|
||||
"just a bin num. If You enter a\n"
|
||||
"file, enter a file bin num or a file\n"
|
||||
"bin tag.\n\n",ctrl_L_footer)) {
|
||||
if (*e->bin_ptr_link_file) {
|
||||
if (*e->bin_ptr_link_tag)
|
||||
"$$%Z,\"%Q\",BI=%d,BP=\"%s,%s\"$$",type,"ST_DOC_CMDS",e->tag,e->bin_num,
|
||||
e->bin_ptr_link_file,e->bin_ptr_link_tag;
|
||||
e->bin_ptr_link_file,e->bin_ptr_link_tag;
|
||||
else
|
||||
"$$%Z,\"%Q\",BI=%d,BP=\"%s,%d\"$$",type,"ST_DOC_CMDS",e->tag,e->bin_num,
|
||||
e->bin_ptr_link_file,e->bin_ptr_link_bin_num;
|
||||
e->bin_ptr_link_file,e->bin_ptr_link_bin_num;
|
||||
} else {
|
||||
if (DocBinFindNum(DocPut,e->bin_num))
|
||||
"$$%Z,\"%Q\",BI=%d$$",type,"ST_DOC_CMDS",e->tag,e->bin_num;
|
||||
@@ -938,12 +951,12 @@ U0 EdInsTree()
|
||||
CEdTree *e=CAlloc(sizeof(CEdTree));
|
||||
e->collapsed=TRUE;
|
||||
e->indent=2;
|
||||
if (DocFormDo(e,,,,ctrl_L_footer)) {
|
||||
if (DocForm(e,,,,ctrl_L_footer)) {
|
||||
*buf=0;
|
||||
if (!e->collapsed) CatPrint(buf,"-C");
|
||||
st1=MStrPrint("%q",e->tag);
|
||||
st2=MStrPrint("$$TR%s,\"%Q\"$$\n$$ID,%d$$*\n$$ID,%d$$",
|
||||
buf,st1,e->indent,-e->indent);
|
||||
buf,st1,e->indent,-e->indent);
|
||||
DocPrintAtomic(DocPut,"%s",st2);
|
||||
Free(st1);
|
||||
Free(st2);
|
||||
@@ -1002,16 +1015,16 @@ U0 EdInsDollarCmd()
|
||||
break;
|
||||
case DOCT_HTML_CODE:
|
||||
EdInsHtml;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define DVT_SPRITE 0
|
||||
#define DVT_SPRITE_PTR 1
|
||||
#define DVT_DUP_SPRITE 2
|
||||
#define DVT_SPRITE_SIZE 3
|
||||
#define DVT_SPRITE_MACRO 4
|
||||
#define DVT_SPRITE_MENU 5
|
||||
#define DVT_SPRITE_LINK 6
|
||||
#define EST_SPRITE 0
|
||||
#define EST_SPRITE_PTR 1
|
||||
#define EST_DUP_SPRITE 2
|
||||
#define EST_SPRITE_SIZE 3
|
||||
#define EST_SPRITE_MACRO 4
|
||||
#define EST_SPRITE_MENU 5
|
||||
#define EST_SPRITE_LINK 6
|
||||
|
||||
I64 PopUpSpriteType()
|
||||
{
|
||||
@@ -1019,13 +1032,13 @@ I64 PopUpSpriteType()
|
||||
CDoc *doc=DocNew;
|
||||
DocPrint(doc,"$$PURPLE$$$$TX+CX,\"Graphic Resource Menu\"$$\n"
|
||||
"$$LK+PU+CX,\"Click for Help\",A=\"FI:::/Doc/Resource.TXT.Z\"$$\n"
|
||||
"\n$$LTBLUE$$$$MU,\"Make Sprite\",LE=DVT_SPRITE$$\n"
|
||||
"$$MU,\"Pointer to Sprite\",LE=DVT_SPRITE_PTR$$\n"
|
||||
"$$MU,\"Duplicate Sprite\",LE=DVT_DUP_SPRITE$$\n"
|
||||
"$$MU,\"Sprite Size (not really needed)\",LE=DVT_SPRITE_SIZE$$\n"
|
||||
"$$MU,\"Sprite Macro (Icon)\",LE=DVT_SPRITE_MACRO$$\n"
|
||||
"$$MU,\"Sprite Menu Item\",LE=DVT_SPRITE_MENU$$\n"
|
||||
"$$MU,\"Sprite Link\",LE=DVT_SPRITE_LINK$$\n"
|
||||
"\n$$LTBLUE$$$$MU,\"Make Sprite\",LE=EST_SPRITE$$\n"
|
||||
"$$MU,\"Pointer to Sprite\",LE=EST_SPRITE_PTR$$\n"
|
||||
"$$MU,\"Duplicate Sprite\",LE=EST_DUP_SPRITE$$\n"
|
||||
"$$MU,\"Sprite Size (not really needed)\",LE=EST_SPRITE_SIZE$$\n"
|
||||
"$$MU,\"Sprite Macro (Icon)\",LE=EST_SPRITE_MACRO$$\n"
|
||||
"$$MU,\"Sprite Menu Item\",LE=EST_SPRITE_MENU$$\n"
|
||||
"$$MU,\"Sprite Link\",LE=EST_SPRITE_LINK$$\n"
|
||||
"\n$$MU,\"Abort\",LE=DOCM_CANCEL$$\n\n");
|
||||
i=PopUpMenu(doc);
|
||||
DocDel(doc);
|
||||
@@ -1074,14 +1087,14 @@ U8 *EdSprite(I64 bin_num)
|
||||
CEdMacroSprite *e=CAlloc(sizeof(CEdMacroSprite));
|
||||
*buf=0;
|
||||
switch (type) {
|
||||
case DVT_SPRITE:
|
||||
case EST_SPRITE:
|
||||
StrPrint(e->tag,"<%d>",bin_num);
|
||||
if (DocFormDo(e,"CEdJustSprite",,,ctrl_L_footer))
|
||||
if (DocForm(e,"CEdJustSprite",,,ctrl_L_footer))
|
||||
st1=MStrPrint("\"%Q\"",e->tag);
|
||||
break;
|
||||
case DVT_SPRITE_MACRO:
|
||||
case EST_SPRITE_MACRO:
|
||||
e->escape=TRUE;
|
||||
if (DocFormDo(e,,,,ctrl_L_footer)) {
|
||||
if (DocForm(e,,,,ctrl_L_footer)) {
|
||||
CatPrint(buf,"+UL");
|
||||
if (e->is_auto)CatPrint(buf,"+LA");
|
||||
if (e->popup) CatPrint(buf,"+PU");
|
||||
@@ -1091,26 +1104,26 @@ U8 *EdSprite(I64 bin_num)
|
||||
Free(st);
|
||||
}
|
||||
break;
|
||||
case DVT_SPRITE_MENU:
|
||||
case EST_SPRITE_MENU:
|
||||
e->escape=TRUE;
|
||||
if (DocFormDo(e,"CEdMenuSprite",,,ctrl_L_footer)) {
|
||||
if (DocForm(e,"CEdMenuSprite",,,ctrl_L_footer)) {
|
||||
if (e->escape) CatPrint(buf,"+X");
|
||||
st1=MStrPrint("\"%Q\",LE=%s",e->tag,e->exp);
|
||||
}
|
||||
break;
|
||||
case DVT_SPRITE_LINK:
|
||||
case EST_SPRITE_LINK:
|
||||
CatPrint(buf,"+L");
|
||||
st1=EdSpriteLink(&pop_up,&html_link);
|
||||
if (pop_up)
|
||||
CatPrint(buf,"+PU");
|
||||
break;
|
||||
case DVT_SPRITE_PTR:
|
||||
case EST_SPRITE_PTR:
|
||||
EdInsBinary(--bin_num,DOCT_INS_BINARY);
|
||||
break;
|
||||
case DVT_SPRITE_SIZE:
|
||||
case EST_SPRITE_SIZE:
|
||||
EdInsBinary(--bin_num,DOCT_INS_BINARY_SIZE);
|
||||
break;
|
||||
case DVT_DUP_SPRITE:
|
||||
case EST_DUP_SPRITE:
|
||||
EdInsBinary(--bin_num,DOCT_SPRITE);
|
||||
break;
|
||||
}
|
||||
|
||||
+163
-161
@@ -5,11 +5,13 @@ public I64 EdCurU8(CDoc *doc)
|
||||
Bool unlock=DocLock(doc);
|
||||
CDocEntry *doc_ce=doc->cur_entry;
|
||||
I64 result=-1;
|
||||
if (doc_ce->type_u8==DOCT_TEXT && doc_ce->min_col<=doc->cur_data_col<doc_ce->max_col)
|
||||
result=doc_ce->tag[doc->cur_data_col];
|
||||
if (doc_ce->type_u8==DOCT_TEXT &&
|
||||
doc_ce->min_col<=doc->cur_col<doc_ce->max_col)
|
||||
result=doc_ce->tag[doc->cur_col];
|
||||
else if (doc_ce->type_u8==DOCT_TAB)
|
||||
result='\t';
|
||||
else if (doc_ce->type_u8==DOCT_NEW_LINE || doc_ce->type_u8==DOCT_SOFT_NEW_LINE)
|
||||
else if (doc_ce->type_u8==DOCT_NEW_LINE ||
|
||||
doc_ce->type_u8==DOCT_SOFT_NEW_LINE)
|
||||
result='\n';
|
||||
if (unlock)
|
||||
DocUnlock(doc);
|
||||
@@ -22,11 +24,11 @@ public U0 EdCursorLeft(CDoc *doc,I64 sc=MIN_I64)
|
||||
U8 *dst;
|
||||
Bool unlock=DocLock(doc);
|
||||
CDocEntry *doc_ce=doc->cur_entry,*original_ce=doc_ce,*doc_ne;
|
||||
I64 cc=doc->cur_data_col,y=doc_ce->y;
|
||||
I64 cc=doc->cur_col,y=doc_ce->y;
|
||||
if (sc!=MIN_I64) sc=sc.u32[0];
|
||||
if (sc>=0 && sc&SCF_CTRL) {
|
||||
while (doc_ce->last!=doc && (doc_ce->last->y==y ||
|
||||
doc_ce->de_flags & (DOCEF_SKIP|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP)))
|
||||
doc_ce->de_flags & (DOCEF_SKIP|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP)))
|
||||
doc_ce=doc_ce->last; //TODO: select? recurse?
|
||||
cc=doc_ce->min_col;
|
||||
} else {
|
||||
@@ -53,8 +55,10 @@ public U0 EdCursorLeft(CDoc *doc,I64 sc=MIN_I64)
|
||||
} else {
|
||||
cc=doc_ce->min_col;
|
||||
while (doc_ce->last!=doc &&
|
||||
(doc_ce->last->type_u8==DOCT_SOFT_NEW_LINE || doc_ce->last->type_u8==DOCT_INDENT ||
|
||||
doc_ce->last->de_flags & (DOCEF_SKIP|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP))) {
|
||||
(doc_ce->last->type_u8==DOCT_SOFT_NEW_LINE ||
|
||||
doc_ce->last->type_u8==DOCT_INDENT ||
|
||||
doc_ce->last->de_flags
|
||||
&(DOCEF_SKIP|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP))) {
|
||||
doc_ce=doc_ce->last;
|
||||
if (sc>=0)
|
||||
BEqu(&doc_ce->type,DOCEt_SELECTED,sc&SCF_SHIFT);
|
||||
@@ -79,7 +83,7 @@ public U0 EdCursorLeft(CDoc *doc,I64 sc=MIN_I64)
|
||||
}
|
||||
}
|
||||
}
|
||||
doc->cur_data_col=cc;
|
||||
doc->cur_col=cc;
|
||||
doc->cur_entry=doc_ce;
|
||||
if (doc_ce!=original_ce)
|
||||
DocFormBwd(doc);
|
||||
@@ -93,12 +97,13 @@ public U0 EdCursorRight(CDoc *doc,I64 sc=MIN_I64)
|
||||
Bool unlock=DocLock(doc);
|
||||
U8 *dst;
|
||||
CDocEntry *doc_ce=doc->cur_entry,*original_ce=doc_ce,*doc_ne;
|
||||
I64 cc=doc->cur_data_col,y=doc_ce->y,old_de_flags,old_color;
|
||||
I64 cc=doc->cur_col,y=doc_ce->y,old_de_flags,old_color;
|
||||
if (sc!=MIN_I64) sc=sc.u32[0];
|
||||
if (sc>=0 && sc&SCF_CTRL) {
|
||||
while (doc_ce!=doc && doc_ce->next->y==y &&
|
||||
doc_ce->next->type_u8!=DOCT_SOFT_NEW_LINE && doc_ce->next!=doc && (doc_ce->next->type_u8!=DOCT_NEW_LINE || !(doc->flags & DOCF_FORM)) ||
|
||||
doc_ce->de_flags & (DOCEF_SKIP|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP))
|
||||
doc_ce->next->type_u8!=DOCT_SOFT_NEW_LINE && doc_ce->next!=doc &&
|
||||
(doc_ce->next->type_u8!=DOCT_NEW_LINE || !(doc->flags & DOCF_FORM)) ||
|
||||
doc_ce->de_flags & (DOCEF_SKIP|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP))
|
||||
doc_ce=doc_ce->next;
|
||||
if (doc_ce->max_col>doc_ce->min_col)
|
||||
cc=doc_ce->max_col-1;
|
||||
@@ -139,7 +144,8 @@ public U0 EdCursorRight(CDoc *doc,I64 sc=MIN_I64)
|
||||
if (cc<=doc_ce->min_col && sc>=0)
|
||||
BEqu(&doc_ce->type,DOCEt_SELECTED,sc&SCF_SHIFT);
|
||||
doc_ce=doc_ce->next;
|
||||
while (doc_ce!=doc && doc_ce->de_flags & (DOCEF_SKIP|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP)) {
|
||||
while (doc_ce!=doc && doc_ce->de_flags
|
||||
&(DOCEF_SKIP|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP)) {
|
||||
if (sc>=0)
|
||||
BEqu(&doc_ce->type,DOCEt_SELECTED,sc&SCF_SHIFT);
|
||||
doc_ce=doc_ce->next;
|
||||
@@ -154,7 +160,7 @@ public U0 EdCursorRight(CDoc *doc,I64 sc=MIN_I64)
|
||||
}
|
||||
}
|
||||
}
|
||||
doc->cur_data_col=cc;
|
||||
doc->cur_col=cc;
|
||||
doc->cur_entry=doc_ce;
|
||||
if (doc_ce!=original_ce)
|
||||
DocFormFwd(doc);
|
||||
@@ -172,42 +178,42 @@ public U0 EdLineUp(CDoc *doc,I64 sc=MIN_I64)
|
||||
|
||||
if (sc!=MIN_I64) sc=sc.u32[0];
|
||||
if (doc_ce->type_u8==DOCT_HEX_ED) {
|
||||
doc->cur_data_col=doc->cur_data_col-doc_ce->hex_ed_width*3;
|
||||
if (doc->cur_data_col>=0) {
|
||||
doc->cur_col=doc->cur_col-doc_ce->hex_ed_width*3;
|
||||
if (doc->cur_col>=0) {
|
||||
if (unlock)
|
||||
DocUnlock(doc);
|
||||
return;
|
||||
} else
|
||||
doc->cur_data_col=0;
|
||||
doc->cur_col=0;
|
||||
}
|
||||
x=doc->x; y=doc->y;
|
||||
if (IsEditableText(doc_ce)) {
|
||||
if (doc_ce->min_col<doc->cur_data_col<doc_ce->max_col-1) {
|
||||
dst=doc_ce->tag+doc->cur_data_col;
|
||||
if (doc_ce->min_col<doc->cur_col<doc_ce->max_col-1) {
|
||||
dst=doc_ce->tag+doc->cur_col;
|
||||
doc_ne=DocEntryNew(doc,doc_ce,StrNew(dst,doc->mem_task));
|
||||
*dst=0;
|
||||
doc_ne->x=doc_ce->x+doc->cur_data_col;
|
||||
doc_ce->max_col=doc->cur_data_col;
|
||||
doc_ne->x=doc_ce->x+doc->cur_col;
|
||||
doc_ce->max_col=doc->cur_col;
|
||||
QueIns(doc_ne,doc_ce);
|
||||
} else
|
||||
if (doc->cur_data_col==doc_ce->min_col && doc_ce->last!=doc)
|
||||
doc_ce=doc_ce->last;
|
||||
} else
|
||||
if (doc_ce->last!=doc)
|
||||
} else if (doc->cur_col==doc_ce->min_col && doc_ce->last!=doc)
|
||||
doc_ce=doc_ce->last;
|
||||
} else if (doc_ce->last!=doc)
|
||||
doc_ce=doc_ce->last;
|
||||
if (sc>=0)
|
||||
BEqu(&doc_ce->type,DOCEt_SELECTED,sc&SCF_SHIFT);
|
||||
doc->cur_entry=doc_ce;
|
||||
DocFormBwd(doc);
|
||||
doc_ce=doc->cur_entry;
|
||||
while (doc_ce->last!=doc && (doc_ce->y>=y || doc_ce->de_flags & (DOCEF_SKIP|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP))) {
|
||||
while (doc_ce->last!=doc && (doc_ce->y>=y ||
|
||||
doc_ce->de_flags & (DOCEF_SKIP|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP))) {
|
||||
doc_ce=doc_ce->last;
|
||||
if (sc>=0)
|
||||
BEqu(&doc_ce->type,DOCEt_SELECTED,sc&SCF_SHIFT);
|
||||
}
|
||||
y=doc_ce->y;
|
||||
doc->y=y;
|
||||
while (doc_ce!=doc && (doc_ce->y>=y && doc_ce->x>=x || doc_ce->de_flags & (DOCEF_SKIP|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP))) {
|
||||
while (doc_ce!=doc && (doc_ce->y>=y && doc_ce->x>=x ||
|
||||
doc_ce->de_flags & (DOCEF_SKIP|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP))) {
|
||||
if (sc>=0)
|
||||
BEqu(&doc_ce->type,DOCEt_SELECTED,sc&SCF_SHIFT);
|
||||
doc_ce=doc_ce->last;
|
||||
@@ -222,38 +228,35 @@ public U0 EdLineUp(CDoc *doc,I64 sc=MIN_I64)
|
||||
} else {
|
||||
if (doc_ce->next->x==x) {
|
||||
doc_ce=doc_ce->next;
|
||||
if (doc->flags & DOCF_FORM) {
|
||||
if (doc->flags & DOCF_FORM)
|
||||
while (doc_ce->next->x==x &&
|
||||
(!Bt(doldoc.type_flags_form,doc_ce->type_u8) &&
|
||||
!(doc_ce->de_flags&DOCEF_LINK)||
|
||||
doc_ce->de_flags&DOCEF_SKIP_IN_FORM))
|
||||
(!Bt(doldoc.type_flags_form,doc_ce->type_u8) &&
|
||||
!(doc_ce->de_flags&DOCEF_LINK)||
|
||||
doc_ce->de_flags&DOCEF_SKIP_IN_FORM))
|
||||
doc_ce=doc_ce->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (doc_ce->de_flags&DOCEF_TAG) {
|
||||
doc->cur_data_col=x-doc_ce->x;
|
||||
doc->cur_col=x-doc_ce->x;
|
||||
if (IsEditableText(doc_ce)) {
|
||||
if (doc->cur_data_col>doc_ce->max_col)
|
||||
doc->cur_data_col=doc_ce->max_col;
|
||||
} else {
|
||||
if (doc->cur_data_col>=doc_ce->max_col)
|
||||
doc->cur_data_col=doc_ce->max_col-1;
|
||||
}
|
||||
if (doc->cur_data_col<doc_ce->min_col)
|
||||
doc->cur_data_col=doc_ce->min_col;
|
||||
if (doc->cur_col>doc_ce->max_col)
|
||||
doc->cur_col=doc_ce->max_col;
|
||||
} else if (doc->cur_col>=doc_ce->max_col)
|
||||
doc->cur_col=doc_ce->max_col-1;
|
||||
if (doc->cur_col<doc_ce->min_col)
|
||||
doc->cur_col=doc_ce->min_col;
|
||||
} else {
|
||||
if (doc_ce->type_u8==DOCT_HEX_ED) {
|
||||
doc->cur_data_col=RoundI64((doc_ce->len-1)*3,doc_ce->hex_ed_width*3);
|
||||
if (doc->cur_data_col<0)
|
||||
doc->cur_data_col=0;
|
||||
doc->cur_col=RoundI64((doc_ce->len-1)*3,doc_ce->hex_ed_width*3);
|
||||
if (doc->cur_col<0)
|
||||
doc->cur_col=0;
|
||||
} else
|
||||
doc->cur_data_col=doc_ce->min_col;
|
||||
doc->cur_col=doc_ce->min_col;
|
||||
}
|
||||
if (IsEditableText(doc_ce) && doc_ce->x<x) {
|
||||
if (doc->cur_data_col<doc_ce->max_col-1) {
|
||||
dst=doc_ce->tag+doc->cur_data_col;
|
||||
if (doc->cur_col<doc_ce->max_col-1) {
|
||||
dst=doc_ce->tag+doc->cur_col;
|
||||
doc_ne=DocEntryNew(doc,doc_ce,StrNew(dst,doc->mem_task));
|
||||
*dst=0;
|
||||
if (sc>=0) {
|
||||
@@ -262,16 +265,16 @@ public U0 EdLineUp(CDoc *doc,I64 sc=MIN_I64)
|
||||
else
|
||||
doc_ne->type=doc_ce->type & ~DOCET_SELECTED;
|
||||
}
|
||||
doc_ne->x=doc_ce->x+doc->cur_data_col;
|
||||
doc_ce->max_col=doc->cur_data_col;
|
||||
doc_ne->x=doc_ce->x+doc->cur_col;
|
||||
doc_ce->max_col=doc->cur_col;
|
||||
QueIns(doc_ne,doc_ce);
|
||||
doc_ce=doc_ne;
|
||||
doc->cur_data_col=doc_ce->min_col;
|
||||
doc->cur_col=doc_ce->min_col;
|
||||
}
|
||||
}
|
||||
doc->cur_entry=doc_ce;
|
||||
DocFormFwd(doc);
|
||||
doc->x=doc->cur_entry->x+doc->cur_data_col;
|
||||
doc->x=doc->cur_entry->x+doc->cur_col;
|
||||
if (unlock)
|
||||
DocUnlock(doc);
|
||||
}
|
||||
@@ -285,11 +288,11 @@ public U0 EdLineDown(CDoc *doc,I64 sc=MIN_I64)
|
||||
CDocEntry *doc_ce=doc->cur_entry,*doc_ne,*doc_ce2;
|
||||
if (sc!=MIN_I64) sc=sc.u32[0];
|
||||
if (doc_ce->type_u8==DOCT_HEX_ED) {
|
||||
doc->cur_data_col=doc->cur_data_col+doc_ce->hex_ed_width*3;
|
||||
if (doc->cur_data_col>=doc_ce->len*3) {
|
||||
doc->cur_col=doc->cur_col+doc_ce->hex_ed_width*3;
|
||||
if (doc->cur_col>=doc_ce->len*3) {
|
||||
doc->cur_entry=doc_ce=doc_ce->next;
|
||||
doc->cur_data_col=doc_ce->min_col;
|
||||
doc->x=doc_ce->x+doc->cur_data_col;
|
||||
doc->cur_col=doc_ce->min_col;
|
||||
doc->x=doc_ce->x+doc->cur_col;
|
||||
doc->y=doc_ce->y;
|
||||
}
|
||||
if (unlock)
|
||||
@@ -298,8 +301,8 @@ public U0 EdLineDown(CDoc *doc,I64 sc=MIN_I64)
|
||||
}
|
||||
x=doc->x; y=doc->y;
|
||||
if (IsEditableText(doc_ce)) {
|
||||
if (doc->cur_data_col>doc_ce->min_col && doc->cur_data_col<doc_ce->max_col-1) {
|
||||
dst=doc_ce->tag+doc->cur_data_col;
|
||||
if (doc->cur_col>doc_ce->min_col && doc->cur_col<doc_ce->max_col-1) {
|
||||
dst=doc_ce->tag+doc->cur_col;
|
||||
doc_ne=DocEntryNew(doc,doc_ce,StrNew(dst,doc->mem_task));
|
||||
*dst=0;
|
||||
if (sc>=0) {
|
||||
@@ -308,67 +311,68 @@ public U0 EdLineDown(CDoc *doc,I64 sc=MIN_I64)
|
||||
else
|
||||
doc_ne->type=doc_ce->type & ~DOCET_SELECTED;
|
||||
}
|
||||
doc_ne->x=doc_ce->x+doc->cur_data_col;
|
||||
doc_ce->max_col=doc->cur_data_col;
|
||||
doc_ne->x=doc_ce->x+doc->cur_col;
|
||||
doc_ce->max_col=doc->cur_col;
|
||||
QueIns(doc_ne,doc_ce);
|
||||
doc_ce=doc_ne;
|
||||
doc->cur_data_col=doc_ce->min_col;
|
||||
doc->cur_col=doc_ce->min_col;
|
||||
}
|
||||
}
|
||||
doc_ce2=doc_ce;
|
||||
while (doc_ce!=doc && (doc_ce->y<=y || doc_ce->de_flags & (DOCEF_SKIP|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP)))
|
||||
while (doc_ce!=doc && (doc_ce->y<=y ||
|
||||
doc_ce->de_flags & (DOCEF_SKIP|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP)))
|
||||
doc_ce=doc_ce->next;
|
||||
y=doc_ce->y;
|
||||
doc->y=y;
|
||||
while (doc_ce!=doc && (doc_ce->y<=y && doc_ce->x<=x || doc_ce->de_flags & (DOCEF_SKIP|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP))) {
|
||||
while (doc_ce!=doc && (doc_ce->y<=y && doc_ce->x<=x ||
|
||||
doc_ce->de_flags & (DOCEF_SKIP|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP))) {
|
||||
old_de_flags=doc_ce->de_flags;
|
||||
old_color=doc_ce->type;
|
||||
doc_ce=doc_ce->next;
|
||||
}
|
||||
if (doc_ce->last!=doc && (doc_ce->x>x || doc_ce->y>y)) {
|
||||
if (doc_ce->last!=doc && (doc_ce->x>x && doc_ce->last->y>=y || doc_ce->y>y)) {
|
||||
doc_ce=doc_ce->last;
|
||||
doc->cur_entry=doc_ce;
|
||||
if (!((doc_ce->type_u8==DOCT_NEW_LINE || doc_ce->type_u8==DOCT_SOFT_NEW_LINE || doc_ce->type_u8==DOCT_INDENT) &&
|
||||
(doc_ce->last->type_u8==DOCT_NEW_LINE || doc_ce->last->type_u8==DOCT_SOFT_NEW_LINE || doc_ce->last->type_u8==DOCT_INDENT)))
|
||||
if (!((doc_ce->type_u8==DOCT_NEW_LINE ||
|
||||
doc_ce->type_u8==DOCT_SOFT_NEW_LINE ||
|
||||
doc_ce->type_u8==DOCT_INDENT) &&
|
||||
(doc_ce->last->type_u8==DOCT_NEW_LINE ||
|
||||
doc_ce->last->type_u8==DOCT_SOFT_NEW_LINE ||
|
||||
doc_ce->last->type_u8==DOCT_INDENT)))
|
||||
DocFormBwd(doc);
|
||||
doc_ce=doc->cur_entry;
|
||||
}
|
||||
while (doc_ce2!=doc && (doc_ce2!=doc_ce || IsEditableText(doc_ce))) {
|
||||
if (doc_ce2->y<y || doc_ce2->x<x || doc_ce2->de_flags & (DOCEF_SKIP|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP) ||
|
||||
doc_ce2->x==x && !doc_ce2->max_col &&
|
||||
Bt(doldoc.type_flags_nontag_invisible,doc_ce2->type_u8)) {
|
||||
if (sc>=0)
|
||||
BEqu(&doc_ce2->type,DOCEt_SELECTED,sc&SCF_SHIFT);
|
||||
}
|
||||
if ((doc_ce2->y<y || doc_ce2->x<x ||
|
||||
doc_ce2->de_flags & (DOCEF_SKIP|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP) ||
|
||||
doc_ce2->x==x && !doc_ce2->max_col &&
|
||||
Bt(doldoc.type_flags_nontag_invisible,doc_ce2->type_u8)) && sc>=0)
|
||||
BEqu(&doc_ce2->type,DOCEt_SELECTED,sc&SCF_SHIFT);
|
||||
if (doc_ce2==doc_ce) break;
|
||||
doc_ce2=doc_ce2->next;
|
||||
}
|
||||
if (doc_ce->de_flags&DOCEF_TAG) {
|
||||
doc->cur_data_col=x-doc_ce->x;
|
||||
doc->cur_col=x-doc_ce->x;
|
||||
if (IsEditableText(doc_ce)) {
|
||||
if (doc->cur_data_col>doc_ce->max_col)
|
||||
doc->cur_data_col=doc_ce->max_col;
|
||||
} else {
|
||||
if (doc->cur_data_col>=doc_ce->max_col)
|
||||
doc->cur_data_col=doc_ce->max_col-1;
|
||||
}
|
||||
if (doc->cur_data_col<doc_ce->min_col)
|
||||
doc->cur_data_col=doc_ce->min_col;
|
||||
if (doc->cur_col>doc_ce->max_col)
|
||||
doc->cur_col=doc_ce->max_col;
|
||||
} else if (doc->cur_col>=doc_ce->max_col)
|
||||
doc->cur_col=doc_ce->max_col-1;
|
||||
if (doc->cur_col<doc_ce->min_col)
|
||||
doc->cur_col=doc_ce->min_col;
|
||||
} else
|
||||
doc->cur_data_col=doc_ce->min_col;
|
||||
if (IsEditableText(doc_ce)) {
|
||||
if (doc_ce->min_col<doc->cur_data_col<doc_ce->max_col-1) {
|
||||
dst=doc_ce->tag+doc->cur_data_col;
|
||||
doc_ne=DocEntryNew(doc,doc_ce,StrNew(dst,doc->mem_task));
|
||||
*dst=0;
|
||||
doc_ne->type=DOCT_TEXT | old_color & -0x100;
|
||||
doc_ne->de_flags=old_de_flags|doldoc.dft_de_flags[DOCT_TEXT];
|
||||
doc_ce->max_col=doc->cur_data_col;
|
||||
doc_ne->x=doc_ce->x+doc->cur_data_col;
|
||||
QueIns(doc_ne,doc_ce);
|
||||
doc_ce=doc_ne;
|
||||
doc->cur_data_col=doc_ce->min_col;
|
||||
}
|
||||
doc->cur_col=doc_ce->min_col;
|
||||
if (IsEditableText(doc_ce)&&doc_ce->min_col<doc->cur_col<doc_ce->max_col-1) {
|
||||
dst=doc_ce->tag+doc->cur_col;
|
||||
doc_ne=DocEntryNew(doc,doc_ce,StrNew(dst,doc->mem_task));
|
||||
*dst=0;
|
||||
doc_ne->type=DOCT_TEXT | old_color & -0x100;
|
||||
doc_ne->de_flags=old_de_flags|doldoc.dft_de_flags[DOCT_TEXT];
|
||||
doc_ce->max_col=doc->cur_col;
|
||||
doc_ne->x=doc_ce->x+doc->cur_col;
|
||||
QueIns(doc_ne,doc_ce);
|
||||
doc_ce=doc_ne;
|
||||
doc->cur_col=doc_ce->min_col;
|
||||
}
|
||||
doc->cur_entry=doc_ce;
|
||||
DocFormFwd(doc);
|
||||
@@ -378,7 +382,7 @@ public U0 EdLineDown(CDoc *doc,I64 sc=MIN_I64)
|
||||
BEqu(&doc_ce->type,DOCEt_SELECTED,sc&SCF_SHIFT);
|
||||
doc_ce=doc_ce->next;
|
||||
}
|
||||
doc->x=doc->cur_entry->x+doc->cur_data_col;
|
||||
doc->x=doc->cur_entry->x+doc->cur_col;
|
||||
if (unlock)
|
||||
DocUnlock(doc);
|
||||
}
|
||||
@@ -393,19 +397,19 @@ U0 EdDelChar(CDoc *doc)
|
||||
DocUnlock(doc);
|
||||
return;
|
||||
}
|
||||
if (doc_ce->max_col!=0 && (IsEditableText(doc_ce)||doc_ce->type_u8==DOCT_DATA)) {
|
||||
if (doc_ce->type_u8==DOCT_DATA) {
|
||||
if (doc_ce->de_flags & DOCEF_HAS_TERMINATOR && doc->cur_data_col==doc_ce->max_col-1) {
|
||||
if (unlock)
|
||||
DocUnlock(doc);
|
||||
return;
|
||||
}
|
||||
if (doc_ce->max_col!=0 &&
|
||||
(IsEditableText(doc_ce)||doc_ce->type_u8==DOCT_DATA)) {
|
||||
if (doc_ce->type_u8==DOCT_DATA && doc_ce->de_flags & DOCEF_HAS_TERMINATOR &&
|
||||
doc->cur_col==doc_ce->max_col-1) {
|
||||
if (unlock)
|
||||
DocUnlock(doc);
|
||||
return;
|
||||
}
|
||||
if (doc->cur_data_col<doc_ce->max_col)
|
||||
StrCpy(doc_ce->tag+doc->cur_data_col,doc_ce->tag+doc->cur_data_col+1);
|
||||
if (doc->cur_data_col>=doc_ce->max_col-1) {
|
||||
if (doc->cur_col<doc_ce->max_col)
|
||||
StrCpy(doc_ce->tag+doc->cur_col,doc_ce->tag+doc->cur_col+1);
|
||||
if (doc->cur_col>=doc_ce->max_col-1) {
|
||||
doc->cur_entry=doc_ce->next;
|
||||
doc->cur_data_col=doc->cur_entry->min_col;
|
||||
doc->cur_col=doc->cur_entry->min_col;
|
||||
}
|
||||
DocRemSoftNewLines(doc,doc->cur_entry);
|
||||
if (unlock)
|
||||
@@ -413,7 +417,7 @@ U0 EdDelChar(CDoc *doc)
|
||||
return;
|
||||
}
|
||||
doc->cur_entry=doc_ce->next;
|
||||
doc->cur_data_col=doc->cur_entry->min_col;
|
||||
doc->cur_col=doc->cur_entry->min_col;
|
||||
if (!(doc_ce->de_flags&DOCEF_FILTER_SKIP))
|
||||
DocEntryDel(doc,doc_ce);
|
||||
DocRemSoftNewLines(doc,doc->cur_entry);
|
||||
@@ -441,7 +445,7 @@ U0 EdInsChar(I64 ch,I64 sc,CDoc *doc)
|
||||
I64 i,j,m,y=doc_ce->y;
|
||||
|
||||
if (doc->flags & DOCF_IN_DOLLAR) {
|
||||
if (!Bt(chars_bitmap_getkey,ch))
|
||||
if (!Bt(chars_bmp_getkey,ch))
|
||||
goto ic_done;
|
||||
ChkDollarBufSize(doc);
|
||||
doc->dollar_buf[doc->dollar_buf_ptr++]=ch;
|
||||
@@ -460,22 +464,21 @@ U0 EdInsChar(I64 ch,I64 sc,CDoc *doc)
|
||||
} else
|
||||
goto ic_done;
|
||||
}
|
||||
if (ch=='$$') {
|
||||
if (!(doc->flags & (DOCF_PLAIN_TEXT | DOCF_PLAIN_TEXT_WITH_TABS))) {
|
||||
doc->flags|=DOCF_IN_DOLLAR;
|
||||
doc->dollar_buf_ptr=0;
|
||||
doc->dollar_buf[doc->dollar_buf_ptr++]=ch;
|
||||
goto ic_done;
|
||||
}
|
||||
if (ch=='$$' && !(doc->flags & (DOCF_PLAIN_TEXT|DOCF_PLAIN_TEXT_WITH_TABS))) {
|
||||
doc->flags|=DOCF_IN_DOLLAR;
|
||||
doc->dollar_buf_ptr=0;
|
||||
doc->dollar_buf[doc->dollar_buf_ptr++]=ch;
|
||||
goto ic_done;
|
||||
}
|
||||
if (ch=='\r') goto ic_done;
|
||||
|
||||
ic_cont:
|
||||
if ((ch==CH_SPACE || ch=='\n') &&
|
||||
!(sc & (SCF_CTRL|SCF_SHIFT)) &&
|
||||
doc_ce->de_flags & (DOCEF_LINK|DOCEF_TREE|DOCEF_LST|DOCEF_CHECK_COLLAPSABLE|
|
||||
DOCEF_LEFT_MACRO|DOCEF_LEFT_EXP|DOCEF_LEFT_CB|DOCEF_LEFT_AUTO |
|
||||
DOCEF_RIGHT_MACRO|DOCEF_RIGHT_EXP|DOCEF_RIGHT_CB|DOCEF_RIGHT_AUTO)) {
|
||||
!(sc & (SCF_CTRL|SCF_SHIFT)) &&
|
||||
doc_ce->de_flags &
|
||||
(DOCEF_LINK|DOCEF_TREE|DOCEF_LST|DOCEF_CHECK_COLLAPSABLE|
|
||||
DOCEF_LEFT_MACRO|DOCEF_LEFT_EXP|DOCEF_LEFT_CB|DOCEF_LEFT_AUTO |
|
||||
DOCEF_RIGHT_MACRO|DOCEF_RIGHT_EXP|DOCEF_RIGHT_CB|DOCEF_RIGHT_AUTO)) {
|
||||
doc->cmd_U8=ch;
|
||||
DocEntryRun(doc,doc_ce,FALSE);
|
||||
DocLock(doc);
|
||||
@@ -486,7 +489,7 @@ ic_cont:
|
||||
b=doc_ce->data;
|
||||
else
|
||||
b=&doc_ce->data;
|
||||
i=doc->cur_data_col;
|
||||
i=doc->cur_col;
|
||||
j=i%(doc_ce->hex_ed_width*3);
|
||||
m=i/(doc_ce->hex_ed_width*3)*doc_ce->hex_ed_width;
|
||||
if (j>=doc_ce->hex_ed_width<<1)
|
||||
@@ -504,38 +507,36 @@ ic_cont:
|
||||
else
|
||||
b[m]=b[m] & 0xF | ch<<4;
|
||||
}
|
||||
doc->cur_data_col++;
|
||||
doc->cur_col++;
|
||||
goto ic_done;
|
||||
}
|
||||
if (doc->flags & DOCF_OVERSTRIKE) {
|
||||
if (Bt(chars_bitmap_displayable,ch)) {
|
||||
if (Bt(chars_bmp_displayable,ch)) {
|
||||
ic_overstrike_char:
|
||||
if (IsEditableText(doc_ce)) {
|
||||
if (doc->cur_data_col<doc_ce->max_col) {
|
||||
if (doc_ce->tag[doc->cur_data_col]) {
|
||||
doc_ce->tag[doc->cur_data_col++]=ch;
|
||||
if (doc->cur_col<doc_ce->max_col) {
|
||||
if (doc_ce->tag[doc->cur_col]) {
|
||||
doc_ce->tag[doc->cur_col++]=ch;
|
||||
goto ic_done;
|
||||
}
|
||||
} else {
|
||||
doc_ce=doc_ce->next;
|
||||
doc->cur_entry=doc_ce;
|
||||
doc->cur_data_col=doc_ce->min_col;
|
||||
doc->cur_col=doc_ce->min_col;
|
||||
goto ic_overstrike_char;
|
||||
}
|
||||
} else if (doc_ce->type_u8==DOCT_DATA) {
|
||||
if (doc_ce->de_flags & DOCEF_HAS_TERMINATOR) {
|
||||
if (doc_ce->tag[doc->cur_data_col] &&
|
||||
doc->cur_data_col<doc_ce->min_col+doc_ce->len) {
|
||||
doc_ce->tag[doc->cur_data_col++]=ch;
|
||||
if ( ! doc_ce->tag[doc->cur_data_col]) {
|
||||
doc_ce->tag[doc->cur_data_col]='_';
|
||||
doc_ce->tag[doc->cur_data_col+1]=0;
|
||||
if (doc_ce->tag[doc->cur_col] &&
|
||||
doc->cur_col<doc_ce->min_col+doc_ce->len) {
|
||||
doc_ce->tag[doc->cur_col++]=ch;
|
||||
if ( ! doc_ce->tag[doc->cur_col]) {
|
||||
doc_ce->tag[doc->cur_col]='_';
|
||||
doc_ce->tag[doc->cur_col+1]=0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (doc_ce->tag[doc->cur_data_col])
|
||||
doc_ce->tag[doc->cur_data_col++]=ch;
|
||||
}
|
||||
} else if (doc_ce->tag[doc->cur_col])
|
||||
doc_ce->tag[doc->cur_col++]=ch;
|
||||
goto ic_done;
|
||||
}
|
||||
b=MAlloc(2,doc->mem_task);
|
||||
@@ -548,7 +549,7 @@ ic_overstrike_char:
|
||||
} else if (ch=='\n') {
|
||||
while (doc->cur_entry->next!=doc && doc->cur_entry->y==y)
|
||||
doc->cur_entry=doc->cur_entry->next;
|
||||
doc->cur_data_col=doc->cur_entry->min_col;
|
||||
doc->cur_col=doc->cur_entry->min_col;
|
||||
} else if (ch=='\t') {
|
||||
if (doc->flags&DOCF_FORM)
|
||||
goto ic_form_tab;
|
||||
@@ -567,12 +568,12 @@ ic_overstrike_char:
|
||||
DocInsEntry(doc,doc_ne);
|
||||
} else if (ch=='\t') {
|
||||
if (doc->flags&DOCF_FORM &&
|
||||
(Bt(doldoc.type_flags_form,doc->cur_entry->type_u8) ||
|
||||
doc->cur_entry->de_flags&DOCEF_LINK) &&
|
||||
!(doc->cur_entry->de_flags&DOCEF_SKIP_IN_FORM)) {
|
||||
(Bt(doldoc.type_flags_form,doc->cur_entry->type_u8) ||
|
||||
doc->cur_entry->de_flags&DOCEF_LINK) &&
|
||||
!(doc->cur_entry->de_flags&DOCEF_SKIP_IN_FORM)) {
|
||||
ic_form_tab:
|
||||
doc->cur_entry=doc->cur_entry->next;
|
||||
doc->cur_data_col=doc->cur_entry->min_col;
|
||||
doc->cur_col=doc->cur_entry->min_col;
|
||||
DocFormFwd(doc);
|
||||
goto ic_done;
|
||||
} else {
|
||||
@@ -582,7 +583,7 @@ ic_form_tab:
|
||||
DocInsEntry(doc,doc_ne);
|
||||
}
|
||||
} else {
|
||||
if (Bt(chars_bitmap_displayable,ch)) {
|
||||
if (Bt(chars_bmp_displayable,ch)) {
|
||||
if (doc_ce->type_u8==DOCT_DATA) {
|
||||
i=doc_ce->len+doc_ce->min_col;
|
||||
if (doc_ce->de_flags & DOCEF_HAS_TERMINATOR)
|
||||
@@ -590,14 +591,14 @@ ic_form_tab:
|
||||
if (i>doc_ce->max_col) {
|
||||
b=doc_ce->tag;
|
||||
doc_ce->max_col++;
|
||||
for (i=doc_ce->max_col;i>doc->cur_data_col;i--)
|
||||
for (i=doc_ce->max_col;i>doc->cur_col;i--)
|
||||
b[i]=b[i-1];
|
||||
b[doc->cur_data_col++]=ch;
|
||||
b[doc->cur_col++]=ch;
|
||||
}
|
||||
} else if (IsEditableText(doc_ce)) {
|
||||
dst=b=MAlloc(doc_ce->max_col+2,doc->mem_task);
|
||||
src=doc_ce->tag;
|
||||
i=doc->cur_data_col;
|
||||
i=doc->cur_col;
|
||||
while (i-->0)
|
||||
*dst++=*src++;
|
||||
*dst++=ch;
|
||||
@@ -605,7 +606,7 @@ ic_form_tab:
|
||||
Free(doc_ce->tag);
|
||||
doc_ce->tag=b;
|
||||
doc_ce->max_col++;
|
||||
doc->cur_data_col++;
|
||||
doc->cur_col++;
|
||||
} else {
|
||||
b=MAlloc(2,doc->mem_task);
|
||||
*b=ch;
|
||||
@@ -620,11 +621,10 @@ ic_form_tab:
|
||||
}
|
||||
ic_done:
|
||||
DocRemSoftNewLines(doc,doc->cur_entry);
|
||||
if (doc->cur_entry->de_flags & DOCEF_UPDATE_DATA) {
|
||||
if (doc->cur_entry->type_u8==DOCT_DATA ||
|
||||
doc->cur_entry->type_u8==DOCT_CHECK_BOX)
|
||||
if (doc->cur_entry->de_flags & DOCEF_UPDATE_DATA &&
|
||||
(doc->cur_entry->type_u8==DOCT_DATA ||
|
||||
doc->cur_entry->type_u8==DOCT_CHECK_BOX))
|
||||
DocDataScan(doc,doc->cur_entry);
|
||||
}
|
||||
if (unlock)
|
||||
DocUnlock(doc);
|
||||
}
|
||||
@@ -637,7 +637,7 @@ U0 EdDelLine(CDoc *doc)
|
||||
while (doc_ce!=doc && doc_ce->y==y)
|
||||
doc_ce=doc_ce->next;
|
||||
doc->cur_entry=doc_ce;
|
||||
doc->cur_data_col=doc_ce->min_col;
|
||||
doc->cur_col=doc_ce->min_col;
|
||||
doc_ce=doc_ce->last;
|
||||
while (doc_ce!=doc && doc_ce->y==y) {
|
||||
doc_ce2=doc_ce->last;
|
||||
@@ -653,10 +653,12 @@ U0 DocEntryToggle(CDoc *doc)
|
||||
CDocEntry *doc_ce=doc->cur_entry,*cl1,*doc_ce2;
|
||||
U8 ch,*st,*st2;
|
||||
I64 i,j,k;
|
||||
if (doc_ce!=doc && !(doc->flags&(DOCF_PLAIN_TEXT|DOCF_PLAIN_TEXT_WITH_TABS))) {
|
||||
if (doc_ce->type_u8==DOCT_TEXT &&
|
||||
!(doc_ce->de_flags & ~(DOCEF_TAG|DOCG_BL_IV_UL|DOCEF_WORD_WRAP|DOCEF_HIGHLIGHT|DOCEF_SKIP|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP)) &&
|
||||
!(doc_ce->type&DOCG_BL_IV_UL)) {
|
||||
if (doc_ce!=doc &&
|
||||
!(doc->flags&(DOCF_PLAIN_TEXT|DOCF_PLAIN_TEXT_WITH_TABS))) {
|
||||
if (doc_ce->type_u8==DOCT_TEXT && !(doc_ce->de_flags &
|
||||
~(DOCEF_TAG|DOCG_BL_IV_UL|DOCEF_WORD_WRAP|DOCEF_HIGHLIGHT|
|
||||
DOCEF_SKIP|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP)) &&
|
||||
!(doc_ce->type&DOCG_BL_IV_UL)) {
|
||||
doc_ce2=doc_ce->last;
|
||||
for (k=0;k<20;k++) {
|
||||
if (doc_ce2!=doc) {
|
||||
@@ -672,7 +674,7 @@ U0 DocEntryToggle(CDoc *doc)
|
||||
Free(doc_ce->tag);
|
||||
doc_ce->tag=st;
|
||||
doc_ce->max_col=i+j;
|
||||
doc->cur_data_col+=i;
|
||||
doc->cur_col+=i;
|
||||
DocEntryDel(doc,doc_ce2);
|
||||
} else if (doc_ce2->type_u8==DOCT_SOFT_NEW_LINE)
|
||||
DocEntryDel(doc,doc_ce2);
|
||||
@@ -706,24 +708,24 @@ U0 DocEntryToggle(CDoc *doc)
|
||||
} else
|
||||
break;
|
||||
}
|
||||
i=doc->cur_data_col;
|
||||
i=doc->cur_col;
|
||||
while (i>doc_ce->min_col && doc_ce->tag[i]!='$$')
|
||||
i--;
|
||||
j=doc->cur_data_col+1;
|
||||
j=doc->cur_col+1;
|
||||
while (j<doc_ce->max_col && doc_ce->tag[j]!='$$')
|
||||
j++;
|
||||
if (i<j-1 && doc_ce->min_col<=i<j<doc_ce->max_col &&
|
||||
doc_ce->tag[i]=='$$' && doc_ce->tag[j]=='$$') {
|
||||
doc_ce->tag[i]=='$$' && doc_ce->tag[j]=='$$') {
|
||||
ch=doc_ce->tag[j+1];
|
||||
doc_ce->tag[j+1]=0;
|
||||
st=StrNew(doc_ce->tag+i);
|
||||
doc_ce->tag[j+1]=ch;
|
||||
StrCpy(doc_ce->tag+i,doc_ce->tag+j+1);
|
||||
doc->cur_data_col=i;
|
||||
doc->cur_col=i;
|
||||
st2=MStrPrint("%q",st);
|
||||
if (doc_ce=DocPrint(doc,st2)) {
|
||||
doc->cur_entry=doc_ce;
|
||||
doc->cur_data_col=doc_ce->min_col;
|
||||
doc->cur_col=doc_ce->min_col;
|
||||
}
|
||||
Free(st);
|
||||
Free(st2);
|
||||
|
||||
+42
-34
@@ -1,4 +1,4 @@
|
||||
#help_index "DolDoc/Output"
|
||||
#help_index "DolDoc/Output;StdOut/DolDoc"
|
||||
|
||||
public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
{//$LK,"PutKey",A="MN:PutKey"$(ch,sc) at doc insert pt, cur_entry.
|
||||
@@ -16,7 +16,7 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
if (!Bt(doldoc.clean_scan_codes,sc.u8[0]))
|
||||
doc->flags|=DOCF_UNDO_DIRTY;
|
||||
DocCaptureUndo(doc);
|
||||
if (Bt(chars_bitmap_getkey,ch) &&
|
||||
if (Bt(chars_bmp_getkey,ch) &&
|
||||
!(sc&(SCF_CTRL|SCF_ALT))) {
|
||||
if (sc&SCF_KEY_DESC) {
|
||||
st=Char2KeyName(ch,FALSE);
|
||||
@@ -39,7 +39,8 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
if (sc&SCF_KEY_DESC)
|
||||
KeyDescSet("Win/Toggle Border");
|
||||
else
|
||||
WinBorder(Bt(&doc->win_task->display_flags,DISPLAYf_NO_BORDER),doc->win_task);
|
||||
WinBorder(Bt(&doc->win_task->display_flags,
|
||||
DISPLAYf_NO_BORDER),doc->win_task);
|
||||
break;
|
||||
case CH_CTRLC:
|
||||
if (sc&SCF_KEY_DESC)
|
||||
@@ -61,7 +62,7 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
if (sc&SCF_KEY_DESC)
|
||||
KeyDescSet("Cmd/Find Wizard");
|
||||
else
|
||||
GrepWiz;
|
||||
FindWiz;
|
||||
} else {
|
||||
if (sc&SCF_KEY_DESC)
|
||||
KeyDescSet("Edit/Find & Replace");
|
||||
@@ -87,21 +88,21 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
else {
|
||||
DocCaptureUndo(doc);
|
||||
doc_ce=doc->cur_entry;
|
||||
if (doc->cur_data_col<=doc_ce->min_col) {
|
||||
if (doc->cur_col<=doc_ce->min_col) {
|
||||
doc_ce=doc->cur_entry=doc_ce->last;
|
||||
if (doc_ce!=doc && doc_ce->type_u8==DOCT_SOFT_NEW_LINE)
|
||||
doc_ce=doc->cur_entry=doc_ce->last;
|
||||
if (doc_ce==doc || doc_ce->type_u8==DOCT_PMT) {
|
||||
doc_ce=doc->cur_entry=doc_ce->next;
|
||||
doc->cur_data_col=doc_ce->min_col;
|
||||
doc->cur_col=doc_ce->min_col;
|
||||
} else {
|
||||
doc->cur_data_col=doc_ce->max_col;
|
||||
if (doc->cur_data_col>doc_ce->min_col)
|
||||
doc->cur_data_col--;
|
||||
doc->cur_col=doc_ce->max_col;
|
||||
if (doc->cur_col>doc_ce->min_col)
|
||||
doc->cur_col--;
|
||||
EdDelChar(doc);
|
||||
}
|
||||
} else {
|
||||
doc->cur_data_col--;
|
||||
doc->cur_col--;
|
||||
EdDelChar(doc);
|
||||
}
|
||||
}
|
||||
@@ -164,7 +165,7 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
Ed("::/Home/PersonalNotes.TXT.Z");
|
||||
else {
|
||||
m=DocRead("::/Home/PersonalMenu.TXT.Z");
|
||||
DocMenuDo(m);
|
||||
DocMenu(m);
|
||||
DocDel(m);
|
||||
}
|
||||
}
|
||||
@@ -217,11 +218,11 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
if (doc_ce->type_u8==DOCT_SPRITE)
|
||||
EdSpriteEd(doc,
|
||||
(doc_ce->x-doc->line_start_col+doc_ce->max_col)*FONT_WIDTH,
|
||||
(doc_ce->y-doc->cur_top_line_num)*FONT_HEIGHT);
|
||||
(doc_ce->y-doc->top_line_num)*FONT_HEIGHT);
|
||||
else
|
||||
EdSpriteIns(doc,
|
||||
(doc_ce->x+doc->cur_data_col-doc->line_start_col)*FONT_WIDTH,
|
||||
(doc_ce->y-doc->cur_top_line_num)*FONT_HEIGHT);
|
||||
(doc_ce->x+doc->cur_col-doc->line_start_col)*FONT_WIDTH,
|
||||
(doc_ce->y-doc->top_line_num)*FONT_HEIGHT);
|
||||
DocLock(doc);
|
||||
}
|
||||
}
|
||||
@@ -249,7 +250,8 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
if (sc&SCF_KEY_DESC)
|
||||
KeyDescSet("Edit/Toggle Plain Text Display");
|
||||
else
|
||||
if (!(doc->flags&DOCF_FORM) || doc->flags&(DOCF_PLAIN_TEXT|DOCF_PLAIN_TEXT_WITH_TABS))
|
||||
if (!(doc->flags&DOCF_FORM) ||
|
||||
doc->flags&(DOCF_PLAIN_TEXT|DOCF_PLAIN_TEXT_WITH_TABS))
|
||||
DocFlagsToggle(doc,DOCF_PLAIN_TEXT);
|
||||
}
|
||||
break;
|
||||
@@ -404,7 +406,8 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
DocUnlock(doc);
|
||||
if (sc&SCF_SHIFT) {
|
||||
if (TaskValidate(sys_macro_util_task))
|
||||
SendMsg(sys_macro_util_task,MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);
|
||||
PostMsgWait(sys_macro_util_task,
|
||||
MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);
|
||||
SysMacroStripKey(&sys_macro_root,ch,sc);
|
||||
PlaySysMacro;
|
||||
} else
|
||||
@@ -479,10 +482,12 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
else
|
||||
KeyDescSet("God Song");
|
||||
} else {
|
||||
//$LK,"::/Adam/God/HSNotes.TXT"$
|
||||
if (sc & SCF_SHIFT)
|
||||
//$LK,"::/Adam/God/HSNotes.TXT"$
|
||||
if (sc & SCF_SHIFT) {
|
||||
DocUnlock(doc);
|
||||
GodDoodle;
|
||||
else
|
||||
DocLock(doc);
|
||||
} else
|
||||
GodSong;
|
||||
}
|
||||
break;
|
||||
@@ -493,7 +498,7 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
else
|
||||
KeyDescSet("God Word");
|
||||
} else {
|
||||
//$LK,"::/Adam/God/HSNotes.TXT"$
|
||||
//$LK,"::/Adam/God/HSNotes.TXT"$
|
||||
FifoU8Flush(god.fifo);
|
||||
GodBitsIns(GOD_GOOD_BITS,KbdMouseEvtTime>>GOD_BAD_BITS);
|
||||
if (sc & SCF_SHIFT)
|
||||
@@ -519,7 +524,7 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
BEqu(&doc_ce->type,DOCEt_SELECTED,sc&SCF_SHIFT);
|
||||
doc_ce=doc->cur_entry=doc_ce->next;
|
||||
}
|
||||
doc->cur_data_col=doc_ce->min_col;
|
||||
doc->cur_col=doc_ce->min_col;
|
||||
DocFormBwd(doc);
|
||||
}
|
||||
} else if (sc&SCF_KEY_DESC) {
|
||||
@@ -545,7 +550,7 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
doc_ce=doc->cur_entry=doc_ce->last;
|
||||
}
|
||||
doc_ce=doc->cur_entry=doc->root.next;
|
||||
doc->cur_data_col=doc_ce->min_col;
|
||||
doc->cur_col=doc_ce->min_col;
|
||||
DocFormFwd(doc);
|
||||
}
|
||||
} else if (sc&SCF_KEY_DESC) {
|
||||
@@ -565,10 +570,11 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
} else {
|
||||
i=doc_ce->y+doc->win_task->win_height-1;
|
||||
if (doc_ce->type_u8==DOCT_HEX_ED)
|
||||
i+=doc->cur_data_col/3/doc_ce->hex_ed_width;
|
||||
i+=doc->cur_col/3/doc_ce->hex_ed_width;
|
||||
while (doc_ce!=doc &&
|
||||
(doc_ce->type_u8!=DOCT_HEX_ED && doc_ce->y<i ||
|
||||
doc_ce->type_u8==DOCT_HEX_ED && doc_ce->y+doc->cur_data_col/3/doc_ce->hex_ed_width<i)) {
|
||||
doc_ce->type_u8==DOCT_HEX_ED &&
|
||||
doc_ce->y+doc->cur_col/3/doc_ce->hex_ed_width<i)) {
|
||||
EdLineDown(doc,sc);
|
||||
//paranoid check for stuck on same node
|
||||
if (doc->cur_entry==doc_ce && doc_ce->type_u8!=DOCT_HEX_ED)
|
||||
@@ -586,10 +592,11 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
}else {
|
||||
i=doc_ce->y-(doc->win_task->win_height-1);
|
||||
if (doc_ce->type_u8==DOCT_HEX_ED)
|
||||
i+=doc->cur_data_col/3/doc_ce->hex_ed_width;
|
||||
i+=doc->cur_col/3/doc_ce->hex_ed_width;
|
||||
while (doc_ce->last!=doc &&
|
||||
(doc_ce->type_u8!=DOCT_HEX_ED && doc_ce->y>i ||
|
||||
doc_ce->type_u8==DOCT_HEX_ED && doc_ce->y+doc->cur_data_col/3/doc_ce->hex_ed_width>i) &&
|
||||
doc_ce->type_u8==DOCT_HEX_ED &&
|
||||
doc_ce->y+doc->cur_col/3/doc_ce->hex_ed_width>i) &&
|
||||
doc_ce->y!=doc->root.next->y) {
|
||||
EdLineUp(doc,sc);
|
||||
//paranoid check for stuck on same node
|
||||
@@ -693,15 +700,15 @@ public U0 DocPrintPartial(CDoc *doc,U8 *fmt,...)
|
||||
DocPutKey(doc,ch,0);
|
||||
else
|
||||
while (ch=*ptr) {
|
||||
if (!Bt(chars_bitmap_safe_dollar,ch) ||
|
||||
doc->flags & (DOCF_OVERSTRIKE | DOCF_IN_DOLLAR)) {
|
||||
if (!Bt(chars_bmp_safe_dollar,ch) ||
|
||||
doc->flags & (DOCF_OVERSTRIKE | DOCF_IN_DOLLAR)) {
|
||||
DocPutKey(doc,ch,0);
|
||||
ptr++;
|
||||
} else {
|
||||
ptr2=ptr++;
|
||||
while (TRUE) {
|
||||
ch=*ptr++;
|
||||
if (!Bt(chars_bitmap_safe_dollar,ch))
|
||||
if (!Bt(chars_bmp_safe_dollar,ch))
|
||||
break;
|
||||
}
|
||||
ptr--;
|
||||
@@ -711,8 +718,8 @@ public U0 DocPrintPartial(CDoc *doc,U8 *fmt,...)
|
||||
if (IsEditableText(doc_ce)) {
|
||||
dst=b=MAlloc(doc_ce->max_col+j+1,doc->mem_task);
|
||||
src=doc_ce->tag;
|
||||
i=doc->cur_data_col;
|
||||
doc->cur_data_col+=j;
|
||||
i=doc->cur_col;
|
||||
doc->cur_col+=j;
|
||||
doc_ce->max_col+=j;
|
||||
while (i-->0)
|
||||
*dst++=*src++;
|
||||
@@ -729,7 +736,7 @@ public U0 DocPrintPartial(CDoc *doc,U8 *fmt,...)
|
||||
doc_ne->de_flags=doldoc.dft_de_flags[DOCT_TEXT];
|
||||
QueIns(doc_ne,doc_ce->last);
|
||||
doc->cur_entry=doc_ne;
|
||||
doc->cur_data_col=StrLen(ptr2);
|
||||
doc->cur_col=StrLen(ptr2);
|
||||
}
|
||||
*ptr=ch;
|
||||
DocRemSoftNewLines(doc,doc->cur_entry);
|
||||
@@ -837,7 +844,7 @@ Bool DocFileEd(I64 _type,U8 *filename,
|
||||
|
||||
if (edf_dof_flags&EDF_WAS_WRITE)
|
||||
result=FALSE;
|
||||
if (!(edf_dof_flags&EDF_BAIL) && DocDo(doc,edf_dof_flags|DOF_DONT_HOME)) {
|
||||
if (!(edf_dof_flags&EDF_BAIL) && DocEd(doc,edf_dof_flags|DOF_DONT_HOME)) {
|
||||
DocLock(doc);
|
||||
doc_e=doc->cur_entry;
|
||||
if (doc_e!=doc)
|
||||
@@ -879,7 +886,8 @@ public I64 EdLinkCvt(U8 *link_st,U8 **_filename=NULL,U8 **_needle_str=NULL,
|
||||
switch (result=DefineMatch(st,"ST_LINK_TYPES",LMF_IGNORE_CASE)) {
|
||||
case LK_MAN_PAGE:
|
||||
if (temph=HashFind(filename2,Fs->hash_table,HTG_SRC_SYM))
|
||||
result=EdLinkCvt(temph->src_link,&filename,&needle_str,&num,edf_dof_flags);
|
||||
result=EdLinkCvt(temph->src_link,&filename,
|
||||
&needle_str,&num,edf_dof_flags);
|
||||
else
|
||||
result=-1;
|
||||
goto lc_done;
|
||||
|
||||
+37
-30
@@ -81,11 +81,12 @@ public U8 *DocSave(CDoc *doc,I64 *_size=NULL)
|
||||
cnt++;
|
||||
break;
|
||||
case DOCT_TEXT://$BK,1$Update $LK,"DOCT_TEXT",A="FF:D:/Compiler/Lex.CPP,DOCT_TEXT"$$BK,0$
|
||||
if (!(doc_e->de_flags & ~(DOCEF_TAG|DOCG_BL_IV_UL|DOCEF_WORD_WRAP|DOCEF_HIGHLIGHT|DOCEF_SKIP|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP)) &&
|
||||
!(doc_e->type&DOCG_BL_IV_UL)) {
|
||||
if (!(doc_e->de_flags & ~(DOCEF_TAG|DOCG_BL_IV_UL|DOCEF_WORD_WRAP|
|
||||
DOCEF_HIGHLIGHT|DOCEF_SKIP|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP))&&
|
||||
!(doc_e->type&DOCG_BL_IV_UL)) {
|
||||
cnt+=StrLen(doc_e->tag);
|
||||
if (!(doc->flags & (DOCF_PLAIN_TEXT | DOCF_PLAIN_TEXT_WITH_TABS)) ||
|
||||
doc->flags&DOCF_DBL_DOLLARS)
|
||||
doc->flags&DOCF_DBL_DOLLARS)
|
||||
cnt+=StrOcc(doc_e->tag,'$$');
|
||||
} else {
|
||||
st=Doc2PlainText(doc,doc_e);
|
||||
@@ -95,39 +96,42 @@ public U8 *DocSave(CDoc *doc,I64 *_size=NULL)
|
||||
break;
|
||||
default:
|
||||
if (doc_e->type_u8!=DOCT_SOFT_NEW_LINE &&
|
||||
doc_e->type_u8!=DOCT_CURSOR) {
|
||||
doc_e->type_u8!=DOCT_CURSOR) {
|
||||
st=Doc2PlainText(doc,doc_e);
|
||||
cnt+=StrLen(st)+2;
|
||||
Free(st);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (b=doc->bin_root.next;b!=&doc->bin_root;b=b->next) {
|
||||
if (b->use_cnt>b->temp_use_cnt)
|
||||
cnt+=offset(CDocBin.end)-
|
||||
offset(CDocBin.start)+b->size;
|
||||
offset(CDocBin.start)+b->size;
|
||||
}
|
||||
result=MAlloc(cnt);
|
||||
dst=result;
|
||||
for (doc_e=doc->root.next;doc_e!=doc;doc_e=doc_e->next) {
|
||||
if (!Bt(doldoc.type_flags_data,doc_e->type_u8)) {
|
||||
if (doc_e->type_u8==DOCT_TEXT &&
|
||||
!(doc_e->de_flags & ~(DOCEF_TAG|DOCG_BL_IV_UL|DOCEF_WORD_WRAP|DOCEF_HIGHLIGHT|DOCEF_SKIP|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP)) &&
|
||||
!(doc_e->type&DOCG_BL_IV_UL)) {
|
||||
!(doc_e->de_flags & ~(DOCEF_TAG|DOCG_BL_IV_UL|DOCEF_WORD_WRAP|
|
||||
DOCEF_HIGHLIGHT|DOCEF_SKIP|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP)) &&
|
||||
!(doc_e->type&DOCG_BL_IV_UL)) {
|
||||
src=doc_e->tag;
|
||||
i=0;
|
||||
while (ch=*src++) {
|
||||
if (doc_e==doc->cur_entry && i++==doc->cur_data_col && !(doc->flags&DOCF_NO_CURSOR))
|
||||
if (doc_e==doc->cur_entry && i++==doc->cur_col &&
|
||||
!(doc->flags&DOCF_NO_CURSOR))
|
||||
*dst++=CH_CURSOR;
|
||||
*dst++=ch;
|
||||
if (ch=='$$') {
|
||||
if (!(doc->flags & (DOCF_PLAIN_TEXT | DOCF_PLAIN_TEXT_WITH_TABS)) ||
|
||||
doc->flags&DOCF_DBL_DOLLARS)
|
||||
doc->flags&DOCF_DBL_DOLLARS)
|
||||
*dst++=ch;
|
||||
}
|
||||
}
|
||||
if (doc_e==doc->cur_entry && i++==doc->cur_data_col && !(doc->flags&DOCF_NO_CURSOR))
|
||||
if (doc_e==doc->cur_entry && i++==doc->cur_col &&
|
||||
!(doc->flags&DOCF_NO_CURSOR))
|
||||
*dst++=CH_CURSOR;
|
||||
} else {
|
||||
if (doc_e==doc->cur_entry && !(doc->flags&DOCF_NO_CURSOR))
|
||||
@@ -146,7 +150,7 @@ public U8 *DocSave(CDoc *doc,I64 *_size=NULL)
|
||||
break;
|
||||
default:
|
||||
if (doc_e->type_u8!=DOCT_SOFT_NEW_LINE &&
|
||||
doc_e->type_u8!=DOCT_CURSOR) {//(Cursor is set by cur_entry)
|
||||
doc_e->type_u8!=DOCT_CURSOR) {//(Cursor is set by cur_entry)
|
||||
*dst++='$$';
|
||||
st=Doc2PlainText(doc,doc_e);
|
||||
StrCpy(dst,st);
|
||||
@@ -158,7 +162,8 @@ public U8 *DocSave(CDoc *doc,I64 *_size=NULL)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (doc->cur_entry==doc && doc->root.next!=doc && !(doc->flags&DOCF_NO_CURSOR))
|
||||
if (doc->cur_entry==doc && doc->root.next!=doc &&
|
||||
!(doc->flags&DOCF_NO_CURSOR))
|
||||
*dst++=CH_CURSOR;
|
||||
*dst++=0;
|
||||
if (*result==CH_CURSOR) {
|
||||
@@ -189,7 +194,7 @@ public Bool DocWrite(CDoc *doc,Bool prompt=FALSE)
|
||||
{//Store doc to disk.
|
||||
I64 size;
|
||||
U8 *buf;
|
||||
if (prompt && !DocFormDo(&doc->filename) ||
|
||||
if (prompt && !DocForm(&doc->filename) ||
|
||||
doc->filename.name[0]=='A' && doc->filename.name[2]==':')
|
||||
return FALSE; //CANCEL || LK_DOC,LK_DOC_ANCHOR,LK_DOC_FIND,LK_DOC_LINE?
|
||||
buf=DocSave(doc,&size);
|
||||
@@ -207,18 +212,18 @@ public U0 DocInsDoc(CDoc *doc=NULL,CDoc *doc2)
|
||||
CDocEntry *doc_ne,*doc_e=doc2->root.next,*doc_ce;
|
||||
if (!doc) doc=DocPut;
|
||||
unlock_doc=DocLock(doc),
|
||||
DocRemSoftNewLines(doc,NULL);
|
||||
DocRemSoftNewLines(doc,NULL);
|
||||
doc_ce=doc->cur_entry;
|
||||
if (doc_ce->type_u8==DOCT_TEXT && doc->cur_data_col>doc_ce->min_col) {
|
||||
if (doc->cur_data_col<doc_ce->max_col) {
|
||||
dst=doc_ce->tag+doc->cur_data_col;
|
||||
if (doc_ce->type_u8==DOCT_TEXT && doc->cur_col>doc_ce->min_col) {
|
||||
if (doc->cur_col<doc_ce->max_col) {
|
||||
dst=doc_ce->tag+doc->cur_col;
|
||||
doc_ne=DocEntryNew(doc,doc_ce,StrNew(dst,doc->mem_task));
|
||||
*dst=0;
|
||||
doc_ne->type=DOCT_TEXT | doc_ce->type & 0xFFFFFF00;
|
||||
doc_ce->max_col=doc->cur_data_col;
|
||||
doc_ce->max_col=doc->cur_col;
|
||||
QueIns(doc_ne,doc_ce);
|
||||
doc->cur_entry=doc_ne;
|
||||
doc->cur_data_col=doc_ne->min_col;
|
||||
doc->cur_col=doc_ne->min_col;
|
||||
} else
|
||||
if (doc_ce!=doc)
|
||||
doc->cur_entry=doc_ce->next;
|
||||
@@ -247,7 +252,7 @@ public U0 EdCopyToClipboard(CDoc *doc)
|
||||
{//Copy $LK,"DOCET_SELECTED",A="MN:DOCET_SELECTED"$ flagged entries to clipboard.
|
||||
CDoc *doc2=sys_clipboard_doc;
|
||||
Bool unlock_doc=DocLock(doc),
|
||||
unlock_doc2=DocLock(doc2);
|
||||
unlock_doc2=DocLock(doc2);
|
||||
CDocEntry *doc_e=doc->root.next,*doc_ne;
|
||||
ClipboardDel;
|
||||
while (doc_e!=doc) {
|
||||
@@ -270,7 +275,7 @@ public U0 EdCutToClipboard(CDoc *doc)
|
||||
{//Remove selected entries and place on clipboard.
|
||||
CDoc *doc2=sys_clipboard_doc;
|
||||
Bool unlock_doc=DocLock(doc),
|
||||
unlock_doc2=DocLock(doc2);
|
||||
unlock_doc2=DocLock(doc2);
|
||||
CDocEntry *doc_e=doc->root.next,*doc_e1,*doc_ne,*doc_e2=NULL;
|
||||
ClipboardDel;
|
||||
while (doc_e!=doc) {
|
||||
@@ -289,7 +294,7 @@ public U0 EdCutToClipboard(CDoc *doc)
|
||||
}
|
||||
if (doc_e2) {
|
||||
doc->cur_entry=doc_e2;
|
||||
doc->cur_data_col=doc_e2->min_col;
|
||||
doc->cur_col=doc_e2->min_col;
|
||||
}
|
||||
DocRemSoftNewLines(doc,NULL);
|
||||
if (unlock_doc2)
|
||||
@@ -302,7 +307,7 @@ public U0 EdPasteClipboard(CDoc *doc)
|
||||
{//Insert copy of clipboard at insert pt, cur_entry.
|
||||
CDoc *doc2=sys_clipboard_doc;
|
||||
Bool unlock_doc=DocLock(doc),
|
||||
unlock_doc2=DocLock(doc2);
|
||||
unlock_doc2=DocLock(doc2);
|
||||
CDocEntry *doc_ce=doc->cur_entry,*doc_e;
|
||||
if (doc_ce->type_u8==DOCT_DATA) {
|
||||
doc_e=doc2->root.next;
|
||||
@@ -327,7 +332,7 @@ public U0 DocCut(CDoc *doc,CDocEntry *start,CDocEntry *end)
|
||||
doc_e1=start->next;
|
||||
if (start==doc->cur_entry) {
|
||||
doc->cur_entry=start->next;
|
||||
doc->cur_data_col=doc->cur_entry->min_col;
|
||||
doc->cur_col=doc->cur_entry->min_col;
|
||||
}
|
||||
DocEntryDel(doc,start);
|
||||
if (start==end)
|
||||
@@ -389,7 +394,8 @@ Bool DocCaptureUndo(CDoc *doc,Bool force=FALSE)
|
||||
unlock=DocLock(doc);
|
||||
time_stamp=GetTSC;
|
||||
if (doc->flags&DOCF_UNDO_DIRTY &&
|
||||
time_stamp>doc->undo_root.last->time_stamp+cnts.time_stamp_freq<<4 || force) {
|
||||
time_stamp>doc->undo_root.last->time_stamp+cnts.time_stamp_freq<<4 ||
|
||||
force) {
|
||||
u=CAlloc(sizeof(CDocUndo),doc->mem_task);
|
||||
u->time_stamp=time_stamp;
|
||||
u->body=DocSave(doc,&u->size);
|
||||
@@ -427,8 +433,8 @@ U0 DocUndoRestore(CDoc *doc)
|
||||
DocUnlock(doc);
|
||||
}
|
||||
|
||||
#help_index "Graphics/Windows BMP Files;Graphics/GRA Files;DolDoc/Output"
|
||||
|
||||
#help_index "Graphics/Windows BMP Files;Graphics/GRA Files;"\
|
||||
"DolDoc/Output;StdOut/DolDoc"
|
||||
public Bool DocType(CDoc *doc=NULL,U8 *filename,I64 trailing_new_lines=1)
|
||||
{//Output txt or graphic file to document.
|
||||
Bool result=FALSE;
|
||||
@@ -455,8 +461,9 @@ public Bool DocType(CDoc *doc=NULL,U8 *filename,I64 trailing_new_lines=1)
|
||||
return result;
|
||||
}
|
||||
|
||||
#help_index "Graphics/Windows BMP Files;Graphics/GRA Files;File/Cmd Line (Typically);DolDoc/Cmd Line (Typically);Cmd Line (Typically)"
|
||||
|
||||
#help_index "Graphics/Windows BMP Files;Graphics/GRA Files;"\
|
||||
"File/Cmd Line (Typically);DolDoc/Cmd Line (Typically);"\
|
||||
"StdOut;Cmd Line (Typically)"
|
||||
public Bool Type(U8 *filename,I64 trailing_new_lines=1)
|
||||
{//Output txt or graphic file to command line.
|
||||
return DocType(,filename,trailing_new_lines);
|
||||
|
||||
+50
-41
@@ -18,7 +18,7 @@ public Bool DocLineNumGoTo(CDoc *doc,I64 line_num) //one based
|
||||
}
|
||||
|
||||
public Bool DocFind(CDoc *haystack_doc,I64 start_line_num=MIN_I64,
|
||||
U8 *needle,I64 match=1)
|
||||
U8 *needle,I64 match=1)
|
||||
{//Find str by searching tags. Move cur_entry & center.
|
||||
Bool result=FALSE,unlock;
|
||||
CDocEntry *doc_e;
|
||||
@@ -38,13 +38,14 @@ public Bool DocFind(CDoc *haystack_doc,I64 start_line_num=MIN_I64,
|
||||
result=FALSE;
|
||||
while (doc_e!=haystack_doc) {
|
||||
if (doc_e->de_flags&DOCEF_TAG && doc_e->tag &&
|
||||
(ptr=StrIMatch(needle,doc_e->tag))) {//TODO: handle multientry strings
|
||||
//TODO: handle multientry strs
|
||||
(ptr=StrIMatch(needle,doc_e->tag))) {
|
||||
i=ptr-doc_e->tag;
|
||||
if (!--match) {
|
||||
haystack_doc->cur_entry=doc_e;
|
||||
if (i<doc_e->min_col) i=doc_e->min_col;
|
||||
if (i>doc_e->max_col) i=doc_e->max_col;
|
||||
haystack_doc->cur_data_col=i;
|
||||
haystack_doc->cur_col=i;
|
||||
result=TRUE;
|
||||
break;
|
||||
}
|
||||
@@ -74,7 +75,7 @@ public Bool DocAnchorFind(CDoc *haystack_doc,U8 *needle_str)
|
||||
if (doc_e->type_u8==DOCT_ANCHOR && doc_e->de_flags & DOCEF_AUX_STR) {
|
||||
if (!StrCmp(needle_str,doc_e->aux_str)) {
|
||||
haystack_doc->cur_entry=doc_e;
|
||||
haystack_doc->cur_data_col=doc_e->min_col;
|
||||
haystack_doc->cur_col=doc_e->min_col;
|
||||
result=TRUE;
|
||||
break;
|
||||
}
|
||||
@@ -104,11 +105,13 @@ public U0 EdFindNext(CDoc *doc)
|
||||
do {
|
||||
if (doc_e!=doc) {
|
||||
if (doc_e->de_flags&DOCEF_TAG && doc_e->tag &&
|
||||
!(doc_e->de_flags&(DOCEG1_DONT_EDIT|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP))) {
|
||||
if (doc_e->type & DOCET_SELECTED || !doc->find_replace->scan_selected_text) {
|
||||
!(doc_e->de_flags&(DOCEG1_DONT_EDIT|
|
||||
DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP))) {
|
||||
if (doc_e->type & DOCET_SELECTED ||
|
||||
!doc->find_replace->scan_selected_text) {
|
||||
if (doc->find_replace->scan_fwd) {
|
||||
if (doc_e==doc_ce) {
|
||||
ptr=doc_ce->tag+doc->cur_data_col+1;
|
||||
ptr=doc_ce->tag+doc->cur_col+1;
|
||||
if (ptr-doc_ce->tag>=doc_ce->max_col)
|
||||
goto fn_skip;
|
||||
if (ptr-doc_ce->tag<doc_ce->min_col)
|
||||
@@ -117,11 +120,11 @@ public U0 EdFindNext(CDoc *doc)
|
||||
ptr=doc_e->tag;
|
||||
if (ptr=StrFind(doc->find_replace->find_text,ptr,sf_flags)) {
|
||||
doc->cur_entry=doc_e;
|
||||
doc->cur_data_col=ptr-doc_e->tag;
|
||||
if (doc->cur_data_col>=doc_e->max_col)
|
||||
doc->cur_data_col=doc_e->max_col-1;
|
||||
if (doc->cur_data_col<doc_e->min_col)
|
||||
doc->cur_data_col=doc_e->min_col;
|
||||
doc->cur_col=ptr-doc_e->tag;
|
||||
if (doc->cur_col>=doc_e->max_col)
|
||||
doc->cur_col=doc_e->max_col-1;
|
||||
if (doc->cur_col<doc_e->min_col)
|
||||
doc->cur_col=doc_e->min_col;
|
||||
DocCenter(doc);
|
||||
if (unlock)
|
||||
DocUnlock(doc);
|
||||
@@ -131,7 +134,7 @@ public U0 EdFindNext(CDoc *doc)
|
||||
ptr2=NULL;
|
||||
ptr=doc_e->tag+doc_e->min_col;
|
||||
if (doc_e==doc_ce)
|
||||
ptr3=doc_ce->tag+doc->cur_data_col;
|
||||
ptr3=doc_ce->tag+doc->cur_col;
|
||||
else
|
||||
ptr3=doc_e->tag+doc_e->max_col;
|
||||
while (ptr=StrFind(doc->find_replace->find_text,ptr,sf_flags)) {
|
||||
@@ -141,11 +144,11 @@ public U0 EdFindNext(CDoc *doc)
|
||||
}
|
||||
if (ptr2 && ptr2<ptr3) {
|
||||
doc->cur_entry=doc_e;
|
||||
doc->cur_data_col=ptr2-doc_e->tag;
|
||||
if (doc->cur_data_col>=doc_e->max_col)
|
||||
doc->cur_data_col=doc_e->max_col-1;
|
||||
if (doc->cur_data_col<doc_e->min_col)
|
||||
doc->cur_data_col=doc_e->min_col;
|
||||
doc->cur_col=ptr2-doc_e->tag;
|
||||
if (doc->cur_col>=doc_e->max_col)
|
||||
doc->cur_col=doc_e->max_col-1;
|
||||
if (doc->cur_col<doc_e->min_col)
|
||||
doc->cur_col=doc_e->min_col;
|
||||
DocCenter(doc);
|
||||
if (unlock)
|
||||
DocUnlock(doc);
|
||||
@@ -177,11 +180,12 @@ public U0 EdSelectAll(CDoc *doc,Bool select)
|
||||
DocUnlock(doc);
|
||||
}
|
||||
|
||||
public Bool EdFindPaired(CDoc *doc,U8 plus,U8 minus,Bool fwd,Bool abort_on_dbl_colon=FALSE)
|
||||
public Bool EdFindPaired(CDoc *doc,U8 plus,U8 minus,
|
||||
Bool fwd,Bool abort_on_dbl_colon=FALSE)
|
||||
{//Find { } or ( ) pair. Move cur_entry & center.
|
||||
Bool unlock=DocLock(doc),result=FALSE;
|
||||
U8 *ptr;
|
||||
I64 ch,levels=0,colons=0,original_col=doc->cur_data_col;
|
||||
I64 ch,levels=0,colons=0,original_col=doc->cur_col;
|
||||
CDocEntry *doc_ce=doc->cur_entry,*doc_e=doc_ce,*original_ce=doc_ce;
|
||||
if (abort_on_dbl_colon && EdCurU8(doc)==':')
|
||||
colons=1;
|
||||
@@ -190,10 +194,10 @@ public Bool EdFindPaired(CDoc *doc,U8 plus,U8 minus,Bool fwd,Bool abort_on_dbl_c
|
||||
do {
|
||||
if (doc_e!=doc) {
|
||||
if (doc_e->de_flags&DOCEF_TAG && doc_e->tag &&
|
||||
!(doc_e->de_flags&(DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP))) {
|
||||
!(doc_e->de_flags&(DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP))) {
|
||||
if (fwd) {
|
||||
if (doc_e==doc_ce)
|
||||
ptr=doc_e->tag+doc->cur_data_col+1;
|
||||
ptr=doc_e->tag+doc->cur_col+1;
|
||||
else
|
||||
ptr=doc_e->tag;
|
||||
if (ptr-doc_e->tag<doc_e->min_col)
|
||||
@@ -204,7 +208,7 @@ public Bool EdFindPaired(CDoc *doc,U8 plus,U8 minus,Bool fwd,Bool abort_on_dbl_c
|
||||
if (abort_on_dbl_colon && ch==':') {
|
||||
if (++colons==2) {
|
||||
doc->cur_entry=doc_e;
|
||||
doc->cur_data_col=ptr-doc_e->tag-1;
|
||||
doc->cur_col=ptr-doc_e->tag-1;
|
||||
EdCursorLeft(doc);
|
||||
result=FALSE;
|
||||
goto pa_done;
|
||||
@@ -216,15 +220,16 @@ public Bool EdFindPaired(CDoc *doc,U8 plus,U8 minus,Bool fwd,Bool abort_on_dbl_c
|
||||
else if (ch==minus) {
|
||||
if (!levels--) {
|
||||
doc->cur_entry=doc_e;
|
||||
doc->cur_data_col=ptr-doc_e->tag-1;
|
||||
result=doc->cur_entry!=original_ce || doc->cur_data_col!=original_col;
|
||||
doc->cur_col=ptr-doc_e->tag-1;
|
||||
result=doc->cur_entry!=original_ce ||
|
||||
doc->cur_col!=original_col;
|
||||
goto pa_done;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (doc_e==doc_ce) {
|
||||
ptr=doc_e->tag+doc->cur_data_col-1;
|
||||
ptr=doc_e->tag+doc->cur_col-1;
|
||||
if (ptr-doc_e->tag>=doc_e->max_col)
|
||||
ptr=doc_e->tag+doc_e->max_col-1;
|
||||
} else
|
||||
@@ -236,7 +241,7 @@ public Bool EdFindPaired(CDoc *doc,U8 plus,U8 minus,Bool fwd,Bool abort_on_dbl_c
|
||||
if (abort_on_dbl_colon && ch==':') {
|
||||
if (++colons==2) {
|
||||
doc->cur_entry=doc_e;
|
||||
doc->cur_data_col=ptr-doc_e->tag+1;
|
||||
doc->cur_col=ptr-doc_e->tag+1;
|
||||
result=FALSE;
|
||||
goto pa_done;
|
||||
}
|
||||
@@ -247,8 +252,9 @@ public Bool EdFindPaired(CDoc *doc,U8 plus,U8 minus,Bool fwd,Bool abort_on_dbl_c
|
||||
else if (ch==minus) {
|
||||
if (!levels--) {
|
||||
doc->cur_entry=doc_e;
|
||||
doc->cur_data_col=ptr-doc_e->tag+1;
|
||||
result=doc->cur_entry!=original_ce || doc->cur_data_col!=original_col;
|
||||
doc->cur_col=ptr-doc_e->tag+1;
|
||||
result=doc->cur_entry!=original_ce ||
|
||||
doc->cur_col!=original_col;
|
||||
goto pa_done;
|
||||
}
|
||||
}
|
||||
@@ -284,7 +290,7 @@ public Bool EdGoToFun(CDoc *doc,Bool fwd,Bool abort_on_dbl_colon)
|
||||
if (++colons==2) {
|
||||
EdCursorLeft(doc);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
colons=0;
|
||||
if (ch=='{')
|
||||
@@ -335,7 +341,7 @@ public U0 EdSelectFun(CDoc *doc,Bool abort_on_dbl_colon=FALSE)
|
||||
if (doc_e->de_flags&DOCEF_TAG && doc_e->tag) {
|
||||
ptr=doc_e->tag;
|
||||
if (doc_e==doc->cur_entry)
|
||||
ptr+=doc->cur_data_col;
|
||||
ptr+=doc->cur_col;
|
||||
while (ch=*ptr++)
|
||||
if (abort_on_dbl_colon && ch==':') {
|
||||
if (++colons==2)
|
||||
@@ -379,7 +385,7 @@ I64 EdFindReplace(CDoc *doc)
|
||||
cmd=RSAC_REPLACE;
|
||||
else
|
||||
cmd=RSAC_ALL;
|
||||
if (!doc->find_replace->pmt || DocFormDo(doc->find_replace)) {
|
||||
if (!doc->find_replace->pmt || DocForm(doc->find_replace)) {
|
||||
result=0;
|
||||
unlock=DocLock(doc);
|
||||
if (doc->find_replace->match_case || doc->find_replace->local_var)
|
||||
@@ -393,7 +399,7 @@ I64 EdFindReplace(CDoc *doc)
|
||||
doc_ce=doc->root.next;
|
||||
while (doc_ce!=doc) {
|
||||
if (doc_ce->de_flags&DOCEF_TAG && doc_ce->tag &&
|
||||
!(doc_ce->de_flags&(DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP)) &&
|
||||
!(doc_ce->de_flags&(DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP)) &&
|
||||
StrFind(doc->find_replace->find_text,doc_ce->tag,sf_flags)) {
|
||||
doc_ce->type|=DOCET_SELECTED;
|
||||
result++;
|
||||
@@ -462,18 +468,21 @@ I64 EdFindReplace(CDoc *doc)
|
||||
break;
|
||||
}
|
||||
if (doc_e->type_u8==DOCT_TEXT &&
|
||||
!(doc_e->de_flags&(DOCEG1_DONT_EDIT|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP)) &&
|
||||
(doc_e->type & DOCET_SELECTED || !doc->find_replace->scan_selected_text&&!doc->find_replace->local_var)) {
|
||||
!(doc_e->de_flags&(DOCEG1_DONT_EDIT|DOCEF_HARD_SKIP|
|
||||
DOCEF_FILTER_SKIP)) &&
|
||||
(doc_e->type & DOCET_SELECTED ||
|
||||
!doc->find_replace->scan_selected_text&&
|
||||
!doc->find_replace->local_var)) {
|
||||
src=doc_e->tag;
|
||||
while (src) {
|
||||
src=StrFind(doc->find_replace->find_text,src,sf_flags);
|
||||
if (src) {
|
||||
doc->cur_data_col=src-doc_e->tag;
|
||||
doc->cur_col=src-doc_e->tag;
|
||||
doc->cur_entry=doc_e;
|
||||
if (cmd!=RSAC_ALL)
|
||||
DocCenter(doc);
|
||||
doc_e=doc->cur_entry;
|
||||
src=doc->cur_data_col+doc_e->tag;
|
||||
src=doc->cur_col+doc_e->tag;
|
||||
if (cmd!=RSAC_ALL) {
|
||||
DocUnlock(doc);
|
||||
cmd=PopUpReplaceSkipAllCancel("");
|
||||
@@ -496,14 +505,14 @@ I64 EdFindReplace(CDoc *doc)
|
||||
*dst++=doc_e->tag[i];
|
||||
Free(doc_e->tag);
|
||||
doc_e->tag=dst2;
|
||||
doc->cur_data_col=src-doc_e->tag;
|
||||
doc->cur_col=src-doc_e->tag;
|
||||
doc->cur_entry=doc_e;
|
||||
if (cmd!=RSAC_ALL) {
|
||||
DocRemSoftNewLines(doc,doc->cur_entry);
|
||||
DocRecalc(doc);
|
||||
}
|
||||
doc_e=doc->cur_entry;
|
||||
src=doc->cur_data_col+doc_e->tag;
|
||||
src=doc->cur_col+doc_e->tag;
|
||||
result++;
|
||||
} else
|
||||
src++;
|
||||
@@ -527,7 +536,7 @@ fr_unlock_done:
|
||||
}
|
||||
|
||||
public I64 EdReplace(CDoc *doc,U8 *find,U8 *replace,
|
||||
Bool selected=TRUE,Bool match_case=TRUE,Bool whole_labels=FALSE)
|
||||
Bool selected=TRUE,Bool match_case=TRUE,Bool whole_labels=FALSE)
|
||||
{//Find & replace using editor's cmd.
|
||||
CEdFindText old_find_replace;
|
||||
Bool unlock;
|
||||
@@ -565,6 +574,6 @@ U0 EdGoToLine(CDoc *doc)
|
||||
{//Prompt with form and go to line num.
|
||||
CEdLineGoTo gtl;
|
||||
gtl.line=1;
|
||||
if (DocFormDo(>l))
|
||||
if (DocForm(>l))
|
||||
DocLineNumGoTo(doc,gtl.line);
|
||||
}
|
||||
@@ -12,7 +12,7 @@ U32 *DocHighlight(CDocEntry *doc_e,U8 *src,I64 len,I64 _temp_u32_attr)
|
||||
case DOCSS_NORMAL:
|
||||
hl_normal:
|
||||
while (len) {
|
||||
while (len && !Bt(chars_bitmap_alpha_numeric,*src)) {
|
||||
while (len && !Bt(chars_bmp_alpha_numeric,*src)) {
|
||||
temp_u32_attr=_temp_u32_attr;
|
||||
ch1=*src++;
|
||||
switch (ch1) {
|
||||
@@ -65,13 +65,14 @@ hl_normal:
|
||||
if (!--len) goto hl_normal_done;
|
||||
}
|
||||
ptr=src;
|
||||
while (len && Bt(chars_bitmap_alpha_numeric,*src)) {
|
||||
while (len && Bt(chars_bmp_alpha_numeric,*src)) {
|
||||
src++;
|
||||
len--;
|
||||
}
|
||||
ch=*src;
|
||||
*src=0;
|
||||
if (temph=HashFind(ptr,cmp.asm_hash,HTT_KEYWORD|HTT_ASM_KEYWORD|HTT_OPCODE|HTT_REG)) {
|
||||
if (temph=HashFind(ptr,cmp.asm_hash,
|
||||
HTT_KEYWORD|HTT_ASM_KEYWORD|HTT_OPCODE|HTT_REG)) {
|
||||
if (temph->type&(HTT_KEYWORD|HTT_ASM_KEYWORD|HTT_OPCODE))
|
||||
temp_u32_attr=DOC_COLOR_KEYWORD<<8|mask_temp_u32_attr;
|
||||
else
|
||||
|
||||
+16
-16
@@ -2,14 +2,14 @@
|
||||
|
||||
U0 DocInit()
|
||||
{//$LK-UL,"CMD Defines",A="MN:DOCT_TEXT"$
|
||||
CLex *lx;
|
||||
CCmpCtrl *cc;
|
||||
I64 i;
|
||||
CHashGeneric *temph;
|
||||
|
||||
DefineLstLoad("ST_DOC_CMDS",
|
||||
"TX\0CR\0SR\0CU\0TB\0CL\0PB\0DA\0PL\0LM\0RM\0HD\0FO\0ID\0"
|
||||
"FG\0BG\0FD\0BD\0PT\0WW\0UL\0IV\0BK\0SX\0SY\0CM\0AN\0LK\0BT\0"
|
||||
"CB\0LS\0MA\0MU\0HX\0TR\0SP\0IB\0IS\0SO\0HL\0HC\0ER\0");
|
||||
"TX\0CR\0SR\0CU\0TB\0CL\0PB\0PL\0LM\0RM\0HD\0FO\0ID\0FG\0"
|
||||
"BG\0FD\0BD\0PT\0WW\0UL\0IV\0BK\0SX\0SY\0CM\0AN\0LK\0BT\0"
|
||||
"DA\0CB\0LS\0MA\0MU\0HX\0TR\0SP\0IB\0IS\0SO\0HL\0HC\0ER\0");
|
||||
DefineLstLoad("ST_DOC_FLAGS",
|
||||
"T\0A\0D\0HTML\0LE\0LM\0RE\0RM\0BI\0BP\0RT\0SX\0SY\0SCX\0U\0"
|
||||
"LC\0LA\0RC\0RA\0TC\0LX\0CX\0RX\0TY\0CY\0BY\0"
|
||||
@@ -26,21 +26,21 @@ U0 DocInit()
|
||||
|
||||
MemSet(doldoc.dft_de_flags, 0,sizeof(doldoc.dft_de_flags));
|
||||
MemSet(doldoc.dft_type_flags, 0,sizeof(doldoc.dft_type_flags));
|
||||
lx=LexNew("TX+T;DA+P+TRM+T;CM+LE+RE;AN+T;LK+L+UL+T;MA+X+UL+T;MU+X+UL+T;"
|
||||
cc=CmpCtrlNew("TX+T;DA+P+TRM+T;CM+LE+RE;AN+T;LK+L+UL+T;MA+X+UL+T;MU+X+UL+T;"
|
||||
"BT+X+B+T;CB+CA+P+T;LS+LS+P+T;HX+P+Z;TR+TR+C+CA+UL+T;SP+T;IB+T;IS+T;"
|
||||
"SO+T;HC+T;",LF_DONT_FREE_BUF);
|
||||
lx->htc.hash_table_lst=NULL;
|
||||
Lex(lx);
|
||||
while (lx->token==TK_IDENT) {
|
||||
if (temph=HashFind(lx->cur_str,doldoc.hash,DHT_DOC_CMD)) {
|
||||
"SO+T;HC+T;",CCF_DONT_FREE_BUF);
|
||||
cc->htc.hash_table_lst=NULL;
|
||||
Lex(cc);
|
||||
while (cc->token==TK_IDENT) {
|
||||
if (temph=HashFind(cc->cur_str,doldoc.hash,DHT_DOC_CMD)) {
|
||||
i=temph->user_data0;
|
||||
Lex(lx);
|
||||
PrsDocFlags(lx,&doldoc.dft_de_flags[i],&doldoc.dft_type_flags[i]);
|
||||
Lex(cc);
|
||||
PrsDocFlags(cc,&doldoc.dft_de_flags[i],&doldoc.dft_type_flags[i]);
|
||||
}
|
||||
if (lx->token==';')
|
||||
Lex(lx);
|
||||
if (cc->token==';')
|
||||
Lex(cc);
|
||||
}
|
||||
LexDel(lx);
|
||||
CmpCtrlDel(cc);
|
||||
|
||||
for (i=0;i<DOCT_NUM_TYPES;i++)
|
||||
doldoc.dft_de_flags[i]&=~DOCG_BL_IV_UL;
|
||||
@@ -50,7 +50,7 @@ U0 DocInit()
|
||||
if (Bt(&doldoc.dft_de_flags[i],DOCEf_TAG) && i!=DOCT_TEXT || i==DOCT_HEX_ED)
|
||||
Bts(doldoc.type_flags_form,i);
|
||||
|
||||
//Don't forget $LK,"cmp_type_flags_src_code",A="MN:cmp_type_flags_src_code"$.
|
||||
//Don't forget $LK,"cmp_type_flags_src_code",A="MN:cmp_type_flags_src_code"$.
|
||||
doldoc.type_flags_nontag_invisible[0]=
|
||||
1<<DOCT_PAGE_LEN|
|
||||
1<<DOCT_LEFT_MARGIN|
|
||||
|
||||
+18
-18
@@ -1,6 +1,6 @@
|
||||
#help_index "DolDoc/Misc"
|
||||
|
||||
U8 captured_macro_name[136];
|
||||
U8 captured_macro_name[STR_LEN];
|
||||
StrCpy(captured_macro_name,"Test");
|
||||
|
||||
I64 sys_macro_repeat_n=1;
|
||||
@@ -12,11 +12,11 @@ U0 SysMacroStripKey(CSrvCmd *macro_root,I64 a1,I64 a2)
|
||||
while (tempc!=macro_root) {
|
||||
tempc1=tempc->next;
|
||||
if (tempc->cmd_code==SVCT_MSG &&
|
||||
(tempc->msg_code==MSG_KEY_DOWN ||
|
||||
tempc->msg_code==MSG_KEY_UP ||
|
||||
tempc->msg_code==MSG_KEY_DOWN_UP) &&
|
||||
a1 && tempc->aux1==a1 ||
|
||||
!a1 && tempc->aux2==a2) {
|
||||
(tempc->msg_code==MSG_KEY_DOWN ||
|
||||
tempc->msg_code==MSG_KEY_UP ||
|
||||
tempc->msg_code==MSG_KEY_DOWN_UP) &&
|
||||
a1 && tempc->aux1==a1 ||
|
||||
!a1 && tempc->aux2==a2) {
|
||||
QueRem(tempc);
|
||||
SrvCmdDel(tempc);
|
||||
}
|
||||
@@ -32,14 +32,14 @@ class CMacroTemp
|
||||
{
|
||||
CMacroTemp *next,*last;
|
||||
I64 type;
|
||||
U8 buf[136];
|
||||
U8 buf[STR_LEN];
|
||||
};
|
||||
|
||||
CMacroTemp *Cmd2MT(CSrvCmd *tempc)
|
||||
{
|
||||
U8 buf[8];
|
||||
CMacroTemp *tempmt=CAlloc(sizeof(CMacroTemp));
|
||||
if (Bt(chars_bitmap_getkey,tempc->aux1) && tempc->msg_code==MSG_KEY_DOWN) {
|
||||
if (Bt(chars_bmp_macro,tempc->aux1) && tempc->msg_code==MSG_KEY_DOWN) {
|
||||
tempmt->type=MT_CHAR;
|
||||
buf[0]=tempc->aux1;
|
||||
buf[1]=0;
|
||||
@@ -47,7 +47,7 @@ CMacroTemp *Cmd2MT(CSrvCmd *tempc)
|
||||
} else {
|
||||
tempmt->type=MT_MSG;
|
||||
StrPrint(tempmt->buf,"Msg(0x%X,0x%X,0x%X);",
|
||||
tempc->msg_code,tempc->aux1,tempc->aux2);
|
||||
tempc->msg_code,tempc->aux1,tempc->aux2);
|
||||
}
|
||||
return tempmt;
|
||||
}
|
||||
@@ -58,7 +58,7 @@ U8 *SysMacro2Str(CSrvCmd *macro_root)
|
||||
I64 cnt=1; //terminating zero
|
||||
U8 *ptr,*m;
|
||||
CMacroTemp *tempmt,*tempmt1,root;
|
||||
Bool old_preempt=Preempt(OFF);
|
||||
Bool old_preempt=Preempt;
|
||||
LBtr(&sys_semas[SYS_SEMA_RECORD_MACRO],0);
|
||||
|
||||
QueInit(&root);
|
||||
@@ -113,7 +113,7 @@ U0 PlaySysMacro(I64 n=1)
|
||||
U8 *m;
|
||||
if (TaskValidate(task)) {
|
||||
LBtr(&sys_semas[SYS_SEMA_RECORD_MACRO],0);
|
||||
old_preempt=Preempt(OFF);
|
||||
old_preempt=Preempt;
|
||||
m=SysMacro2Str(&sys_macro_root);
|
||||
while (n-- && TaskValidate(task)) {
|
||||
if (task==Fs)
|
||||
@@ -128,11 +128,11 @@ U0 PlaySysMacro(I64 n=1)
|
||||
|
||||
U0 EdInsCapturedMacro()
|
||||
{
|
||||
Bool old_preempt=Preempt(OFF);
|
||||
Bool old_preempt=Preempt;
|
||||
U8 *st=SysMacro2Str(&sys_macro_root);
|
||||
if (sys_focus_task) {
|
||||
XTalk(sys_focus_task,"$$MA+LA,T=\"%s\",LM=\"%Q\"$$",
|
||||
captured_macro_name,st);
|
||||
captured_macro_name,st);
|
||||
Free(st);
|
||||
}
|
||||
Preempt(old_preempt);
|
||||
@@ -147,10 +147,10 @@ U0 EdInsCapturedMacro()
|
||||
I64 PopUpMacroMenu()
|
||||
{
|
||||
I64 result=0;
|
||||
U8 buf[136];
|
||||
U8 buf[STR_LEN];
|
||||
CSrvCmd *tempc;
|
||||
CDoc *doc=DocNew;
|
||||
CDocEntry *doc_e=DocPrint(doc,"$$DA-P,135,A=\"Name:%%s\"$$");
|
||||
CDocEntry *doc_e=DocPrint(doc,"$$DA-P,STR_LEN-1,A=\"Name:%%s\"$$");
|
||||
doc_e->data=captured_macro_name;
|
||||
DocDataFmt(doc,doc_e);
|
||||
|
||||
@@ -167,13 +167,13 @@ I64 PopUpMacroMenu()
|
||||
"$$CM+LX,17,0$$$$BT,\"CANCEL\",LE=DOCM_CANCEL$$"
|
||||
"\n\n\n$$GREEN$$SHIFT-F2$$FG$$ will play macro.\n");
|
||||
doc->flags|=DOCF_MIN_SIZE | DOCF_FORM;
|
||||
StrPrint(buf,"DocMenuDo(%d);",doc);
|
||||
StrPrint(buf,"DocMenu(%d);",doc);
|
||||
sys_macro_util_task=Spawn(&SrvCmdLine,NULL,"Macro Popup",,Fs);
|
||||
Fs->popup_task=sys_macro_util_task;
|
||||
LBts(&sys_macro_util_task->display_flags,DISPLAYf_WIN_ON_TOP);
|
||||
tempc=TaskExe(sys_macro_util_task,Fs,buf,
|
||||
1<<SVCf_WAKE_MASTER|1<<SVCf_FOCUS_MASTER);
|
||||
ScanResult(tempc,&result);
|
||||
1<<SVCf_WAKE_MASTER|1<<SVCf_FOCUS_MASTER);
|
||||
JobResultScan(tempc,&result);
|
||||
Fs->popup_task=NULL;
|
||||
Kill(sys_macro_util_task);
|
||||
sys_macro_util_task=NULL;
|
||||
|
||||
+36
-26
@@ -21,7 +21,7 @@ public Bool Ed(U8 *link_st,I64 edf_dof_flags=0)
|
||||
DocHelpIndex(doc,filename);
|
||||
ej_doc:
|
||||
if (!(edf_dof_flags&EDF_BAIL)) {
|
||||
DocDo(doc);
|
||||
DocEd(doc);
|
||||
DocDel(doc);
|
||||
}
|
||||
if (!(edf_dof_flags&EDF_WAS_WRITE))
|
||||
@@ -33,8 +33,8 @@ ej_doc:
|
||||
else {
|
||||
cont=TRUE;
|
||||
if (!(edf_dof_flags&EDF_BAIL) && !(LK_DOC<=i<=LK_DOC_LINE) &&
|
||||
!FilesFindMatch(filename,FILEMASK_TXT) &&
|
||||
!PopUpCancelOk(ST_WARN_ST "Not Text File\n\n"))
|
||||
!FilesFindMatch(filename,FILEMASK_TXT) &&
|
||||
!PopUpCancelOk(ST_WARN_ST "Not Text File\n\n"))
|
||||
cont=FALSE;
|
||||
if (cont)
|
||||
result=DocFileEd(i,filename,needle_str,&num,edf_dof_flags);
|
||||
@@ -57,7 +57,7 @@ public Bool Plain(U8 *filename,I64 edf_dof_flags=0)
|
||||
#help_index "DolDoc"
|
||||
public Bool DocLinkChk(U8 *link_st)
|
||||
{//Check for bad $LK,"Editor Link",A="MN:LK_FILE"$.
|
||||
U8 *filename;
|
||||
U8 *filename,*st;
|
||||
Bool result=FALSE;
|
||||
if (link_st) {
|
||||
switch (EdLinkCvt(link_st,&filename)) {
|
||||
@@ -66,11 +66,17 @@ public Bool DocLinkChk(U8 *link_st)
|
||||
case LK_FILE_LINE:
|
||||
case LK_PLAIN_LINE:
|
||||
case LK_FILE:
|
||||
//We don't check line number
|
||||
result=FileFind(filename,,FUF_JUST_FILES|FUF_Z_OR_NOT_Z|FUF_SCAN_PARENTS);
|
||||
//We don't check line number
|
||||
result=FileFind(filename,,
|
||||
FUF_JUST_FILES|FUF_Z_OR_NOT_Z|FUF_SCAN_PARENTS);
|
||||
break;
|
||||
case LK_BIBLE_FIND:
|
||||
result=TRUE; //We don't check verse string
|
||||
st=StrNew(link_st+3);
|
||||
if (StrOcc(st,','))
|
||||
StrLastRem(st,",");
|
||||
if (DefineMatch(st,"ST_BIBLE_BOOKS",LMF_IGNORE_CASE)>=0)
|
||||
result=TRUE;
|
||||
Free(st);
|
||||
break;
|
||||
default://TODO: Need to validate HI: and DF:
|
||||
if (Ed(link_st,EDF_BAIL))
|
||||
@@ -106,7 +112,7 @@ public U8 *DocLinkFile(U8 *link_st,CTask *mem_task=NULL)
|
||||
return result;
|
||||
}
|
||||
|
||||
#help_index "DolDoc/Task"
|
||||
#help_index "DolDoc/Task;StdOut/Task"
|
||||
public CDoc *DocBorderNew(CDoc *pdoc)
|
||||
{//Make new std border doc.
|
||||
CDocEntry *doc_e;
|
||||
@@ -145,7 +151,7 @@ public CDoc *DocBorderNew(CDoc *pdoc)
|
||||
|
||||
public U0 DocTermNew()
|
||||
{//Make into term win task with Put/Display/Border docs.
|
||||
Bool old_preempt=Preempt(OFF);
|
||||
Bool old_preempt=Preempt;
|
||||
CDoc *pdoc=DocNew;
|
||||
pdoc->right_click_link=&TermRightClickLink;
|
||||
pdoc->max_entries=4096;
|
||||
@@ -159,8 +165,9 @@ public U0 DocTermNew()
|
||||
Raw(OFF);
|
||||
}
|
||||
|
||||
#help_index "DolDoc/Input"
|
||||
public U8 *DocScanLine(CDoc *doc,CDocEntry *doc_e,I64 *cur_col=NULL,CDocEntry **_do_e_end=NULL)
|
||||
#help_index "DolDoc/Input;StdIn/DolDoc"
|
||||
public U8 *DocScanLine(CDoc *doc,CDocEntry *doc_e,
|
||||
I64 *cur_col=NULL,CDocEntry **_do_e_end=NULL)
|
||||
{//Start at entry in doc,make and return one line as str.
|
||||
CDocEntry *doc_e2=doc_e;
|
||||
Bool unlock=DocLock(doc);
|
||||
@@ -187,19 +194,19 @@ public U8 *DocScanLine(CDoc *doc,CDocEntry *doc_e,I64 *cur_col=NULL,CDocEntry **
|
||||
} else if (doc_e->type_u8==DOCT_TAB)
|
||||
*dst++='\t';
|
||||
if (doc_e==doc->cur_entry && cur_col)
|
||||
*cur_col=start-result+doc->cur_data_col;
|
||||
*cur_col=start-result+doc->cur_col;
|
||||
doc_e=doc_e->next;
|
||||
}
|
||||
if (_do_e_end) *_do_e_end=doc_e;
|
||||
*dst=0;
|
||||
if (doc_e==doc->cur_entry && cur_col && !doc->cur_data_col)
|
||||
if (doc_e==doc->cur_entry && cur_col && !doc->cur_col)
|
||||
*cur_col=dst-result;
|
||||
if (unlock)
|
||||
DocUnlock(doc);
|
||||
return result;
|
||||
}
|
||||
|
||||
#help_index "DolDoc/Output"
|
||||
#help_index "DolDoc/Output;StdOut/DolDoc"
|
||||
U0 DocDump(CDoc *doc,I64 uS_delay=0)
|
||||
{
|
||||
U8 *st;
|
||||
@@ -259,7 +266,7 @@ public CDocEntry *DocPutLine(CDoc *doc=NULL,CDocEntry *doc_e)
|
||||
return doc_e;
|
||||
}
|
||||
|
||||
#help_index "DolDoc/Input"
|
||||
#help_index "DolDoc/Input;StdIn/DolDoc"
|
||||
U8 *DocGetStr2(I64 flags=0)
|
||||
{//$LK,"Flags",A="MN:GSF_SHIFT_ESC_EXIT"$
|
||||
CDoc *doc;
|
||||
@@ -291,10 +298,11 @@ U8 *DocGetStr2(I64 flags=0)
|
||||
goto gs_done;
|
||||
}
|
||||
}
|
||||
//<CTRL-SHIFT-ENTER> is a blank line without entry
|
||||
} while (flags&GSF_WITH_NEW_LINE || ch!='\n' || sc & SCF_CTRL && sc & SCF_SHIFT);
|
||||
//<CTRL-SHIFT-ENTER> is a blank line without entry
|
||||
} while (flags&GSF_WITH_NEW_LINE || ch!='\n' ||
|
||||
sc & SCF_CTRL && sc & SCF_SHIFT);
|
||||
|
||||
Preempt(OFF);
|
||||
Preempt;
|
||||
doc=DocPut;
|
||||
DocLock(doc);
|
||||
if (flags&GSF_WITH_NEW_LINE) {
|
||||
@@ -319,11 +327,11 @@ U8 *DocGetStr2(I64 flags=0)
|
||||
doc_e=doc->cur_entry;
|
||||
do doc_e=doc_e->last;
|
||||
while (doc_e!=doc && doc_e->type_u8!=DOCT_NEW_LINE &&
|
||||
doc_e->type_u8!=DOCT_PMT);
|
||||
doc_e->type_u8!=DOCT_PMT);
|
||||
if (doc_e!=doc && doc_e->type_u8!=DOCT_PMT) {
|
||||
do doc_e=doc_e->last;
|
||||
while (doc_e!=doc && doc_e->type_u8!=DOCT_NEW_LINE &&
|
||||
doc_e->type_u8!=DOCT_PMT);
|
||||
doc_e->type_u8!=DOCT_PMT);
|
||||
}
|
||||
doc_e=doc_e->next;
|
||||
result=DocScanLine(doc,doc_e,NULL);
|
||||
@@ -335,7 +343,7 @@ gs_done:
|
||||
return result;
|
||||
}
|
||||
|
||||
#help_index "Keyboard Devices;Char/Input"
|
||||
#help_index "Keyboard Devices;Char/Input;StdIn"
|
||||
|
||||
public I64 GetI64(U8 *msg=NULL,I64 dft=0,I64 lo=MIN_I64,I64 hi=MAX_I64)
|
||||
{//Prompt user for I64 expression.
|
||||
@@ -389,7 +397,8 @@ public F64 GetF64(U8 *msg=NULL,F64 dft=0,F64 lo=MIN_F64,F64 hi=MAX_F64)
|
||||
}
|
||||
}
|
||||
|
||||
public CDate GetDate(U8 *msg=NULL,CDate dft=MIN_I64,CDate lo=MIN_I64,CDate hi=MAX_I64)
|
||||
public CDate GetDate(U8 *msg=NULL,CDate dft=MIN_I64,
|
||||
CDate lo=MIN_I64,CDate hi=MAX_I64)
|
||||
{//Prompt user for date expression. (Use $LK,"Now",A="MN:Now"$() if you want current time.)
|
||||
U8 *st;
|
||||
CDate result;
|
||||
@@ -497,14 +506,14 @@ I64 TermRightClickLink(CDoc *doc,CDocEntry *doc_e)
|
||||
break;
|
||||
case RIGHT_COPY:
|
||||
StrCpy(fn.name,st);
|
||||
if (DocFormDo(&fn)) {
|
||||
if (DocForm(&fn)) {
|
||||
result=ToBool(Copy(st,fn.name));
|
||||
} else
|
||||
send_new_line=TRUE;
|
||||
break;
|
||||
case RIGHT_MOVE:
|
||||
StrCpy(fn.name,st);
|
||||
if (DocFormDo(&fn))
|
||||
if (DocForm(&fn))
|
||||
result=Move(st,fn.name);
|
||||
else
|
||||
send_new_line=TRUE;
|
||||
@@ -551,7 +560,8 @@ I64 TermRightClickLink(CDoc *doc,CDocEntry *doc_e)
|
||||
return result;
|
||||
}
|
||||
|
||||
#help_index "Debugging/Dump;DolDoc/Cmd Line (Typically);Cmd Line (Typically);DolDoc/Output"
|
||||
#help_index "Debugging/Dump;DolDoc/Cmd Line (Typically);"\
|
||||
"Cmd Line (Typically);DolDoc/Output;StdOut/DolDoc"
|
||||
public U0 DocDm(U8 *buf,I64 cnt=0x80)
|
||||
{//Dump live chunk of mem showing addresses. Can be edited.
|
||||
CDocEntry *doc_e;
|
||||
@@ -578,7 +588,7 @@ public U0 DocD(U8 *buf,I64 cnt=0x80)
|
||||
DocUnlock(doc);
|
||||
}
|
||||
|
||||
#help_index "DolDoc/Output"
|
||||
#help_index "DolDoc/Output;StdOut/DolDoc"
|
||||
Bool KDDocPutS(U8 *st)
|
||||
{
|
||||
CDoc *doc;
|
||||
|
||||
+28
-27
@@ -266,12 +266,12 @@ U0 DocFormFwd(CDoc *doc,Bool giveup=FALSE)
|
||||
if (doc->flags & DOCF_FORM) {
|
||||
if (doc_e==doc) goto ff_recover;
|
||||
while (!Bt(doldoc.type_flags_form,doc_e->type_u8) &&
|
||||
!(doc_e->de_flags&DOCEF_LINK) ||
|
||||
doc_e->de_flags&DOCEF_SKIP_IN_FORM) {
|
||||
!(doc_e->de_flags&DOCEF_LINK) ||
|
||||
doc_e->de_flags&DOCEF_SKIP_IN_FORM) {
|
||||
doc_e=doc_e->next;
|
||||
if (doc_e==doc) {
|
||||
ff_recover:
|
||||
doc->cur_data_col=0;
|
||||
doc->cur_col=0;
|
||||
if (!giveup) {
|
||||
doc->cur_entry=doc_e->last;
|
||||
DocFormBwd(doc,TRUE);
|
||||
@@ -284,7 +284,7 @@ ff_recover:
|
||||
while (doc_e->type_u8==DOCT_INDENT)
|
||||
doc_e=doc_e->next;
|
||||
if (doc_e!=doc_e2) {
|
||||
doc->cur_data_col=doc_e->min_col;
|
||||
doc->cur_col=doc_e->min_col;
|
||||
doc->cur_entry=doc_e;
|
||||
}
|
||||
}
|
||||
@@ -294,11 +294,11 @@ U0 DocFormBwd(CDoc *doc,Bool giveup=FALSE)
|
||||
CDocEntry *doc_e=doc->cur_entry,*doc_e2=doc_e;
|
||||
if (doc->flags & DOCF_FORM) {
|
||||
while (!Bt(doldoc.type_flags_form,doc_e->type_u8) &&
|
||||
!(doc_e->de_flags&DOCEF_LINK) ||
|
||||
doc_e->de_flags&DOCEF_SKIP_IN_FORM) {
|
||||
!(doc_e->de_flags&DOCEF_LINK) ||
|
||||
doc_e->de_flags&DOCEF_SKIP_IN_FORM) {
|
||||
doc_e=doc_e->last;
|
||||
if (doc_e==doc) {
|
||||
doc->cur_data_col=0;
|
||||
doc->cur_col=0;
|
||||
if (!giveup) {
|
||||
doc->cur_entry=doc_e->next;
|
||||
DocFormFwd(doc,TRUE);
|
||||
@@ -311,7 +311,7 @@ U0 DocFormBwd(CDoc *doc,Bool giveup=FALSE)
|
||||
while (doc_e->type_u8==DOCT_INDENT)
|
||||
doc_e=doc_e->next;
|
||||
if (doc_e!=doc_e2) {
|
||||
doc->cur_data_col=doc_e->min_col;
|
||||
doc->cur_col=doc_e->min_col;
|
||||
doc->cur_entry=doc_e;
|
||||
}
|
||||
}
|
||||
@@ -323,11 +323,11 @@ public U0 DocTop(CDoc *doc=NULL)
|
||||
return;
|
||||
unlock=DocLock(doc);
|
||||
doc->cur_entry=doc->root.next;
|
||||
doc->cur_data_col=doc->cur_entry->min_col;
|
||||
doc->cur_col=doc->cur_entry->min_col;
|
||||
doc->x=0;
|
||||
doc->y=0;
|
||||
doc->line_start_col=0;
|
||||
doc->cur_top_line_num=0;
|
||||
doc->top_line_num=0;
|
||||
|
||||
DocFormFwd(doc);
|
||||
DocRecalc(doc);
|
||||
@@ -367,7 +367,7 @@ public U0 DocRst(CDoc *doc,Bool is_old)
|
||||
b=b1;
|
||||
}
|
||||
}
|
||||
//Check $LK,"DocInsDoc",A="MN:DocInsDoc"$
|
||||
//Check $LK,"DocInsDoc",A="MN:DocInsDoc"$
|
||||
doc->flags&=DOCF_BREAK_UNLOCKED;
|
||||
doc->root.next=doc->root.last=doc;
|
||||
QueInit(&doc->bin_root);
|
||||
@@ -495,9 +495,8 @@ U0 DocDataFmt(CDoc *doc,CDocEntry *doc_e,I64 d=DOCM_CANCEL)
|
||||
}
|
||||
doc_e->max_col=StrLen(doc_e->tag);
|
||||
} else if (doc_e->de_flags & DOCEF_LST) {
|
||||
if (doc_e->de_flags & DOCEF_DEFINE &&
|
||||
(temph=HashFind(doc_e->define_str,doc->win_task->hash_table,HTT_DEFINE_STR)) &&
|
||||
0<=d<temph->cnt) {
|
||||
if (doc_e->de_flags & DOCEF_DEFINE && (temph=HashFind(doc_e->define_str,
|
||||
doc->win_task->hash_table,HTT_DEFINE_STR)) && 0<=d<temph->cnt) {
|
||||
ptr=MStrPrint("[%s]",temph->sub_lst[d]);
|
||||
Free(doc_e->tag);
|
||||
doc_e->tag=StrNew(ptr,doc->mem_task);
|
||||
@@ -521,7 +520,7 @@ U0 DocDataScan(CDoc *doc,CDocEntry *doc_e)
|
||||
U8 *ptr,*ptr1,*ptr2;
|
||||
CHashDefineStr *temph;
|
||||
if (doc_e->type_u8==DOCT_DATA && doc_e->de_flags&DOCEF_AUX_STR ||
|
||||
doc_e->type_u8==DOCT_CHECK_BOX || doc_e->de_flags & DOCEF_LST) {
|
||||
doc_e->type_u8==DOCT_CHECK_BOX || doc_e->de_flags & DOCEF_LST) {
|
||||
if (doc_e->de_flags & DOCEF_DATA_IS_PTR) {
|
||||
if (!(ptr=doc_e->data)) return;
|
||||
} else
|
||||
@@ -545,7 +544,8 @@ U0 DocDataScan(CDoc *doc,CDocEntry *doc_e)
|
||||
} else if (doc_e->de_flags & DOCEF_LST) {
|
||||
d=0;
|
||||
if (doc_e->tag && doc_e->de_flags & DOCEF_DEFINE &&
|
||||
(temph=HashFind(doc_e->define_str,doc->win_task->hash_table,HTT_DEFINE_STR))) {
|
||||
(temph=HashFind(doc_e->define_str,
|
||||
doc->win_task->hash_table,HTT_DEFINE_STR))) {
|
||||
ptr1=ptr2=StrNew(doc_e->tag);
|
||||
if (*ptr2=='[') {
|
||||
ptr2++;
|
||||
@@ -596,7 +596,7 @@ U0 DocRemSoftNewLines(CDoc *doc=NULL,CDocEntry *doc_e=NULL)
|
||||
if (doc_e->type_u8==DOCT_SOFT_NEW_LINE) {
|
||||
if (doc->cur_entry==doc_e) {
|
||||
doc->cur_entry=doc_e2;
|
||||
doc->cur_data_col=doc->cur_entry->min_col;
|
||||
doc->cur_col=doc->cur_entry->min_col;
|
||||
}
|
||||
DocEntryDel(doc,doc_e);
|
||||
} else if (saved_ll && doc_e->type_u8==DOCT_NEW_LINE)
|
||||
@@ -612,9 +612,9 @@ U0 DocRemSoftNewLines(CDoc *doc=NULL,CDocEntry *doc_e=NULL)
|
||||
public I64 DocMax(I64 i=MAX_I64)
|
||||
{//Set max document entries. (Cmd line buffer.)
|
||||
//Adjusts the size of the cmd line buf.
|
||||
//Normally, the cmd line deletes entries
|
||||
//when more are added and the old scroll up.
|
||||
//See $LK,"max_entries",A="FF:::/Adam/DolDoc/DocMain.CPP,max_entries"$.
|
||||
//Normally, the cmd line deletes entries
|
||||
//when more are added and the old scroll up.
|
||||
//See $LK,"max_entries",A="FF:::/Adam/DolDoc/DocMain.CPP,max_entries"$.
|
||||
I64 result;
|
||||
CDoc *doc;
|
||||
if (doc=DocPut) {
|
||||
@@ -650,10 +650,10 @@ public CDoc *DocNew(U8 *filename=NULL,CTask *task=NULL)
|
||||
return doc;
|
||||
}
|
||||
|
||||
#help_index "DolDoc/Task"
|
||||
#help_index "DolDoc/Task;StdOut/Task"
|
||||
public CDoc *DocPut(CTask *task=NULL)
|
||||
{//Current document that StdOut Put() goes to.
|
||||
//Basically, StdOut unless double buffering.
|
||||
//Basically, StdOut unless double buffering.
|
||||
CDoc *result;
|
||||
if (!task) task=Fs;
|
||||
if ((result=task->put_doc) && result->doc_signature==DOC_SIGNATURE_VAL)
|
||||
@@ -684,13 +684,13 @@ public CDoc *DocBorder(CTask *task=NULL)
|
||||
|
||||
public CDoc *DocDblBufStart(CTask *task=NULL)
|
||||
{//See $LK,"::/Demo/Spy.CPP"$
|
||||
Bool unlock_ddoc,old_preempt=Preempt(OFF);
|
||||
Bool unlock_ddoc,old_preempt=Preempt;
|
||||
CDoc *pdoc=DocPut(task),*ddoc=DocDisplay(task),*result;
|
||||
if (!pdoc || !ddoc || pdoc!=ddoc)
|
||||
result=NULL; //Already Double buffering
|
||||
else {
|
||||
if (!task) task=Fs;
|
||||
unlock_ddoc=DocLock(ddoc); //dont want change during winupdate, so lock DocPut$WW,0$
|
||||
unlock_ddoc=DocLock(ddoc); //dont change during winupdate, so lock DocPut$WW,0$
|
||||
result=DocNew(,task);
|
||||
result->win_task =ddoc->win_task;
|
||||
result->max_entries =ddoc->max_entries;
|
||||
@@ -715,7 +715,7 @@ public CDoc *DocDblBufStart(CTask *task=NULL)
|
||||
|
||||
public Bool DocDblBufEnd(CTask *task=NULL)
|
||||
{//See $LK,"::/Demo/Spy.CPP"$
|
||||
Bool result=FALSE,old_preempt=Preempt(OFF);
|
||||
Bool result=FALSE,old_preempt=Preempt;
|
||||
CDoc *pdoc=DocPut(task),*ddoc=DocDisplay(task);
|
||||
if (pdoc && ddoc && pdoc!=ddoc) {//Double buffering?
|
||||
if (!task) task=Fs;
|
||||
@@ -733,7 +733,7 @@ public Bool DocDblBufEnd(CTask *task=NULL)
|
||||
|
||||
public Bool DocDblBufSwap(CTask *task=NULL)
|
||||
{//See $LK,"::/Demo/Spy.CPP"$
|
||||
Bool result=FALSE,old_preempt=Preempt(OFF);
|
||||
Bool result=FALSE,old_preempt=Preempt;
|
||||
CDoc *pdoc=DocPut(task),*ddoc=DocDisplay(task);
|
||||
if (pdoc && ddoc && pdoc!=ddoc) {//Double buffering?
|
||||
if (!task) task=Fs;
|
||||
@@ -746,7 +746,8 @@ public Bool DocDblBufSwap(CTask *task=NULL)
|
||||
MemCpy(ddoc->find_replace,pdoc->find_replace,sizeof(CEdFindText));
|
||||
MemCpy(&ddoc->filename,&pdoc->filename,sizeof(CEdFileName));
|
||||
ddoc->max_entries =pdoc->max_entries;
|
||||
ddoc->flags =pdoc->flags&DOCG_DBL_BUF_FLAGS | ddoc->flags&~DOCG_DBL_BUF_FLAGS;
|
||||
ddoc->flags =pdoc->flags&DOCG_DBL_BUF_FLAGS |
|
||||
ddoc->flags&~DOCG_DBL_BUF_FLAGS;
|
||||
ddoc->left_click_link =pdoc->left_click_link;
|
||||
ddoc->right_click_link =pdoc->right_click_link;
|
||||
ddoc->user_put_data =pdoc->user_put_data;
|
||||
|
||||
+14
-13
@@ -7,7 +7,8 @@ I64 DocOptEntry(CDoc *,CDocEntry *doc_e)
|
||||
|
||||
if (doc_e->de_flags&DOCEF_LINK && doc_e->de_flags&(DOCEF_AUX_STR|DOCEF_TAG)) {
|
||||
if (doc_e->de_flags & DOCEF_AUX_STR && doc_e->de_flags & DOCEF_TAG &&
|
||||
!MemCmp(doc_e->aux_str,"FI:",3) && !StrCmp(doc_e->aux_str+3,doc_e->tag)) {
|
||||
!MemCmp(doc_e->aux_str,"FI:",3) &&
|
||||
!StrCmp(doc_e->aux_str+3,doc_e->tag)) {
|
||||
Free(doc_e->aux_str);
|
||||
doc_e->aux_str=NULL;
|
||||
doc_e->de_flags&=~DOCEF_AUX_STR;
|
||||
@@ -31,18 +32,18 @@ I64 DocOptEntry(CDoc *,CDocEntry *doc_e)
|
||||
Free(st);
|
||||
}
|
||||
/* !!! Dangerous, but handy !!!
|
||||
if (doc_e->de_flags & DOCEF_AUX_STR) {
|
||||
if (st=StrMatch(".Z",doc_e->aux_str)) {
|
||||
StrCpy(st,st+2);
|
||||
result++;
|
||||
}
|
||||
}
|
||||
if (doc_e->de_flags&DOCEF_TAG) {
|
||||
if (st=StrMatch(".Z",doc_e->tag)) {
|
||||
StrCpy(st,st+2);
|
||||
result++;
|
||||
}
|
||||
}
|
||||
if (doc_e->de_flags & DOCEF_AUX_STR) {
|
||||
if (st=StrMatch(".Z",doc_e->aux_str)) {
|
||||
StrCpy(st,st+2);
|
||||
result++;
|
||||
}
|
||||
}
|
||||
if (doc_e->de_flags&DOCEF_TAG) {
|
||||
if (st=StrMatch(".Z",doc_e->tag)) {
|
||||
StrCpy(st,st+2);
|
||||
result++;
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
return result;
|
||||
|
||||
+110
-99
@@ -1,10 +1,11 @@
|
||||
#help_index "DolDoc"
|
||||
|
||||
I64 PrsDocFlagSingle(CLex *lx,I64 *_de_flags,U32 *_type,Bool turn_on)
|
||||
I64 PrsDocFlagSingle(CCmpCtrl *cc,I64 *_de_flags,U32 *_type,Bool turn_on)
|
||||
{
|
||||
I64 result=-1;
|
||||
CHashGeneric *temph;
|
||||
if (lx->token==TK_IDENT && (temph=HashFind(lx->cur_str,doldoc.hash,DHT_DOC_FLAG))) {
|
||||
if (cc->token==TK_IDENT &&
|
||||
(temph=HashFind(cc->cur_str,doldoc.hash,DHT_DOC_FLAG))) {
|
||||
result=temph->user_data0;
|
||||
if (result<64) {
|
||||
BEqu(_de_flags,result,turn_on);
|
||||
@@ -17,24 +18,24 @@ I64 PrsDocFlagSingle(CLex *lx,I64 *_de_flags,U32 *_type,Bool turn_on)
|
||||
break;
|
||||
}
|
||||
}
|
||||
Lex(lx); //skip flag
|
||||
Lex(cc); //skip flag
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
I64 PrsDocFlags(CLex *lx,I64 *_de_flags,U32 *_type)
|
||||
I64 PrsDocFlags(CCmpCtrl *cc,I64 *_de_flags,U32 *_type)
|
||||
{
|
||||
I64 result=-1;
|
||||
Bool turn_on;
|
||||
while (TRUE) {
|
||||
if (lx->token=='+')
|
||||
if (cc->token=='+')
|
||||
turn_on=TRUE;
|
||||
else if (lx->token=='-')
|
||||
else if (cc->token=='-')
|
||||
turn_on=FALSE;
|
||||
else
|
||||
break;
|
||||
Lex(lx);
|
||||
result=PrsDocFlagSingle(lx,_de_flags,_type,turn_on);
|
||||
Lex(cc);
|
||||
result=PrsDocFlagSingle(cc,_de_flags,_type,turn_on);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -45,7 +46,8 @@ I64 DocBinPtrRst(CDoc *doc,CDocEntry *doc_e)
|
||||
CDoc *doc2;
|
||||
CDocBin *tempb,*tempb2;
|
||||
I64 i,bin_num=0;
|
||||
if (doc_e->de_flags&DOCEF_HAS_BIN && doc_e->bin_ptr_link && StrLen(doc_e->bin_ptr_link)) {
|
||||
if (doc_e->de_flags&DOCEF_HAS_BIN &&
|
||||
doc_e->bin_ptr_link && StrLen(doc_e->bin_ptr_link)) {
|
||||
bin_num=doc_e->bin_num;
|
||||
st=StrNew(doc_e->bin_ptr_link);
|
||||
st2=StrNew(st);
|
||||
@@ -54,7 +56,7 @@ I64 DocBinPtrRst(CDoc *doc,CDocEntry *doc_e)
|
||||
if (i>0||*st2) {
|
||||
doc2=DocRead(st);
|
||||
if (i>0 && (tempb2=DocBinFindNum(doc2,i)) ||
|
||||
i==0 && (tempb2=DocBinFindTag(doc2,st2))) {
|
||||
i==0 && (tempb2=DocBinFindTag(doc2,st2))) {
|
||||
i=1;
|
||||
if (bin_num>0) {
|
||||
if (tempb=DocBinFindNum(doc,bin_num)) {
|
||||
@@ -91,7 +93,8 @@ U8 *Doc2PlainText(CDoc *doc,CDocEntry *doc_e)
|
||||
t1,f1,de_flags,type;
|
||||
U8 *buf,*buf2;
|
||||
|
||||
if (doc_e->type_u8==DOCT_FOREGROUND && doc->flags&DOCF_COLOR_NAMES && 0<=attr<NUM_COLORS) {
|
||||
if (doc_e->type_u8==DOCT_FOREGROUND &&
|
||||
doc->flags&DOCF_COLOR_NAMES && 0<=attr<NUM_COLORS) {
|
||||
buf=StrNew(DefineSub(attr,"ST_COLORS"));
|
||||
attr=DOC_DFT;
|
||||
} else
|
||||
@@ -100,7 +103,8 @@ U8 *Doc2PlainText(CDoc *doc,CDocEntry *doc_e)
|
||||
f1=doldoc.dft_de_flags[doc_e->type_u8];
|
||||
t1=doc_e->type_u8|doldoc.dft_type_flags[doc_e->type_u8];
|
||||
|
||||
de_flags=doc_e->de_flags&~(DOCG_BL_IV_UL|DOCEF_SELECTED|DOCEF_HIGHLIGHT|DOCEF_WORD_WRAP|DOCEF_SKIP|DOCEF_FILTER_SKIP);
|
||||
de_flags=doc_e->de_flags&~(DOCG_BL_IV_UL|DOCEF_SELECTED|
|
||||
DOCEF_HIGHLIGHT|DOCEF_WORD_WRAP|DOCEF_SKIP|DOCEF_FILTER_SKIP);
|
||||
for (i=0;i<DOCEf_NUM_FLAGS;i++)
|
||||
if (Bt(&f1,i)!=Bt(&de_flags,i)) {
|
||||
if (Bt(&de_flags,i)) {
|
||||
@@ -174,9 +178,12 @@ U8 *Doc2PlainText(CDoc *doc,CDocEntry *doc_e)
|
||||
nobound_switch (j) {
|
||||
case DOCEf_TAG:
|
||||
if (doc_e->type_u8==DOCT_DATA || doc_e->type_u8==DOCT_MACRO &&
|
||||
(doc_e->de_flags&DOCEF_LEFT_MACRO && !StrCmp(doc_e->tag,doc_e->left_macro) ||
|
||||
doc_e->de_flags&DOCEF_RIGHT_MACRO && !StrCmp(doc_e->tag,doc_e->right_macro)) ||
|
||||
doc_e->de_flags&DOCEF_LST && !StrCmp(doc_e->tag,"[]") && doc_e->de_flags&DOCEF_DEFINE) {
|
||||
(doc_e->de_flags&DOCEF_LEFT_MACRO &&
|
||||
!StrCmp(doc_e->tag,doc_e->left_macro) ||
|
||||
doc_e->de_flags&DOCEF_RIGHT_MACRO &&
|
||||
!StrCmp(doc_e->tag,doc_e->right_macro)) ||
|
||||
doc_e->de_flags&DOCEF_LST && !StrCmp(doc_e->tag,"[]") &&
|
||||
doc_e->de_flags&DOCEF_DEFINE) {
|
||||
buf2=buf;
|
||||
buf=NULL;
|
||||
} else {
|
||||
@@ -227,7 +234,7 @@ U8 *Doc2PlainText(CDoc *doc,CDocEntry *doc_e)
|
||||
break;
|
||||
case DOCEf_RAW_TYPE:
|
||||
if (doc_e->type_u8==DOCT_CHECK_BOX&&doc_e->raw_type!=RT_I8 ||
|
||||
doc_e->type_u8!=DOCT_CHECK_BOX&&doc_e->raw_type!=RT_I64)
|
||||
doc_e->type_u8!=DOCT_CHECK_BOX&&doc_e->raw_type!=RT_I64)
|
||||
buf2=MStrPrint("%sRT=%Z,",buf,doc_e->raw_type,"ST_RAW_TYPES");
|
||||
break;
|
||||
case DOCEf_SHIFTED_X:
|
||||
@@ -264,12 +271,12 @@ CDocEntry *PrsDollarCmd(CDoc *doc,U8 *st)
|
||||
U8 *ptr,*st2;
|
||||
CDocEntry *doc_e=NULL;
|
||||
CHashGeneric *temph;
|
||||
CLex *lx=LexNew(st,LF_DONT_FREE_BUF);
|
||||
CHashTable *old_hash_table_lst=lx->htc.hash_table_lst;
|
||||
CCmpCtrl *cc=CmpCtrlNew(st,CCF_DONT_FREE_BUF);
|
||||
CHashTable *old_hash_table_lst=cc->htc.hash_table_lst;
|
||||
try {
|
||||
lx->htc.hash_table_lst=NULL;
|
||||
if (Lex(lx)==TK_IDENT) {
|
||||
if (temph=HashFind(lx->cur_str,doldoc.hash,DHT_DOC_CMD|DHT_COLOR)) {
|
||||
cc->htc.hash_table_lst=NULL;
|
||||
if (Lex(cc)==TK_IDENT) {
|
||||
if (temph=HashFind(cc->cur_str,doldoc.hash,DHT_DOC_CMD|DHT_COLOR)) {
|
||||
if (temph->type&DHT_DOC_CMD)
|
||||
i=temph->user_data0;
|
||||
else {//DHT_COLOR
|
||||
@@ -278,20 +285,20 @@ CDocEntry *PrsDollarCmd(CDoc *doc,U8 *st)
|
||||
}
|
||||
} else
|
||||
goto pd_err;
|
||||
Lex(lx); //skip cmd code
|
||||
Lex(cc); //skip cmd code
|
||||
doc_e=CAlloc(sizeof(CDocEntry),doc->mem_task);
|
||||
doc_e->type=i;
|
||||
doc_e->de_flags=doldoc.dft_de_flags[i];
|
||||
doc_e->type|=doldoc.dft_type_flags[i];
|
||||
doc_e->raw_type=RT_I64;
|
||||
j=PrsDocFlags(lx,&doc_e->de_flags,&doc_e->type);
|
||||
lx->htc.hash_table_lst=old_hash_table_lst;
|
||||
j=PrsDocFlags(cc,&doc_e->de_flags,&doc_e->type);
|
||||
cc->htc.hash_table_lst=old_hash_table_lst;
|
||||
nobound_switch (i) {
|
||||
case DOCT_DATA:
|
||||
while (lx->token==',')
|
||||
Lex(lx);
|
||||
if (lx->token)
|
||||
doc_e->len=LexExpressionI64(lx);
|
||||
while (cc->token==',')
|
||||
Lex(cc);
|
||||
if (cc->token)
|
||||
doc_e->len=LexExpressionI64(cc);
|
||||
else
|
||||
goto pd_err;
|
||||
break;
|
||||
@@ -299,16 +306,16 @@ CDocEntry *PrsDollarCmd(CDoc *doc,U8 *st)
|
||||
doc_e->raw_type=RT_I8;
|
||||
break;
|
||||
case DOCT_HEX_ED:
|
||||
while (lx->token==',')
|
||||
Lex(lx);
|
||||
if (lx->token)
|
||||
doc_e->len=LexExpressionI64(lx);
|
||||
while (cc->token==',')
|
||||
Lex(cc);
|
||||
if (cc->token)
|
||||
doc_e->len=LexExpressionI64(cc);
|
||||
else
|
||||
goto pd_err;
|
||||
while (lx->token==',')
|
||||
Lex(lx);
|
||||
if (lx->token)
|
||||
doc_e->hex_ed_width=LexExpressionI64(lx);
|
||||
while (cc->token==',')
|
||||
Lex(cc);
|
||||
if (cc->token)
|
||||
doc_e->hex_ed_width=LexExpressionI64(cc);
|
||||
else
|
||||
goto pd_err;
|
||||
break;
|
||||
@@ -329,10 +336,10 @@ CDocEntry *PrsDollarCmd(CDoc *doc,U8 *st)
|
||||
case DOCT_BLINK:
|
||||
case DOCT_SHIFTED_X:
|
||||
case DOCT_SHIFTED_Y:
|
||||
while (lx->token==',')
|
||||
Lex(lx);
|
||||
if (lx->token)
|
||||
doc_e->attr=LexExpressionI64(lx);
|
||||
while (cc->token==',')
|
||||
Lex(cc);
|
||||
if (cc->token)
|
||||
doc_e->attr=LexExpressionI64(cc);
|
||||
else
|
||||
doc_e->attr=attr;
|
||||
break;
|
||||
@@ -343,15 +350,15 @@ CDocEntry *PrsDollarCmd(CDoc *doc,U8 *st)
|
||||
|
||||
processed_flags=0;
|
||||
while (TRUE) {
|
||||
lx->htc.hash_table_lst=NULL;
|
||||
while (lx->token==',')
|
||||
Lex(lx);
|
||||
lx->htc.hash_table_lst=old_hash_table_lst;
|
||||
j=PrsDocFlagSingle(lx,&doc_e->de_flags,&doc_e->type,TRUE);
|
||||
cc->htc.hash_table_lst=NULL;
|
||||
while (cc->token==',')
|
||||
Lex(cc);
|
||||
cc->htc.hash_table_lst=old_hash_table_lst;
|
||||
j=PrsDocFlagSingle(cc,&doc_e->de_flags,&doc_e->type,TRUE);
|
||||
if (!(de_flags=~processed_flags & doc_e->de_flags & DOCEG1_HAS_ARG))
|
||||
break;
|
||||
if (lx->token=='=')
|
||||
Lex(lx);
|
||||
if (cc->token=='=')
|
||||
Lex(cc);
|
||||
else
|
||||
j=Bsf(de_flags);
|
||||
if (j<0 || Bts(&processed_flags,j))
|
||||
@@ -360,10 +367,11 @@ CDocEntry *PrsDollarCmd(CDoc *doc,U8 *st)
|
||||
case DOCEf_TAG:
|
||||
if (!doc_e->tag) {
|
||||
//If a $$MA,LM=""$$, Tag is filled when the LM is processed.
|
||||
//if doc_e->df_flags&DOCEF_LST, Tag is filled when the Define is processed.
|
||||
//(The dft_flag1.tag calls this after.)
|
||||
if (lx->token==TK_STR) {
|
||||
st2=LexExtStr(lx);
|
||||
//if doc_e->df_flags&DOCEF_LST,
|
||||
// Tag is filled when the Define is processed.
|
||||
//(The dft_flag1.tag calls this after.)
|
||||
if (cc->token==TK_STR) {
|
||||
st2=LexExtStr(cc);
|
||||
if (i==DOCT_CHECK_BOX) {
|
||||
st=MStrPrint("[X] %s",st2);
|
||||
Free(st2);
|
||||
@@ -388,22 +396,23 @@ CDocEntry *PrsDollarCmd(CDoc *doc,U8 *st)
|
||||
}
|
||||
break;
|
||||
case DOCEf_AUX_STR:
|
||||
if (lx->token==TK_STR) {
|
||||
st2=LexExtStr(lx);
|
||||
if (cc->token==TK_STR) {
|
||||
st2=LexExtStr(cc);
|
||||
doc_e->aux_str=StrNew(st2,doc->mem_task);
|
||||
Free(st2);
|
||||
//$AN,"Anchor",A="DataTagWidth"$
|
||||
if (i==DOCT_DATA) {
|
||||
if (ptr=StrMatch(":",doc_e->aux_str))
|
||||
doc_e->min_col=ptr-doc_e->aux_str+1;
|
||||
doc_e->tag=MAlloc(doc_e->len+doc_e->min_col+2,doc->mem_task); //+2 because "_\0"
|
||||
doc_e->tag=MAlloc(doc_e->len+doc_e->min_col+2,
|
||||
doc->mem_task); //+2 because "_\0"
|
||||
}
|
||||
} else
|
||||
goto pd_err;
|
||||
break;
|
||||
case DOCEf_DEFINE:
|
||||
if (lx->token==TK_STR) {
|
||||
st2=LexExtStr(lx);
|
||||
if (cc->token==TK_STR) {
|
||||
st2=LexExtStr(cc);
|
||||
doc_e->define_str=StrNew(st2,doc->mem_task);
|
||||
Free(st2);
|
||||
if (doc_e->de_flags&DOCEF_LST && !doc_e->tag)
|
||||
@@ -412,22 +421,22 @@ CDocEntry *PrsDollarCmd(CDoc *doc,U8 *st)
|
||||
goto pd_err;
|
||||
break;
|
||||
case DOCEf_HTML_LINK:
|
||||
if (lx->token==TK_STR) {
|
||||
st2=LexExtStr(lx);
|
||||
if (cc->token==TK_STR) {
|
||||
st2=LexExtStr(cc);
|
||||
doc_e->html_link=StrNew(st2,doc->mem_task);
|
||||
Free(st2);
|
||||
} else
|
||||
goto pd_err;
|
||||
break;
|
||||
case DOCEf_LEFT_EXP:
|
||||
if (lx->token)
|
||||
doc_e->left_exp=LexExpression(lx);
|
||||
if (cc->token)
|
||||
doc_e->left_exp=LexExpression(cc);
|
||||
else
|
||||
goto pd_err;
|
||||
break;
|
||||
case DOCEf_LEFT_MACRO:
|
||||
if (lx->token==TK_STR) {
|
||||
st2=LexExtStr(lx);
|
||||
if (cc->token==TK_STR) {
|
||||
st2=LexExtStr(cc);
|
||||
doc_e->left_macro=StrNew(st2,doc->mem_task);
|
||||
Free(st2);
|
||||
if (i==DOCT_MACRO && !doc_e->tag)
|
||||
@@ -436,14 +445,14 @@ CDocEntry *PrsDollarCmd(CDoc *doc,U8 *st)
|
||||
goto pd_err;
|
||||
break;
|
||||
case DOCEf_RIGHT_EXP:
|
||||
if (lx->token)
|
||||
doc_e->right_exp=LexExpression(lx);
|
||||
if (cc->token)
|
||||
doc_e->right_exp=LexExpression(cc);
|
||||
else
|
||||
goto pd_err;
|
||||
break;
|
||||
case DOCEf_RIGHT_MACRO:
|
||||
if (lx->token==TK_STR) {
|
||||
st2=LexExtStr(lx);
|
||||
if (cc->token==TK_STR) {
|
||||
st2=LexExtStr(cc);
|
||||
doc_e->right_macro=StrNew(st2,doc->mem_task);
|
||||
Free(st2);
|
||||
if (i==DOCT_MACRO && !doc_e->tag)
|
||||
@@ -452,14 +461,14 @@ CDocEntry *PrsDollarCmd(CDoc *doc,U8 *st)
|
||||
goto pd_err;
|
||||
break;
|
||||
case DOCEf_HAS_BIN:
|
||||
if (lx->token)
|
||||
doc_e->bin_num=LexExpressionI64(lx);
|
||||
if (cc->token)
|
||||
doc_e->bin_num=LexExpressionI64(cc);
|
||||
else
|
||||
goto pd_err;
|
||||
break;
|
||||
case DOCEf_BIN_PTR_LINK:
|
||||
if (lx->token==TK_STR) {
|
||||
st2=LexExtStr(lx);
|
||||
if (cc->token==TK_STR) {
|
||||
st2=LexExtStr(cc);
|
||||
doc_e->bin_ptr_link=StrNew(st2,doc->mem_task);
|
||||
Free(st2);
|
||||
if (!DocBinPtrRst(doc,doc_e))
|
||||
@@ -468,36 +477,36 @@ CDocEntry *PrsDollarCmd(CDoc *doc,U8 *st)
|
||||
goto pd_err;
|
||||
break;
|
||||
case DOCEf_RAW_TYPE:
|
||||
if (lx->token==TK_IDENT) {
|
||||
j=DefineMatch(lx->cur_str,"ST_RAW_TYPES");
|
||||
if (cc->token==TK_IDENT) {
|
||||
j=DefineMatch(cc->cur_str,"ST_RAW_TYPES");
|
||||
if (j<0)
|
||||
goto pd_err;
|
||||
doc_e->raw_type=j;
|
||||
Lex(lx);
|
||||
Lex(cc);
|
||||
} else
|
||||
goto pd_err;
|
||||
break;
|
||||
case DOCEf_SHIFTED_X:
|
||||
if (lx->token)
|
||||
doc_e->type|=(LexExpressionI64(lx) & 0x1F)<<16;
|
||||
if (cc->token)
|
||||
doc_e->type|=(LexExpressionI64(cc) & 0x1F)<<16;
|
||||
else
|
||||
goto pd_err;
|
||||
break;
|
||||
case DOCEf_SHIFTED_Y:
|
||||
if (lx->token)
|
||||
doc_e->type|=(LexExpressionI64(lx) & 0x1F)<<21;
|
||||
if (cc->token)
|
||||
doc_e->type|=(LexExpressionI64(cc) & 0x1F)<<21;
|
||||
else
|
||||
goto pd_err;
|
||||
break;
|
||||
case DOCEf_SCROLLING_X:
|
||||
if (lx->token)
|
||||
doc_e->scroll_len=LexExpressionI64(lx);
|
||||
if (cc->token)
|
||||
doc_e->scroll_len=LexExpressionI64(cc);
|
||||
else
|
||||
goto pd_err;
|
||||
break;
|
||||
case DOCEf_USER_DATA:
|
||||
if (lx->token)
|
||||
doc_e->user_data=LexExpression(lx);
|
||||
if (cc->token)
|
||||
doc_e->user_data=LexExpression(cc);
|
||||
else
|
||||
goto pd_err;
|
||||
break;
|
||||
@@ -512,11 +521,12 @@ pd_err:
|
||||
doc_e->type=DOCT_ERROR;
|
||||
doc_e->de_flags=0;
|
||||
}
|
||||
if (doc_e->de_flags & DOCEF_LST && !(doc_e->de_flags & DOCEF_DATA_IS_PTR)) {
|
||||
if (doc_e->de_flags & DOCEF_LST &&
|
||||
!(doc_e->de_flags & DOCEF_DATA_IS_PTR)) {
|
||||
DocDataScan(doc,doc_e);
|
||||
DocDataFmt(doc,doc_e);
|
||||
}
|
||||
LexDel(lx);
|
||||
CmpCtrlDel(cc);
|
||||
} catch {
|
||||
Fs->catch_except=TRUE;
|
||||
if (!doc_e)
|
||||
@@ -537,40 +547,40 @@ public U0 DocInsEntry(CDoc *doc,CDocEntry *doc_e)
|
||||
doc_e->y=doc_ce->y;
|
||||
doc_e->page_line_num=doc_ce->page_line_num;
|
||||
MemCpy(&doc_e->settings,&doc_ce->settings,sizeof(CDocSettings));
|
||||
if (doc->cur_data_col>0 &&
|
||||
doc_ce->type_u8==DOCT_TEXT &&
|
||||
!(doc_ce->de_flags&(DOCEF_TAG_CB|DOCEF_DEFINE|
|
||||
if (doc->cur_col>0 &&
|
||||
doc_ce->type_u8==DOCT_TEXT &&
|
||||
!(doc_ce->de_flags&(DOCEF_TAG_CB|DOCEF_DEFINE|
|
||||
DOCEF_HTML_LINK|DOCEF_BIN_PTR_LINK)) &&
|
||||
doc->cur_data_col<doc_ce->max_col) {
|
||||
dst=doc_ce->tag+doc->cur_data_col;
|
||||
doc->cur_col<doc_ce->max_col) {
|
||||
dst=doc_ce->tag+doc->cur_col;
|
||||
doc_ne=DocEntryNew(doc,doc_ce,StrNew(dst,doc->mem_task));
|
||||
*dst=0;
|
||||
doc_ne->type=DOCT_TEXT|doc_ce->type&0xFFFFFF00;
|
||||
doc_ce->max_col=doc->cur_data_col;
|
||||
doc_ce->max_col=doc->cur_col;
|
||||
QueIns(doc_ne,doc_ce);
|
||||
doc->cur_data_col=0;
|
||||
doc->cur_col=0;
|
||||
doc_ce=doc_ne;
|
||||
}
|
||||
if (doc_ce->type_u8==DOCT_TEXT && doc->cur_data_col>=doc_ce->max_col) {
|
||||
if (doc_ce->type_u8==DOCT_TEXT && doc->cur_col>=doc_ce->max_col) {
|
||||
QueIns(doc_e,doc_ce);
|
||||
doc->cur_entry=doc_e->next;
|
||||
} else {
|
||||
QueIns(doc_e,doc_ce->last);
|
||||
doc->cur_entry=doc_ce;
|
||||
}
|
||||
doc->cur_data_col=doc->cur_entry->min_col;
|
||||
doc->cur_col=doc->cur_entry->min_col;
|
||||
DocRemSoftNewLines(doc,doc->cur_entry);
|
||||
if (unlock)
|
||||
DocUnlock(doc);
|
||||
}
|
||||
|
||||
#help_index "DolDoc/Output"
|
||||
#help_index "DolDoc/Output;StdOut/DolDoc"
|
||||
CDocEntry *DocPutS(CDoc *doc,U8 *st)
|
||||
{//Don't use this. Use $LK-UL,"DocPrint",A="MN:DocPrint"$().
|
||||
//Does not handle partial Doc entries
|
||||
//Does not handle partial Doc entries
|
||||
//Returns last newly created dollar-sign CDocEntry.
|
||||
U8 *ptr=st,*ptr2,*st2,*ptr3,*ptr4,*src,
|
||||
*char_bitmap;
|
||||
*char_bitmap;
|
||||
Bool unlock;
|
||||
I64 ch,j;
|
||||
CDocEntry *doc_e=NULL,*result=NULL,*doc_ce;
|
||||
@@ -578,11 +588,11 @@ CDocEntry *DocPutS(CDoc *doc,U8 *st)
|
||||
return NULL;
|
||||
unlock=DocLock(doc);
|
||||
if (doc->flags & DOCF_PLAIN_TEXT_WITH_TABS)
|
||||
char_bitmap=chars_bitmap_zero_cr_nl_cursor;
|
||||
char_bitmap=chars_bmp_zero_cr_nl_cursor;
|
||||
else if (doc->flags & DOCF_PLAIN_TEXT)
|
||||
char_bitmap=chars_bitmap_zero_tab_ff_cr_nl_cursor;
|
||||
char_bitmap=chars_bmp_zero_tab_ff_cr_nl_cursor;
|
||||
else
|
||||
char_bitmap=chars_bitmap_zero_tab_ff_cr_nl_cursor_dollar;
|
||||
char_bitmap=chars_bmp_zero_tab_ff_cr_nl_cursor_dollar;
|
||||
doc_ce=doc->cur_entry;
|
||||
while (*ptr) {
|
||||
ptr2=ptr;
|
||||
@@ -694,7 +704,8 @@ CDocEntry *DocPutS(CDoc *doc,U8 *st)
|
||||
DocInsEntry(doc,doc_e);
|
||||
} else if (ch==CH_FORM_FEED) {
|
||||
doc_e=CAlloc(sizeof(CDocEntryBase),doc->mem_task);
|
||||
doc_e->type=DOCT_PAGE_BREAK | doc->settings_root.dft_text_attr<<8;
|
||||
doc_e->type=DOCT_PAGE_BREAK |
|
||||
doc->settings_root.dft_text_attr<<8;
|
||||
doc_e->de_flags=doldoc.dft_de_flags[DOCT_PAGE_BREAK];
|
||||
DocInsEntry(doc,doc_e);
|
||||
} else
|
||||
|
||||
+109
-86
@@ -1,6 +1,7 @@
|
||||
#help_index "DolDoc"
|
||||
|
||||
public I64 DocEntryRun(CDoc *doc,CDocEntry *doc_e,Bool exited,I64 *_has_action=NULL)
|
||||
public I64 DocEntryRun(CDoc *doc,CDocEntry *doc_e,
|
||||
Bool exited,I64 *_has_action=NULL)
|
||||
{//Do action on final entry selected by user.
|
||||
//Sometimes returns locked, sometimes unlocked
|
||||
U8 ch=doc->cmd_U8,*st;
|
||||
@@ -52,9 +53,11 @@ public I64 DocEntryRun(CDoc *doc,CDocEntry *doc_e,Bool exited,I64 *_has_action=N
|
||||
}
|
||||
has_action=TRUE;
|
||||
}
|
||||
if (!exited && doc_e->de_flags & DOCEF_LST && doc_e->de_flags & DOCEF_DEFINE &&
|
||||
(temph=HashFind(doc_e->define_str,doc->win_task->hash_table,HTT_DEFINE_STR)) &&
|
||||
(result=PopUpPickLst(temph->data))!=DOCM_CANCEL) {
|
||||
if (!exited && doc_e->de_flags & DOCEF_LST &&
|
||||
doc_e->de_flags & DOCEF_DEFINE &&
|
||||
(temph=HashFind(doc_e->define_str,
|
||||
doc->win_task->hash_table,HTT_DEFINE_STR)) &&
|
||||
(result=PopUpPickLst(temph->data))!=DOCM_CANCEL) {
|
||||
DocDataFmt(doc,doc_e,result);
|
||||
DocDataScan(doc,doc_e);
|
||||
has_action=TRUE;
|
||||
@@ -150,7 +153,7 @@ U8 *EdDollarTypeCB(CDoc *,CDocEntry *doc_e,CTask *mem_task)
|
||||
{
|
||||
CDoc *doc=doc_e->user_data;
|
||||
U8 *src=DefineSub(doc->cur_entry->type_u8,"ST_DOC_CMDS"),
|
||||
*st=CAlloc(8,mem_task);
|
||||
*st=CAlloc(8,mem_task);
|
||||
if (doc->cur_entry==doc)
|
||||
src="EOF";
|
||||
else if (!src)
|
||||
@@ -168,7 +171,7 @@ public I64 DocGetKey(I64 *_sc=NULL)
|
||||
DocRecalc(DocPut);
|
||||
cont=FALSE;
|
||||
if (ch==CH_ESC || ch==CH_SHIFT_ESC) {//Check for exit filter mode
|
||||
Preempt(OFF);
|
||||
Preempt;
|
||||
if (DocPut && DocPut->find_replace->filter_lines) {
|
||||
EdUndoFilter(DocPut);
|
||||
cont=TRUE;
|
||||
@@ -180,7 +183,7 @@ public I64 DocGetKey(I64 *_sc=NULL)
|
||||
return ch;
|
||||
}
|
||||
|
||||
#help_index "DolDoc/Output"
|
||||
#help_index "DolDoc/Output;StdOut/DolDoc"
|
||||
public Bool View()
|
||||
{//Go live for user interaction until <ESC> or <SHIFT-ESC>.
|
||||
I64 ch;
|
||||
@@ -190,16 +193,16 @@ public Bool View()
|
||||
}
|
||||
|
||||
#help_index "DolDoc"
|
||||
public Bool DocDo(CDoc *doc,I64 dof_flags=0)
|
||||
public Bool DocEd(CDoc *doc,I64 dof_flags=0)
|
||||
{//Live for user interaction. End on <ESC> or <SHIFT-ESC>.
|
||||
CDoc *old_put_doc =DocPut,
|
||||
*old_display_doc=DocDisplay,
|
||||
*old_border_doc =DocBorder,*bdoc;
|
||||
*old_display_doc=DocDisplay,
|
||||
*old_border_doc =DocBorder,*bdoc;
|
||||
CDocEntry *doc_e;
|
||||
I64 old_attr=Fs->text_attr,
|
||||
old_top =Fs->win_top, old_bottom=Fs->win_bottom,
|
||||
old_left=Fs->win_left,old_right =Fs->win_right,
|
||||
old_title_src=Fs->title_src;
|
||||
old_top =Fs->win_top, old_bottom=Fs->win_bottom,
|
||||
old_left=Fs->win_left,old_right =Fs->win_right,
|
||||
old_title_src=Fs->title_src;
|
||||
Bool result,unlock,old_preempt;
|
||||
U8 *old_task_title;
|
||||
if (dof_flags&DOF_WIN_MAX)
|
||||
@@ -256,7 +259,7 @@ public Bool DocDo(CDoc *doc,I64 dof_flags=0)
|
||||
DocRecalc(doc);
|
||||
if (!(dof_flags&DOF_DONT_HOME))
|
||||
DocTop(doc);
|
||||
old_preempt=Preempt(OFF);
|
||||
old_preempt=Preempt;
|
||||
Fs->border_doc=bdoc;
|
||||
if (doc!=old_display_doc)
|
||||
doc->parent_doc=old_display_doc;
|
||||
@@ -279,7 +282,7 @@ public Bool DocDo(CDoc *doc,I64 dof_flags=0)
|
||||
}
|
||||
result=View;
|
||||
|
||||
Preempt(OFF);
|
||||
Preempt;
|
||||
DocLock(doc);
|
||||
if (result) {
|
||||
doc_e=doc->root.next;
|
||||
@@ -309,11 +312,10 @@ public Bool DocDo(CDoc *doc,I64 dof_flags=0)
|
||||
return result;
|
||||
}
|
||||
|
||||
#help_index "DolDoc/Input"
|
||||
public Bool DocFormDo(U8 *_d,U8 *class_name=lastclass,
|
||||
#help_index "DolDoc/Input;StdIn/DolDoc"
|
||||
public Bool DocForm(U8 *_d,U8 *class_name=lastclass,
|
||||
I64 dof_flags=0,U8 *header=NULL,U8 *footer=NULL)
|
||||
{//Supply a class name that has fmtstr definitions.
|
||||
//and this routine will allow user input.
|
||||
{//User input. Supply a class name that has fmtstr definitions.
|
||||
//See $LK,"::/Demo/DolDoc/Form.CPP"$ and $LK,"::/Demo/LastClass.CPP"$.
|
||||
CMemberLst *ml;
|
||||
CDocEntry *doc_e;
|
||||
@@ -344,7 +346,7 @@ public Bool DocFormDo(U8 *_d,U8 *class_name=lastclass,
|
||||
if (doc->root.next!=doc) {
|
||||
Fs->border_src=BDS_CONST;
|
||||
DocRecalc(doc);
|
||||
if (DocDo(doc,dof_flags)) {
|
||||
if (DocEd(doc,dof_flags)) {
|
||||
doc_e=doc->cur_entry;
|
||||
result=TRUE;
|
||||
if (doc_e!=doc) {
|
||||
@@ -359,25 +361,25 @@ public Bool DocFormDo(U8 *_d,U8 *class_name=lastclass,
|
||||
return result;
|
||||
}
|
||||
|
||||
U0 DocMenuDoEndTaskCB()
|
||||
U0 DocMenuEndTaskCB()
|
||||
{
|
||||
WinToTop;
|
||||
throw;
|
||||
}
|
||||
|
||||
public I64 DocMenuDo(CDoc *m,I64 dof_flags=0)
|
||||
{//Do (Run) menu chooser doc. (Returns menu doc unlocked.)
|
||||
public I64 DocMenu(CDoc *m,I64 dof_flags=0)
|
||||
{//Run menu chooser doc. Returns menu doc unlocked.
|
||||
U8 *old_end_cb=Fs->task_end_cb;
|
||||
Bool old_break_shift_esc=LBts(&Fs->task_flags,TASKf_BREAK_TO_SHIFT_ESC);
|
||||
CDocEntry *doc_e;
|
||||
I64 old_border_src=Fs->border_src,result=DOCM_CANCEL,has_action;
|
||||
Fs->task_end_cb=&DocMenuDoEndTaskCB;
|
||||
Fs->task_end_cb=&DocMenuEndTaskCB;
|
||||
try {
|
||||
if (m) {
|
||||
m->desc='Menu';
|
||||
Fs->border_src=BDS_CONST;
|
||||
md_restart:
|
||||
if (DocDo(m,dof_flags)) {
|
||||
dm_restart:
|
||||
if (DocEd(m,dof_flags)) {
|
||||
doc_e=m->cur_entry;
|
||||
if (doc_e!=m) {
|
||||
result=DocEntryRun(m,doc_e,TRUE,&has_action);
|
||||
@@ -385,7 +387,7 @@ md_restart:
|
||||
if (!has_action) {
|
||||
result=DOCM_CANCEL;
|
||||
dof_flags|=DOF_DONT_HOME;
|
||||
goto md_restart;
|
||||
goto dm_restart;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -412,10 +414,10 @@ public I64 PopUpEd(U8 *filename,CTask *parent=NULL,CTask **_pu_task=NULL)
|
||||
return result;
|
||||
}
|
||||
|
||||
#help_index "DolDoc/Output"
|
||||
#help_index "DolDoc/Output;StdOut/DolDoc"
|
||||
public CTask *PopUpViewDoc(CDoc *doc,I64 dof_flags=0)
|
||||
{//Pass doc to PopUp win task for viewing.
|
||||
U8 *buf=MStrPrint("Preempt(ON);DocDo(0x%X,0x%X);",doc,dof_flags);
|
||||
U8 *buf=MStrPrint("Preempt(ON);DocEd(0x%X,0x%X);",doc,dof_flags);
|
||||
CTask *task=Spawn(&SrvCmdLine,NULL,"View",,Fs);
|
||||
TaskExe(task,NULL,buf,1<<SVCf_EXIT_ON_COMPLETE|1<<SVCf_FREE_ON_COMPLETE);
|
||||
Free(buf);
|
||||
@@ -441,21 +443,21 @@ public CTask *PopUpViewPrint(U8 *fmt,...)
|
||||
return task;
|
||||
}
|
||||
|
||||
#help_index "DolDoc/Input"
|
||||
#help_index "DolDoc/Input;StdIn/DolDoc"
|
||||
public I64 PopUpMenu(CDoc *doc,I64 dof_flags=0)
|
||||
{//Do (Run) menu chooser doc in PopUp win task.
|
||||
{//Run menu chooser doc in PopUp win task.
|
||||
doc->flags|=DOCF_MIN_SIZE | DOCF_FORM;
|
||||
return PopUpPrint("DocMenuDo(0x%X,0x%X);",doc,dof_flags);
|
||||
return PopUpPrint("DocMenu(0x%X,0x%X);",doc,dof_flags);
|
||||
}
|
||||
|
||||
public Bool PopUpForm(U8 *_d,U8 *class_name=lastclass,I64 dof_flags=DOF_MIN_SIZE,
|
||||
U8 *header=NULL,U8 *footer=NULL)
|
||||
public Bool PopUpForm(U8 *_d,U8 *class_name=lastclass,
|
||||
I64 dof_flags=DOF_MIN_SIZE,U8 *header=NULL,U8 *footer=NULL)
|
||||
{//See $LK,"::/Demo/DolDoc/Form.CPP"$ and $LK,"::/Demo/LastClass.CPP"$.
|
||||
return PopUpPrint("DocFormDo(0x%X,0x%X,0x%X,0x%X,0x%X);",_d,class_name,
|
||||
dof_flags,header,footer);
|
||||
return PopUpPrint("DocForm(0x%X,0x%X,0x%X,0x%X,0x%X);",_d,class_name,
|
||||
dof_flags,header,footer);
|
||||
}
|
||||
|
||||
#help_index "DolDoc/Input;File/FileNames"
|
||||
#help_index "DolDoc/Input;File/FileNames;StdIn/DolDoc"
|
||||
public U8 *PopUpPickFile(U8 *dir=NULL)
|
||||
{//Filename chooser. Uses $LK,"FileMgr",A="MN:FileMgr"$().
|
||||
U8 *result,*st,*st2;
|
||||
@@ -493,7 +495,7 @@ public U8 *FileNameForm(U8 *dft=NULL,I64 dof_flags=0,CTask *mem_task=NULL)
|
||||
StrCpy(fn.name,dft);
|
||||
else
|
||||
*fn.name=0;
|
||||
if (DocFormDo(&fn,,dof_flags))
|
||||
if (DocForm(&fn,,dof_flags))
|
||||
return StrNew(fn.name,mem_task);
|
||||
else
|
||||
return NULL;
|
||||
@@ -501,8 +503,8 @@ public U8 *FileNameForm(U8 *dft=NULL,I64 dof_flags=0,CTask *mem_task=NULL)
|
||||
|
||||
public U8 *PopUpFileName(U8 *dft=NULL,I64 dof_flags=0)
|
||||
{//Filename chooser. Uses form, not $LK,"FileMgr",A="MN:FileMgr"$().
|
||||
U8 *st=MStrPrint("FileNameForm(\"%Q\",0x%X,Fs->parent_task);",dft,dof_flags|DOF_MIN_SIZE),
|
||||
*result=PopUp(st,Fs);
|
||||
U8 *st=MStrPrint("FileNameForm(\"%Q\",0x%X,Fs->parent_task);",
|
||||
dft,dof_flags|DOF_MIN_SIZE),*result=PopUp(st,Fs);
|
||||
Free(st);
|
||||
return result;
|
||||
}
|
||||
@@ -520,7 +522,7 @@ Bool PopUpCd()
|
||||
return result;
|
||||
}
|
||||
|
||||
#help_index "DolDoc/Input;Char/Lists"
|
||||
#help_index "DolDoc/Input;Char/Lists;StdIn/DolDoc"
|
||||
public U8 *PopUpPickLst(U8 *lst)
|
||||
{//Prompt for lst entry in PopUp win task.
|
||||
I64 i=0;
|
||||
@@ -545,7 +547,7 @@ public U8 *PopUpPickDefineSub(U8 *st)
|
||||
return PopUpPickLst(Define(st));
|
||||
}
|
||||
|
||||
#help_index "DolDoc/Input"
|
||||
#help_index "DolDoc/Input;StdIn/DolDoc"
|
||||
public I64 PopUp1(U8 *b1,I64 n1,U8 *header=NULL,U8 *footer=NULL)
|
||||
{//Make PopUp win task with one button.
|
||||
I64 i,l1=StrLen(b1);
|
||||
@@ -611,7 +613,7 @@ I64 PopUpReplaceSkipAllCancel(U8 *header=NULL,U8 *footer=NULL)
|
||||
return i;
|
||||
}
|
||||
|
||||
U8 *DoPopUpGetStr(U8 *header,CTask *mem_task)
|
||||
U8 *PopUpGetStr2(U8 *header,CTask *mem_task)
|
||||
{
|
||||
U8 *result,*st;
|
||||
if (header)
|
||||
@@ -624,8 +626,8 @@ U8 *DoPopUpGetStr(U8 *header,CTask *mem_task)
|
||||
|
||||
public U8 *PopUpGetStr(U8 *header=NULL)
|
||||
{//Prompt for text str in PopUp win task.
|
||||
U8 *st=MStrPrint("DoPopUpGetStr(0x%X,0x%X);",header,Fs),
|
||||
*result=PopUp(st,Fs);
|
||||
U8 *st=MStrPrint("PopUpGetStr2(0x%X,0x%X);",header,Fs),
|
||||
*result=PopUp(st,Fs);
|
||||
Free(st);
|
||||
return result;
|
||||
}
|
||||
@@ -638,7 +640,16 @@ public I64 PopUpGetI64(U8 *msg,I64 dft,I64 lo=MIN_I64,I64 hi=MAX_I64)
|
||||
return result;
|
||||
}
|
||||
|
||||
public I64 PopUpRangeI64(I64 lo,I64 hi,I64 step=1,U8 *header=NULL,U8 *footer=NULL)
|
||||
public F64 PopUpGetF64(U8 *msg,F64 dft,F64 lo=MIN_F64,F64 hi=MAX_F64)
|
||||
{//Prompt for F64 text expression in PopUp win task.
|
||||
U8 *st=MStrPrint("GetF64(0x%X,0x%X(F64),0x%X(F64),0x%X(F64));",msg,dft,lo,hi);
|
||||
F64 result=PopUp(st,Fs)(F64);
|
||||
Free(st);
|
||||
return result;
|
||||
}
|
||||
|
||||
public I64 PopUpRangeI64(I64 lo,I64 hi,I64 step=1,
|
||||
U8 *header=NULL,U8 *footer=NULL)
|
||||
{//Evenly-spaced I64 range chooser in PopUp win task.
|
||||
I64 i;
|
||||
CDoc *doc=DocNew;
|
||||
@@ -659,7 +670,7 @@ public F64 PopUpRangeF64(F64 lo,F64 hi,F64 step,
|
||||
{//Evenly-spaced F64 range chooser in PopUp win task.
|
||||
F64 d;
|
||||
I64 i;
|
||||
U8 buf[136];
|
||||
U8 buf[STR_LEN];
|
||||
CDoc *doc=DocNew;
|
||||
if (header)
|
||||
DocPrint(doc,"%s",header);
|
||||
@@ -680,7 +691,7 @@ public F64 PopUpRangeF64Exp(F64 lo,F64 hi,F64 factor,
|
||||
{//Exp-spaced F64 range chooser in PopUp win task.
|
||||
F64 d;
|
||||
I64 i;
|
||||
U8 buf[136];
|
||||
U8 buf[STR_LEN];
|
||||
CDoc *doc=DocNew;
|
||||
if (header)
|
||||
DocPrint(doc,"%s",header);
|
||||
@@ -707,11 +718,11 @@ public I64 AdamFile(U8 *filename,Bool warn_ext=TRUE)
|
||||
{//Tell adam task to compile and run a file.
|
||||
Bool okay=TRUE;
|
||||
U8 *name=FileNameAbs(filename),
|
||||
*name2=DftExt(name,"CPP.Z");
|
||||
*name2=DftExt(name,"CPP.Z");
|
||||
I64 result=0;
|
||||
if (warn_ext &&
|
||||
!FilesFindMatch(name2,FILEMASK_JIT) &&
|
||||
!PopUpCancelOk(ST_WARN_ST "Not .CPP File\n\n"))
|
||||
!FilesFindMatch(name2,FILEMASK_JIT) &&
|
||||
!PopUpCancelOk(ST_WARN_ST "Not .CPP File\n\n"))
|
||||
okay=FALSE;
|
||||
if (okay)
|
||||
result=Adam("#include \"%s\";",name2);
|
||||
@@ -720,18 +731,21 @@ public I64 AdamFile(U8 *filename,Bool warn_ext=TRUE)
|
||||
return result;
|
||||
}
|
||||
|
||||
public I64 PopUpFile(U8 *filename,Bool warn_ext=TRUE,CTask *parent=NULL,CTask **_pu_task=NULL)
|
||||
public I64 PopUpFile(U8 *filename,Bool warn_ext=TRUE,
|
||||
CTask *parent=NULL,CTask **_pu_task=NULL)
|
||||
{//Run code file in PopUp win task.
|
||||
Bool okay=TRUE;
|
||||
U8 *st,*name=FileNameAbs(filename),
|
||||
*name2=DftExt(name,"CPP.Z");
|
||||
*name2=DftExt(name,"CPP.Z");
|
||||
I64 result=0;
|
||||
if (warn_ext &&
|
||||
!FilesFindMatch(name2,FILEMASK_JIT) &&
|
||||
!PopUpCancelOk(ST_WARN_ST "Not .CPP File\n\n"))
|
||||
!FilesFindMatch(name2,FILEMASK_JIT) &&
|
||||
!PopUpCancelOk(ST_WARN_ST "Not .CPP File\n\n"))
|
||||
okay=FALSE;
|
||||
if (okay) {
|
||||
st=MStrPrint("\"$$$$WW+H,1$$$$\";Auto(\"ExeFile2(\\\"%s\\\");\\n\");UserTaskCont;",name2);
|
||||
st=MStrPrint(
|
||||
"\"$$$$WW+H,1$$$$\";Auto(\"ExeFile2(\\\"%s\\\");\\n\");UserTaskCont;",
|
||||
name2);
|
||||
result=PopUp(st,parent,_pu_task);
|
||||
Free(st);
|
||||
}
|
||||
@@ -741,7 +755,8 @@ public I64 PopUpFile(U8 *filename,Bool warn_ext=TRUE,CTask *parent=NULL,CTask **
|
||||
}
|
||||
|
||||
#help_index "Graphics/Input"
|
||||
public I64 PopUpColor(U8 *header=NULL,Bool allow_transparent=TRUE,Bool allow_dft=TRUE)
|
||||
public I64 PopUpColor(U8 *header=NULL,
|
||||
Bool allow_transparent=TRUE,Bool allow_dft=TRUE)
|
||||
{//Chooser for 16-color, default or transparent.
|
||||
I64 i;
|
||||
CDoc *doc=DocNew;
|
||||
@@ -749,7 +764,7 @@ public I64 PopUpColor(U8 *header=NULL,Bool allow_transparent=TRUE,Bool allow_dft
|
||||
DocPrint(doc,"%s",header);
|
||||
if (allow_transparent)
|
||||
DocPrint(doc,"$$MU,\"TRANSPARENT\",LE=TRANSPARENT$$\n");
|
||||
for (i=0;i<16;i++)
|
||||
for (i=0;i<NUM_COLORS;i++)
|
||||
DocPrint(doc,"$$BG,%d$$$$MU,\"__%-8Z__\",LE=%d$$$$BG$$\n",i,i,"ST_COLORS",i);
|
||||
if (allow_dft)
|
||||
DocPrint(doc,"$$BG,WHITE$$$$MU,\"DEFAULT\",LE=DOC_DFT$$$$BG$$");
|
||||
@@ -759,27 +774,32 @@ public I64 PopUpColor(U8 *header=NULL,Bool allow_transparent=TRUE,Bool allow_dft
|
||||
}
|
||||
|
||||
public I64 PopUpColorLighting(U8 *header=NULL)
|
||||
{//Chooser for std TempleOS $LK,"GrLighting",A="MN:GrLighting"$() color.
|
||||
{//Chooser for std TempleOS $LK,"DCLighting",A="MN:DCLighting"$() color.
|
||||
I64 i;
|
||||
CDoc *doc=DocNew;
|
||||
if (header)
|
||||
DocPrint(doc,"%s",header);
|
||||
DocPrint(doc,"\nSingle-Sided means both sides same color."
|
||||
"\nDouble-Sided means back side darker."
|
||||
"\n"
|
||||
"\nHalf-Range means 0 to [0,7]"
|
||||
"\n [8,15]-8 to [8,15]"
|
||||
"\nFull-Range means 0 to [0,7] to [0,7]+8"
|
||||
"\n");
|
||||
DocPrint(doc,"\n$$LTPURPLE$$Single-Sided Full-Range Double-Sided Full-Range\n$$BLACK$$");
|
||||
for (i=0;i<8;i++) {
|
||||
"\nDouble-Sided means back side darker."
|
||||
"\n"
|
||||
"\nHalf-Range means 0 to [0,7]"
|
||||
"\n [8,15]-8 to [8,15]"
|
||||
"\nFull-Range means 0 to [0,7] to [0,7]+8"
|
||||
"\n");
|
||||
DocPrint(doc,
|
||||
"\n$$LTPURPLE$$Single-Sided Full-Range Double-Sided Full-Range\n$$BLACK$$");
|
||||
for (i=0;i<NUM_COLORS/2;i++) {
|
||||
DocPrint(doc,"$$BG,%d$$$$MU,\"__%-19Z__\",LE=%d$$$$BG$$ ",i,i,"ST_COLORS",i);
|
||||
DocPrint(doc,"$$BG,%d$$$$MU,\"__%-19Z__\",LE=%d$$$$BG$$\n",i,i,"ST_COLORS",ROPF_TWO_SIDED+i);
|
||||
DocPrint(doc,"$$BG,%d$$$$MU,\"__%-19Z__\",LE=%d$$$$BG$$\n",i,i,"ST_COLORS",
|
||||
ROPF_TWO_SIDED+i);
|
||||
}
|
||||
DocPrint(doc,"\n$$LTPURPLE$$Single-Sided Half-Range Double-Sided Half-Range\n$$BLACK$$");
|
||||
for (i=0;i<16;i++) {
|
||||
DocPrint(doc,"$$BG,%d$$$$MU,\"__%-19Z__\",LE=%d$$$$BG$$ ",i,i,"ST_COLORS",ROPF_HALF_RANGE_COLOR+i);
|
||||
DocPrint(doc,"$$BG,%d$$$$MU,\"__%-19Z__\",LE=%d$$$$BG$$\n",i,i,"ST_COLORS",ROPF_TWO_SIDED+ROPF_HALF_RANGE_COLOR+i);
|
||||
DocPrint(doc,
|
||||
"\n$$LTPURPLE$$Single-Sided Half-Range Double-Sided Half-Range\n$$BLACK$$");
|
||||
for (i=0;i<NUM_COLORS;i++) {
|
||||
DocPrint(doc,"$$BG,%d$$$$MU,\"__%-19Z__\",LE=%d$$$$BG$$ ",
|
||||
i,i,"ST_COLORS",ROPF_HALF_RANGE_COLOR+i);
|
||||
DocPrint(doc,"$$BG,%d$$$$MU,\"__%-19Z__\",LE=%d$$$$BG$$\n",
|
||||
i,i,"ST_COLORS",ROPF_TWO_SIDED+ROPF_HALF_RANGE_COLOR+i);
|
||||
}
|
||||
i=PopUpMenu(doc);
|
||||
DocDel(doc);
|
||||
@@ -791,7 +811,8 @@ class CTransformForm
|
||||
F64 x_scale fmtstr "$$DA-TRM,32,RT=F64,A=\"X Scale :%12.6f\"$$\n";
|
||||
F64 y_scale fmtstr "$$DA-TRM,32,RT=F64,A=\"Y Scale :%12.6f\"$$\n";
|
||||
F64 z_scale fmtstr "$$DA-TRM,32,RT=F64,A=\"Z Scale :%12.6f\"$$\n";
|
||||
F64 é_z fmtstr "\nAngles are in degrees\n$$DA-TRM,32,RT=F64,A=\"Z-Axis :%12.6f\"$$\n";
|
||||
F64 é_z fmtstr
|
||||
"\nAngles are in degrees\n$$DA-TRM,32,RT=F64,A=\"Z-Axis :%12.6f\"$$\n";
|
||||
F64 é_y fmtstr "$$DA-TRM,32,RT=F64,A=\"Y-Axis :%12.6f\"$$\n";
|
||||
F64 é_x fmtstr "$$DA-TRM,32,RT=F64,A=\"X-Axis :%12.6f\"$$\n";
|
||||
F64 x_offset fmtstr "\n$$DA-TRM,32,RT=F64,A=\"X Offset:%12.6f\"$$\n";
|
||||
@@ -818,9 +839,9 @@ Bool PopUpTransform(I64 *r)
|
||||
r[10]=tf->z_scale*GR_SCALE;
|
||||
r[15]=GR_SCALE;
|
||||
|
||||
GrRotZEqu(r,tf->é_z*ã/180.0);
|
||||
GrRotYEqu(r,tf->é_y*ã/180.0);
|
||||
GrRotXEqu(r,tf->é_x*ã/180.0);
|
||||
Mat4x4RotZ(r,tf->é_z*ã/180.0);
|
||||
Mat4x4RotY(r,tf->é_y*ã/180.0);
|
||||
Mat4x4RotX(r,tf->é_x*ã/180.0);
|
||||
|
||||
r[3] =tf->x_offset*GR_SCALE;
|
||||
r[7] =tf->y_offset*GR_SCALE;
|
||||
@@ -846,21 +867,23 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
else
|
||||
i1=TRANSPARENT;
|
||||
dc->color=j1+i1<<16+ROPF_DITHER;
|
||||
GrRect(dc,i*PU_SPACING,j*PU_SPACING+FramePtr("DitherDoFrame",task),PU_SPACING,PU_SPACING);
|
||||
GrRect(dc,i*PU_SPACING,j*PU_SPACING+FramePtr("DitherFrame",task),
|
||||
PU_SPACING,PU_SPACING);
|
||||
}
|
||||
i=(17*PU_SPACING+FONT_WIDTH-1)/FONT_WIDTH;
|
||||
if (doc->max_x>i) i=doc->max_x;
|
||||
WinHorz(task->win_left,task->win_left+i,task);
|
||||
WinVert(task->win_top,task->win_top+doc->max_y+(17*PU_SPACING+FONT_WIDTH-1)/FONT_WIDTH,task);
|
||||
WinVert(task->win_top,task->win_top+doc->max_y+
|
||||
(17*PU_SPACING+FONT_WIDTH-1)/FONT_WIDTH,task);
|
||||
}
|
||||
|
||||
I64 DitherColorDo(U8 *header=NULL)
|
||||
I64 DitherColor2(U8 *header=NULL)
|
||||
{
|
||||
I64 msg_code,a1,a2,result=-1,i,j;
|
||||
DocClear;
|
||||
"%s",header;
|
||||
DocRecalc(DocPut);
|
||||
FramePtrAdd("DitherDoFrame",(DocPut->max_y+1)*FONT_HEIGHT);
|
||||
FramePtrAdd("DitherFrame",(DocPut->max_y+1)*FONT_HEIGHT);
|
||||
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
|
||||
Fs->draw_it=&DrawIt;
|
||||
do {
|
||||
@@ -868,26 +891,26 @@ I64 DitherColorDo(U8 *header=NULL)
|
||||
if (msg_code==MSG_IP_L_DOWN) {
|
||||
msg_code=GetMsg(&a1,&a2,1<<MSG_IP_L_UP);
|
||||
i=a1/PU_SPACING;
|
||||
j=(a2-FramePtr("DitherDoFrame"))/PU_SPACING;
|
||||
j=(a2-FramePtr("DitherFrame"))/PU_SPACING;
|
||||
if (a1>=0 && a2>=0 && 0<=j<17 && 0<=i<17) {
|
||||
if (j==16) j=TRANSPARENT;
|
||||
if (i==16) i=TRANSPARENT;
|
||||
result=j+i<<16+ROPF_DITHER;
|
||||
goto dcd_done;
|
||||
goto dc_done;
|
||||
}
|
||||
}
|
||||
} while (!(msg_code==MSG_KEY_DOWN && (a1==CH_ESC || a1==CH_SHIFT_ESC)));
|
||||
do GetMsg(&a1,&a2,1<<MSG_KEY_UP);
|
||||
while (!a1);
|
||||
dcd_done:
|
||||
dc_done:
|
||||
SettingsPop;
|
||||
FramePtrDel("DitherDoFrame");
|
||||
FramePtrDel("DitherFrame");
|
||||
return result;
|
||||
}
|
||||
|
||||
public I64 PopUpColorDither(U8 *header=NULL)
|
||||
{//Chooser for 2 x 16 colors or transparent.
|
||||
U8 buf[136];
|
||||
StrPrint(buf,"DitherColorDo(0x%X);",header);
|
||||
U8 buf[STR_LEN];
|
||||
StrPrint(buf,"DitherColor2(0x%X);",header);
|
||||
return PopUp(buf,Fs);
|
||||
}
|
||||
+10
-10
@@ -16,7 +16,7 @@ public U0 DocCenter(CDoc *doc=NULL,I64 recalc=DOC_RECALC)
|
||||
task=doc->win_task;
|
||||
DocRecalc(doc,FALSE,recalc);
|
||||
if (!(doc->flags&DOCF_BORDER_DOC))
|
||||
doc->cur_top_line_num=doc->y-(task->win_height+1)>>1;
|
||||
doc->top_line_num=doc->y-(task->win_height+1)>>1;
|
||||
if (unlock)
|
||||
DocUnlock(doc);
|
||||
}
|
||||
@@ -29,7 +29,7 @@ U0 DocDelToNum(CDoc *doc,I64 num)
|
||||
if (!(doc_e->de_flags & (DOCEF_HOLD|DOCEF_FILTER_SKIP))) {
|
||||
if (doc_e==doc->cur_entry) {
|
||||
doc->cur_entry=doc_e2;
|
||||
doc->cur_data_col=doc_e2->min_col;
|
||||
doc->cur_col=doc_e2->min_col;
|
||||
}
|
||||
DocEntryDel(doc,doc_e);
|
||||
}
|
||||
@@ -45,7 +45,7 @@ U0 DocDelToEntry(CDoc *doc,CDocEntry *clear_entry)
|
||||
if (!(doc_e->de_flags & (DOCEF_HOLD|DOCEF_FILTER_SKIP))) {
|
||||
if (doc_e==doc->cur_entry) {
|
||||
doc->cur_entry=doc_e2;
|
||||
doc->cur_data_col=doc_e2->min_col;
|
||||
doc->cur_col=doc_e2->min_col;
|
||||
}
|
||||
DocEntryDel(doc,doc_e);
|
||||
}
|
||||
@@ -62,7 +62,7 @@ U0 DocBorderLstDraw(CDoc *doc)
|
||||
U64 ch;
|
||||
CDoc *templ=doc;
|
||||
CD3I64 saved_scroll;
|
||||
Bool old_preempt=Preempt(OFF);
|
||||
Bool old_preempt=Preempt;
|
||||
while (templ && templ->doc_signature==DOC_SIGNATURE_VAL) {
|
||||
y+=(Bsr(templ->desc)+7)>>3+1; //StrLen+1
|
||||
templ=templ->parent_doc;
|
||||
@@ -94,7 +94,7 @@ public U0 DocBottom(CDoc *doc=NULL)
|
||||
return;
|
||||
unlock=DocLock(doc);
|
||||
doc->cur_entry=doc;
|
||||
doc->cur_data_col=0;
|
||||
doc->cur_col=0;
|
||||
DocRecalc(doc);
|
||||
if (unlock)
|
||||
DocUnlock(doc);
|
||||
@@ -145,7 +145,7 @@ public U0 DocCollapse(Bool collapse=TRUE,CDoc *doc=NULL)
|
||||
DocUnlock(doc);
|
||||
}
|
||||
|
||||
#help_index "DolDoc/Output"
|
||||
#help_index "DolDoc/Output;StdOut/DolDoc"
|
||||
public U0 DocPrintAtomic(CDoc *doc,U8 *fmt,...)
|
||||
{//Necessary when hidden text might screw-up
|
||||
//inserts. It does multiple whole doc cmds all-at-once.
|
||||
@@ -166,13 +166,13 @@ public U0 DocPrintAtomic(CDoc *doc,U8 *fmt,...)
|
||||
Free(buf);
|
||||
}
|
||||
|
||||
#help_index "DolDoc/Task"
|
||||
#help_index "DolDoc/Task;StdOut/Task"
|
||||
U0 DocUpdateTaskDocs(CTask *task)
|
||||
{//This is called from $LK,"GrUpdateWins",A="MN:GrUpdateWins"$() by the winmgr at 30fps.
|
||||
{//This is called from $LK,"GrUpdateTaskWin",A="MN:GrUpdateTaskWin"$() by the winmgr at 30fps.
|
||||
CDrv *dv;
|
||||
CDoc *doc;
|
||||
CD3I64 saved_scroll;
|
||||
Bool old_preempt=Preempt(OFF);
|
||||
Bool old_preempt=Preempt;
|
||||
I64 border_attr;
|
||||
if (task->border_src==BDS_CUR_DRV && task->cur_dv) {
|
||||
border_attr=task->cur_dv->text_attr;
|
||||
@@ -195,7 +195,7 @@ U0 DocUpdateTaskDocs(CTask *task)
|
||||
MemCpy(task->task_title,doc->filename.name,TASK_TITLE_LEN);
|
||||
Preempt(old_preempt);
|
||||
DocRecalc(doc,TRUE,DOC_RECALC_TO_SCREEN);
|
||||
Preempt(OFF);
|
||||
Preempt;
|
||||
}
|
||||
if ((doc=DocBorder(task)) && !(doc->flags&DOCF_DONT_SHOW)) {
|
||||
WinScrollNull(task,&saved_scroll);
|
||||
|
||||
+104
-79
@@ -17,7 +17,7 @@ I64 DocWordWrapDel(CDoc *doc,CDocEntry *doc_e,
|
||||
if (doc_e2->type_u8==DOCT_SOFT_NEW_LINE && !same_win) {
|
||||
if (doc->cur_entry==doc_e2) {
|
||||
doc->cur_entry=doc_e2->next;
|
||||
doc->cur_data_col=doc->cur_entry->min_col;
|
||||
doc->cur_col=doc->cur_entry->min_col;
|
||||
}
|
||||
if (*_best_doc_e==doc_e2) {
|
||||
*_best_doc_e=doc_e2->next;
|
||||
@@ -34,7 +34,7 @@ I64 DocWordWrapDel(CDoc *doc,CDocEntry *doc_e,
|
||||
doc_e->tag=ptr;
|
||||
if (doc->cur_entry==doc_e2) {
|
||||
doc->cur_entry=doc_e;
|
||||
doc->cur_data_col+=k;
|
||||
doc->cur_col+=k;
|
||||
}
|
||||
if (*_best_doc_e==doc_e2) {
|
||||
*_best_doc_e=doc_e;
|
||||
@@ -94,7 +94,7 @@ U0 DocRecalcXY(CDoc *doc,CDocEntry *doc_e,
|
||||
doc->page_line_num+=y-i;
|
||||
if (doc->page_line_num<0)
|
||||
doc->page_line_num=doc_e->settings.page_len+
|
||||
doc->page_line_num%doc_e->settings.page_len;
|
||||
doc->page_line_num%doc_e->settings.page_len;
|
||||
else
|
||||
doc->page_line_num=doc->page_line_num%doc_e->settings.page_len;
|
||||
if (doc_e->settings.header!=DOC_DFT &&
|
||||
@@ -112,7 +112,8 @@ U0 DocRecalcXY(CDoc *doc,CDocEntry *doc_e,
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (doc->page_line_num>=doc_e->settings.page_len-doc_e->settings.footer) {
|
||||
if (doc->page_line_num>=
|
||||
doc_e->settings.page_len-doc_e->settings.footer) {
|
||||
y+=doc_e->settings.footer;
|
||||
if (doc_e->settings.header==DOC_DFT)
|
||||
doc->page_line_num=0;
|
||||
@@ -137,10 +138,10 @@ CDocEntry *DocWordWrapAdd(CDoc *doc,CDocEntry *doc_e,
|
||||
ii=x+1-doc_e->settings.left_margin;
|
||||
if (IsEditableText(doc_e)) {
|
||||
if (doc->cur_entry==doc_e->next) {
|
||||
if (doc->cur_data_col==doc_e->next->min_col)
|
||||
if (doc->cur_col==doc_e->next->min_col)
|
||||
i--;
|
||||
} else {
|
||||
if (doc->cur_entry==doc_e && doc->cur_data_col==i)
|
||||
if (doc->cur_entry==doc_e && doc->cur_col==i)
|
||||
i--;
|
||||
}
|
||||
if (*_k>i) {
|
||||
@@ -154,9 +155,9 @@ CDocEntry *DocWordWrapAdd(CDoc *doc,CDocEntry *doc_e,
|
||||
doc_e2=MAllocIdentical(doc_e,doc->mem_task);
|
||||
doc_e2->tag=StrNew(doc_e->tag+i,doc->mem_task);
|
||||
QueIns(doc_e2,doc_e);
|
||||
if (doc->cur_entry==doc_e && doc->cur_data_col>=i) {
|
||||
if (doc->cur_entry==doc_e && doc->cur_col>=i) {
|
||||
doc->cur_entry=doc_e2;
|
||||
doc->cur_data_col=doc->cur_data_col-i;
|
||||
doc->cur_col=doc->cur_col-i;
|
||||
}
|
||||
doc_e->tag[i]=0;
|
||||
ptr=StrNew(doc_e->tag,doc->mem_task);
|
||||
@@ -164,7 +165,8 @@ CDocEntry *DocWordWrapAdd(CDoc *doc,CDocEntry *doc_e,
|
||||
doc_e->tag=ptr;
|
||||
doc_e2=CAlloc(sizeof(CDocEntryBase),doc->mem_task);
|
||||
doc_e2->type=DOCT_SOFT_NEW_LINE | doc_e->type & 0xFFFFFF00;
|
||||
doc_e2->de_flags=doc_e->de_flags&~DOCEF_TAG|doldoc.dft_de_flags[DOCT_SOFT_NEW_LINE];
|
||||
doc_e2->de_flags=doc_e->de_flags
|
||||
&~DOCEF_TAG|doldoc.dft_de_flags[DOCT_SOFT_NEW_LINE];
|
||||
doc_e2->x=x;
|
||||
doc_e2->y=y;
|
||||
doc_e2->page_line_num=doc_e->page_line_num;
|
||||
@@ -185,7 +187,8 @@ CDocEntry *DocWordWrapAdd(CDoc *doc,CDocEntry *doc_e,
|
||||
doc_e2=CAlloc(sizeof(CDocEntryBase),doc->mem_task);
|
||||
doc_e2->type=DOCT_SOFT_NEW_LINE | doc_e->type & 0xFFFFFF00;
|
||||
doc_e2->de_flags=DOCEF_WORD_WRAP|doldoc.dft_de_flags[DOCT_SOFT_NEW_LINE]|
|
||||
doc_e->de_flags & (DOCEF_HIGHLIGHT|DOCG_BL_IV_UL|DOCEF_SKIP|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP);
|
||||
doc_e->de_flags&(DOCEF_HIGHLIGHT|DOCG_BL_IV_UL|
|
||||
DOCEF_SKIP|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP);
|
||||
doc_e2->x=x;
|
||||
doc_e2->y=y;
|
||||
doc_e2->page_line_num=doc_e->last->page_line_num;
|
||||
@@ -202,7 +205,9 @@ I64 DocTempAttr(CDoc *doc,CDocEntry *doc_e,I64 cur_u8_attr)
|
||||
I64 temp_u32_attr;
|
||||
doc_e->de_flags=doc->flags& (DOCG_BL_IV_UL|DOCEF_WORD_WRAP|DOCEF_HIGHLIGHT) |
|
||||
doc_e->de_flags&~(DOCG_BL_IV_UL|DOCEF_WORD_WRAP|DOCEF_HIGHLIGHT);
|
||||
temp_u32_attr=(cur_u8_attr&0xF0)<<8|doc->flags&DOCG_BL_IV_UL|(doc_e->settings.shifted_x&0x1F)<<16|(doc_e->settings.shifted_y&0x1F)<<21;
|
||||
temp_u32_attr=(cur_u8_attr&0xF0)<<8|
|
||||
doc->flags&DOCG_BL_IV_UL|(doc_e->settings.shifted_x&0x1F)<<16|
|
||||
(doc_e->settings.shifted_y&0x1F)<<21;
|
||||
if (doc_e->de_flags & DOCEF_HAS_BIN && *doc_e->tag=='<')
|
||||
temp_u32_attr.u8[1]|=DOC_COLOR_BIN;
|
||||
else
|
||||
@@ -259,7 +264,7 @@ public Bool DocRecalc(CDoc *doc,Bool has_cursor=FALSE,I64 recalc=DOC_RECALC)
|
||||
find_cursor=FALSE,blink_flag,full_refresh=TRUE,unlock;
|
||||
CTask *win_task,*mem_task;
|
||||
CDC *dc;
|
||||
U8 *bptr,*ptr,buf[136],ch;
|
||||
U8 *bptr,*ptr,buf[STR_LEN],ch;
|
||||
U32 *u32_ptr,*hl;
|
||||
I32 *depth_buf=NULL;
|
||||
F64 cur_time=tS;
|
||||
@@ -340,11 +345,12 @@ public Bool DocRecalc(CDoc *doc,Bool has_cursor=FALSE,I64 recalc=DOC_RECALC)
|
||||
hss=&win_task->horz_scroll;
|
||||
vss=&win_task->vert_scroll;
|
||||
if (doc->flags&DOCF_BORDER_DOC) {
|
||||
doc->cur_top_line_num=0;
|
||||
doc->top_line_num=0;
|
||||
doc->line_start_col=0;
|
||||
has_cursor=FALSE;
|
||||
if (recalc==DOC_RECALC_TO_SCREEN)
|
||||
doc->settings_root.cur_text_attr=doc->settings_root.dft_text_attr=win_task->border_attr;
|
||||
doc->settings_root.cur_text_attr=
|
||||
doc->settings_root.dft_text_attr=win_task->border_attr;
|
||||
} else {
|
||||
if (has_cursor && full_refresh) {
|
||||
if (Bt(&hss->flags,WSSf_SET_TO_POS)||Bt(&vss->flags,WSSf_SET_TO_POS)) {
|
||||
@@ -354,35 +360,37 @@ public Bool DocRecalc(CDoc *doc,Bool has_cursor=FALSE,I64 recalc=DOC_RECALC)
|
||||
LBtr(&hss->flags,WSSf_SET_TO_POS);
|
||||
}
|
||||
if (Bt(&vss->flags,WSSf_SET_TO_POS)) {
|
||||
doc->cur_top_line_num=vss->pos;
|
||||
doc->top_line_num=vss->pos;
|
||||
LBtr(&vss->flags,WSSf_SET_TO_POS);
|
||||
}
|
||||
}
|
||||
doc->x=doc->line_start_col+width/2;
|
||||
doc->y=doc->cur_top_line_num+height/2;
|
||||
doc->y=doc->top_line_num+height/2;
|
||||
find_cursor=TRUE;
|
||||
}
|
||||
}
|
||||
if (recalc==DOC_RECALC_TO_SCREEN)
|
||||
doc->settings_root.cur_text_attr=doc->settings_root.dft_text_attr=win_task->text_attr;
|
||||
doc->settings_root.cur_text_attr=
|
||||
doc->settings_root.dft_text_attr=win_task->text_attr;
|
||||
}
|
||||
x0=doc->line_start_col;
|
||||
y0=doc->cur_top_line_num;
|
||||
y0=doc->top_line_num;
|
||||
same_win=top ==doc->old_win_top &&
|
||||
bottom==doc->old_win_bottom &&
|
||||
left ==doc->old_win_left &&
|
||||
right ==doc->old_win_right &&
|
||||
doc->cur_entry==doc->old_cur_entry &&
|
||||
doc->cur_data_col==doc->old_cur_data_col;
|
||||
doc->cur_col==doc->old_cur_col;
|
||||
if (recalc==DOC_RECALC_TO_SCREEN) {
|
||||
y_plot_top=y0-scroll_y/FONT_HEIGHT;
|
||||
y_plot_bottom=y0+height-1-scroll_y/FONT_HEIGHT;
|
||||
if (!(doc->flags&DOCF_BORDER_DOC) && !Bt(&win_task->display_flags,DISPLAYf_NO_BORDER))
|
||||
if (!(doc->flags&DOCF_BORDER_DOC) &&
|
||||
!Bt(&win_task->display_flags,DISPLAYf_NO_BORDER))
|
||||
DocBorderLstDraw(doc);
|
||||
}
|
||||
|
||||
if (doc->cur_data_col<=doc->cur_entry->min_col)
|
||||
doc->cur_data_col=doc->cur_entry->min_col;
|
||||
if (doc->cur_col<=doc->cur_entry->min_col)
|
||||
doc->cur_col=doc->cur_entry->min_col;
|
||||
doc_e=doc->root.next;
|
||||
doc_e->de_flags&=~(DOCG_BL_IV_UL|DOCEF_WORD_WRAP|DOCEF_HIGHLIGHT);
|
||||
if (doc_e==doc->root.next)
|
||||
@@ -404,7 +412,7 @@ public Bool DocRecalc(CDoc *doc,Bool has_cursor=FALSE,I64 recalc=DOC_RECALC)
|
||||
best_doc_e=doc;
|
||||
best_col=0;
|
||||
doc->cur_entry=doc;
|
||||
doc->cur_data_col=0;
|
||||
doc->cur_col=0;
|
||||
doc_e=doc;
|
||||
}
|
||||
skipped_update= doc_e==doc && doc->root.next!=doc;
|
||||
@@ -423,7 +431,7 @@ public Bool DocRecalc(CDoc *doc,Bool has_cursor=FALSE,I64 recalc=DOC_RECALC)
|
||||
MemCpy(&doc_e->settings,s,sizeof(CDocSettings));
|
||||
s=&doc_e->settings;
|
||||
if (doc_e->de_flags & (DOCEF_TAG_CB|DOCEF_DEFINE) &&
|
||||
!(doc_e->de_flags & DOCEF_LST)) {
|
||||
!(doc_e->de_flags & DOCEF_LST)) {
|
||||
Free(doc_e->tag);
|
||||
if (doc_e->de_flags & DOCEF_TAG_CB) {
|
||||
if (doc_e->tag_cb)
|
||||
@@ -431,17 +439,18 @@ public Bool DocRecalc(CDoc *doc,Bool has_cursor=FALSE,I64 recalc=DOC_RECALC)
|
||||
else
|
||||
doc_e->tag=StrNew("",mem_task);
|
||||
} else {
|
||||
if (temph=HashFind(doc_e->define_str,win_task->hash_table,HTT_DEFINE_STR))
|
||||
if (temph=HashFind(doc_e->define_str,
|
||||
win_task->hash_table,HTT_DEFINE_STR))
|
||||
doc_e->tag=StrNew(temph->data,mem_task);
|
||||
else
|
||||
doc_e->tag=CAlloc(1,mem_task);
|
||||
}
|
||||
doc_e->max_col=StrLen(doc_e->tag);
|
||||
if (doc->cur_entry==doc_e && doc->cur_data_col>=doc_e->max_col) {
|
||||
if (doc->cur_entry==doc_e && doc->cur_col>=doc_e->max_col) {
|
||||
if (doc_e->max_col)
|
||||
doc->cur_data_col=doc_e->max_col-1;
|
||||
doc->cur_col=doc_e->max_col-1;
|
||||
else
|
||||
doc->cur_data_col=0;
|
||||
doc->cur_col=0;
|
||||
}
|
||||
}
|
||||
k=DocWordWrapDel(doc,doc_e,full_refresh,same_win,
|
||||
@@ -475,8 +484,8 @@ public Bool DocRecalc(CDoc *doc,Bool has_cursor=FALSE,I64 recalc=DOC_RECALC)
|
||||
cursor_y=doc_e->y;
|
||||
|
||||
if (doc_e->de_flags & DOCEF_REFRESH_DATA &&
|
||||
(doc_e->type_u8==DOCT_DATA || doc_e->type_u8==DOCT_CHECK_BOX ||
|
||||
doc_e->de_flags & DOCEF_LST)) {
|
||||
(doc_e->type_u8==DOCT_DATA || doc_e->type_u8==DOCT_CHECK_BOX ||
|
||||
doc_e->de_flags & DOCEF_LST)) {
|
||||
DocDataFmt(doc,doc_e);
|
||||
k=StrLen(doc_e->tag);
|
||||
}
|
||||
@@ -520,8 +529,9 @@ public Bool DocRecalc(CDoc *doc,Bool has_cursor=FALSE,I64 recalc=DOC_RECALC)
|
||||
ijif>>=3;
|
||||
for (k=0;k<doc_e->scroll_len;k++) {
|
||||
ch=ptr[(ijif+k)%j];
|
||||
if (!Bt(chars_bitmap_displayable,ch)) ch='.';
|
||||
if (recalc==DOC_RECALC_TO_SCREEN && !(doc_e->de_flags&DOCEF_DONT_DRAW)) {
|
||||
if (!Bt(chars_bmp_displayable,ch)) ch='.';
|
||||
if (recalc==DOC_RECALC_TO_SCREEN &&
|
||||
!(doc_e->de_flags&DOCEF_DONT_DRAW)) {
|
||||
if (doc_e->de_flags & DOCEF_BORDER_PLOT &&
|
||||
!Bt(&win_task->display_flags,DISPLAYf_NO_BORDER))
|
||||
TextChar(win_task,TRUE,x-x0,y-y0,temp_u32_attr+ch);
|
||||
@@ -540,7 +550,8 @@ public Bool DocRecalc(CDoc *doc,Bool has_cursor=FALSE,I64 recalc=DOC_RECALC)
|
||||
if (doc_e->de_flags & DOCEF_BORDER_PLOT &&
|
||||
!Bt(&win_task->display_flags,DISPLAYf_NO_BORDER)) {
|
||||
while (ch=*ptr++) {
|
||||
if (recalc==DOC_RECALC_TO_SCREEN && !(doc_e->de_flags&DOCEF_DONT_DRAW))
|
||||
if (recalc==DOC_RECALC_TO_SCREEN &&
|
||||
!(doc_e->de_flags&DOCEF_DONT_DRAW))
|
||||
TextChar(win_task,TRUE,x-x0,y-y0,temp_u32_attr+ch);
|
||||
else
|
||||
if (find_cursor) {
|
||||
@@ -558,8 +569,10 @@ public Bool DocRecalc(CDoc *doc,Bool has_cursor=FALSE,I64 recalc=DOC_RECALC)
|
||||
hl=DocHighlight(doc_e,ptr,k,temp_u32_attr);
|
||||
else
|
||||
hl=NULL;
|
||||
if (recalc==DOC_RECALC_TO_SCREEN && !(doc_e->de_flags&DOCEF_DONT_DRAW)) {
|
||||
if (y>y_plot_bottom) //Technically we should do this for scrolling_x, too.
|
||||
if (recalc==DOC_RECALC_TO_SCREEN &&
|
||||
!(doc_e->de_flags&DOCEF_DONT_DRAW)) {
|
||||
//Technically we should do this for scrolling_x, too.
|
||||
if (y>y_plot_bottom)
|
||||
more=TRUE;
|
||||
else if (y>=y_plot_top) {
|
||||
if (hl)
|
||||
@@ -591,8 +604,9 @@ public Bool DocRecalc(CDoc *doc,Bool has_cursor=FALSE,I64 recalc=DOC_RECALC)
|
||||
}
|
||||
nobound_switch (doc_e->type_u8) {
|
||||
case DOCT_TEXT:
|
||||
if (!col2 && !(doc_e->de_flags&(DOCEF_TREE|DOCEF_LST|DOCEF_TAG_CB|DOCEF_DEFINE|
|
||||
DOCEF_HTML_LINK|DOCEF_BIN_PTR_LINK)))
|
||||
if (!col2 && !(doc_e->de_flags
|
||||
&(DOCEF_TREE|DOCEF_LST|DOCEF_TAG_CB|DOCEF_DEFINE|
|
||||
DOCEF_HTML_LINK|DOCEF_BIN_PTR_LINK)))
|
||||
del_cl=TRUE;
|
||||
break;
|
||||
case DOCT_HEX_ED:
|
||||
@@ -608,7 +622,8 @@ public Bool DocRecalc(CDoc *doc,Bool has_cursor=FALSE,I64 recalc=DOC_RECALC)
|
||||
StrPrint(buf,"%08tX ",bptr);
|
||||
ptr=buf;
|
||||
while (ch=*ptr++) {
|
||||
if (recalc==DOC_RECALC_TO_SCREEN && !(doc_e->de_flags&DOCEF_DONT_DRAW)) {
|
||||
if (recalc==DOC_RECALC_TO_SCREEN &&
|
||||
!(doc_e->de_flags&DOCEF_DONT_DRAW)) {
|
||||
if (doc_e->de_flags & DOCEF_BORDER_PLOT &&
|
||||
!Bt(&win_task->display_flags,DISPLAYf_NO_BORDER))
|
||||
TextChar(win_task,TRUE,x-x0,y-y0,temp_u32_attr+ch);
|
||||
@@ -629,7 +644,8 @@ public Bool DocRecalc(CDoc *doc,Bool has_cursor=FALSE,I64 recalc=DOC_RECALC)
|
||||
StrPrint(buf,"%02tX",*bptr++);
|
||||
ptr=buf;
|
||||
while (ch=*ptr++) {
|
||||
if (recalc==DOC_RECALC_TO_SCREEN && !(doc_e->de_flags&DOCEF_DONT_DRAW)) {
|
||||
if (recalc==DOC_RECALC_TO_SCREEN &&
|
||||
!(doc_e->de_flags&DOCEF_DONT_DRAW)) {
|
||||
if (doc_e->de_flags & DOCEF_BORDER_PLOT &&
|
||||
!Bt(&win_task->display_flags,DISPLAYf_NO_BORDER))
|
||||
TextChar(win_task,TRUE,x-x0,y-y0,temp_u32_attr+ch);
|
||||
@@ -652,8 +668,9 @@ public Bool DocRecalc(CDoc *doc,Bool has_cursor=FALSE,I64 recalc=DOC_RECALC)
|
||||
x+=(doc_e->hex_ed_width-k)*3;
|
||||
for (j=0;j<k;j++) {
|
||||
ch=*bptr++;
|
||||
if (!Bt(chars_bitmap_displayable,ch)) ch='.';
|
||||
if (recalc==DOC_RECALC_TO_SCREEN && !(doc_e->de_flags&DOCEF_DONT_DRAW)) {
|
||||
if (!Bt(chars_bmp_displayable,ch)) ch='.';
|
||||
if (recalc==DOC_RECALC_TO_SCREEN &&
|
||||
!(doc_e->de_flags&DOCEF_DONT_DRAW)) {
|
||||
if (doc_e->de_flags & DOCEF_BORDER_PLOT &&
|
||||
!Bt(&win_task->display_flags,DISPLAYf_NO_BORDER))
|
||||
TextChar(win_task,TRUE,x-x0,y-y0,temp_u32_attr+ch);
|
||||
@@ -679,7 +696,8 @@ public Bool DocRecalc(CDoc *doc,Bool has_cursor=FALSE,I64 recalc=DOC_RECALC)
|
||||
if (doc_e->de_flags & DOCEF_BORDER_PLOT &&
|
||||
!Bt(&win_task->display_flags,DISPLAYf_NO_BORDER)) {
|
||||
while (x<k) {
|
||||
if (recalc==DOC_RECALC_TO_SCREEN && !(doc_e->de_flags&DOCEF_DONT_DRAW))
|
||||
if (recalc==DOC_RECALC_TO_SCREEN &&
|
||||
!(doc_e->de_flags&DOCEF_DONT_DRAW))
|
||||
TextChar(win_task,TRUE,x-x0,y-y0,temp_u32_attr+CH_SPACE);
|
||||
if (find_cursor) {
|
||||
d2=DocCharDist(doc,x,y);
|
||||
@@ -690,7 +708,8 @@ public Bool DocRecalc(CDoc *doc,Bool has_cursor=FALSE,I64 recalc=DOC_RECALC)
|
||||
}
|
||||
} else {
|
||||
k-=x;
|
||||
if (recalc==DOC_RECALC_TO_SCREEN && !(doc_e->de_flags&DOCEF_DONT_DRAW)) {
|
||||
if (recalc==DOC_RECALC_TO_SCREEN &&
|
||||
!(doc_e->de_flags&DOCEF_DONT_DRAW)) {
|
||||
if (y_plot_top<=y<=y_plot_bottom)
|
||||
TextLenStr(win_task,x-x0,y-y0,k,temp_u32_attr," ");
|
||||
x+=k;
|
||||
@@ -709,8 +728,8 @@ public Bool DocRecalc(CDoc *doc,Bool has_cursor=FALSE,I64 recalc=DOC_RECALC)
|
||||
break;
|
||||
case DOCT_NEW_LINE:
|
||||
case DOCT_SOFT_NEW_LINE:
|
||||
if (recalc==DOC_RECALC_TO_SCREEN &&
|
||||
!(doc_e->de_flags&DOCEF_DONT_DRAW)&& y_plot_top<=y<=y_plot_bottom)
|
||||
if (recalc==DOC_RECALC_TO_SCREEN &&!(doc_e->de_flags&DOCEF_DONT_DRAW)&&
|
||||
y_plot_top<=y<=y_plot_bottom)
|
||||
TextLenAttr(win_task,x-x0,y-y0,width-(x-x0),cur_u8_attr<<8);
|
||||
if (doc_e->de_flags&DOCEF_HIGHLIGHT) {
|
||||
if (s->state==DOCSS_CPP_Z_COMMENT)
|
||||
@@ -856,7 +875,7 @@ rc_adjust_xy:
|
||||
cur_u8_attr=cur_u8_attr&0xF0|DOC_COLOR_PMT;
|
||||
if (y==cursor_y) {
|
||||
doc->cur_entry=doc_e->next;
|
||||
doc->cur_data_col=doc->cur_entry->min_col;
|
||||
doc->cur_col=doc->cur_entry->min_col;
|
||||
}
|
||||
break;
|
||||
case DOCT_WORD_WRAP:
|
||||
@@ -898,14 +917,15 @@ rc_adjust_xy:
|
||||
case DOCT_CURSOR:
|
||||
if (!find_cursor && !(doc->flags & DOCF_NO_CURSOR)) {
|
||||
doc->cur_entry=doc_e->next;
|
||||
doc->cur_data_col=doc->cur_entry->min_col;
|
||||
doc->cur_col=doc->cur_entry->min_col;
|
||||
}
|
||||
del_cl=TRUE;
|
||||
break;
|
||||
case DOCT_SPRITE:
|
||||
if (!doc_e->bin_data && doc->flags&DOCEF_HAS_BIN)
|
||||
doc_e->bin_data=DocBinFindNum(doc,doc_e->bin_num);
|
||||
if ((tempb=doc_e->bin_data) && !tempb->tag && doc_e->tag && *doc_e->tag)
|
||||
if ((tempb=doc_e->bin_data) &&
|
||||
!tempb->tag && doc_e->tag && *doc_e->tag)
|
||||
tempb->tag=StrNew(doc_e->tag,mem_task);
|
||||
if (tempb && dc) {
|
||||
DCRst(dc);
|
||||
@@ -926,14 +946,13 @@ rc_adjust_xy:
|
||||
i^=0xF;
|
||||
if (temp_u32_attr & DOCET_INVERT)
|
||||
i^=0xF;
|
||||
if (blink_flag && (doc_e==doc->cur_entry || temp_u32_attr&DOCET_BLINK))
|
||||
if (blink_flag &&
|
||||
(doc_e==doc->cur_entry || temp_u32_attr&DOCET_BLINK))
|
||||
i^=0xF;
|
||||
}
|
||||
dc->color=i;
|
||||
if (find_cursor)
|
||||
dc->flags|=DCF_LOCATE_NEAREST;
|
||||
dc->nearest_sprite_elem_num=0;
|
||||
dc->nearest_dist=MAX_I64;
|
||||
if (recalc==DOC_RECALC_TO_SCREEN && doc->cur_sprite==bptr) {
|
||||
dc->flags|=DCF_LOCATE_NEAREST;
|
||||
dc->cur_x=ip.pos.x;
|
||||
@@ -955,13 +974,14 @@ rc_adjust_xy:
|
||||
}
|
||||
if (ii&(1<<SPT_MESH|1<<SPT_SHIFTABLE_MESH)) {
|
||||
if (!depth_buf) {
|
||||
DCAllocDepthBuf(dc);
|
||||
DCDepthBufAlloc(dc);
|
||||
depth_buf=dc->depth_buf;
|
||||
} else
|
||||
dc->depth_buf=depth_buf;
|
||||
GrRotZEqu(dc->r,cur_time*3.1);
|
||||
GrRotYEqu(dc->r,cur_time*1.9);
|
||||
GrRotXEqu(dc->r,cur_time);
|
||||
Mat4x4IdentEqu(dc->r);
|
||||
Mat4x4RotZ(dc->r,cur_time*3.1);
|
||||
Mat4x4RotY(dc->r,cur_time*1.9);
|
||||
Mat4x4RotX(dc->r,cur_time);
|
||||
dc->flags|=DCF_TRANSFORMATION;
|
||||
dc->x=xx;
|
||||
dc->y=yy;
|
||||
@@ -971,7 +991,7 @@ rc_adjust_xy:
|
||||
Sprite3(dc,xx,yy,zz,bptr);
|
||||
dc->depth_buf=NULL;
|
||||
if (recalc==DOC_RECALC_TO_SCREEN && doc->cur_sprite==bptr)
|
||||
doc->cur_sprite_elem_num=dc->nearest_sprite_elem_num;
|
||||
doc->nearest_sprite_elem_num=dc->nearest_sprite_elem_num;
|
||||
dc->flags&=~(DCF_LOCATE_NEAREST|DCF_DONT_DRAW|DCF_TRANSFORMATION);
|
||||
if (dc->nearest_dist<=D) {
|
||||
D=dc->nearest_dist;
|
||||
@@ -980,8 +1000,10 @@ rc_adjust_xy:
|
||||
}
|
||||
break;
|
||||
case DOCT_SONG:
|
||||
if (sys_focus_task==win_task && recalc==DOC_RECALC_TO_SCREEN && !(doc_e->de_flags&DOCEF_DONT_DRAW)) {
|
||||
if (doc_e->aux_str && (!music.cur_song || StrCmp(music.cur_song,doc_e->aux_str))) {
|
||||
if (sys_focus_task==win_task && recalc==DOC_RECALC_TO_SCREEN &&
|
||||
!(doc_e->de_flags&DOCEF_DONT_DRAW)) {
|
||||
if (doc_e->aux_str &&
|
||||
(!music.cur_song || StrCmp(music.cur_song,doc_e->aux_str))) {
|
||||
Free(music.cur_song);
|
||||
MusicSettingsRst;
|
||||
music.cur_song=AStrNew(doc_e->aux_str);
|
||||
@@ -999,7 +1021,7 @@ rc_adjust_xy:
|
||||
|
||||
if (doc_e->de_flags & DOCEF_HAS_BORDER)
|
||||
TextBorder(win_task,doc_e->x-x0,x-x0-1,doc_e->y-y0,y-y0,
|
||||
temp_u32_attr.u8[1],ToBool(doc_e->de_flags & DOCEF_SOLID_BORDER));
|
||||
temp_u32_attr.u8[1],ToBool(doc_e->de_flags & DOCEF_SOLID_BORDER));
|
||||
if (full_refresh) {
|
||||
switch (doc_e->type_u8) {
|
||||
case DOCT_CHECK_BOX:
|
||||
@@ -1033,7 +1055,8 @@ rc_adjust_xy:
|
||||
else
|
||||
tree_collapsed=FALSE;
|
||||
doc_e2=doc_e->next;
|
||||
while (doc_e2!=doc && doc_e2->type_u8!=DOCT_INDENT && !(doc_e2->de_flags & DOCEF_TREE))
|
||||
while (doc_e2!=doc && doc_e2->type_u8!=DOCT_INDENT &&
|
||||
!(doc_e2->de_flags & DOCEF_TREE))
|
||||
doc_e2=doc_e2->next;
|
||||
if (doc_e2->type_u8==DOCT_INDENT) {
|
||||
j=i=s->indent;
|
||||
@@ -1056,10 +1079,11 @@ rc_adjust_xy:
|
||||
|
||||
doc_e2=doc_e->next;
|
||||
rc_skip:
|
||||
while (doc_e2!=doc && doc_e2->de_flags & (DOCEF_SKIP|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP)) {
|
||||
while (doc_e2!=doc && doc_e2->de_flags
|
||||
&(DOCEF_SKIP|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP)) {
|
||||
if (doc_e2==doc->cur_entry) {
|
||||
doc->cur_entry=doc_e2->next;
|
||||
doc->cur_data_col=doc->cur_entry->min_col;
|
||||
doc->cur_col=doc->cur_entry->min_col;
|
||||
}
|
||||
if (full_refresh) {
|
||||
doc_e2->x=x;
|
||||
@@ -1067,7 +1091,8 @@ rc_skip:
|
||||
doc_e2->page_line_num=doc->page_line_num;
|
||||
MemCpy(&doc_e2->settings,s,sizeof(CDocSettings));
|
||||
doc_e2->type.u8[1]=cur_u8_attr;
|
||||
doc_e2->de_flags=doc->flags&(DOCG_BL_IV_UL|DOCEF_WORD_WRAP|DOCEF_HIGHLIGHT) |
|
||||
doc_e2->de_flags=doc->flags
|
||||
&(DOCG_BL_IV_UL|DOCEF_WORD_WRAP|DOCEF_HIGHLIGHT) |
|
||||
doc_e2->de_flags&~(DOCG_BL_IV_UL|DOCEF_WORD_WRAP|DOCEF_HIGHLIGHT);
|
||||
}
|
||||
doc_e2=doc_e2->next;
|
||||
@@ -1078,7 +1103,7 @@ rc_skip:
|
||||
if (!(doc_e->de_flags & (DOCEF_HOLD|DOCEF_FILTER_SKIP))) {
|
||||
if (doc_e==doc->cur_entry) {
|
||||
doc->cur_entry=doc_e2;
|
||||
doc->cur_data_col=doc_e2->min_col;
|
||||
doc->cur_col=doc_e2->min_col;
|
||||
}
|
||||
if (best_doc_e==doc_e) {
|
||||
best_doc_e=doc_e2;
|
||||
@@ -1151,7 +1176,7 @@ rc_skip:
|
||||
}
|
||||
if (find_cursor) {
|
||||
doc->cur_entry=best_doc_e;
|
||||
doc->cur_data_col=best_col;
|
||||
doc->cur_col=best_col;
|
||||
DocFormBwd(doc);
|
||||
//We need this because text coordinates are used
|
||||
if (best_d<FONT_WIDTH)
|
||||
@@ -1161,10 +1186,10 @@ rc_skip:
|
||||
|
||||
if (doc->cur_entry->type_u8!=DOCT_HEX_ED) {
|
||||
doc->y=doc->cur_entry->y;
|
||||
doc->x=doc->cur_entry->x+doc->cur_data_col;
|
||||
doc->x=doc->cur_entry->x+doc->cur_col;
|
||||
} else {
|
||||
doc->y=doc->cur_entry->y+doc->cur_data_col/3/doc->cur_entry->hex_ed_width;
|
||||
x=doc->cur_data_col%(doc->cur_entry->hex_ed_width*3);
|
||||
doc->y=doc->cur_entry->y+doc->cur_col/3/doc->cur_entry->hex_ed_width;
|
||||
x=doc->cur_col%(doc->cur_entry->hex_ed_width*3);
|
||||
i=x/doc->cur_entry->hex_ed_width;
|
||||
doc->x=doc->cur_entry->x+9;
|
||||
if (i<2)
|
||||
@@ -1184,15 +1209,15 @@ rc_skip:
|
||||
x=scroll_x/FONT_WIDTH;
|
||||
y=scroll_y/FONT_HEIGHT;
|
||||
}
|
||||
if (doc->cur_top_line_num-y+height-1>doc->max_y)
|
||||
doc->cur_top_line_num=doc->max_y-(height-1)+y;
|
||||
if (doc->cur_top_line_num-y<doc->min_y)
|
||||
doc->cur_top_line_num=doc->min_y+y;
|
||||
if (doc->top_line_num-y+height-1>doc->max_y)
|
||||
doc->top_line_num=doc->max_y-(height-1)+y;
|
||||
if (doc->top_line_num-y<doc->min_y)
|
||||
doc->top_line_num=doc->min_y+y;
|
||||
|
||||
if (doc->y-doc->cur_top_line_num+y>height-1)
|
||||
doc->cur_top_line_num=doc->y-(height-1)+y;
|
||||
if (doc->y-doc->cur_top_line_num+y<0)
|
||||
doc->cur_top_line_num=doc->y+y;
|
||||
if (doc->y-doc->top_line_num+y>height-1)
|
||||
doc->top_line_num=doc->y-(height-1)+y;
|
||||
if (doc->y-doc->top_line_num+y<0)
|
||||
doc->top_line_num=doc->y+y;
|
||||
|
||||
if (doc->line_start_col-x+width-1>doc->max_x)
|
||||
doc->line_start_col=doc->max_x-(width-1)+x;
|
||||
@@ -1207,7 +1232,7 @@ rc_skip:
|
||||
}
|
||||
if (recalc==DOC_RECALC_TO_SCREEN && has_cursor) {
|
||||
x=doc->x-doc->line_start_col+left +scroll_x/FONT_WIDTH;
|
||||
y=doc->y-doc->cur_top_line_num+top+scroll_y/FONT_HEIGHT;
|
||||
y=doc->y-doc->top_line_num+top+scroll_y/FONT_HEIGHT;
|
||||
if (0<=x<=right && 0<=y<=bottom &&
|
||||
x<TEXT_COLS && y<TEXT_ROWS &&
|
||||
!(doc->flags&DOCF_HIDE_CURSOR)) {
|
||||
@@ -1231,7 +1256,7 @@ rc_skip:
|
||||
vss->max=vss->min;
|
||||
else
|
||||
vss->max=doc->max_y-height+1;
|
||||
vss->pos=doc->cur_top_line_num;
|
||||
vss->pos=doc->top_line_num;
|
||||
}
|
||||
}
|
||||
LBEqu(&doc->flags,DOCf_MORE,more);
|
||||
@@ -1243,7 +1268,7 @@ rc_skip:
|
||||
doc->old_win_left=left;
|
||||
doc->old_win_right=right;
|
||||
doc->old_cur_entry=doc->cur_entry;
|
||||
doc->old_cur_data_col=doc->old_cur_data_col;
|
||||
doc->old_cur_col=doc->old_cur_col;
|
||||
}
|
||||
if (doc->flags & DOCF_HAS_SONG)
|
||||
LBts(&win_task->task_flags,TASKf_HAS_SONG);
|
||||
|
||||
+50
-48
@@ -17,32 +17,33 @@ public Bool DocTreeFind(CDoc *haystack_doc,U8 *needle_path,
|
||||
while (doc_e!=haystack_doc) {
|
||||
if (doc_e->type_u8==DOCT_INDENT)
|
||||
i+=doc_e->attr;
|
||||
else if (i==k && doc_e->de_flags&DOCEF_TREE && !StrCmp(doc_e->tag+3,st2)) {
|
||||
if (*st1)
|
||||
break;
|
||||
else {
|
||||
if (_tree_entry) *_tree_entry=doc_e;
|
||||
i=0;
|
||||
while (doc_e!=haystack_doc && doc_e->type_u8!=DOCT_INDENT)
|
||||
doc_e=doc_e->next;
|
||||
if (doc_e!=haystack_doc) {
|
||||
i=doc_e->attr;
|
||||
if (_start_indent) *_start_indent=doc_e;
|
||||
doc_e=doc_e->next;
|
||||
while (doc_e!=haystack_doc && i>0) {
|
||||
if (doc_e->type_u8==DOCT_INDENT) {
|
||||
i+=doc_e->attr;
|
||||
if (i<=0) {
|
||||
if (_end_indent) *_end_indent=doc_e;
|
||||
result=TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
doc_e=doc_e->next;
|
||||
}
|
||||
}
|
||||
goto ft_done;
|
||||
}
|
||||
else if (i==k && doc_e->de_flags&DOCEF_TREE &&
|
||||
!StrCmp(doc_e->tag+3,st2)) {
|
||||
if (*st1)
|
||||
break;
|
||||
else {
|
||||
if (_tree_entry) *_tree_entry=doc_e;
|
||||
i=0;
|
||||
while (doc_e!=haystack_doc && doc_e->type_u8!=DOCT_INDENT)
|
||||
doc_e=doc_e->next;
|
||||
if (doc_e!=haystack_doc) {
|
||||
i=doc_e->attr;
|
||||
if (_start_indent) *_start_indent=doc_e;
|
||||
doc_e=doc_e->next;
|
||||
while (doc_e!=haystack_doc && i>0) {
|
||||
if (doc_e->type_u8==DOCT_INDENT) {
|
||||
i+=doc_e->attr;
|
||||
if (i<=0) {
|
||||
if (_end_indent) *_end_indent=doc_e;
|
||||
result=TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
doc_e=doc_e->next;
|
||||
}
|
||||
}
|
||||
goto ft_done;
|
||||
}
|
||||
}
|
||||
doc_e=doc_e->next;
|
||||
}
|
||||
@@ -61,12 +62,12 @@ public Bool DocTreeMake(CDoc *doc,U8 *path)
|
||||
{//Make registry-like tree widget.
|
||||
I64 i=0,j=MIN_I64,k=0;
|
||||
U8 *st1=StrNew(path),
|
||||
*st2=MAlloc(StrLen(path)+1),
|
||||
*st3=StrNew(path);
|
||||
*st2=MAlloc(StrLen(path)+1),
|
||||
*st3=StrNew(path);
|
||||
Bool result=TRUE,unlock_doc=DocLock(doc);
|
||||
CDocEntry *doc_e=doc->root.next;
|
||||
doc->cur_entry=doc;
|
||||
doc->cur_data_col=0;
|
||||
doc->cur_col=0;
|
||||
while (*st1 && doc_e!=doc) {
|
||||
StrFirstRem(st1,"/",st2);
|
||||
if (*st2) {
|
||||
@@ -75,17 +76,18 @@ public Bool DocTreeMake(CDoc *doc,U8 *path)
|
||||
i+=doc_e->attr;
|
||||
if (i==j) {
|
||||
doc->cur_entry=doc_e;
|
||||
doc->cur_data_col=0;
|
||||
doc->cur_col=0;
|
||||
goto mt_done;
|
||||
}
|
||||
} else if (i==k && doc_e->de_flags&DOCEF_TREE && !StrCmp(doc_e->tag+3,st2)) {
|
||||
Free(st3);
|
||||
st3=StrNew(st1);
|
||||
j=i;
|
||||
if (!*st1)
|
||||
result=FALSE;
|
||||
else
|
||||
break;
|
||||
} else if (i==k && doc_e->de_flags&DOCEF_TREE &&
|
||||
!StrCmp(doc_e->tag+3,st2)) {
|
||||
Free(st3);
|
||||
st3=StrNew(st1);
|
||||
j=i;
|
||||
if (!*st1)
|
||||
result=FALSE;
|
||||
else
|
||||
break;
|
||||
}
|
||||
doc_e=doc_e->next;
|
||||
}
|
||||
@@ -99,7 +101,7 @@ mt_done:
|
||||
if (*st2) {
|
||||
DocPrint(doc,"$$TR+C,\"%s\"$$\n$$ID,2$$",st2);
|
||||
doc->cur_entry=DocPrint(doc,"$$ID,-2$$");
|
||||
doc->cur_data_col=0;
|
||||
doc->cur_col=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -116,16 +118,16 @@ public I64 ExeDoc(CDoc *doc,Bool just_load=FALSE)
|
||||
{//JIT Compile and execute a document.
|
||||
I64 result;
|
||||
Bool okay=TRUE,unlock_doc=DocLock(doc);
|
||||
CLex *lx=LexNew(,LF_DONT_FREE_BUF);
|
||||
CCmpCtrl *cc=CmpCtrlNew(,CCF_DONT_FREE_BUF);
|
||||
if (just_load)
|
||||
lx->flags|=LF_JUST_LOAD;
|
||||
cc->flags|=CCF_JUST_LOAD;
|
||||
if (Fs->last_lex!=&Fs->next_lex)
|
||||
lx->opts=Fs->last_lex->opts;
|
||||
QueIns(lx,Fs->last_lex);
|
||||
LexAttachDoc(lx,,doc);
|
||||
cc->opts=Fs->last_lex->opts;
|
||||
QueIns(cc,Fs->last_lex);
|
||||
LexAttachDoc(cc,,doc);
|
||||
try {
|
||||
Lex(lx);
|
||||
result=ExeCmdLine(lx);
|
||||
Lex(cc);
|
||||
result=ExeCmdLine(cc);
|
||||
} catch {
|
||||
if (Fs->except_ch=='Compiler' || Fs->except_ch=='Break') {
|
||||
Fs->catch_except=TRUE;
|
||||
@@ -133,9 +135,9 @@ public I64 ExeDoc(CDoc *doc,Bool just_load=FALSE)
|
||||
result=0;
|
||||
}
|
||||
}
|
||||
QueRem(lx);
|
||||
QueRem(cc);
|
||||
if (okay)
|
||||
LexDel(lx); //TODO: can crash
|
||||
CmpCtrlDel(cc); //TODO: can crash
|
||||
if (unlock_doc)
|
||||
DocUnlock(doc);
|
||||
return result;
|
||||
|
||||
Reference in new issue
Block a user