931 lines
27 KiB
Plaintext
931 lines
27 KiB
Plaintext
#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;
|
|
}
|