LTCD_070816.ISO
This commit is contained in:
1 parent
d14bbc24f9
commit
0e9364ff4c
506 files changed
+157705
-41812
No files matched your search
Binary file not shown.
@@ -0,0 +1,154 @@
|
||||
LoadStr("ST_BIBLE_FILE","::/LT/Text/Bible.TXZ");
|
||||
|
||||
LoadList("ST_BIBLE_BOOKS",
|
||||
"Genesis\0"
|
||||
"Exodus\0"
|
||||
"Leviticus\0"
|
||||
"Numbers\0"
|
||||
"Deuteronomy\0"
|
||||
"Joshua\0"
|
||||
"Judges\0"
|
||||
"Ruth\0"
|
||||
"1 Samuel\0"
|
||||
"2 Samuel\0"
|
||||
"1 Kings\0"
|
||||
"2 Kings\0"
|
||||
"1 Chronicles\0"
|
||||
"2 Chronicles\0"
|
||||
"Ezra\0"
|
||||
"Nehemiah\0"
|
||||
"Tobit\0"
|
||||
"Judith\0"
|
||||
"Esther\0"
|
||||
"1 Maccabees\0"
|
||||
"2 Maccabees\0"
|
||||
"Job\0"
|
||||
"Psalms\0"
|
||||
"Proverbs\0"
|
||||
"Ecclesiastes\0"
|
||||
"Song of Songs\0"
|
||||
"Wisdom\0"
|
||||
"Sirach\0"
|
||||
"Isaiah\0"
|
||||
"Jeremiah\0"
|
||||
"Lamentations\0"
|
||||
"Baruch\0"
|
||||
"Ezekiel\0"
|
||||
"Daniel\0"
|
||||
"Hosea\0"
|
||||
"Joel\0"
|
||||
"Amos\0"
|
||||
"Obadiah\0"
|
||||
"Jonah\0"
|
||||
"Micah\0"
|
||||
"Nahum\0"
|
||||
"Habakkuk\0"
|
||||
"Zephaniah\0"
|
||||
"Haggai\0"
|
||||
"Zechariah\0"
|
||||
"Malachi\0"
|
||||
"Matthew\0"
|
||||
"Mark\0"
|
||||
"Luke\0"
|
||||
"John\0"
|
||||
"Acts\0"
|
||||
"Romans\0"
|
||||
"1 Corinthians\0"
|
||||
"2 Corinthians\0"
|
||||
"Galatians\0"
|
||||
"Ephesians\0"
|
||||
"Philippians\0"
|
||||
"Colossians\0"
|
||||
"1 Thessalonians\0"
|
||||
"2 Thessalonians\0"
|
||||
"1 Timothy\0"
|
||||
"2 Timothy\0"
|
||||
"Titus\0"
|
||||
"Philemon\0"
|
||||
"Hebrews\0"
|
||||
"James\0"
|
||||
"1 Peter\0"
|
||||
"2 Peter\0"
|
||||
"1 John\0"
|
||||
"2 John\0"
|
||||
"3 John\0"
|
||||
"Jude\0"
|
||||
"Revelation\0"
|
||||
"\0");
|
||||
|
||||
LoadList("ST_BIBLE_BOOK_LINES",
|
||||
"297\0"
|
||||
"5068\0"
|
||||
"9123\0"
|
||||
"12005\0"
|
||||
"15977\0"
|
||||
"19168\0"
|
||||
"21329\0"
|
||||
"23598\0"
|
||||
"23902\0"
|
||||
"26892\0"
|
||||
"29345\0"
|
||||
"32241\0"
|
||||
"34961\0"
|
||||
"37633\0"
|
||||
"40756\0"
|
||||
"41671\0"
|
||||
"Tobit\0"
|
||||
"Judith\0"
|
||||
"42963\0"
|
||||
"1 Maccabees\0"
|
||||
"2 Maccabees\0"
|
||||
"43605\0"
|
||||
"46190\0"
|
||||
"53793\0"
|
||||
"56267\0"
|
||||
"56966\0"
|
||||
"Wisdom\0"
|
||||
"Sirach\0"
|
||||
"57332\0"
|
||||
"61806\0"
|
||||
"66736\0"
|
||||
"Baruch\0"
|
||||
"67217\0"
|
||||
"71804\0"
|
||||
"73189\0"
|
||||
"73876\0"
|
||||
"74130\0"
|
||||
"74615\0"
|
||||
"74697\0"
|
||||
"74860\0"
|
||||
"75241\0"
|
||||
"75416\0"
|
||||
"75604\0"
|
||||
"75806\0"
|
||||
"75932\0"
|
||||
"76684\0"
|
||||
"76908\0"
|
||||
"79970\0"
|
||||
"81941\0"
|
||||
"85266\0"
|
||||
"87803\0"
|
||||
"90914\0"
|
||||
"92110\0"
|
||||
"93323\0"
|
||||
"94088\0"
|
||||
"94514\0"
|
||||
"94869\0"
|
||||
"95153\0"
|
||||
"95402\0"
|
||||
"95647\0"
|
||||
"95772\0"
|
||||
"96090\0"
|
||||
"96320\0"
|
||||
"96440\0"
|
||||
"96500\0"
|
||||
"97370\0"
|
||||
"97687\0"
|
||||
"97976\0"
|
||||
"98163\0"
|
||||
"98506\0"
|
||||
"98552\0"
|
||||
"98597\0"
|
||||
"98684\0"
|
||||
"\0");
|
||||
|
||||
@@ -0,0 +1,930 @@
|
||||
#define LK_FILE 0
|
||||
#define LK_FILE_ANCHOR 1
|
||||
#define LK_FILE_FIND 2
|
||||
#define LK_FILE_LINE 3
|
||||
#define LK_MAN_PAGE 4
|
||||
#define LK_PLAIN 5
|
||||
#define LK_PLAIN_FIND 6
|
||||
#define LK_PLAIN_LINE 7
|
||||
#define LK_BIBLE_FIND 8
|
||||
#define LK_DEF 9
|
||||
#define LK_HELP_INDEX 10
|
||||
#define LK_PLACE_ANCHOR 11
|
||||
|
||||
I8 PopUpLinkType(BoolU4 include_anchor)
|
||||
{
|
||||
I8 i;
|
||||
Ltf *l=LtfNew;
|
||||
LtfPutSExt(l,"$$MU,\"To file\",LK_FILE$$\r\n");
|
||||
LtfPutSExt(l,"$$MU,\"To anchor in file\",LK_FILE_ANCHOR$$\r\n");
|
||||
LtfPutSExt(l,"$$MU,\"To str in file\",LK_FILE_FIND$$\r\n");
|
||||
LtfPutSExt(l,"$$MU,\"To line in file\",LK_FILE_LINE$$\r\n");
|
||||
LtfPutSExt(l,"$$MU,\"To man page\",LK_MAN_PAGE$$\r\n");
|
||||
LtfPutSExt(l,"$$MU,\"To plain-text file\",LK_PLAIN$$\r\n");
|
||||
LtfPutSExt(l,"$$MU,\"To str in plain-text file\",LK_PLAIN_FIND$$\r\n");
|
||||
LtfPutSExt(l,"$$MU,\"To line in plain-text file\",LK_PLAIN_LINE$$\r\n");
|
||||
LtfPutSExt(l,"$$MU,\"To Bible chapter line and verse\",LK_BIBLE_FIND$$\r\n");
|
||||
LtfPutSExt(l,"$$MU,\"To Dictionary Definition\",LK_DEF$$\r\n");
|
||||
LtfPutSExt(l,"$$MU,\"To Help Index\",LK_HELP_INDEX$$\r\n");
|
||||
if (include_anchor)
|
||||
LtfPutSExt(l,"$$MU,\"Place Anchor\",LK_PLACE_ANCHOR$$\r\n");
|
||||
LtfPutSExt(l,"$$MU,\"CANCEL\",-1$$");
|
||||
i=PopUpMenu(l);
|
||||
LtfDel(l);
|
||||
return i;
|
||||
}
|
||||
|
||||
class EditFileLinkStruct
|
||||
{
|
||||
I1 display[132] fmtstr "$$DA-P,131,\"Displayed Text:%s\"$$\r\n";
|
||||
I1 file[132] fmtstr "$$DA-P,131,\"File :%s\"$$\r\n";
|
||||
I1 aux[132];
|
||||
I8 num;
|
||||
BoolU4 quote fmtstr "$$CB,\"Quote\"$$\r\n";
|
||||
BoolU4 hide;
|
||||
};
|
||||
|
||||
class EditFileAnchorLinkStruct
|
||||
{
|
||||
I1 display[132] fmtstr "$$DA-P,131,\"Displayed Text:%s\"$$\r\n";
|
||||
I1 file[132] fmtstr "$$DA-P,131,\"File :%s\"$$\r\n";
|
||||
I1 aux[132] fmtstr "$$DA-P,131,\"Anchor Label :%s\"$$\r\n";
|
||||
I8 num;
|
||||
BoolU4 quote fmtstr "$$CB,\"Quote\"$$\r\n";
|
||||
BoolU4 hide;
|
||||
};
|
||||
|
||||
class EditFileFindLinkStruct
|
||||
{
|
||||
I1 display[132] fmtstr "$$DA-P,131,\"Displayed Text:%s\"$$\r\n";
|
||||
I1 file[132] fmtstr "$$DA-P,131,\"File :%s\"$$\r\n";
|
||||
I1 aux[132] fmtstr "$$DA-P,131,\"Str :%s\"$$\r\n";
|
||||
I8 num fmtstr "$$DA-T,131,\"Occurrence Num:%04d\"$$\r\n";
|
||||
BoolU4 quote fmtstr "$$CB,\"Quote\"$$\r\n";
|
||||
BoolU4 hide;
|
||||
};
|
||||
|
||||
class EditFileLineLinkStruct
|
||||
{
|
||||
I1 display[132] fmtstr "$$DA-P,131,\"Displayed Text:%s\"$$\r\n";
|
||||
I1 file[132] fmtstr "$$DA-P,131,\"File :%s\"$$\r\n";
|
||||
I1 aux[132];
|
||||
I8 num fmtstr "$$DA-T,131,\"Line Num :%04d\"$$\r\n";
|
||||
BoolU4 quote fmtstr "$$CB,\"Quote\"$$\r\n";
|
||||
BoolU4 hide;
|
||||
};
|
||||
|
||||
class EditManPageLinkStruct
|
||||
{
|
||||
I1 display[132] fmtstr "$$DA-P,131,\"Displayed Text:%s\"$$\r\n";
|
||||
I1 file[132];
|
||||
I1 aux[132] fmtstr "$$DA-P,131,\"Label :%s\"$$\r\n";
|
||||
I8 num;
|
||||
BoolU4 quote fmtstr "$$CB,\"Quote\"$$\r\n";
|
||||
BoolU4 hide;
|
||||
};
|
||||
|
||||
class EditPlaceAnchorStruct
|
||||
{
|
||||
I1 display[132] fmtstr "$$DA-P,131,\"Displayed Text:%s\"$$\r\n";
|
||||
I1 file[132];
|
||||
I1 aux[132] fmtstr "$$DA-P,131,\"Anchor Label :%s\"$$\r\n";
|
||||
I8 num;
|
||||
BoolU4 quote fmtstr "$$CB,\"Quote\"$$\r\n";
|
||||
BoolU4 hide fmtstr "$$CB,\"Hide\"$$\r\n";
|
||||
};
|
||||
|
||||
class EditBibleLinkStruct
|
||||
{
|
||||
I1 display[132] fmtstr "$$DA-P,131,\"Displayed Text:%s\"$$\r\n";
|
||||
I1 file[132];
|
||||
I1 aux[132] fmtstr "$$DA-P,131,\"Chapter Verse :%s\"$$\r\n";
|
||||
I8 num;
|
||||
BoolU4 quote fmtstr "$$CB,\"Quote\"$$\r\n";
|
||||
BoolU4 hide;
|
||||
};
|
||||
|
||||
class EditDefLinkStruct
|
||||
{
|
||||
I1 display[132] fmtstr "$$DA-P,131,\"Displayed Text:%s\"$$\r\n";
|
||||
I1 file[132];
|
||||
I1 aux[132] fmtstr "$$DA-P,131,\"Word :%s\"$$\r\n";
|
||||
I8 num fmtstr "$$DA-T,131,\"Def Num :%4d\"$$\r\n";
|
||||
BoolU4 quote fmtstr "$$CB,\"Quote\"$$\r\n";
|
||||
BoolU4 hide;
|
||||
};
|
||||
|
||||
|
||||
|
||||
I1 *ctrl_L_header="Press WINDOW's key for help\r\n\r\n";
|
||||
|
||||
|
||||
BoolU8 PmtLink(I8 type,I1 **display,I1 **link,BoolU4 *quote)
|
||||
{
|
||||
I8 i;
|
||||
BoolU4 result=FALSE;
|
||||
if (quote) *quote=FALSE;
|
||||
EditFileLinkStruct *el=MAllocZ(sizeof(EditFileLinkStruct));
|
||||
if (type>=0) {
|
||||
el->num=1;
|
||||
switch (type) {
|
||||
case LK_FILE:
|
||||
if (DoForm(el,"EditFileLinkStruct",CTRL_L_HELP,TRUE,ctrl_L_header)) {
|
||||
result=TRUE;
|
||||
if (!el->display[0])
|
||||
*display=NewStr(el->file);
|
||||
else
|
||||
*display=NewStr(el->display);
|
||||
*link=MSPrintF("FI:%s",el->file);
|
||||
}
|
||||
break;
|
||||
case LK_PLAIN:
|
||||
if (DoForm(el,"EditFileLinkStruct",CTRL_L_HELP,TRUE,ctrl_L_header)) {
|
||||
result=TRUE;
|
||||
if (!el->display[0])
|
||||
*display=NewStr(el->file);
|
||||
else
|
||||
*display=NewStr(el->display);
|
||||
*link=MSPrintF("PI:%s",el->file);
|
||||
}
|
||||
break;
|
||||
case LK_FILE_ANCHOR:
|
||||
if (DoForm(el,"EditFileAnchorLinkStruct",CTRL_L_HELP,TRUE,ctrl_L_header)) {
|
||||
result=TRUE;
|
||||
if (!el->display[0])
|
||||
*display=NewStr(el->aux);
|
||||
else
|
||||
*display=NewStr(el->display);
|
||||
*link=MSPrintF("FA:%s,%s",el->file,el->aux);
|
||||
}
|
||||
break;
|
||||
case LK_FILE_FIND:
|
||||
if (DoForm(el,"EditFileFindLinkStruct",CTRL_L_HELP,TRUE,ctrl_L_header)) {
|
||||
result=TRUE;
|
||||
if (el->num==1) {
|
||||
if (!el->display[0])
|
||||
*display=NewStr(el->aux);
|
||||
else
|
||||
*display=NewStr(el->display);
|
||||
*link=MSPrintF("FF:%s,%s",el->file,el->aux);
|
||||
} else {
|
||||
if (!el->display[0])
|
||||
*display=NewStr(el->aux);
|
||||
else
|
||||
*display=NewStr(el->display);
|
||||
*link=MSPrintF("FF:%s,%s:%d",el->file,el->aux,el->num);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case LK_PLAIN_FIND:
|
||||
if (DoForm(el,"EditFileFindLinkStruct",CTRL_L_HELP,TRUE,ctrl_L_header)) {
|
||||
result=TRUE;
|
||||
if (el->num==1) {
|
||||
if (!el->display[0])
|
||||
*display=NewStr(el->aux);
|
||||
else
|
||||
*display=NewStr(el->display);
|
||||
*link=MSPrintF("PF:%s,%s",el->file,el->aux);
|
||||
} else {
|
||||
if (!el->display[0])
|
||||
*display=NewStr(el->aux);
|
||||
else
|
||||
*display=NewStr(el->display);
|
||||
*link=MSPrintF("PF:%s,%s:%d",el->file,el->aux,el->num);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case LK_FILE_LINE:
|
||||
if (DoForm(el,"EditFileLineLinkStruct",CTRL_L_HELP,TRUE,ctrl_L_header)) {
|
||||
result=TRUE;
|
||||
if (!el->display[0])
|
||||
*display=NewStr(el->file);
|
||||
else
|
||||
*display=NewStr(el->display);
|
||||
*link=MSPrintF("FL:%s,%d",el->file,el->num);
|
||||
}
|
||||
break;
|
||||
case LK_PLAIN_LINE:
|
||||
if (DoForm(el,"EditFileLineLinkStruct",CTRL_L_HELP,TRUE,ctrl_L_header)) {
|
||||
result=TRUE;
|
||||
if (!el->display[0])
|
||||
*display=NewStr(el->file);
|
||||
else
|
||||
*display=NewStr(el->display);
|
||||
*link=MSPrintF("PL:%s,%d",el->file,el->num);
|
||||
}
|
||||
break;
|
||||
case LK_MAN_PAGE:
|
||||
if (DoForm(el,"EditManPageLinkStruct",CTRL_L_HELP,TRUE,ctrl_L_header)) {
|
||||
result=TRUE;
|
||||
if (!el->display[0])
|
||||
*display=NewStr(el->aux);
|
||||
else
|
||||
*display=NewStr(el->display);
|
||||
*link=MSPrintF("MN:%s",el->aux);
|
||||
}
|
||||
break;
|
||||
case LK_PLACE_ANCHOR:
|
||||
if (DoForm(el,"EditPlaceAnchorStruct",CTRL_L_HELP,TRUE,ctrl_L_header)) {
|
||||
result=TRUE;
|
||||
if (!el->display[0]) {
|
||||
if (el->hide)
|
||||
*display=NewStr("");
|
||||
else
|
||||
*display=NewStr(el->aux);
|
||||
} else
|
||||
*display=NewStr(el->display);
|
||||
*link=NewStr(el->aux);
|
||||
}
|
||||
break;
|
||||
case LK_BIBLE_FIND: //TODO
|
||||
i=PopUpPickSysTextSub("ST_BIBLE_BOOKS");
|
||||
if (i>=0) {
|
||||
if (DoForm(el,"EditBibleLinkStruct",CTRL_L_HELP,TRUE,ctrl_L_header)) {
|
||||
result=TRUE;
|
||||
if (!el->display[0])
|
||||
*display=MSPrintF("%Z,%s",i,"ST_BIBLE_BOOKS",el->aux);
|
||||
else
|
||||
*display=NewStr(el->display);
|
||||
*link=MSPrintF("BF:%Z,%s",i,"ST_BIBLE_BOOKS",el->aux);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case LK_DEF:
|
||||
el->num=-1;
|
||||
if (DoForm(el,"EditDefLinkStruct",CTRL_L_HELP,TRUE,ctrl_L_header)) {
|
||||
result=TRUE;
|
||||
if (!el->display[0])
|
||||
*display=NewStr(el->aux);
|
||||
else
|
||||
*display=NewStr(el->display);
|
||||
if (el->num<0)
|
||||
*link=MSPrintF("DF:%s",el->aux);
|
||||
else
|
||||
*link=MSPrintF("DF:%s,%d",el->aux,el->num);
|
||||
|
||||
}
|
||||
break;
|
||||
case LK_HELP_INDEX:
|
||||
if (DoForm(el,"EditManPageLinkStruct",CTRL_L_HELP,TRUE,ctrl_L_header)) {
|
||||
result=TRUE;
|
||||
if (!el->display[0])
|
||||
*display=NewStr(el->aux);
|
||||
else
|
||||
*display=NewStr(el->display);
|
||||
*link=MSPrintF("HI:%s",el->aux);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (el->quote) *quote=TRUE;
|
||||
Free(el);
|
||||
return result;
|
||||
}
|
||||
|
||||
void EditInsertLink()
|
||||
{
|
||||
I1 *display=NULL,*link=NULL,*st=NULL;
|
||||
BoolU4 quote=FALSE;
|
||||
I8 type=PopUpLinkType(TRUE);
|
||||
if (type>=0) {
|
||||
if (PmtLink(type,&display,&link,"e)) {
|
||||
if (type==LK_PLACE_ANCHOR)
|
||||
st=MSPrintF("$$AN,\"%s\",\"%s\"$$",display,link);
|
||||
else
|
||||
st=MSPrintF("$$LK,\"%s\",\"%s\"$$",display,link);
|
||||
}
|
||||
}
|
||||
if (st) {
|
||||
if (quote)
|
||||
PrintF("%Q",st);
|
||||
else
|
||||
PutS(st);
|
||||
}
|
||||
Free(display);
|
||||
Free(link);
|
||||
Free(st);
|
||||
}
|
||||
|
||||
I8 PopUpColorType()
|
||||
{
|
||||
I8 i;
|
||||
Ltf *l=LtfNew;
|
||||
LtfPutSExt(l,"$$MU,\"Foreground\" LTFT_FOREGROUND_COLOR$$\r\n");
|
||||
LtfPutSExt(l,"$$MU,\"Background\" LTFT_BACKGROUND_COLOR$$\r\n");
|
||||
LtfPutSExt(l,"$$MU,\"Default Foreground\" LTFT_DEFAULT_FOREGROUND_COLOR$$\r\n");
|
||||
LtfPutSExt(l,"$$MU,\"Default Background\" LTFT_DEFAULT_BACKGROUND_COLOR$$\r\n");
|
||||
LtfPutSExt(l,"$$MU,\"Link Foreground\" LTFT_LINK_FOREGROUND$$\r\n");
|
||||
LtfPutSExt(l,"$$MU,\"Link Background\" LTFT_LINK_BACKGROUND$$\r\n");
|
||||
LtfPutSExt(l,"$$MU,\"Macro Foreground\" LTFT_MACRO_FOREGROUND$$\r\n");
|
||||
LtfPutSExt(l,"$$MU,\"Macro Background\" LTFT_MACRO_BACKGROUND$$\r\n");
|
||||
LtfPutSExt(l,"$$MU,\"Anchor Foreground\" LTFT_ANCHOR_FOREGROUND$$\r\n");
|
||||
LtfPutSExt(l,"$$MU,\"Anchor Background\" LTFT_ANCHOR_BACKGROUND$$\r\n");
|
||||
LtfPutSExt(l,"$$MU,\"Hidden Foreground\" LTFT_HIDDEN_FOREGROUND$$\r\n");
|
||||
LtfPutSExt(l,"$$MU,\"Hidden Background\" LTFT_HIDDEN_BACKGROUND$$\r\n");
|
||||
LtfPutSExt(l,"$$MU,\"Tree Foreground\" LTFT_TREE_FOREGROUND$$\r\n");
|
||||
LtfPutSExt(l,"$$MU,\"Tree Background\" LTFT_TREE_BACKGROUND$$\r\n");
|
||||
LtfPutSExt(l,"$$MU,\"User Foreground\" LTFT_USER_FOREGROUND$$\r\n");
|
||||
LtfPutSExt(l,"$$MU,\"User Background\" LTFT_USER_BACKGROUND$$\r\n");
|
||||
LtfPutSExt(l,"$$MU,\"CANCEL\" -1$$");
|
||||
i=PopUpMenu(l);
|
||||
LtfDel(l);
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
I8 PopUpPageSettingType()
|
||||
{
|
||||
I8 i;
|
||||
Ltf *l=LtfNew;
|
||||
LtfPutSExt(l,"$$MU,\"Page Length\",LTFT_PAGE_LENGTH$$\r\n");
|
||||
LtfPutSExt(l,"$$MU,\"Page Header\",LTFT_HEADER$$\r\n");
|
||||
LtfPutSExt(l,"$$MU,\"Page Footer\",LTFT_FOOTER$$\r\n");
|
||||
LtfPutSExt(l,"$$MU,\"Left Margin\",LTFT_LEFT_MARGIN$$\r\n");
|
||||
LtfPutSExt(l,"$$MU,\"Right Margin\",LTFT_RIGHT_MARGIN$$\r\n");
|
||||
i=PopUpMenu(l);
|
||||
LtfDel(l);
|
||||
return i;
|
||||
}
|
||||
|
||||
void EditInsertColor()
|
||||
{
|
||||
I8 type=PopUpColorType,col=LTF_DEFAULT;
|
||||
if (type>=0) {
|
||||
col=PopUpColor;
|
||||
if (col==LTF_DEFAULT)
|
||||
PrintF("$$%Z$$",type,"ST_LTF_CMDS");
|
||||
else if (col>=0)
|
||||
PrintF("$$%Z,%d$$",type,"ST_LTF_CMDS",col);
|
||||
}
|
||||
}
|
||||
|
||||
class EditPageSettingStruct
|
||||
{
|
||||
I1 value[132] fmtstr "$$DA -P 131 \"Setting Value:%s\"$$\r\n";
|
||||
};
|
||||
|
||||
class EditPageSettingStruct2
|
||||
{
|
||||
I1 value[132] fmtstr "$$DA -P 131 \"Setting Value:%s\"$$\r\n";
|
||||
BoolU4 winrel fmtstr "$$CB \"Win Relative\"$$\r\n";
|
||||
};
|
||||
|
||||
|
||||
void EditInsertPageSetting()
|
||||
{
|
||||
I8 type=PopUpPageSettingType;
|
||||
EditPageSettingStruct *el=MAllocZ(sizeof(EditPageSettingStruct));
|
||||
EditPageSettingStruct2 *el2=MAllocZ(sizeof(EditPageSettingStruct2));
|
||||
if (type>=0) {
|
||||
if (type==LTFT_RIGHT_MARGIN) {
|
||||
if (DoForm(el2,"EditPageSettingStruct2")) {
|
||||
if (el2->winrel) {
|
||||
if (*el2->value)
|
||||
PrintF("$$%Z+WR,%s$$",type,"ST_LTF_CMDS",el2->value);
|
||||
else
|
||||
PrintF("$$%Z+WR$$",type,"ST_LTF_CMDS");
|
||||
} else {
|
||||
if (*el2->value)
|
||||
PrintF("$$%Z,%s$$",type,"ST_LTF_CMDS",el2->value);
|
||||
else
|
||||
PrintF("$$%Z$$",type,"ST_LTF_CMDS");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (DoForm(el,"EditPageSettingStruct")) {
|
||||
if (*el->value)
|
||||
PrintF("$$%Z,%s$$",type,"ST_LTF_CMDS",el->value);
|
||||
else
|
||||
PrintF("$$%Z$$",type,"ST_LTF_CMDS");
|
||||
}
|
||||
}
|
||||
}
|
||||
Free(el2);
|
||||
Free(el);
|
||||
}
|
||||
|
||||
I8 PopUpDollarType()
|
||||
{
|
||||
I8 i;
|
||||
Ltf *l=LtfNew;
|
||||
LtfPutSExt(l,"$$MU,\"Link\" LTFT_LINK$$\r\n");
|
||||
LtfPutSExt(l,"$$MU,\"Text\" LTFT_TEXT$$\r\n");
|
||||
LtfPutSExt(l,"$$MU,\"Tree Branch\" LTFT_TREE$$\r\n");
|
||||
LtfPutSExt(l,"$$MU,\"Color\" LTFT_FOREGROUND_COLOR$$\r\n");
|
||||
LtfPutSExt(l,"$$MU,\"Page Settings\" LTFT_PAGE_LENGTH$$\r\n");
|
||||
LtfPutSExt(l,"$$MU,\"Cursor Movement\" LTFT_CURSOR_MOVEMENT$$\r\n");
|
||||
LtfPutSExt(l,"$$MU,\"Button\" LTFT_BUTTON$$\r\n");
|
||||
LtfPutSExt(l,"$$MU,\"Check Box\" LTFT_CHECK_BOX$$\r\n");
|
||||
LtfPutSExt(l,"$$MU,\"Macro\" LTFT_MACRO$$\r\n");
|
||||
LtfPutSExt(l,"$$MU,\"Menu Value\" LTFT_MENU_VALUE$$\r\n");
|
||||
LtfPutSExt(l,"$$MU,\"Button\" LTFT_BUTTON$$\r\n");
|
||||
LtfPutSExt(l,"$$MU,\"Data\" LTFT_DATA$$\r\n");
|
||||
LtfPutSExt(l,"$$MU,\"Hex Edit\" LTFT_HEX_EDIT$$\r\n");
|
||||
LtfPutSExt(l,"$$MU,\"Hidden Widget\" LTFT_HIDE_START$$\r\n");
|
||||
LtfPutSExt(l,"$$MU,\"Song\" LTFT_SONG$$\r\n");
|
||||
LtfPutSExt(l,"$$MU,\"CANCEL\" -1$$");
|
||||
i=PopUpMenu(l);
|
||||
LtfDel(l);
|
||||
return i;
|
||||
}
|
||||
|
||||
class EditDollarTextStruct
|
||||
{
|
||||
I1 display[132] fmtstr "$$DA-P,131,\"Displayed Text:%s\"$$\r\n";
|
||||
BoolU4 left_x fmtstr "$$CB,\"Left X\"$$\r\n";
|
||||
BoolU4 center_x fmtstr "$$CB,\"Center X\"$$\r\n";
|
||||
BoolU4 right_x fmtstr "$$CB,\"Right X\"$$\r\n";
|
||||
BoolU4 margin_rel fmtstr "$$CB,\"Margin Rel X\"$$\r\n";
|
||||
BoolU4 blink fmtstr "$$CB,\"Blink\"$$\r\n";
|
||||
BoolU4 invert fmtstr "$$CB,\"Invert\"$$\r\n";
|
||||
BoolU4 underline fmtstr "$$CB,\"Underline\"$$\r\n";
|
||||
BoolU4 tree fmtstr "$$CB,\"Tree\"$$\r\n";
|
||||
BoolU4 collapsed fmtstr "$$CB,\"Collapsed\"$$\r\n";
|
||||
BoolU4 alias fmtstr "$$CB,\"Alias\"$$\r\n";
|
||||
I1 scroll_x [132] fmtstr "$$DA-P,131,\"Scroll X Length Expression:%s\"$$\r\n";
|
||||
I1 shift_x [132] fmtstr "$$DA-P,131,\"X Offset Expression :%s\"$$\r\n";
|
||||
I1 shift_y [132] fmtstr "$$DA-P,131,\"Y Offset Expression :%s\"$$\r\n";
|
||||
};
|
||||
|
||||
void EditInsertDollarText()
|
||||
{
|
||||
I1 *st,buf[132];
|
||||
EditDollarTextStruct *dt=MAllocZ(sizeof(EditDollarTextStruct));
|
||||
if (DoForm(dt,"EditDollarTextStruct",CTRL_L_HELP,TRUE,ctrl_L_header)) {
|
||||
*buf=0;
|
||||
if (dt->left_x ) StrCat(buf,"+LX");
|
||||
if (dt->center_x) StrCat(buf,"+CX");
|
||||
if (dt->right_x ) StrCat(buf,"+RX");
|
||||
if (dt->margin_rel) StrCat(buf,"+MRX");
|
||||
if (dt->blink) StrCat(buf,"+BK");
|
||||
if (dt->invert) StrCat(buf,"+IV");
|
||||
if (dt->underline) StrCat(buf,"+UL");
|
||||
if (dt->tree) StrCat(buf,"+TR");
|
||||
if (dt->collapsed) StrCat(buf,"+C");
|
||||
if (dt->alias) StrCat(buf,"+AL");
|
||||
if (*dt->scroll_x) StrCat(buf,"+SCX");
|
||||
if (*dt->shift_x) StrCat(buf,"+SX");
|
||||
if (*dt->shift_y) StrCat(buf,"+SY");
|
||||
st=MSPrintF("%q",dt->display);
|
||||
PrintF("$$TX%s,\"%Q\"",buf,st);
|
||||
Free(st);
|
||||
if (*dt->shift_x)
|
||||
PrintF(",%s",dt->shift_x);
|
||||
if (*dt->shift_y)
|
||||
PrintF(",%s",dt->shift_y);
|
||||
if (*dt->scroll_x)
|
||||
PrintF(",%s",dt->scroll_x);
|
||||
PrintF("$$");
|
||||
}
|
||||
Free(dt);
|
||||
}
|
||||
|
||||
class EditSongStruct
|
||||
{
|
||||
I1 display[132] fmtstr "$$DA-P,131,\"Displayed Text:%s\"$$\r\n";
|
||||
I1 song[512] fmtstr "$$DA-P,511,\"Song :%s\"$$\r\n";
|
||||
};
|
||||
|
||||
void EditInsertSong()
|
||||
{
|
||||
EditSongStruct *dt=MAllocZ(sizeof(EditSongStruct));
|
||||
if (DoForm(dt,"EditSongStruct",CTRL_L_HELP,TRUE,ctrl_L_header))
|
||||
PrintF("$$SO,\"%s\",\"%s\"$$",dt->display,dt->song);
|
||||
Free(dt);
|
||||
}
|
||||
|
||||
class EditMacroMenuStruct
|
||||
{
|
||||
I1 display[132] fmtstr "$$DA-P,131,\"Displayed Text :%s\"$$\r\n";
|
||||
I1 left_macro[512] fmtstr "$$DA-P,511,\"Left Click Macro :%s\"$$\r\n";
|
||||
I1 left_exp[132] fmtstr "$$DA-P,131,\"Left Click Expression :%s\"$$\r\n";
|
||||
BoolU4 popup fmtstr "$$CB,\"PopUp\"$$\r\n";
|
||||
BoolU4 left_is_auto fmtstr "$$CB,\"Left is AutoStr\"$$\r\n";
|
||||
BoolU4 left_x fmtstr "$$CB,\"Left X \"$$\r\n";
|
||||
BoolU4 center_x fmtstr "$$CB,\"Center X \"$$\r\n";
|
||||
BoolU4 right_x fmtstr "$$CB,\"Right X \"$$\r\n";
|
||||
BoolU4 margin_rel fmtstr "$$CB,\"Margin Rel X\"$$\r\n";
|
||||
BoolU4 blink fmtstr "$$CB,\"Blink\"$$\r\n";
|
||||
BoolU4 invert fmtstr "$$CB,\"Invert\"$$\r\n";
|
||||
BoolU4 underline fmtstr "$$CB,\"Underline\"$$\r\n";
|
||||
BoolU4 escape fmtstr "$$CB,\"Escape\"$$\r\n";
|
||||
I1 scroll_x[132] fmtstr "$$DA-P,131,\"Scroll X Length Expression:%s\"$$\r\n";
|
||||
I1 shift_x[132] fmtstr "$$DA-P,131,\"X Offset Expression :%s\"$$\r\n";
|
||||
I1 shift_y[132] fmtstr "$$DA-P,131,\"Y Offset Expression :%s\"$$\r\n";
|
||||
};
|
||||
|
||||
void EditInsertMacroMenu(BoolU4 is_macro)
|
||||
{
|
||||
I1 *st,buf[132];
|
||||
EditMacroMenuStruct *dt=MAllocZ(sizeof(EditMacroMenuStruct));
|
||||
dt->underline=TRUE;
|
||||
dt->escape=TRUE;
|
||||
if (DoForm(dt,"EditMacroMenuStruct",CTRL_L_HELP,TRUE,ctrl_L_header)) {
|
||||
*buf=0;
|
||||
if (is_macro && *dt->display) StrCat(buf,"+A ");
|
||||
if (dt->popup) StrCat(buf,"+PU-X");
|
||||
if (dt->left_x ) StrCat(buf,"+LX");
|
||||
if (dt->center_x) StrCat(buf,"+CX");
|
||||
if (dt->right_x ) StrCat(buf,"+RX");
|
||||
if (dt->margin_rel) StrCat(buf,"+MRX");
|
||||
if (dt->blink) StrCat(buf,"+BK");
|
||||
if (dt->invert) StrCat(buf,"+IV");
|
||||
if (!dt->underline) StrCat(buf,"-UL");
|
||||
if (!dt->escape) StrCat(buf,"-X");
|
||||
if (*dt->scroll_x) StrCat(buf,"+SCX");
|
||||
if (*dt->shift_x) StrCat(buf,"+SX");
|
||||
if (*dt->shift_y) StrCat(buf,"+SY");
|
||||
if (is_macro) {
|
||||
if (*dt->left_exp) StrCat(buf,"+LE");
|
||||
if (!*dt->left_macro) StrCat(buf,"-LM");
|
||||
} else {
|
||||
if (!*dt->left_exp) StrCat(buf,"-LE");
|
||||
if (*dt->left_macro) StrCat(buf,"+LM");
|
||||
}
|
||||
if (dt->left_is_auto) StrCat(buf,"+LA");
|
||||
if (*dt->display || is_macro) {
|
||||
if (is_macro) {
|
||||
if (*dt->display) {
|
||||
st=MSPrintF("%q",dt->display);
|
||||
PrintF("$$MA %s,\"%Q\"",buf,st);
|
||||
Free(st);
|
||||
} else
|
||||
PrintF("$$MA %s,",buf);
|
||||
} else {
|
||||
st=MSPrintF("%q",dt->display);
|
||||
PrintF("$$MU %s,\"%Q\"",buf,st);
|
||||
Free(st);
|
||||
}
|
||||
if (*dt->left_exp)
|
||||
PrintF(",%s",dt->left_exp);
|
||||
if (*dt->left_macro) {
|
||||
st=MSPrintF("%q",dt->left_macro);
|
||||
PrintF(",\"%Q\"",st);
|
||||
Free(st);
|
||||
}
|
||||
if (*dt->shift_x)
|
||||
PrintF(",%s",dt->shift_x);
|
||||
if (*dt->shift_y)
|
||||
PrintF(",%s",dt->shift_y);
|
||||
if (*dt->scroll_x)
|
||||
PrintF(",%s",dt->scroll_x);
|
||||
PutS("$$");
|
||||
}
|
||||
}
|
||||
Free(dt);
|
||||
}
|
||||
|
||||
class EditButtonStruct
|
||||
{
|
||||
I1 display[132] fmtstr "$$DA-P,131,\"Displayed Text:%s\"$$\r\n";
|
||||
BoolU4 popup fmtstr "$$CB,\"PopUp\"$$\r\n";
|
||||
BoolU4 left_x fmtstr "$$CB,\"Left X \"$$\r\n";
|
||||
BoolU4 center_x fmtstr "$$CB,\"Center X \"$$\r\n";
|
||||
BoolU4 right_x fmtstr "$$CB,\"Right X \"$$\r\n";
|
||||
BoolU4 margin_rel fmtstr "$$CB,\"Margin Rel X\"$$\r\n";
|
||||
BoolU4 escape fmtstr "$$CB,\"Escape\"$$\r\n";
|
||||
I1 left_macro [132] fmtstr "$$DA-P,131,\"Left Click Macro:%s\"$$\r\n";
|
||||
BoolU4 left_is_auto fmtstr "$$CB,\"Left is AutoStr\"$$\r\n";
|
||||
I1 left_exp [132] fmtstr "$$DA-P,131,\"Left Click Expression:%s\"$$\r\n";
|
||||
BoolU4 quote fmtstr "$$CB,\"Quote\"$$\r\n";
|
||||
};
|
||||
|
||||
void EditInsertButton()
|
||||
{
|
||||
I1 *st,buf[132];
|
||||
EditButtonStruct *dt=MAllocZ(sizeof(EditButtonStruct));
|
||||
dt->escape=TRUE;
|
||||
if (DoForm(dt,"EditButtonStruct",CTRL_L_HELP,TRUE,ctrl_L_header)) {
|
||||
*buf=0;
|
||||
if (dt->popup) StrCat(buf,"+PU-X");
|
||||
if (dt->left_x ) StrCat(buf,"+LX");
|
||||
if (dt->center_x) StrCat(buf,"+CX");
|
||||
if (dt->right_x ) StrCat(buf,"+RX");
|
||||
if (dt->margin_rel) StrCat(buf,"+MRX");
|
||||
if (!dt->escape) StrCat(buf,"-X");
|
||||
if (!*dt->left_exp) StrCat(buf,"-LE");
|
||||
if (*dt->left_macro) StrCat(buf,"+LM");
|
||||
if (dt->left_is_auto) StrCat(buf,"+LA");
|
||||
if (dt->display[0]) {
|
||||
if (dt->quote) {
|
||||
st=MSPrintF("%q",dt->display);
|
||||
PrintF("$$$$BT%s,\\\"%Q\\\"",buf,st);
|
||||
Free(st);
|
||||
if (*dt->left_exp)
|
||||
PrintF(",%s",dt->left_exp);
|
||||
if (*dt->left_macro) {
|
||||
st=MSPrintF("%q",dt->left_macro);
|
||||
PrintF(",\\\"%Q\\\"",st);
|
||||
Free(st);
|
||||
}
|
||||
PutS("$$$$");
|
||||
} else {
|
||||
st=MSPrintF("%q",dt->display);
|
||||
PrintF("$$BT%s,\"%Q\"",buf,st);
|
||||
Free(st);
|
||||
if (*dt->left_exp)
|
||||
PrintF(",%s",dt->left_exp);
|
||||
if (*dt->left_macro) {
|
||||
st=MSPrintF("%q",dt->left_macro);
|
||||
PrintF(",\"%Q\"",st);
|
||||
Free(st);
|
||||
}
|
||||
PutS("$$");
|
||||
}
|
||||
}
|
||||
}
|
||||
Free(dt);
|
||||
}
|
||||
|
||||
|
||||
class EditCursorMovementStruct
|
||||
{
|
||||
I1 left_exp[132] fmtstr "$$DA-P,131,\"X Expression:%s\"$$\r\n";
|
||||
I1 right_exp[132] fmtstr "$$DA-P,131,\"Y Expression:%s\"$$\r\n";
|
||||
BoolU4 left_x fmtstr "$$CB,\"Left X \"$$\r\n";
|
||||
BoolU4 center_x fmtstr "$$CB,\"Center X \"$$\r\n";
|
||||
BoolU4 right_x fmtstr "$$CB,\"Right X \"$$\r\n";
|
||||
BoolU4 margin_rel fmtstr "$$CB,\"Margin Rel X\"$$\r\n";
|
||||
BoolU4 top_y fmtstr "$$CB,\"Top Y \"$$\r\n";
|
||||
BoolU4 center_y fmtstr "$$CB,\"Center Y \"$$\r\n";
|
||||
BoolU4 bottom_y fmtstr "$$CB,\"Bottom Y \"$$\r\n";
|
||||
BoolU4 page_rel fmtstr "$$CB,\"Page Rel Y\"$$\r\n";
|
||||
BoolU4 quote fmtstr "$$CB,\"Quote\"$$\r\n";
|
||||
};
|
||||
|
||||
void EditInsertCursorMovement()
|
||||
{
|
||||
I1 buf[132];
|
||||
EditCursorMovementStruct *dt=MAllocZ(sizeof(EditCursorMovementStruct));
|
||||
if (DoForm(dt,"EditCursorMovementStruct",CTRL_L_HELP,TRUE,ctrl_L_header)) {
|
||||
*buf=0;
|
||||
if (dt->left_x ) StrCat(buf,"+LX");
|
||||
if (dt->center_x) StrCat(buf,"+CX");
|
||||
if (dt->right_x ) StrCat(buf,"+RX");
|
||||
if (dt->margin_rel) StrCat(buf,"+MRX");
|
||||
if (dt->top_y ) StrCat(buf,"+TY");
|
||||
if (dt->center_y) StrCat(buf,"+CY");
|
||||
if (dt->bottom_y) StrCat(buf,"+BY");
|
||||
if (dt->page_rel) StrCat(buf,"+PRY");
|
||||
if (!*dt->left_exp) StrCat(buf,"-LE");
|
||||
if (!*dt->right_exp) StrCat(buf,"-RE");
|
||||
if (dt->quote)
|
||||
PutS("$$");
|
||||
PrintF("$$CM%s",buf);
|
||||
if (*dt->left_exp)
|
||||
PrintF(",%s",dt->left_exp);
|
||||
if (*dt->right_exp)
|
||||
PrintF(",%s",dt->right_exp);
|
||||
PutS("$$");
|
||||
if (dt->quote)
|
||||
PutS("$$");
|
||||
}
|
||||
Free(dt);
|
||||
}
|
||||
|
||||
class EditDataStruct
|
||||
{
|
||||
I1 format_str [132] fmtstr "$$DA-P,131,\"Format Str:%s\"$$\r\n";
|
||||
U8 len fmtstr "$$DA,256,\"Length:%d\"$$\r\n";
|
||||
BoolU4 term fmtstr "$$CB,\"Terminator\"$$\r\n";
|
||||
BoolU4 str fmtstr "$$CB,\"Str\"$$\r\n";
|
||||
BoolU4 refresh fmtstr "$$CB,\"Refresh Data\"$$\r\n";
|
||||
};
|
||||
|
||||
void EditInsertData()
|
||||
{
|
||||
I1 *st,buf[132];
|
||||
EditDataStruct *dt=MAllocZ(sizeof(EditDataStruct));
|
||||
dt->term=TRUE;
|
||||
dt->len=256;
|
||||
if (DoForm(dt,"EditDataStruct",CTRL_L_HELP,TRUE,ctrl_L_header)) {
|
||||
*buf=0;
|
||||
if (dt->str) StrCat(buf,"-P");
|
||||
if (!dt->term) StrCat(buf,"-T");
|
||||
if (dt->refresh) StrCat(buf,"+RD");
|
||||
st=MSPrintF("%q",dt->format_str);
|
||||
PrintF("$$$$DA%s,%d,\\\"%Q\\\"$$$$",
|
||||
buf,dt->len,st);
|
||||
Free(st);
|
||||
}
|
||||
Free(dt);
|
||||
}
|
||||
|
||||
class EditCheckBoxStruct
|
||||
{
|
||||
I1 label [132] fmtstr "$$DA-P,131,\"Displayed Text:%s\"$$\r\n";
|
||||
BoolU4 refresh fmtstr "$$CB,\"Refresh Data\"$$\r\n";
|
||||
};
|
||||
|
||||
void EditInsertCheckBox()
|
||||
{
|
||||
I1 *st,buf[132];
|
||||
EditCheckBoxStruct *dt=MAllocZ(sizeof(EditCheckBoxStruct));
|
||||
if (DoForm(dt,"EditCheckBoxStruct",CTRL_L_HELP,TRUE)) {
|
||||
*buf=0;
|
||||
if (dt->refresh) StrCat(buf,"+RD");
|
||||
st=MSPrintF("%q",dt->label);
|
||||
PrintF("$$$$CB %s,\\\"%Q\\\"$$$$",
|
||||
buf,st);
|
||||
Free(st);
|
||||
}
|
||||
Free(dt);
|
||||
}
|
||||
|
||||
class EditHexEditStruct
|
||||
{
|
||||
U8 cnt fmtstr "$$DA,256,\"Count:%d\"$$\r\n";
|
||||
U8 cols fmtstr "$$DA,256,\"Columns:%d\"$$\r\n";
|
||||
BoolU4 zero fmtstr "$$CB,\"Zero Based\"$$\r\n";
|
||||
BoolU4 refresh fmtstr "$$CB,\"Refresh Data\"$$\r\n";
|
||||
};
|
||||
|
||||
void EditInsertHexEdit()
|
||||
{
|
||||
I1 buf[132];
|
||||
EditHexEditStruct *dt=MAllocZ(sizeof(EditHexEditStruct));
|
||||
dt->cnt=128;
|
||||
dt->cols=4;
|
||||
dt->zero=TRUE;
|
||||
if (DoForm(dt,"EditHexEditStruct",CTRL_L_HELP,TRUE,ctrl_L_header)) {
|
||||
*buf=0;
|
||||
if (!dt->zero) StrCat(buf,"-Z");
|
||||
if (dt->refresh) StrCat(buf,"+RD");
|
||||
PrintF("$$$$HX %s,%d,%d$$$$",
|
||||
buf,dt->cnt,dt->cols);
|
||||
}
|
||||
Free(dt);
|
||||
}
|
||||
|
||||
class EditTreeStruct
|
||||
{
|
||||
I1 label[132] fmtstr "$$DA-P,131,\"Displayed Text:%s\"$$\r\n";
|
||||
I8 indent fmtstr "$$DA,131,\"Indention:%d\"$$\r\n";
|
||||
BoolU4 collapsed fmtstr "$$CB,\"Collapsed\"$$\r\n";
|
||||
};
|
||||
|
||||
void EditInsertTree()
|
||||
{
|
||||
I1 *st,*st2,buf[132];
|
||||
EditTreeStruct *dt=MAllocZ(sizeof(EditTreeStruct));
|
||||
dt->collapsed=TRUE;
|
||||
dt->indent=2;
|
||||
if (DoForm(dt,"EditTreeStruct",CTRL_L_HELP,TRUE,ctrl_L_header)) {
|
||||
*buf=0;
|
||||
if (!dt->collapsed) StrCat(buf,"-C");
|
||||
st=MSPrintF("%q",dt->label);
|
||||
st2=MSPrintF("$$TR %s,\"%Q\"$$\r\n$$ID,%d$$*\r\n$$ID,%d$$",
|
||||
buf,st,dt->indent,-dt->indent);
|
||||
LtfSafeInsert(Fs->cur_ltf,st2);
|
||||
Free(st);
|
||||
Free(st2);
|
||||
}
|
||||
Free(dt);
|
||||
}
|
||||
|
||||
void EditInsertHidden()
|
||||
{
|
||||
LtfSafeInsert(Fs->cur_ltf,"$$HS$$*$$HE$$");
|
||||
}
|
||||
|
||||
void EditInsertDollarCmd()
|
||||
{
|
||||
I8 type=PopUpDollarType;
|
||||
switch (type) {
|
||||
case LTFT_FOREGROUND_COLOR:
|
||||
EditInsertColor;
|
||||
break;
|
||||
case LTFT_PAGE_LENGTH:
|
||||
EditInsertPageSetting;
|
||||
break;
|
||||
case LTFT_LINK:
|
||||
EditInsertLink;
|
||||
break;
|
||||
case LTFT_TEXT:
|
||||
EditInsertDollarText;
|
||||
break;
|
||||
case LTFT_TREE:
|
||||
EditInsertTree;
|
||||
break;
|
||||
case LTFT_MACRO:
|
||||
EditInsertMacroMenu(TRUE);
|
||||
break;
|
||||
case LTFT_MENU_VALUE:
|
||||
EditInsertMacroMenu(FALSE);
|
||||
break;
|
||||
case LTFT_CURSOR_MOVEMENT:
|
||||
EditInsertCursorMovement;
|
||||
break;
|
||||
case LTFT_BUTTON:
|
||||
EditInsertButton;
|
||||
break;
|
||||
case LTFT_DATA:
|
||||
EditInsertData;
|
||||
break;
|
||||
case LTFT_CHECK_BOX:
|
||||
EditInsertCheckBox;
|
||||
break;
|
||||
case LTFT_HEX_EDIT:
|
||||
EditInsertHexEdit;
|
||||
break;
|
||||
case LTFT_HIDE_START:
|
||||
EditInsertHidden;
|
||||
break;
|
||||
case LTFT_SONG:
|
||||
EditInsertSong;
|
||||
break;
|
||||
}
|
||||
}
|
||||
I8 PopUpPictureType()
|
||||
{
|
||||
I8 i;
|
||||
Ltf *l=LtfNew;
|
||||
LtfPutSExt(l,"$$MU,\"Just Picture\",1$$\r\n");
|
||||
LtfPutSExt(l,"$$MU,\"Macro\",2$$\r\n");
|
||||
LtfPutSExt(l,"$$MU,\"Menu Item\",3$$\r\n");
|
||||
LtfPutSExt(l,"$$MU,\"Link\",4$$\r\n");
|
||||
LtfPutSExt(l,"$$MU,\"CANCEL\",-1$$");
|
||||
i=PopUpMenu(l);
|
||||
LtfDel(l);
|
||||
return i;
|
||||
}
|
||||
|
||||
class EditJustPictureStruct
|
||||
{
|
||||
I1 display[132] fmtstr "$$DA-P,131,\"Displayed Text :%s\"$$\r\n";
|
||||
};
|
||||
|
||||
class EditMacroPictureStruct
|
||||
{
|
||||
I1 display[132] fmtstr "$$DA-P,131,\"Displayed Text :%s\"$$\r\n";
|
||||
I1 exp[512] fmtstr "$$DA-P,511,\"Macro :%s\"$$\r\n";
|
||||
BoolU4 escape fmtstr "$$CB,\"Escape\"$$\r\n";
|
||||
BoolU4 popup fmtstr "$$CB,\"PopUp\"$$\r\n";
|
||||
BoolU4 is_auto fmtstr "$$CB,\"AutoStr\"$$\r\n";
|
||||
};
|
||||
|
||||
class EditMenuPictureStruct
|
||||
{
|
||||
I1 display[132] fmtstr "$$DA-P,131,\"Displayed Text :%s\"$$\r\n";
|
||||
I1 exp[512] fmtstr "$$DA-P,511,\"Expression :%s\"$$\r\n";
|
||||
BoolU4 escape fmtstr "$$CB,\"Escape\"$$\r\n";
|
||||
};
|
||||
|
||||
I1 *EditPictureLink()
|
||||
{
|
||||
I1 *result=NULL,*display=NULL,*link=NULL;
|
||||
BoolU4 quote=FALSE;
|
||||
I8 type=PopUpLinkType(FALSE);
|
||||
if (type>=0) {
|
||||
if (PmtLink(type,&display,&link,"e))
|
||||
result=MSPrintF("\"%s\",\"%s\"",display,link);
|
||||
}
|
||||
Free(display);
|
||||
Free(link);
|
||||
return result;
|
||||
}
|
||||
|
||||
I1 *EditPicture()
|
||||
{
|
||||
I8 type=PopUpPictureType;
|
||||
I1 *st,*st1=NULL,*st2=NULL,buf[132];
|
||||
EditMacroPictureStruct *dt=MAllocZ(sizeof(EditMacroPictureStruct));
|
||||
*buf=0;
|
||||
switch (type) {
|
||||
case 1:
|
||||
if (DoForm(dt,"EditJustPictureStruct",CTRL_L_HELP,TRUE))
|
||||
st1=MSPrintF("\"%Q\"",dt->display);
|
||||
break;
|
||||
case 2:
|
||||
dt->escape=TRUE;
|
||||
if (DoForm(dt,"EditMacroPictureStruct",CTRL_L_HELP,TRUE)) {
|
||||
StrCat(buf,"+LM+UL");
|
||||
if (dt->is_auto) StrCat(buf,"+LA");
|
||||
if (dt->popup) StrCat(buf,"+PU");
|
||||
if (dt->escape) StrCat(buf,"+X");
|
||||
st=MSPrintF("%q",dt->exp);
|
||||
st1=MSPrintF("\"%Q\",\"%Q\"",dt->display,st);
|
||||
Free(st);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
dt->escape=TRUE;
|
||||
if (DoForm(dt,"EditMenuPictureStruct",CTRL_L_HELP,TRUE)) {
|
||||
StrCat(buf,"+LE");
|
||||
if (dt->escape) StrCat(buf,"+X");
|
||||
st1=MSPrintF("\"%Q\",\"%Q\"",dt->display,dt->exp);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
StrCat(buf,"+L+A");
|
||||
st1=EditPictureLink;
|
||||
break;
|
||||
}
|
||||
if (st1) {
|
||||
st2=MSPrintF("$$PI%s,%s$$",buf,st1);
|
||||
Free(st1);
|
||||
}
|
||||
Free(dt);
|
||||
return st2;
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,313 @@
|
||||
public void LtfLoad(Ltf *l,I1 *src2,U8 size)
|
||||
{
|
||||
I8 i;
|
||||
I1 *src;
|
||||
LtfBinEntry *tempb;
|
||||
if (src2) {
|
||||
LtfPutSExt(l,src2);
|
||||
src=src2+StrLen(src2)+1;
|
||||
i=size-(offset(LtfBinEntry.data)-offset(LtfBinEntry.start));
|
||||
while (src<=src2+i) {
|
||||
tempb=MAllocZ(sizeof(LtfBinEntry),l->mem_tss);
|
||||
MemCpy(&tempb->start,src,offset(LtfBinEntry.data)-offset(LtfBinEntry.start));
|
||||
src+=offset(LtfBinEntry.data)-offset(LtfBinEntry.start);
|
||||
tempb->data=MAlloc(tempb->size,l->mem_tss);
|
||||
if (tempb->size) {
|
||||
MemCpy(tempb->data,src,tempb->size);
|
||||
src+=tempb->size;
|
||||
}
|
||||
InsQue(tempb,l->bin_root.last);
|
||||
if (tempb->num>=l->cur_bin_num)
|
||||
l->cur_bin_num=tempb->num+1;
|
||||
}
|
||||
}
|
||||
if (!(l->flags & (LTFF_PLAIN_TEXT|LTFF_PLAIN_TEXT_WITH_TABS)))
|
||||
LtfValidateBins(l);
|
||||
l->recalc_start=l;
|
||||
LtfRecalc(l);
|
||||
}
|
||||
|
||||
public Ltf *LtfRead(I1 *name,U8 flags=0)
|
||||
{
|
||||
Ltf *l=LtfNew;
|
||||
I1 *src,*name2;
|
||||
U8 size=0;
|
||||
l->flags|=flags;
|
||||
name2=AbsoluteFileName(name);
|
||||
StrCpy(l->filename.name,name2);
|
||||
src=ReadFile(name2,&size,&l->file_attr);
|
||||
Free(name2);
|
||||
|
||||
if (src) {
|
||||
LtfLoad(l,src,size);
|
||||
Free(src);
|
||||
}
|
||||
return l;
|
||||
}
|
||||
|
||||
public void *LtfSave(Ltf *l,U8 *size=NULL)
|
||||
{
|
||||
LtfEntry *cl;
|
||||
LtfBinEntry *b;
|
||||
I1 *st;
|
||||
U8 cnt=2; //cursor + terminator
|
||||
I1 *result,*dst,*src,ch;
|
||||
I8 i;
|
||||
if (!(l->flags & (LTFF_PLAIN_TEXT|LTFF_PLAIN_TEXT_WITH_TABS)))
|
||||
LtfValidateBins(l);
|
||||
l->recalc_start=l;
|
||||
LtfRecalc(l);
|
||||
for (cl=l->dummy.next;cl!=l;cl=cl->next) {
|
||||
if (!Bt(ltf_data_types,cl->btype)) {
|
||||
if (cl->btype==LTFT_TEXT &&
|
||||
!(cl->flags & ~(LTFLF_WORD_WRAP |LTFLF_UNDERLINED |
|
||||
LTFLF_INVERTED | LTFLF_BLINK | LTFLF_SKIP))) {
|
||||
cnt+=StrLen(cl->display);
|
||||
if (!(l->flags & (LTFF_PLAIN_TEXT | LTFF_PLAIN_TEXT_WITH_TABS)))
|
||||
cnt+=Occurrences(cl->display,'$$');
|
||||
} else if (cl->btype==LTFT_TAB ||
|
||||
cl->btype==LTFT_PAGE_BREAK)
|
||||
cnt++;
|
||||
else if (cl->btype==LTFT_CR)
|
||||
cnt+=2;
|
||||
else if (cl->btype==LTFT_PICWORD)
|
||||
cnt+=StrLen(cl->aux_str);
|
||||
else if (cl->btype!=LTFT_SOFT_CR &&
|
||||
cl->btype!=LTFT_CURSOR &&
|
||||
cl->btype!=LTFT_BPT) {
|
||||
st=LtfToPlainText(l,cl);
|
||||
cnt+=StrLen(st)+2;
|
||||
Free(st,l->mem_tss);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (b=l->bin_root.next;b!=&l->bin_root;b=b->next) {
|
||||
if (b->use_cnt>b->temp_use_cnt)
|
||||
cnt+=offset(LtfBinEntry.data)-
|
||||
offset(LtfBinEntry.start)+b->size;
|
||||
}
|
||||
result=MAlloc(cnt);
|
||||
dst=result;
|
||||
for (cl=l->dummy.next;cl!=l;cl=cl->next) {
|
||||
if (!Bt(ltf_data_types,cl->btype)) {
|
||||
if (cl->btype==LTFT_TEXT &&
|
||||
!(cl->flags & ~(LTFLF_WORD_WRAP |LTFLF_UNDERLINED |
|
||||
LTFLF_INVERTED | LTFLF_BLINK | LTFLF_SKIP))) {
|
||||
src=cl->display;
|
||||
i=0;
|
||||
while (ch=*src++) {
|
||||
if (cl==l->cur_entry && i++==l->cur_data_col)
|
||||
*dst++=CH_CURSOR;
|
||||
*dst++=ch;
|
||||
if (ch=='$$') {
|
||||
if (!(l->flags & (LTFF_PLAIN_TEXT | LTFF_PLAIN_TEXT_WITH_TABS)))
|
||||
*dst++=ch;
|
||||
}
|
||||
}
|
||||
if (cl==l->cur_entry && i++==l->cur_data_col)
|
||||
*dst++=CH_CURSOR;
|
||||
} else {
|
||||
if (cl==l->cur_entry)
|
||||
*dst++=CH_CURSOR;
|
||||
if (cl->btype==LTFT_TAB)
|
||||
*dst++=CH_TAB;
|
||||
else if (cl->btype==LTFT_PAGE_BREAK)
|
||||
*dst++=CH_FORM_FEED;
|
||||
else if (cl->btype==LTFT_CR) {
|
||||
*dst++=CH_CR;
|
||||
*dst++=CH_LINE_FEED;
|
||||
} else if (cl->btype==LTFT_PICWORD) {
|
||||
StrCpy(dst,cl->aux_str);
|
||||
dst+=StrLen(cl->aux_str);
|
||||
} else if (cl->btype!=LTFT_SOFT_CR &&
|
||||
cl->btype!=LTFT_CURSOR &&
|
||||
cl->btype!=LTFT_BPT) {
|
||||
*dst++='$$';
|
||||
st=LtfToPlainText(l,cl);
|
||||
StrCpy(dst,st);
|
||||
dst+=StrLen(st);
|
||||
*dst++='$$';
|
||||
Free(st,l->mem_tss);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*dst++=0;
|
||||
b=l->bin_root.next;
|
||||
if (b!=&l->bin_root) {
|
||||
while (b!=&l->bin_root) {
|
||||
if (b->use_cnt>b->temp_use_cnt) {
|
||||
MemCpy(dst,&b->type,offset(LtfBinEntry.data)-offset(LtfBinEntry.start));
|
||||
dst+=offset(LtfBinEntry.data)-offset(LtfBinEntry.start);
|
||||
MemCpy(dst,b->data,b->size);
|
||||
dst+=b->size;
|
||||
}
|
||||
b=b->next;
|
||||
}
|
||||
} else
|
||||
cnt--;
|
||||
if (size) *size=cnt;
|
||||
return result;
|
||||
}
|
||||
|
||||
public void LtfWrite(Ltf *l,BoolU4 prompt=FALSE)
|
||||
{
|
||||
U8 size;
|
||||
I1 *buf=LtfSave(l,&size);
|
||||
if (prompt) {
|
||||
if (DoForm(&l->filename,"EditFileNameStruct"))
|
||||
WriteFile(l->filename.name,buf,size,0,l->file_attr);
|
||||
} else
|
||||
WriteFile(l->filename.name,buf,size,0,l->file_attr);
|
||||
Free(buf);
|
||||
}
|
||||
|
||||
public void DelClipboard()
|
||||
{
|
||||
LtfReset(sys_clipboard_ltf,TRUE);
|
||||
}
|
||||
|
||||
public void EditCopyToClipboard(Ltf *l)
|
||||
{
|
||||
Ltf *b=sys_clipboard_ltf;
|
||||
LtfEntry *cl=l->dummy.next,*nl;
|
||||
DelClipboard;
|
||||
while (cl!=l) {
|
||||
if (cl->type & LTFLT_SELECTED) {
|
||||
cl->type&=~LTFLT_SELECTED;
|
||||
if (!Bt(ltf_data_types,cl->btype)) {
|
||||
nl=LtfCopyEntry(b,cl);
|
||||
InsQue(nl,b->dummy.last);
|
||||
}
|
||||
}
|
||||
cl=cl->next;
|
||||
}
|
||||
}
|
||||
|
||||
public void EditCutToClipboard(Ltf *l)
|
||||
{
|
||||
Ltf *b=sys_clipboard_ltf;
|
||||
LtfEntry *cl=l->dummy.next,*cl1,*nl,*cl2=NULL;
|
||||
DelClipboard;
|
||||
while (cl!=l) {
|
||||
cl1=cl->next;
|
||||
if (cl->type & LTFLT_SELECTED) {
|
||||
cl->type&=~LTFLT_SELECTED;
|
||||
if (!Bt(ltf_data_types,cl->btype)) {
|
||||
nl=LtfCopyEntry(b,cl);
|
||||
InsQue(nl,b->dummy.last);
|
||||
}
|
||||
if (cl==l->cur_entry || cl==cl2)
|
||||
cl2=cl->next;
|
||||
LtfDelEntry(l,cl);
|
||||
}
|
||||
cl=cl1;
|
||||
}
|
||||
if (cl2) {
|
||||
l->cur_entry=cl2;
|
||||
l->cur_data_col=cl2->min_col;
|
||||
}
|
||||
l->recalc_start=l;
|
||||
LtfRemoveSoftCRs(l,NULL);
|
||||
}
|
||||
|
||||
public void EditInsertLtf(Ltf *l,Ltf *b)
|
||||
{ //TODO: $LK,"LtfReset","MN:LtfReset"$
|
||||
I1 *dst;
|
||||
BoolU4 old_preempt=Preempt(OFF);
|
||||
LtfEntry *nl,*cl=b->dummy.next;
|
||||
LtfRemoveSoftCRs(l,NULL);
|
||||
if (l->cur_entry->btype==LTFT_TEXT &&
|
||||
l->cur_data_col>l->cur_entry->min_col) {
|
||||
if (l->cur_data_col<l->cur_entry->max_col) {
|
||||
nl=MAllocZ(sizeof(LtfEntryBase)+sizeof(void *),l->mem_tss);
|
||||
nl->type=LTFT_TEXT | l->cur_entry->type & 0xFFFFFF00;
|
||||
nl->flags=l->cur_entry->flags;
|
||||
nl->x=l->cur_entry->x;
|
||||
nl->y=l->cur_entry->y;
|
||||
nl->indent=l->cur_entry->indent;
|
||||
nl->page_line_num=l->cur_entry->page_line_num;
|
||||
nl->left_margin=l->cur_entry->left_margin;
|
||||
nl->right_margin=l->cur_entry->right_margin;
|
||||
dst=l->cur_entry->display+l->cur_data_col;
|
||||
nl->display=NewStr(dst,l->mem_tss);
|
||||
nl->max_col=StrLen(dst);
|
||||
*dst=0;
|
||||
l->cur_entry->max_col=l->cur_data_col;
|
||||
InsQue(nl,l->cur_entry);
|
||||
l->cur_entry=nl;
|
||||
l->cur_data_col=nl->min_col;
|
||||
} else
|
||||
if (l->cur_entry!=l)
|
||||
l->cur_entry=l->cur_entry->next;
|
||||
}
|
||||
while (cl!=b) {
|
||||
if (cl->btype!=LTFT_SOFT_CR) {
|
||||
nl=LtfCopyEntry(l,cl);
|
||||
InsQue(nl,l->cur_entry->last);
|
||||
}
|
||||
cl=cl->next;
|
||||
}
|
||||
l->recalc_start=l;
|
||||
Preempt(old_preempt);
|
||||
}
|
||||
|
||||
|
||||
BoolU4 LtfCaptureUndo(Ltf *l)
|
||||
{
|
||||
BoolU4 result=FALSE,old_preempt=Preempt(OFF);
|
||||
U8 i=GetTimeStamp;
|
||||
LtfUndo *u;
|
||||
if (l->flags<FF_UNDO_DIRTY &&
|
||||
i>l->undo_root.last->timestamp+15*time_stamp_freq &&
|
||||
l->flags<FF_ALLOW_UNDO) {
|
||||
u=MAllocZ(sizeof(LtfUndo),l->mem_tss);
|
||||
u->timestamp=i;
|
||||
u->body=LtfSave(l,&u->size);
|
||||
InsQue(u,l->undo_root.last);
|
||||
l->flags&=~LTFF_UNDO_DIRTY;
|
||||
l->undo_cnt++;
|
||||
u->ltf_flags=l->flags;
|
||||
}
|
||||
Preempt(old_preempt);
|
||||
return result;
|
||||
}
|
||||
|
||||
void LtfRestoreUndo(Ltf *l)
|
||||
{
|
||||
BoolU4 old_preempt=Preempt(OFF);
|
||||
LtfUndo *u=l->undo_root.last,*u_next,*u_last;
|
||||
Ltf *m;
|
||||
if (u!=&l->undo_root) {
|
||||
RemQue(u);
|
||||
u_next=l->undo_root.next;
|
||||
u_last=l->undo_root.last;
|
||||
l->undo_root.next=&l->undo_root;
|
||||
l->undo_root.last=&l->undo_root;
|
||||
m=l->menu_ltf;
|
||||
LtfReset(l,TRUE);
|
||||
l->flags=u->ltf_flags;
|
||||
LtfLoad(l,u->body,u->size);
|
||||
LtfDelUndo(l,u);
|
||||
l->undo_root.next=u_next;
|
||||
l->undo_root.last=u_last;
|
||||
l->menu_ltf=m;
|
||||
}
|
||||
LtfSetUndoCnt(l);
|
||||
l->flags&=~LTFF_UNDO_DIRTY;
|
||||
Preempt(old_preempt);
|
||||
}
|
||||
|
||||
|
||||
#help_index "File/Cmd Line (Typically);Ltf/Cmd Line (Typically)"
|
||||
|
||||
public void Type(I1 *name)
|
||||
//Output a file to the command line.
|
||||
//Even graphics and macros will be sent.
|
||||
{
|
||||
Ltf *l=LtfRead(name);
|
||||
EditInsertLtf(Fs->cur_ltf,l);
|
||||
LtfDel(l);
|
||||
}
|
||||
#help_index "Ltf"
|
||||
| ||||