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.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,84 +0,0 @@
|
||||
//This is the startup file for new local users
|
||||
UseConsoleLtf("USER.MUZ");
|
||||
Fs->answers_displayed=2; //from 0-8
|
||||
|
||||
LoadAdam3;
|
||||
|
||||
U8 F(I1 *pattern,I1 *flags="+r+i")
|
||||
{
|
||||
return Grep(pattern,"/LT/"TEXT_FILE_MASK,flags);
|
||||
}
|
||||
|
||||
U8 R(I1 *pattern,I1 *replace_text=NULL,I1 *flags="+r+l")
|
||||
{
|
||||
return Grep(pattern,"/LT/"TEXT_FILE_MASK,flags,replace_text);
|
||||
}
|
||||
|
||||
U8 FD(I1 *pattern,I1 *flags="+r+i")
|
||||
{
|
||||
return Grep(pattern,TEXT_FILE_MASK,flags);
|
||||
}
|
||||
|
||||
U8 RD(I1 *pattern,I1 *replace_text=NULL,I1 *flags="+r+l")
|
||||
{
|
||||
return Grep(pattern,TEXT_FILE_MASK,flags,replace_text);
|
||||
}
|
||||
|
||||
|
||||
PutSysText("ST_USER_STARTUP");
|
||||
Type("/LT/DOC/Help.TXZ");
|
||||
Fs->scroll_speed=10;
|
||||
Bts(&Fs->crt_flags,CRTf_SHOW);
|
||||
|
||||
|
||||
Type("/LT/DOC/StartUp.TXZ");
|
||||
|
||||
I1 src,dst,*st1,*st2;
|
||||
I4 i;
|
||||
|
||||
if (Fs->user_num==1) {
|
||||
for (i=0;i<10;i++) CrLf;
|
||||
coutln "This will reformat or delete old installations, "
|
||||
"copy files onto a partition, recompile "
|
||||
"and modify the boot sector. For this "
|
||||
"to work, your hard disk partition must "
|
||||
"already be bootable with a boot loader like LILO. "
|
||||
"Obviously, the partition "
|
||||
"you select will lose data and be destroyed. ";
|
||||
cout "Continue ";
|
||||
if (YorN) {
|
||||
cout "\r\nWould you like to view notes on installation, first";
|
||||
if (YorN)
|
||||
Edit("/LT/DOC/Install.TXZ");
|
||||
coutln "\r\n$$BK,1$$$$FG,PURPLE$$Add Drives so you can install.$$FG$$$$BK,0$$";
|
||||
AddDrives;
|
||||
src=default_drive;
|
||||
cout "\r\n\r\n\r\n$$BK,1$$$$FG,PURPLE$$Destination Drive:$$FG$$$$BK,0$$";
|
||||
dst=GetChar;
|
||||
coutln;
|
||||
st1=MSPrintF("%c:/LT",src);
|
||||
st2=MSPrintF("%c:/LT",dst);
|
||||
|
||||
PrintF("Format %c drive ",dst);
|
||||
if (YorN) {
|
||||
coutln;
|
||||
Format(dst,TRUE,FALSE,PT_LT);
|
||||
} else {
|
||||
cout "\r\n$$BK 1$$WARNING$$BK 0$$ if you answer yes to the following "
|
||||
"you will lose all files in your /LT directory.\r\n";
|
||||
cout "Delete ",st2," Directory ";
|
||||
if (YorN)
|
||||
DelTree(st2);
|
||||
coutln;
|
||||
}
|
||||
CopyTree(st1,st2);
|
||||
st2=MSPrintF("%c:/0000BOOT",dst);
|
||||
MkDir(st2);
|
||||
Free(st2);
|
||||
st2=MSPrintF("%c:/TEMP",dst);
|
||||
MkDir(st2);
|
||||
Free(st2);
|
||||
InstallBoot(dst);
|
||||
}
|
||||
|
||||
}
|
||||
Binary file not shown.
@@ -1,114 +0,0 @@
|
||||
while (!initial_user_tasks_startup_complete)
|
||||
SwapInNext;
|
||||
|
||||
void ASCIIKeys(I1 *st)
|
||||
{
|
||||
U8 ch;
|
||||
I1 buf[80];
|
||||
do {
|
||||
ch=GetKey;
|
||||
if (ch==*st) {
|
||||
PutChar(ch);
|
||||
st++;
|
||||
} else {
|
||||
if (*st==CH_CR)
|
||||
SPrintF(buf,"Press the '$$FG GREEN$$ENTER$$FG$$' key");
|
||||
else
|
||||
SPrintF(buf,"Press the '$$FG GREEN$$%c$$FG$$' key",*st);
|
||||
PopUpOk(buf);
|
||||
}
|
||||
} while (*st);
|
||||
}
|
||||
|
||||
void SlowASCIIAutoType(I1 *st)
|
||||
{
|
||||
U8 ch;
|
||||
do {
|
||||
if (ch=*st++) {
|
||||
PutChar(ch);
|
||||
Sleep(100);
|
||||
}
|
||||
} while (ch);
|
||||
}
|
||||
|
||||
void SpecialKey(U8 scancode,I1 *name)
|
||||
{
|
||||
U8 sc,ch;
|
||||
I1 buf[80];
|
||||
do {
|
||||
ch=GetChar2(&sc);
|
||||
if (sc&0xFF!=SC_PRTSCRN1) {
|
||||
if (sc&0xFF!=scancode&0xFF) {
|
||||
SPrintF(buf,"Press the '$$FG GREEN$$%s$$FG$$' key",name);
|
||||
PopUpOk(buf);
|
||||
}
|
||||
}
|
||||
} while (sc&0xFF!=scancode&0xFF);
|
||||
Msg(MSG_KEY_DOWN,ch,sc);
|
||||
}
|
||||
|
||||
void SpecialASCIIKey(U8 ch1,I1 *name,U8 flag_mask=0,U8 flags=0)
|
||||
{
|
||||
U8 sc,ch;
|
||||
I1 buf[80];
|
||||
do {
|
||||
ch=GetChar2(&sc);
|
||||
if (ch && ch!=ch1) {
|
||||
SPrintF(buf,"Press the '$$FG GREEN$$%s$$FG$$' key",name);
|
||||
PopUpOk(buf);
|
||||
}
|
||||
} while (ch!=ch1 || (sc&flag_mask!=flags));
|
||||
Msg(MSG_KEY_DOWN,ch,sc);
|
||||
}
|
||||
|
||||
void UntilSpecialKey(U8 scancode)
|
||||
{
|
||||
U8 sc,ch;
|
||||
do {
|
||||
ch=GetChar2(&sc);
|
||||
Msg(MSG_KEY_DOWN,ch,sc);
|
||||
} while (sc&0xFF!=scancode&0xFF);
|
||||
}
|
||||
|
||||
void UntilASCIIKey(U8 ch1)
|
||||
{
|
||||
U8 sc,ch;
|
||||
do {
|
||||
ch=GetChar2(&sc);
|
||||
Msg(MSG_KEY_DOWN,ch,sc);
|
||||
} while (ch!=ch1);
|
||||
}
|
||||
|
||||
public I8 PopUpTourPart()
|
||||
{
|
||||
I8 i;
|
||||
Ltf *l=LtfNew;
|
||||
LtfPutS(l,"$$FG PURPLE$$LoseThos Tours$$FG$$\r\n\r\n");
|
||||
LtfPutS(l,"$$CM +LX, 4,4$$$$BT, \"Part 1: The basics\",1$$");
|
||||
LtfPutS(l,"$$CM +LX, 4,4$$$$BT, \"Part 2: Editing and running programs\",2$$");
|
||||
LtfPutS(l,"$$CM +LX, 4,4$$$$BT, \"Part 3: Adding macros to your start menu\",3$$");
|
||||
LtfPutS(l,"$$CM +LX, 4,4$$$$BT, \"Part 4: WordStat\",4$$");
|
||||
LtfPutS(l,"$$CM +LX, 4,4$$$$BT, \"Done\",-1$$");
|
||||
i=PopUpMenu(l);
|
||||
LtfDel(l);
|
||||
return i;
|
||||
}
|
||||
|
||||
I8 i;
|
||||
do {
|
||||
switch (i=PopUpTourPart)
|
||||
{
|
||||
case 1:
|
||||
ExecuteFile("::/LT/ACCOUNTS/TOUR/TOUR1.AUZ");
|
||||
break;
|
||||
case 2:
|
||||
ExecuteFile("::/LT/ACCOUNTS/TOUR/TOUR2.AUZ");
|
||||
break;
|
||||
case 3:
|
||||
ExecuteFile("::/LT/ACCOUNTS/TOUR/TOUR3.AUZ");
|
||||
break;
|
||||
case 4:
|
||||
ExecuteFile("::/LT/ACCOUNTS/TOUR/TOUR4.AUZ");
|
||||
break;
|
||||
}
|
||||
} while (i>=1);
|
||||
@@ -1,101 +0,0 @@
|
||||
//This puts the cursor at the bottom
|
||||
Msg(MSG_KEY_DOWN,0,SC_CURSOR_DOWN|SCF_CTRL);
|
||||
PutS("\r");
|
||||
|
||||
PopUpOk(
|
||||
"After clicking 'OKAY', you will be at the\r\n"
|
||||
"command line.\r\n\r\n"
|
||||
"Type \"$$FG GREEN$$Dir;$$FG$$\" and press $$FG GREEN$$ENTER$$FG$$.\r\n\r\n"
|
||||
"You must remember the semicolon.\r\n"
|
||||
);
|
||||
|
||||
ASCIIKeys("Dir;\r");
|
||||
Sleep(1000); //allow user time to see dir
|
||||
PutChar(CH_CR);
|
||||
|
||||
PopUpOk(
|
||||
"After clicking 'OKAY', you will be at the\r\n"
|
||||
"command line.\r\n\r\n"
|
||||
"Press the $$FG GREEN$$WINDOW$$FG$$s key.\r\n\r\n"
|
||||
"This will access your macro/menu/help area.\r\n"
|
||||
"You can customize it. It's like your\r\n"
|
||||
"START menu.\r\n");
|
||||
|
||||
SpecialKey(SC_GUI,"WINDOWS KEY");
|
||||
Sleep(1000);
|
||||
PopUpOk(
|
||||
"For future reference, you can get to the\r\n"
|
||||
"menu/macro/help area by clicking the left\r\n"
|
||||
"mouse button when the mouse cursor is on\r\n"
|
||||
"the word \"MENU\" in the upper-left border\r\n"
|
||||
"of the window.\r\n");
|
||||
|
||||
PopUpOk(
|
||||
"After clicking 'OKAY', you will be back at\r\n"
|
||||
"the menu/macro/help area.\r\n\r\n"
|
||||
"Press $$FG GREEN$$CURSOR-DOWN$$FG$$ five times.\r\n");
|
||||
|
||||
//This puts the cursor at the top
|
||||
Msg(MSG_KEY_DOWN,0,SC_CURSOR_UP|SCF_CTRL);
|
||||
|
||||
I8 i;
|
||||
for (i=0;i<5;i++)
|
||||
SpecialKey(SC_CURSOR_DOWN,"CURSOR-DOWN");
|
||||
|
||||
PopUpOk(
|
||||
"After clicking 'OKAY', the cursor will be\r\n"
|
||||
"on top of a macro we wish to run. Usually,\r\n"
|
||||
"underlined text will do something.\r\n\r\n"
|
||||
"Macros are normally $$FG LTBLUE$$BLUE$$FG$$ and you run\r\n"
|
||||
"them by left-clicking the mouse. You can\r\n"
|
||||
"simulate a left-mouse with a $$FG GREEN$$SPACE$$FG$$\r\n"
|
||||
"key.\r\n\r\n"
|
||||
"After clicking OKAY, press $$FG GREEN$$SPACE$$FG$$.\r\n");
|
||||
ASCIIKeys(" ");
|
||||
Sleep(1000);
|
||||
|
||||
PopUpOk(
|
||||
"The macro changed directories and did\r\n"
|
||||
"a $$FG GREEN$$Dir;$$FG$$ command.\r\n\r\n"
|
||||
"The $$FG RED$$RED$$FG$$ filenames listed are file\r\n"
|
||||
"links. Left-clicking will edit/view them.\r\n"
|
||||
"Right-clicking or pressing $$FG GREEN$$ENTER$$FG$$\r\n"
|
||||
"when the cursor is on top will bring-up a\r\n"
|
||||
"menu of options.\r\n\r\n"
|
||||
"The $$FG LTBLUE$$BLUE$$FG$$ underline entries \"$$FG LTBLUE$$.$$FG$$\" and \"$$FG LTBLUE$$..$$FG$$\"\r\n"
|
||||
"are macros and will change directories.\r\n");
|
||||
|
||||
PopUpOk(
|
||||
"As you can see, the command line is not\r\n"
|
||||
"different from the help/menu/macro area.\r\n"
|
||||
"Both use the same commands and have the same\r\n"
|
||||
"'Widgets' available.\r\n\r\n"
|
||||
"Both utilize the same underlying document format\r\n"
|
||||
"known as LoseThos rich text. It is similar to\r\n"
|
||||
"html because it has ASCII behind it.\r\n\r\n"
|
||||
"Press \"$$FG GREEN$$CTRL-T$$FG$$\" after clicking 'OKAY' to toggle\r\n"
|
||||
"to plain text mode.\r\n");
|
||||
SpecialASCIIKey(20,"CTRL-T");
|
||||
Sleep(1000);
|
||||
|
||||
PopUpOk(
|
||||
"The widgets are bracketed with dollar sign\r\n"
|
||||
"characters. \"LK\" stands \"link\" and \"MA\"\r\n"
|
||||
"stands for \"macro\".\r\n\r\n"
|
||||
"Now, press \"$$FG GREEN$$CTRL-T$$FG$$\" to toggle back to\r\n"
|
||||
"regular mode.\r");
|
||||
SpecialASCIIKey(20,"CTRL-T");
|
||||
Sleep(1000);
|
||||
|
||||
PopUpOk(
|
||||
"In summary, you left-click on underlined\r\n"
|
||||
"text or press $$FG GREEN$$SPACE$$FG$$ when the cursor\r\n"
|
||||
"is on top, to perform the primary action.\r\n"
|
||||
"You right-click or press $$FG GREEN$$ENTER$$FG$$\r\n"
|
||||
"to perform a secondary action.\r\n\r\n"
|
||||
|
||||
"The $$FG GREEN$$WINDOW$$FG$$'s key will bring-up the help/macro/menus\r\n"
|
||||
"as will clicking on the word \"MENU\" in the\r\n"
|
||||
"upper-left corner of a window's border.\r\n\r\n"
|
||||
|
||||
"The $$FG GREEN$$CTRL-T$$FG$$ key will toggle plain-text mode.\r\n");
|
||||
@@ -1,76 +0,0 @@
|
||||
//This puts the cursor at the bottom
|
||||
Msg(MSG_KEY_DOWN,0,SC_CURSOR_DOWN|SCF_CTRL);
|
||||
PutS("\r");
|
||||
|
||||
PopUpOk(
|
||||
"Now, we're going to demonstrate how to work\r\n"
|
||||
"with programs. We'll change to the \LT\DEMO\r\n"
|
||||
"directory. The change directory command\r\n"
|
||||
"will be typed for you and you just need\r\n"
|
||||
"to press $$FG GREEN$$ENTER$$FG$$.\r\n\r\n"
|
||||
"Note, that directories are specified with\r\n"
|
||||
"a forward slash, not a backslash.\r\n"
|
||||
"Drives can be specified in a $$FG GREEN$$Cd()$$FG$$ command\r\n"
|
||||
"and the boot drive is specified with \"$$FG GREEN$$::$$FG$$\".");
|
||||
|
||||
PutS("Cd(\"::/LT/DEMO\");Dir;");
|
||||
ASCIIKeys("\r");
|
||||
|
||||
|
||||
PopUpOk(
|
||||
"Now, we're going to edit a file. Normally,\r\n"
|
||||
"you'll probably left-click on a directory\r\n"
|
||||
"listing to edit a file, but we're going to\r\n"
|
||||
"type it on the command line.\r\n\r\n"
|
||||
"Press $$FG GREEN$$ENTER$$FG$$ to complete the command.\r\n");
|
||||
|
||||
PutS("Edit(\"Sound.CPZ\");");
|
||||
ASCIIKeys("\r");
|
||||
|
||||
Sleep(1000);
|
||||
PopUpOk(
|
||||
"This program gets keys and plays frequencies.\r\n"
|
||||
"It quits when you press $$FG GREEN$$ESC$$FG$$.\r\n\r\n"
|
||||
"There is no \"$$FG GREEN$$main()$$FG$$\" function in LoseThos\r\n"
|
||||
"programs. Any program statements outside\r\n"
|
||||
"functions get executed when you $$FG GREEN$$#include$$FG$$\r\n"
|
||||
"them at the command line.\r\n\r\n"
|
||||
"The \"$$FG GREEN$$Organ;$$FG$$\" statement at the bottom\r\n"
|
||||
"will run the program when we $$FG GREEN$$#include$$FG$$ it.\r\n");
|
||||
|
||||
PopUpOk(
|
||||
"The editor and most things exit when you press\r\n"
|
||||
"$$FG GREEN$$ESC$$FG$$. $$FG GREEN$$CTRL-Q$$FG$$ will abort (cancel) most things.\r\n\r\n"
|
||||
"The $$FG GREEN$$ESC$$FG$$ key can be simulated with a left\r\n"
|
||||
"double-click, while the $$FG GREEN$$CTRL-Q$$FG$$ key can be\r\n"
|
||||
"simulated with a right double-click. When\r\n"
|
||||
"you browse documentation, you'll left-click\r\n"
|
||||
"on links and right double-click to go back,\r\n"
|
||||
"unless you want to save changes to documents\r\n"
|
||||
"using left double-click.\r\n\r\n"
|
||||
"Press $$FG GREEN$$CTRL-Q$$FG$$ to quit out of the editor.\r\n"
|
||||
);
|
||||
|
||||
SpecialASCIIKey(CH_CTRLQ,"CTRL-Q");
|
||||
|
||||
PopUpOk(
|
||||
"Now, we'll run the Sound.CPZ program.\r\n"
|
||||
"Press $$FG GREEN$$ENTER$$FG$$ at the command line to\r\n"
|
||||
"$$FG GREEN$$#include$$FG$$ it. Then press keys to\r\n"
|
||||
"cause sounds and press $$FG GREEN$$ESC$$FG$$ when\r\n"
|
||||
"you are done.\r\n");
|
||||
|
||||
PutS("#include \"Sound.CPZ\";");
|
||||
ASCIIKeys("\r");
|
||||
UntilASCIIKey(CH_ESC);
|
||||
|
||||
PopUpOk(
|
||||
"The program is still in memory and we\r\n"
|
||||
"can start it again by typing \"$$FG GREEN$$Organ;$$FG$$\".\r\n\r\n"
|
||||
"Press $$FG GREEN$$ENTER$$FG$$ at the command line to\r\n"
|
||||
"run it again.\r\n");
|
||||
|
||||
PutS("Organ;");
|
||||
ASCIIKeys("\r");
|
||||
UntilASCIIKey(27);
|
||||
|
||||
@@ -1,95 +0,0 @@
|
||||
//This puts the cursor at the bottom
|
||||
Msg(MSG_KEY_DOWN,0,SC_CURSOR_DOWN|SCF_CTRL);
|
||||
PutS("\rCd(\"::/LT/DEMO\");Dir;\r");
|
||||
|
||||
PopUpOk(
|
||||
"Now, we're going to add the Sound.CPZ\r\n"
|
||||
"program to your start menu.\r\n\r\n"
|
||||
"Press the $$FG GREEN$$WINDOW$$FG$$s key\r\n"
|
||||
"to get to your menu/macro/help area.\r\n");
|
||||
SpecialKey(SC_GUI,"WINDOWS KEY");
|
||||
Msg(MSG_KEY_DOWN,0,SC_CURSOR_UP|SCF_CTRL);
|
||||
Sleep(1000);
|
||||
|
||||
PopUpOk(
|
||||
"Press $$FG GREEN$$CTRL-L$$FG$$ to invoke the\r\n"
|
||||
"rich-text resource editor.\r\n");
|
||||
SpecialASCIIKey(12,"CTRL-L");
|
||||
|
||||
PopUpOk(
|
||||
"Press $$FG GREEN$$CURSOR-DOWN$$FG$$ until you reach\r\n"
|
||||
"\"Macro\".\r\n");
|
||||
I8 i;
|
||||
for (i=0;i<8;i++)
|
||||
SpecialKey(SC_CURSOR_DOWN,"CURSOR-DOWN");
|
||||
|
||||
PopUpOk(
|
||||
"Press $$FG GREEN$$SPACE$$FG$$.\r\n");
|
||||
ASCIIKeys(" ");
|
||||
Sleep(1000);
|
||||
|
||||
|
||||
PopUpOk(
|
||||
"Now, we'll fill-in the visible text\r\n"
|
||||
"of the macro.\r\n");
|
||||
SlowASCIIAutoType("Click Here");
|
||||
|
||||
Msg(MSG_KEY_DOWN,0,SC_CURSOR_DOWN);
|
||||
PopUpOk("Now, we'll fill-in the macro text.\r\n");
|
||||
SlowASCIIAutoType("Cd(\\\"::/LT/DEMO\\\");;#include \\\"Sound.CPZ\\\";\\r");
|
||||
|
||||
PopUpOk("Press $$FG GREEN$$ESC$$FG$$ to exit the form.\r\n");
|
||||
SpecialASCIIKey(CH_ESC,"ESC");
|
||||
Sleep(1000);
|
||||
|
||||
PopUpOk("Press $$FG GREEN$$CTRL-SHIFT-ENTER$$FG$$ to insert a line feed.\r\n");
|
||||
SpecialASCIIKey(CH_CR,"CTRL-SHIFT-ENTER",SCF_CTRL|SCF_SHIFT,SCF_CTRL|SCF_SHIFT);
|
||||
Sleep(1000);
|
||||
|
||||
Msg(MSG_KEY_DOWN,0,SC_CURSOR_UP|SCF_CTRL);
|
||||
PopUpOk(
|
||||
"Press $$FG GREEN$$SPACE$$FG$$ to test it.\r\n");
|
||||
ASCIIKeys(" ");
|
||||
UntilASCIIKey(CH_ESC);
|
||||
|
||||
PopUpOk(
|
||||
"Now, we'll do a fancier macro that pops-up\r\n"
|
||||
"a new window which dies when finished,\r\n"
|
||||
"returning memory to the system.\r\n");
|
||||
Msg(MSG_KEY_DOWN,0,SC_GUI);
|
||||
Msg(MSG_KEY_DOWN,0,SC_CURSOR_UP|SCF_CTRL);
|
||||
Msg(MSG_KEY_DOWN,12,0); //CTRL-L
|
||||
for (i=0;i<8;i++)
|
||||
Msg(MSG_KEY_DOWN,0,SC_CURSOR_DOWN);
|
||||
SlowASCIIAutoType(" Click here for Pop-up version");
|
||||
Msg(MSG_KEY_DOWN,0,SC_CURSOR_DOWN);
|
||||
SlowASCIIAutoType("Cd(\\\"::/LT/DEMO\\\");;#include \\\"Sound.CPZ\\\"\\r");
|
||||
|
||||
PopUpOk(
|
||||
"Press $$FG GREEN$$CURSOR-DOWN$$FG$$ until you reach\r\n"
|
||||
"the \"Pop-Up\" check-box.\r\n");
|
||||
for (i=0;i<2;i++)
|
||||
SpecialKey(SC_CURSOR_DOWN,"CURSOR-DOWN");
|
||||
PopUpOk(
|
||||
"Press $$FG GREEN$$SPACE$$FG$$ to\r\n"
|
||||
"check the box.\r\n");
|
||||
ASCIIKeys(" ");
|
||||
Sleep(500);
|
||||
|
||||
PopUpOk("Press $$FG GREEN$$ESC$$FG$$ to exit the form.\r\n");
|
||||
SpecialASCIIKey(CH_ESC,"ESC");
|
||||
Sleep(500);
|
||||
|
||||
PopUpOk("Press $$FG GREEN$$CTRL-SHIFT-ENTER$$FG$$ to insert a line feed.\r\n");
|
||||
SpecialASCIIKey(CH_CR,"CTRL-SHIFT-ENTER",SCF_CTRL|SCF_SHIFT,SCF_CTRL|SCF_SHIFT);
|
||||
Sleep(500);
|
||||
|
||||
Msg(MSG_KEY_DOWN,0,SC_CURSOR_UP|SCF_CTRL);
|
||||
PopUpOk(
|
||||
"Press $$FG GREEN$$SPACE$$FG$$ to test it.\r\n");
|
||||
ASCIIKeys(" ");
|
||||
Sleep(5000);
|
||||
|
||||
PopUpOk(
|
||||
"Press $$FG GREEN$$CTRL-S$$FG$$ to save your\r\n"
|
||||
"macro/menu/help area file, if you wish.\r\n");
|
||||
@@ -1,58 +0,0 @@
|
||||
PopUp("WsInit(\"::/LT\");");
|
||||
if (!ws_task)
|
||||
ws_task=Spawn(&WsTsk,"WORDSTAT");
|
||||
|
||||
//This puts the cursor at the bottom
|
||||
Msg(MSG_KEY_DOWN,0,SC_CURSOR_DOWN|SCF_CTRL);
|
||||
PutS("\rCd(\"::/LT/DEMO\");\r");
|
||||
|
||||
PopUpOk(
|
||||
"WordStat is an autocomplete feature\r\n"
|
||||
"which will also jump to source code.\r\n\r\n"
|
||||
"We will now place some text on the command\r\n"
|
||||
"line and jump to source code.\r\n");
|
||||
PutS("InstallB");
|
||||
Sleep(1000);
|
||||
|
||||
PopUpOk(
|
||||
"After clicking $$FG GREEN$$OKAY$$FG$$, look at\r\n"
|
||||
"the $$FG GREEN$$InstallBoot$$FG$$ entry in the WordStat\r\n"
|
||||
"window. Notice it has a '$$FG GREEN$$*$$FG$$' by it.\r\n"
|
||||
"This means a source code link is available.\r\n");
|
||||
sys_cur_focus_task=Fs->parent_tss;
|
||||
Sleep(2000);
|
||||
|
||||
PopUpOk(
|
||||
"Press $$FG GREEN$$CTRL-SHIFT-F1$$FG$$ to jump to source code.\r\n");
|
||||
sys_cur_focus_task=Fs->parent_tss;
|
||||
UntilSpecialKey(SC_F1|SCF_CTRL|SCF_SHIFT);
|
||||
Sleep(2000);
|
||||
|
||||
PopUpOk(
|
||||
"Press $$FG GREEN$$CTRL-Q$$FG$$ to quit the source code.\r\n");
|
||||
UntilASCIIKey(CH_CTRLQ);
|
||||
|
||||
PopUpOk(
|
||||
"Press $$FG GREEN$$CTRL-F1$$FG$$ to autocomplete.\r\n");
|
||||
sys_cur_focus_task=Fs->parent_tss;
|
||||
UntilSpecialKey(SC_F1|SCF_CTRL);
|
||||
Sleep(500);
|
||||
|
||||
Msg(MSG_KEY_DOWN,CH_CR,SCF_CTRL|SCF_SHIFT);
|
||||
PutS("\r");
|
||||
|
||||
PopUpOk(
|
||||
"Tip: You can restart the WordStat window if you\r\n"
|
||||
"have closed it by pressing $$FG GREEN$$CTRL-F1$$FG$$.\r\n");
|
||||
|
||||
PopUpOk(
|
||||
"You can also use the $$FG GREEN$$Man()$$FG$$ function\r\n"
|
||||
"to jump to source code.\r\n");
|
||||
SlowASCIIAutoType("Man(\"InstallBoot\");");
|
||||
Sleep(1000);
|
||||
PutS("\r");
|
||||
|
||||
Sleep(2000);
|
||||
PopUpOk(
|
||||
"Press $$FG GREEN$$CTRL-Q$$FG$$ to quit the source code.\r\n");
|
||||
UntilASCIIKey(CH_CTRLQ);
|
||||
@@ -1,10 +0,0 @@
|
||||
//This is the startup file for new local users
|
||||
UseConsoleLtf("USER.MUZ");
|
||||
Fs->answers_displayed=2; //from 0-8
|
||||
LoadAdam3;
|
||||
PutSysText("ST_USER_STARTUP");
|
||||
Type("/LT/DOC/Help.TXZ");
|
||||
Bts(&Fs->crt_flags,CRTf_SHOW);
|
||||
|
||||
if (Fs->user_num==1)
|
||||
AutoFile("TOUR");
|
||||
@@ -1,71 +0,0 @@
|
||||
//This is the startup file for new local users
|
||||
UseConsoleLtf("USER.MUZ");
|
||||
Fs->answers_displayed=2; //from 0-8
|
||||
|
||||
LoadAdam3;
|
||||
|
||||
U8 F(I1 *pattern,I1 *flags="+r+i")
|
||||
{
|
||||
return Grep(pattern,"/LT/"TEXT_FILE_MASK,flags);
|
||||
}
|
||||
|
||||
U8 R(I1 *pattern,I1 *replace_text=NULL,I1 *flags="+r+l")
|
||||
{
|
||||
return Grep(pattern,"/LT/"TEXT_FILE_MASK,flags,replace_text);
|
||||
}
|
||||
|
||||
U8 FD(I1 *pattern,I1 *flags="+r+i")
|
||||
{
|
||||
return Grep(pattern,TEXT_FILE_MASK,flags);
|
||||
}
|
||||
|
||||
U8 RD(I1 *pattern,I1 *replace_text=NULL,I1 *flags="+r+l")
|
||||
{
|
||||
return Grep(pattern,TEXT_FILE_MASK,flags,replace_text);
|
||||
}
|
||||
|
||||
|
||||
PutSysText("ST_USER_STARTUP");
|
||||
Type("/LT/DOC/Help.TXZ");
|
||||
Fs->scroll_speed=10;
|
||||
Bts(&Fs->crt_flags,CRTf_SHOW);
|
||||
|
||||
|
||||
Type("/LT/DOC/StartUp.TXZ");
|
||||
|
||||
I1 src,dst,*st1,*st2;
|
||||
I4 i;
|
||||
|
||||
if (Fs->user_num==1) {
|
||||
for (i=0;i<10;i++) CrLf;
|
||||
coutln "This will copy the /LT directory from "
|
||||
"the CD-ROM onto a harddisk overwriting old files. "
|
||||
"It will then recompile "
|
||||
"and modify the boot sector. If your old "
|
||||
"installation is the right disk format and "
|
||||
"you have created your own ACCOUNTS directory "
|
||||
"that directory will be left intact.";
|
||||
cout "Continue ";
|
||||
if (YorN) {
|
||||
cout "\r\nWould you like to view notes on installation, first";
|
||||
if (YorN)
|
||||
Edit("/LT/DOC/Install.TXZ");
|
||||
coutln "\r\n$$BK,1$$$$FG,PURPLE$$Add Drives so you can upgrade.$$FG$$$$BK,0$$";
|
||||
AddDrives;
|
||||
src=default_drive;
|
||||
cout "\r\n\r\n$$BK,1$$$$FG,PURPLE$$Destination Drive:$$FG$$$$BK,0$$";
|
||||
dst=GetChar;
|
||||
coutln;
|
||||
st1=MSPrintF("%c:/LT",src);
|
||||
st2=MSPrintF("%c:/LT",dst);
|
||||
|
||||
CopyTree(st1,st2);
|
||||
st2=MSPrintF("%c:/0000BOOT",dst);
|
||||
MkDir(st2);
|
||||
Free(st2);
|
||||
st2=MSPrintF("%c:/TEMP",dst);
|
||||
MkDir(st2);
|
||||
Free(st2);
|
||||
InstallBoot(dst);
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
If you modify this file, you should place it
|
||||
into your HOME directory. This version is the
|
||||
default for accounts without a version in HOME.
|
||||
|
||||
$MA,"Cd(\"HOME\");Dir;\r"$
|
||||
$MA,"Cd(\"::/LT/OSMain\");Dir;\r"$
|
||||
$MA,"Cd(\"::/LT/ADAM\");Dir;\r"$
|
||||
$MA,"Cd(\"::/LT/APPS\");Dir;\r"$
|
||||
$MA,"Cd(\"::/LT/DEMO\");Dir;\r"$
|
||||
$MA,"Cd(\"::/LT/UTILS\");Dir;\r"$
|
||||
$MA,"Drive('A');\r"$
|
||||
$MA+A,"Recompile Floppy OS Drive A:","InstallBoot('A');\r"$
|
||||
|
||||
$WW,1$$MA+A-X+PU,"Play WarGame","Cd(\"::/LT/APPS\");;#include \"WARGAME\"\r"$
|
||||
$MA+A-X+PU,"DO-TELL (A fractel-like thing)","Cd(\"::/LT/DEMO\");;#include \"Dawg\"\r"$
|
||||
$MA+A-X+PU,"StarTrek Game","#include \"::/LT/DEMO/Graphics/StarTrek2\"\r"$
|
||||
|
||||
$MA+A,"Tour","Cd(\"::/LT/ACCOUNTS/TOUR\");;AutoFile(\"TOUR\");\r"$
|
||||
|
||||
The following can be used if you recompile, adding hard disk support.
|
||||
$MA,"Drive('D');\r"$
|
||||
$MA,"Drive('E');\r"$
|
||||
$MA+A,"Recompile Hard Drive D:","InstallBoot(':','D');\r"$
|
||||
|
||||
|
||||
$MA+A-X+PU,"List functions in alphabetic order","HFunsRep;View;"$
|
||||
$MA+A-X+PU,"List functions in numeric address order","HMapRep;View;"$
|
||||
@@ -1,67 +0,0 @@
|
||||
#include "AdamExt"
|
||||
#include "IncCompress"
|
||||
#include "MATH"
|
||||
#include "ODE"
|
||||
Load("ADAMASM");
|
||||
#include "ADAMASM.HPZ"
|
||||
#include "GRMODE3"
|
||||
#include "MUSIC"
|
||||
#include "DISK10"
|
||||
#include "FIFO"
|
||||
#include "COMM"
|
||||
#include "INPTR"
|
||||
#include "GRELEM"
|
||||
#include "LTF"
|
||||
#include "UTILS"
|
||||
#include "MOUSE"
|
||||
#include "JOY"
|
||||
#include "WINDOW"
|
||||
#include "EDIT"
|
||||
#include "LOGIN"
|
||||
#include "WORDSTAT"
|
||||
|
||||
BoolU4 initial_user_tasks_startup_complete=FALSE;
|
||||
public void DuelUsers()
|
||||
{
|
||||
I1 buf[80];
|
||||
TssStruct *tss,*tss1;
|
||||
|
||||
tss=Spawn(&UserCmdLine);
|
||||
while (!Bt(&tss->task_flags,TSSf_IDLE))
|
||||
SwapInNext;
|
||||
tss->window_top=2;
|
||||
tss->window_right=(SCREEN_COLS-2)<<1;
|
||||
tss1=tss;
|
||||
|
||||
tss=Spawn(&UserCmdLine);
|
||||
while (!Bt(&tss->task_flags,TSSf_IDLE))
|
||||
SwapInNext;
|
||||
tss->window_top=2;
|
||||
tss->window_left=SCREEN_COLS<<2>>1;
|
||||
|
||||
WindowToTop(tss1);
|
||||
ws_task=Spawn(&WsTsk,"WORDSTAT");
|
||||
|
||||
SPrintF(buf,"Boot Time:%h17Ts\r\n",BootTime);
|
||||
AdamLog(buf);
|
||||
initial_user_tasks_startup_complete=TRUE;
|
||||
}
|
||||
|
||||
Preempt(ON);
|
||||
|
||||
UseConsoleLtf(NULL);
|
||||
adam_tss->window_top=2;
|
||||
adam_tss->window_bottom=10;
|
||||
update_screen_tss=Spawn(&WindowManagerTsk,"WINDOW MANAGER");
|
||||
CollectAccntList;
|
||||
|
||||
Bts(&Fs->crt_flags,CRTf_SHOW);
|
||||
if (!(Fs->account=FindSysAccnt(sys_startup_account)))
|
||||
Fs->account=PopUpGetSysAccnt;
|
||||
WsInit(wordstat_mask);
|
||||
|
||||
|
||||
//This must be spawned because start-up files
|
||||
// may invoke the Adam() cmd.
|
||||
Spawn(&DuelUsers,"SPAWNUSERS");
|
||||
coutln "\r\nOS Compile Time:",sys_compile_time;
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,10 +0,0 @@
|
||||
public LTextern CP_PLOT_SCREEN_I1 BoolU4 PlotScreenChar(U8 w,I8 x,I8 y);
|
||||
public LTextern CP_PLOT_WINDOW_I1 BoolU4 PlotWindowChar(U8 w,I8 x,I8 y);
|
||||
public LTextern CP_PLOT_BORDER_I1 BoolU4 PlotBorderChar(U8 w,I8 x,I8 y);
|
||||
|
||||
LTextern REVERSE_BITS_TABLE U1 reverse_bits_table[256];
|
||||
LTextern GR_XOR_LINE void GrXorLine(U4 **dst3,U4 **src,U4 **src2,U8 d5,U4 **vga);
|
||||
LTextern GR_PLOT_CHAR void GrPlotChar(U1 *font_ptr,U1 attr,U1 **dst2,U8 d1,U8 d2);
|
||||
LTextern GR_PLOT_BACKGROUND void GrPlotBackground(U1 attr,U1 **dst,U8 d1,U8 d2);
|
||||
LTextern GR_UPDATE_WINDOWS void GrUpdateWindows();
|
||||
//The callback is void Plot(aux_data,x,y,z)
|
||||
Binary file not shown.
@@ -1,32 +0,0 @@
|
||||
extern I8 PopUp(I1 *msg,TssStruct *parent=NULL);
|
||||
extern U8 LtfPutChar(Ltf *l,I8 ch, U8 sc,BoolU4 old_preempt);
|
||||
extern void LeftClickLink(Ltf *l,LtfEntry *cl,BoolU4 old_preempt2);
|
||||
extern void RightClickLink(Ltf *l,LtfEntry *cl,BoolU4 old_preempt2);
|
||||
extern U8 GetMsg(I8 *param1,I8 *param2,U8 mask=-2,TssStruct *tss=NULL);
|
||||
extern U8 GetMsgNoWait(I8 *param1,I8 *param2,U8 mask=-2,TssStruct *tss=NULL);
|
||||
extern void LtfInsert(Ltf *l,LtfEntry *ll);
|
||||
extern LtfEntry *LtfPutS(Ltf *l,I1 *st);
|
||||
extern I8 PopUpMenu(Ltf *l,I1 *help=NULL);
|
||||
extern Ltf *LtfNew();
|
||||
extern void LtfDel(Ltf *l,BoolU4 root_mem=FALSE);
|
||||
extern LtfEntry *LtfPrintF(Ltf *l,I1 *src,...);
|
||||
extern void DrawBorder(BoolU4 solid,I8 l,I8 r,I8 t,I8 b,U1 attr,BoolU4 clip);
|
||||
extern void EditInsertLtf(Ltf *l,Ltf *b);
|
||||
extern Ltf *LtfRead(I1 *name,U8 flags=0);
|
||||
extern BoolU4 View();
|
||||
extern BoolU4 IsPixelCovered(TssStruct *tss,I8 x,I8 y);
|
||||
extern void PlotInputPointer();
|
||||
extern void GrCircle(GrBitMap *base,I8 cx,I8 cy,I8 radius,
|
||||
I8 step=1,double start_rad=0,double len_rad=pi2);
|
||||
extern void GrPlot0(GrBitMap *base,I8 x,I8 y);
|
||||
extern void ClearAllBpts(Ltf *l);
|
||||
extern void ToggleBpt(Ltf *l,I8 line_offset=0,U8 flags=SBPTF_BPT);
|
||||
extern void LtfGo();
|
||||
extern void LtfStep(Ltf *l);
|
||||
extern void Lpt1PutChar(U1 ch);
|
||||
extern void WsFillin(I8 n);
|
||||
extern void WsMan(I8 n,TssStruct *parent=NULL);
|
||||
extern void WsTsk();
|
||||
extern TssStruct *ws_task;
|
||||
extern void Edit(I1 *filename);
|
||||
|
||||
-3346
File diff suppressed because it is too large.
Load diff
@@ -1,834 +0,0 @@
|
||||
I8 PopUpGrElemType(BoolU4 new_picture)
|
||||
{
|
||||
I8 i;
|
||||
Ltf *l=LtfNew;
|
||||
LtfPutS(l,"$$MU,\"Color (4-bit)\" GRET_COLOR4$$\r\n");
|
||||
LtfPutS(l,"$$MU,\"Width\" GRET_WIDTH$$\r\n");
|
||||
LtfPutS(l,"$$MU,\"Point\" GRET_POINT$$\r\n");
|
||||
LtfPutS(l,"$$MU,\"Line\" GRET_LINE$$\r\n");
|
||||
LtfPutS(l,"$$MU,\"PolyLine\" GRET_POLYLINE$$\r\n");
|
||||
LtfPutS(l,"$$MU,\"PolyPoint\" GRET_POLYPOINT$$\r\n");
|
||||
LtfPutS(l,"$$MU,\"BSpline2\" GRET_BSPLINE2$$\r\n");
|
||||
LtfPutS(l,"$$MU,\"BSpline3\" GRET_BSPLINE3$$\r\n");
|
||||
LtfPutS(l,"$$MU,\"BSpline2 Closed\" GRET_BSPLINE2_CLOSED$$\r\n");
|
||||
LtfPutS(l,"$$MU,\"BSpline3 Closed\" GRET_BSPLINE3_CLOSED$$\r\n");
|
||||
LtfPutS(l,"$$MU,\"End\" GRET_END$$\r\n");
|
||||
if (new_picture)
|
||||
LtfPutS(l,"$$MU,\"Cancel\" -1$$\r\n");
|
||||
LtfPutS(l,"\r\nNote: Right-Click to get back to this menu.\r\n"
|
||||
"Press ESC to Exit, CTRL-Q to abort.\r\n");
|
||||
i=PopUpMenu(l);
|
||||
LtfDel(l);
|
||||
return i;
|
||||
}
|
||||
|
||||
public I8 PopUpColor()
|
||||
{
|
||||
I8 i;
|
||||
Ltf *l=LtfNew;
|
||||
for (i=0;i<16;i++)
|
||||
LtfPrintF(l,"$$BM %d$$$$MU,\"________________\" %d$$\r\n",i,i);
|
||||
LtfPutS(l,"$$BM WHITE$$$$MU,\"DEFAULT\" -1$$");
|
||||
i=PopUpMenu(l);
|
||||
LtfDel(l);
|
||||
return i;
|
||||
}
|
||||
|
||||
public I8 PopUpWidth()
|
||||
{
|
||||
I8 i;
|
||||
Ltf *l=LtfNew;
|
||||
for (i=0;i<16;i++)
|
||||
LtfPrintF(l,"$$MU,\"%d\" %d$$\r\n",i,i);
|
||||
i=PopUpMenu(l);
|
||||
LtfDel(l);
|
||||
return i;
|
||||
}
|
||||
|
||||
I8 GrXOffsets[8]={-1,0,1,-1,1,-1,0,1},
|
||||
GrYOffsets[8]={-1,-1,-1,0,0,1,1,1};
|
||||
|
||||
U8 GrElemBaseSize(I8 type,BoolU4 queue=TRUE)
|
||||
{
|
||||
U8 i=(queue) ? offset(GrElem.start):0;
|
||||
switch (type) {
|
||||
case GRET_COLOR4:
|
||||
i+=1+offset(GrElem.color4)-offset(GrElem.start);
|
||||
break;
|
||||
case GRET_COLOR24:
|
||||
i+=3+offset(GrElem.color24)-offset(GrElem.start);
|
||||
break;
|
||||
case GRET_WIDTH:
|
||||
i+=offset(GrElem.y1)-offset(GrElem.start);
|
||||
break;
|
||||
case GRET_POINT:
|
||||
i+=offset(GrElem.x2)-offset(GrElem.start);
|
||||
break;
|
||||
case GRET_LINE:
|
||||
i+=sizeof(GrElem)-offset(GrElem.start);
|
||||
break;
|
||||
case GRET_POLYLINE:
|
||||
case GRET_POLYPOINT:
|
||||
case GRET_BSPLINE2:
|
||||
case GRET_BSPLINE3:
|
||||
case GRET_BSPLINE2_CLOSED:
|
||||
case GRET_BSPLINE3_CLOSED:
|
||||
i+=offset(GrElem.y1)-offset(GrElem.start);
|
||||
break;
|
||||
case GRET_SHIFT:
|
||||
i+=offset(GrElem.x2)-offset(GrElem.start);
|
||||
break;
|
||||
case GRET_END:
|
||||
i+=offset(GrElem.x1)-offset(GrElem.start);
|
||||
break;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
U8 GrElemSize(GrElem *tempg,BoolU4 queue=TRUE)
|
||||
{
|
||||
U8 i=GrElemBaseSize(tempg->type,queue);
|
||||
switch (tempg->type) {
|
||||
case GRET_POLYLINE:
|
||||
i+=tempg->num<<1*sizeof(I4);
|
||||
break;
|
||||
case GRET_POLYPOINT:
|
||||
i+=sizeof(I4)<<1+(tempg->num*3+7)>>3;
|
||||
break;
|
||||
case GRET_BSPLINE2:
|
||||
case GRET_BSPLINE3:
|
||||
case GRET_BSPLINE2_CLOSED:
|
||||
case GRET_BSPLINE3_CLOSED:
|
||||
i+=tempg->num*sizeof(P3I4);
|
||||
break;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
//If you do not enter a color or width into
|
||||
//a GrElem, you can pass a color and width
|
||||
//when you plot it. "colorbase" is the color of
|
||||
//the background you are drawing on.
|
||||
public void GrElemsPlot(GrBitMap *base,I8 x,I8 y,I8 z,U1 *elems,U8 colorbase)
|
||||
{
|
||||
GrElem *tempg=elems-offset(GrElem.start);
|
||||
U8 i,j;
|
||||
I8 x1,y1,x2,y2;
|
||||
I4 *ptr;
|
||||
I8 cur_sub_GrElem_num=0;
|
||||
P3I4 *p;
|
||||
while (tempg->type) {
|
||||
base->cur_sub_GrElem=cur_sub_GrElem_num++;
|
||||
switch (tempg->type) {
|
||||
case GRET_COLOR4:
|
||||
base->color=colorbase^tempg->color4;
|
||||
break;
|
||||
case GRET_COLOR24:
|
||||
base->color=colorbase^tempg->color24;
|
||||
break;
|
||||
case GRET_WIDTH:
|
||||
base->pen_width=tempg->width;
|
||||
break;
|
||||
case GRET_POINT:
|
||||
GrPlot3(base,tempg->x1+x,tempg->y1+y,0);
|
||||
break;
|
||||
case GRET_SHIFT:
|
||||
x+=tempg->x1;
|
||||
y+=tempg->y1;
|
||||
break;
|
||||
case GRET_LINE:
|
||||
GrLine3(base,tempg->x1+x,tempg->y1+y,0,tempg->x2+x,tempg->y2+y,0);
|
||||
break;
|
||||
case GRET_POLYLINE:
|
||||
ptr=&tempg->y1;
|
||||
x1=ptr[0];
|
||||
y1=ptr[1];
|
||||
for (i=1;i<tempg->num;i++) {
|
||||
x2=ptr[i<<1];
|
||||
y2=ptr[i<<1+1];
|
||||
GrLine3(base,x1+x,y1+y,0,x2+x,y2+y,0);
|
||||
x1=x2;y1=y2;
|
||||
}
|
||||
break;
|
||||
case GRET_POLYPOINT:
|
||||
ptr=&tempg->y1;
|
||||
x1=ptr[0];
|
||||
y1=ptr[1];
|
||||
ptr=ptr+sizeof(I4)<<1;
|
||||
for (i=0;i<tempg->num;i++) {
|
||||
GrPlot3(base,x1+x,y1+y,0);
|
||||
j=Bt(ptr,i*3)+Bt(ptr,i*3+1)<<1+Bt(ptr,i*3+2)<<2;
|
||||
x1+=GrXOffsets[j];
|
||||
y1+=GrYOffsets[j];
|
||||
}
|
||||
break;
|
||||
case GRET_BSPLINE2:
|
||||
p=&tempg->y1;
|
||||
for (i=0;i<tempg->num;i++) {
|
||||
p[i].x+=x;
|
||||
p[i].y+=y;
|
||||
}
|
||||
Gr2BSpline3(base,p,tempg->num,FALSE);
|
||||
for (i=0;i<tempg->num;i++) {
|
||||
p[i].x-=x;
|
||||
p[i].y-=y;
|
||||
}
|
||||
break;
|
||||
case GRET_BSPLINE3:
|
||||
p=&tempg->y1;
|
||||
for (i=0;i<tempg->num;i++) {
|
||||
p[i].x+=x;
|
||||
p[i].y+=y;
|
||||
}
|
||||
Gr3BSpline3(base,p,tempg->num,FALSE);
|
||||
for (i=0;i<tempg->num;i++) {
|
||||
p[i].x-=x;
|
||||
p[i].y-=y;
|
||||
}
|
||||
break;
|
||||
case GRET_BSPLINE2_CLOSED:
|
||||
p=&tempg->y1;
|
||||
for (i=0;i<tempg->num;i++) {
|
||||
p[i].x+=x;
|
||||
p[i].y+=y;
|
||||
}
|
||||
Gr2BSpline3(base,p,tempg->num,TRUE);
|
||||
for (i=0;i<tempg->num;i++) {
|
||||
p[i].x-=x;
|
||||
p[i].y-=y;
|
||||
}
|
||||
break;
|
||||
case GRET_BSPLINE3_CLOSED:
|
||||
p=&tempg->y1;
|
||||
for (i=0;i<tempg->num;i++) {
|
||||
p[i].x+=x;
|
||||
p[i].y+=y;
|
||||
}
|
||||
Gr3BSpline3(base,p,tempg->num,TRUE);
|
||||
for (i=0;i<tempg->num;i++) {
|
||||
p[i].x-=x;
|
||||
p[i].y-=y;
|
||||
}
|
||||
break;
|
||||
}
|
||||
tempg+=GrElemSize(tempg,FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
public void GrSetOrigin(GrElem *root,I8 dx,I8 dy,I8 dz)
|
||||
{
|
||||
U8 i;
|
||||
I4 *ptr;
|
||||
P3I4 *p;
|
||||
GrElem *tempg=root->next;
|
||||
while (tempg!=root) {
|
||||
switch (tempg->type) {
|
||||
case GRET_POINT:
|
||||
tempg->x1+=dx;
|
||||
tempg->y1+=dy;
|
||||
break;
|
||||
case GRET_LINE:
|
||||
tempg->x1+=dx;
|
||||
tempg->y1+=dy;
|
||||
tempg->x2+=dx;
|
||||
tempg->y2+=dy;
|
||||
break;
|
||||
case GRET_POLYLINE:
|
||||
ptr=&tempg->y1;
|
||||
ptr[0]+=dx;
|
||||
ptr[1]+=dy;
|
||||
for (i=1;i<tempg->num;i++) {
|
||||
ptr[i<<1]+=dx;
|
||||
ptr[i<<1+1]+=dy;
|
||||
}
|
||||
break;
|
||||
case GRET_POLYPOINT:
|
||||
ptr=&tempg->y1;
|
||||
ptr[0]+=dx;
|
||||
ptr[1]+=dy;
|
||||
break;
|
||||
case GRET_BSPLINE2:
|
||||
case GRET_BSPLINE3:
|
||||
case GRET_BSPLINE2_CLOSED:
|
||||
case GRET_BSPLINE3_CLOSED:
|
||||
p=&tempg->y1;
|
||||
for (i=0;i<tempg->num;i++) {
|
||||
p[i].x+=dx;
|
||||
p[i].y+=dy;
|
||||
}
|
||||
break;
|
||||
}
|
||||
tempg=tempg->next;
|
||||
}
|
||||
}
|
||||
|
||||
void GrPolyPointPlot(GrElem *root,I8 x,I8 y,I8 z)
|
||||
{
|
||||
GrElem *tempg;
|
||||
tempg=MAllocZ(GrElemBaseSize(GRET_POINT));
|
||||
tempg->type=GRET_POINT;
|
||||
tempg->x1=x;
|
||||
tempg->y1=y;
|
||||
InsQue(tempg,root->last);
|
||||
}
|
||||
|
||||
void GrElemsDel(GrElem *root)
|
||||
{
|
||||
GrElem *tempg,*tempg1;
|
||||
tempg=root->next;
|
||||
while (tempg!=root) {
|
||||
tempg1=tempg->next;
|
||||
Free(tempg);
|
||||
tempg=tempg1;
|
||||
}
|
||||
}
|
||||
|
||||
GrElem *GrElemsFromQueue(GrElem *root,U4 *size=NULL)
|
||||
{
|
||||
U8 s,my_size=GrElemBaseSize(GRET_END,FALSE);
|
||||
GrElem *tempg,*result,*dst;
|
||||
|
||||
tempg=root->next;
|
||||
while (tempg!=root) {
|
||||
my_size+=GrElemSize(tempg,FALSE);
|
||||
tempg=tempg->next;
|
||||
}
|
||||
result=MAlloc(my_size);
|
||||
dst=result;
|
||||
tempg=root->next;
|
||||
while (tempg!=root) {
|
||||
s=GrElemSize(tempg,FALSE);
|
||||
MemCpy(dst,&tempg->type,s);
|
||||
dst+=s;
|
||||
tempg=tempg->next;
|
||||
}
|
||||
*dst=GRET_END;
|
||||
if (size) *size=my_size;
|
||||
return result;
|
||||
}
|
||||
|
||||
GrElem *GrElemsToQueue(GrElem *elems)
|
||||
{
|
||||
U8 s;
|
||||
GrElem *result=MAllocZ(sizeof(GrElem)),
|
||||
*tempg=elems-offset(GrElem.start),
|
||||
*tempg1;
|
||||
result->next=result;
|
||||
result->last=result;
|
||||
while (tempg->type) {
|
||||
tempg1=MAlloc(GrElemSize(tempg,TRUE));
|
||||
s=GrElemSize(tempg,FALSE);
|
||||
MemCpy(&tempg1->type,&tempg->type,s);
|
||||
InsQue(tempg1,result->last);
|
||||
tempg+=s;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public I4 PopUpPickGrElem(GrElem *root)
|
||||
{
|
||||
Ltf *l=LtfNew;
|
||||
GrElem *tempg;
|
||||
I4 cur_num=0;
|
||||
|
||||
tempg=root->next;
|
||||
while (tempg!=root) {
|
||||
LtfPrintF(l,"$$MU,\"%Z\",%d$$\r\n",
|
||||
tempg->type,"ST_GRELEM_TYPES",cur_num++);
|
||||
tempg=tempg->next;
|
||||
}
|
||||
LtfPrintF(l,"$$MU,\"END\",%d$$\r\n",cur_num);
|
||||
cur_num=PopUpMenu(l);
|
||||
LtfDel(l);
|
||||
return cur_num;
|
||||
}
|
||||
|
||||
#define GED_PICK_TEXT 1
|
||||
#define GED_PICK_GRAPHICALLY 2
|
||||
#define GED_SET_ORIGIN 3
|
||||
#define GED_SHIFT_ORIGIN 4
|
||||
#define GED_INSERT 5
|
||||
#define GED_DELETE 6
|
||||
#define GED_EDIT 7
|
||||
#define GED_END 8
|
||||
#define GED_CANCEL -1
|
||||
|
||||
I8 PopUpGrElemsEditChoice()
|
||||
{
|
||||
I8 i;
|
||||
Ltf *l=LtfNew;
|
||||
LtfPutS(l,"$$MU,\"Pick from text\",GED_PICK_TEXT$$\r\n");
|
||||
LtfPutS(l,"$$MU,\"Pick graphically\",GED_PICK_GRAPHICALLY$$\r\n");
|
||||
LtfPutS(l,"$$MU,\"Set Origin\",GED_SET_ORIGIN$$\r\n");
|
||||
LtfPutS(l,"$$MU,\"Insert Shift Origin\",GED_SHIFT_ORIGIN$$\r\n");
|
||||
LtfPutS(l,"$$MU,\"Insert\",GED_INSERT$$\r\n");
|
||||
LtfPutS(l,"$$MU,\"Delete\",GED_DELETE$$\r\n");
|
||||
// LtfPutS(l,"$$MU,\"Edit\",GED_EDIT$$\r\n");
|
||||
LtfPutS(l,"$$MU,\"End\",GED_END$$\r\n");
|
||||
LtfPutS(l,"$$MU,\"Cancel\",GED_CANCEL$$\r\n");
|
||||
i=PopUpMenu(l);
|
||||
LtfDel(l);
|
||||
return i;
|
||||
}
|
||||
|
||||
GrElem *GrNumToQueue(GrElem *root,I8 num,I8 *x=NULL,I8 *y=NULL)
|
||||
{
|
||||
I8 xx=0,yy=0;
|
||||
GrElem *result=root->next;
|
||||
while (result!=root && num--) {
|
||||
if (result->type==GRET_SHIFT) {
|
||||
xx+=result->x1;
|
||||
yy+=result->y1;
|
||||
}
|
||||
result=result->next;
|
||||
}
|
||||
if (x) *x=xx;
|
||||
if (y) *y=yy;
|
||||
return result;
|
||||
}
|
||||
|
||||
void GrEditUpdate(LtfBinEntry *tempb,GrElem *root)
|
||||
{
|
||||
BoolU4 old_preempt=Preempt(OFF);
|
||||
Free(tempb->data);
|
||||
tempb->data=GrElemsFromQueue(root,&tempb->size);
|
||||
Preempt(old_preempt);
|
||||
}
|
||||
|
||||
I4 GrElOffset[9]={0,1,2,3,0,4,5,6,7};
|
||||
|
||||
BoolU4 GrElemsInsert(LtfBinEntry *tempb,I8 *cur_num,GrElem *root,I8 x,I8 y,BoolU4 new_picture)
|
||||
{
|
||||
I8 i,j,cmd,x1,y1,x2,y2,x3,y3,p1,p2;
|
||||
I4 *ptr;
|
||||
U8 color=ROP_EQU^GR_BLACK^((Fs->text_attribute>>4)&15);
|
||||
BoolU4 old_ip_double=Bts(&Fs->crt_flags,CRTf_NO_DOUBLE_CLICK);
|
||||
I8 eletype=-2;
|
||||
GrElem root2,*tempg,*tempg1,*tempg2,*insert_point;
|
||||
U8 num;
|
||||
BoolU4 old_inhibit=ip_inhibit_win_operations;
|
||||
GrBitMap *base=GrNew(grbase);
|
||||
I8 width=1;
|
||||
P3I4 *p;
|
||||
|
||||
insert_point=GrNumToQueue(root,*cur_num,&x1,&y1);
|
||||
x+=x1; y+=y1;
|
||||
|
||||
ip_inhibit_win_operations=TRUE;
|
||||
while (TRUE) {
|
||||
GrClear;
|
||||
if (eletype==-2) {
|
||||
ip_inhibit_win_operations=FALSE;
|
||||
i=PopUpGrElemType(new_picture);
|
||||
if (i>=-1)
|
||||
eletype=i;
|
||||
ip_inhibit_win_operations=TRUE;
|
||||
}
|
||||
switch (eletype) {
|
||||
case GRET_COLOR4:
|
||||
ip_inhibit_win_operations=FALSE;
|
||||
i=PopUpColor;
|
||||
if (i>=0) {
|
||||
color=ROP_EQU|i;
|
||||
tempg=MAlloc(GrElemBaseSize(GRET_COLOR4));
|
||||
tempg->type=GRET_COLOR4;
|
||||
tempg->color4=color;
|
||||
InsQue(tempg,insert_point->last);
|
||||
GrEditUpdate(tempb,root);
|
||||
*cur_num=*cur_num+1;
|
||||
}
|
||||
ip_inhibit_win_operations=TRUE;
|
||||
eletype=-2;
|
||||
color^=((Fs->text_attribute>>4)&15);
|
||||
base->color=color;
|
||||
break;
|
||||
case GRET_COLOR24:
|
||||
eletype=-2;
|
||||
break;
|
||||
case GRET_WIDTH:
|
||||
ip_inhibit_win_operations=FALSE;
|
||||
i=PopUpWidth;
|
||||
if (i>=1) {
|
||||
width=i;
|
||||
tempg=MAlloc(GrElemBaseSize(GRET_WIDTH));
|
||||
tempg->type=GRET_WIDTH;
|
||||
tempg->width=width;
|
||||
InsQue(tempg,insert_point->last);
|
||||
GrEditUpdate(tempb,root);
|
||||
*cur_num=*cur_num+1;
|
||||
base->pen_width=width;
|
||||
}
|
||||
ip_inhibit_win_operations=TRUE;
|
||||
eletype=-2;
|
||||
break;
|
||||
}
|
||||
if (eletype!=-2) {
|
||||
cmd=0;p1=0;p2=0;
|
||||
if (eletype!=GRET_END && eletype!=-1) {
|
||||
cmd=GetMsg(&p1,&p2,
|
||||
(1<<MSG_KEY_DOWN)+(1<<MSG_IP_L_DOWN)+
|
||||
(1<<MSG_IP_R_UP));
|
||||
if (cmd==MSG_IP_R_UP)
|
||||
eletype=-2;
|
||||
}
|
||||
if (eletype==GRET_END || eletype==-1
|
||||
|| cmd==MSG_KEY_DOWN) {
|
||||
if (eletype==GRET_END || eletype==-1
|
||||
|| p1==CH_CTRLQ || p1==CH_ESC) {
|
||||
AssignBit(&Fs->crt_flags,CRTf_NO_DOUBLE_CLICK,old_ip_double);
|
||||
ip_inhibit_win_operations=old_inhibit;
|
||||
GrDel(base);
|
||||
return eletype==GRET_END || p1==CH_ESC;
|
||||
}
|
||||
} else {
|
||||
switch (eletype) {
|
||||
case GRET_LINE:
|
||||
x1=p1; y1=p2;
|
||||
x2=p1; y2=p2;
|
||||
do {
|
||||
base->color=color&0xFFFFFF|ROP_OR;
|
||||
GrLine3(base,x1,y1,0,x2,y2,0);
|
||||
cmd=GetMsg(&p1,&p2,
|
||||
(1<<MSG_IP_L_UP)+(1<<MSG_IP_MOVE));
|
||||
base->color=color&0xFFFFFF|ROP_NAND;
|
||||
GrLine3(base,x1,y1,0,x2,y2,0);
|
||||
x2=p1; y2=p2;
|
||||
} while (cmd!=MSG_IP_L_UP);
|
||||
base->color=color&0xFFFFFF|ROP_EQU;
|
||||
GrLine3(base,x1,y1,0,x2,y2,0);
|
||||
tempg=MAlloc(GrElemBaseSize(GRET_LINE));
|
||||
tempg->type=GRET_LINE;
|
||||
tempg->x1=x1-x;
|
||||
tempg->y1=y1-y;
|
||||
tempg->x2=x2-x;
|
||||
tempg->y2=y2-y;
|
||||
InsQue(tempg,insert_point->last);
|
||||
GrEditUpdate(tempb,root);
|
||||
*cur_num=*cur_num+1;
|
||||
break;
|
||||
case GRET_POINT:
|
||||
x1=p1; y1=p2;
|
||||
base->color=color;
|
||||
GrPlot3(base,x1,y1,0);
|
||||
|
||||
tempg=MAlloc(GrElemBaseSize(GRET_POINT));
|
||||
tempg->type=GRET_POINT;
|
||||
tempg->x1=x1-x;
|
||||
tempg->y1=y1-y;
|
||||
InsQue(tempg,insert_point->last);
|
||||
GrEditUpdate(tempb,root);
|
||||
*cur_num=*cur_num+1;
|
||||
break;
|
||||
case GRET_POLYLINE:
|
||||
root2.next=&root2;
|
||||
root2.last=&root2;
|
||||
num=0;
|
||||
x3=p1-x; y3=p2-y;
|
||||
x1=p1; y1=p2;
|
||||
x2=p1; y2=p2;
|
||||
do {
|
||||
do {
|
||||
base->color=color&0xFFFFFF|ROP_OR;
|
||||
GrLine3(base,x1,y1,0,x2,y2,0);
|
||||
cmd=GetMsg(&p1,&p2,
|
||||
(1<<MSG_IP_L_UP)+(1<<MSG_IP_MOVE)+
|
||||
(1<<MSG_IP_R_UP));
|
||||
base->color=color&0xFFFFFF|ROP_NAND;
|
||||
GrLine3(base,x1,y1,0,x2,y2,0);
|
||||
x2=p1; y2=p2;
|
||||
} while (cmd!=MSG_IP_L_UP && cmd!=MSG_IP_R_UP);
|
||||
base->color=color&0xFFFFFF|ROP_EQU;
|
||||
if (cmd==MSG_IP_L_UP) {
|
||||
GrLine3(base,x1,y1,0,x2,y2,0);
|
||||
tempg=MAlloc(GrElemBaseSize(GRET_POINT));
|
||||
tempg->type=GRET_POINT;
|
||||
tempg->x1=x2-x;
|
||||
tempg->y1=y2-y;
|
||||
InsQue(tempg,root2.last);
|
||||
x1=x2;y1=y2;
|
||||
num++;
|
||||
}
|
||||
} while (cmd!=MSG_IP_R_UP);
|
||||
if (num) {
|
||||
tempg2=MAllocZ(GrElemBaseSize(GRET_POLYLINE)+
|
||||
(num+1)<<1*sizeof(I4));
|
||||
ptr=&tempg2->y1;
|
||||
tempg=root2.next;
|
||||
ptr[0]=x3;
|
||||
ptr[1]=y3;
|
||||
ptr+=sizeof(I4)<<1;
|
||||
for (i=0;i<num;i++) {
|
||||
tempg1=tempg->next;
|
||||
ptr[i<<1]=tempg->x1;
|
||||
ptr[i<<1+1]=tempg->y1;
|
||||
Free(tempg);
|
||||
tempg=tempg1;
|
||||
}
|
||||
tempg2->type=GRET_POLYLINE;
|
||||
tempg2->num=num+1;
|
||||
InsQue(tempg2,insert_point->last);
|
||||
GrEditUpdate(tempb,root);
|
||||
*cur_num=*cur_num+1;
|
||||
}
|
||||
break;
|
||||
case GRET_POLYPOINT:
|
||||
root2.next=&root2;
|
||||
root2.last=&root2;
|
||||
x3=p1-x; y3=p2-y;
|
||||
x1=p1; y1=p2;
|
||||
x2=p1; y2=p2;
|
||||
base->color=color&0xFFFFFF|ROP_EQU;
|
||||
do {
|
||||
cmd=GetMsg(&p1,&p2,
|
||||
(1<<MSG_IP_L_UP)+(1<<MSG_IP_MOVE));
|
||||
x2=p1; y2=p2;
|
||||
GrLine3(base,x1,y1,0,x2,y2,0);
|
||||
Line(&root2,x1-x,y1-y,0,x2-x,y2-y,0,&GrPolyPointPlot);
|
||||
x1=x2;y1=y2;
|
||||
num++;
|
||||
} while (cmd!=MSG_IP_L_UP);
|
||||
|
||||
num=0;
|
||||
tempg=root2.next;
|
||||
x1=x3;y1=y3;
|
||||
while (tempg!=&root2) {
|
||||
tempg1=tempg->next;
|
||||
if (tempg->x1==x1 && tempg->y1==y1) {
|
||||
RemQue(tempg);
|
||||
Free(tempg);
|
||||
} else {
|
||||
num++;
|
||||
x1=tempg->x1;
|
||||
y1=tempg->y1;
|
||||
}
|
||||
tempg=tempg1;
|
||||
}
|
||||
|
||||
tempg2=MAllocZ(GrElemBaseSize(GRET_POLYPOINT)+
|
||||
sizeof(I4)*2+(num*3+7)>>3);
|
||||
ptr=&tempg2->y1;
|
||||
tempg=root2.next;
|
||||
ptr[0]=x3;
|
||||
ptr[1]=y3;
|
||||
ptr+=sizeof(I4)<<1;
|
||||
x1=x3;y1=y3;
|
||||
for (i=0;i<num;i++) {
|
||||
tempg1=tempg->next;
|
||||
j=GrElOffset[SignI8(tempg->x1-x1)+1+3*(SignI8(tempg->y1-y1)+1)];
|
||||
x1=tempg->x1;y1=tempg->y1;
|
||||
if (j&1) Bts(ptr,i*3);
|
||||
if (j&2) Bts(ptr,i*3+1);
|
||||
if (j&4) Bts(ptr,i*3+2);
|
||||
Free(tempg);
|
||||
tempg=tempg1;
|
||||
}
|
||||
tempg2->type=GRET_POLYPOINT;
|
||||
tempg2->num=num+1;
|
||||
InsQue(tempg2,insert_point->last);
|
||||
GrEditUpdate(tempb,root);
|
||||
*cur_num=*cur_num+1;
|
||||
break;
|
||||
case GRET_BSPLINE2:
|
||||
case GRET_BSPLINE3:
|
||||
case GRET_BSPLINE2_CLOSED:
|
||||
case GRET_BSPLINE3_CLOSED:
|
||||
root2.next=&root2;
|
||||
root2.last=&root2;
|
||||
num=0;
|
||||
x3=p1-x; y3=p2-y;
|
||||
x1=p1; y1=p2;
|
||||
x2=p1; y2=p2;
|
||||
do {
|
||||
do {
|
||||
base->color=color&0xFFFFFF|ROP_OR;
|
||||
GrLine3(base,x1,y1,0,x2,y2,0);
|
||||
cmd=GetMsg(&p1,&p2,
|
||||
(1<<MSG_IP_L_UP)+(1<<MSG_IP_MOVE)+
|
||||
(1<<MSG_IP_R_UP));
|
||||
base->color=color&0xFFFFFF|ROP_NAND;
|
||||
GrLine3(base,x1,y1,0,x2,y2,0);
|
||||
x2=p1; y2=p2;
|
||||
} while (cmd!=MSG_IP_L_UP && cmd!=MSG_IP_R_UP);
|
||||
base->color=color&0xFFFFFF|ROP_EQU;
|
||||
if (cmd==MSG_IP_L_UP) {
|
||||
GrLine3(base,x1,y1,0,x2,y2,0);
|
||||
tempg=MAlloc(GrElemBaseSize(GRET_POINT));
|
||||
tempg->type=GRET_POINT;
|
||||
tempg->x1=x2-x;
|
||||
tempg->y1=y2-y;
|
||||
InsQue(tempg,root2.last);
|
||||
x1=x2;y1=y2;
|
||||
num++;
|
||||
}
|
||||
} while (cmd!=MSG_IP_R_UP);
|
||||
if (num) {
|
||||
tempg2=MAllocZ(GrElemBaseSize(GRET_POLYLINE)+
|
||||
(num+1)*sizeof(P3I4));
|
||||
p=&tempg2->y1;
|
||||
tempg=root2.next;
|
||||
p[0].x=x3;
|
||||
p[0].y=y3;
|
||||
p+=sizeof(P3I4);
|
||||
for (i=0;i<num;i++) {
|
||||
tempg1=tempg->next;
|
||||
p[i].x=tempg->x1;
|
||||
p[i].y=tempg->y1;
|
||||
Free(tempg);
|
||||
tempg=tempg1;
|
||||
}
|
||||
tempg2->type=eletype;
|
||||
tempg2->num=num+1;
|
||||
InsQue(tempg2,insert_point->last);
|
||||
GrEditUpdate(tempb,root);
|
||||
*cur_num=*cur_num+1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EditInsertGraphic(Ltf *l,I8 x,I8 y)
|
||||
{
|
||||
BoolU4 old_preempt=Preempt(OFF);
|
||||
LtfEntry *ll;
|
||||
LtfBinEntry *tempb;
|
||||
I8 cur_num=0;
|
||||
GrElem *root;
|
||||
tempb=MAllocZ(sizeof(LtfBinEntry));
|
||||
tempb->type=LTFBT_ELEMENT_GRAPH;
|
||||
tempb->size=GrElemBaseSize(GRET_END,FALSE);
|
||||
tempb->data=MAllocZ(tempb->size);
|
||||
ll=MAllocZ(sizeof(LtfEntry));
|
||||
ll->display=NewString("");
|
||||
ll->plain_text=MSPrintF("PI %d",l->cur_bin_num);
|
||||
ll->bin_num=l->cur_bin_num;
|
||||
tempb->num=l->cur_bin_num++;
|
||||
ll->type=LTFT_PICTURE;
|
||||
ll->flags=LTFLF_HAS_BIN;
|
||||
ll->bin_data=tempb;
|
||||
InsQue(tempb,l->bin_root.last);
|
||||
LtfInsert(l,ll);
|
||||
Preempt(old_preempt);
|
||||
root=GrElemsToQueue(tempb->data);
|
||||
if (!GrElemsInsert(tempb,&cur_num,root,x,y,TRUE)) {
|
||||
Preempt(OFF);
|
||||
RemQue(ll);
|
||||
Free(ll);
|
||||
Free(ll->display);
|
||||
Free(ll->plain_text);
|
||||
RemQue(tempb);
|
||||
Free(tempb->data);
|
||||
Preempt(old_preempt);
|
||||
}
|
||||
GrElemsDel(root);
|
||||
}
|
||||
|
||||
public void LtfPutGrElem(Ltf *l,U1 *elems,U8 size)
|
||||
{
|
||||
BoolU4 old_preempt=Preempt(OFF);
|
||||
LtfEntry *ll;
|
||||
LtfBinEntry *tempb;
|
||||
tempb=MAllocZ(sizeof(LtfBinEntry),l->mem_tss);
|
||||
tempb->type=LTFBT_ELEMENT_GRAPH;
|
||||
tempb->size=size;
|
||||
tempb->data=MAlloc(size,l->mem_tss);
|
||||
MemCpy(tempb->data,elems,size);
|
||||
ll=MAllocZ(sizeof(LtfEntry),l->mem_tss);
|
||||
ll->display=NewString("",l->mem_tss);
|
||||
ll->plain_text=MSPrintF("PI %d",l->cur_bin_num); //TODO:mem_tss
|
||||
ll->bin_num=l->cur_bin_num;
|
||||
tempb->num=l->cur_bin_num++;
|
||||
ll->type=LTFT_PICTURE;
|
||||
ll->flags=LTFLF_HAS_BIN;
|
||||
ll->bin_data=tempb;
|
||||
InsQue(tempb,l->bin_root.last);
|
||||
LtfInsert(l,ll);
|
||||
Preempt(old_preempt);
|
||||
}
|
||||
|
||||
public void PutGrElem(U1 *elems,U8 size)
|
||||
{
|
||||
Ltf *l=Fs->cur_ltf;
|
||||
if (l)
|
||||
LtfPutGrElem(l,elems,size);
|
||||
}
|
||||
|
||||
void EditExistingGraphic(Ltf *l,I8 x,I8 y)
|
||||
{
|
||||
BoolU4 *old_preempt=Preempt(OFF);
|
||||
LtfEntry *ll=l->cur_entry;
|
||||
LtfBinEntry *tempb=ll->bin_data;
|
||||
I8 i,cur_num=0,cmd,p1,p2,old_size=tempb->size,xx,yy;
|
||||
GrElem *cur_elem,*old_GrElem=tempb->data,
|
||||
*root=GrElemsToQueue(old_GrElem),*tempg,*insert_point;
|
||||
BoolU4 old_inhibit=ip_inhibit_win_operations;
|
||||
BoolU4 old_ip_double=Bt(&Fs->crt_flags,CRTf_NO_DOUBLE_CLICK);
|
||||
tempb->data=MAllocIdentical(old_GrElem);
|
||||
Preempt(old_preempt);
|
||||
do {
|
||||
i=PopUpGrElemsEditChoice;
|
||||
switch (i) {
|
||||
case GED_PICK_TEXT:
|
||||
cur_num=PopUpPickGrElem(root);
|
||||
break;
|
||||
case GED_PICK_GRAPHICALLY:
|
||||
l->cur_GrElem=tempb->data;
|
||||
GetMsg(&p1,&p2,1<<MSG_IP_L_UP);
|
||||
cur_num=l->cur_sub_GrElem;
|
||||
l->cur_GrElem=NULL;
|
||||
break;
|
||||
case GED_SET_ORIGIN:
|
||||
GetMsg(&p1,&p2,1<<MSG_IP_L_UP);
|
||||
GrSetOrigin(root,x-p1,y-p2,0);
|
||||
GrEditUpdate(tempb,root);
|
||||
break;
|
||||
case GED_SHIFT_ORIGIN:
|
||||
ip_inhibit_win_operations=TRUE;
|
||||
Bts(&Fs->crt_flags,CRTf_NO_DOUBLE_CLICK);
|
||||
insert_point=GrNumToQueue(root,cur_num);
|
||||
tempg=MAlloc(GrElemBaseSize(GRET_SHIFT));
|
||||
tempg->type=GRET_SHIFT;
|
||||
tempg->x1=0;
|
||||
tempg->y1=0;
|
||||
InsQue(tempg,insert_point->last);
|
||||
GetMsg(&p1,&p2,1<<MSG_IP_L_DOWN);
|
||||
xx=p1; yy=p2;
|
||||
do {
|
||||
cmd=GetMsg(&p1,&p2,
|
||||
(1<<MSG_IP_L_UP)+(1<<MSG_IP_MOVE));
|
||||
tempg->x1=p1-xx;
|
||||
tempg->y1=p2-yy;
|
||||
GrEditUpdate(tempb,root);
|
||||
} while (cmd!=MSG_IP_L_UP);
|
||||
AssignBit(&Fs->crt_flags,CRTf_NO_DOUBLE_CLICK,old_ip_double);
|
||||
ip_inhibit_win_operations=old_inhibit;
|
||||
break;
|
||||
case GED_INSERT:
|
||||
GrElemsInsert(tempb,&cur_num,root,x,y,FALSE);
|
||||
break;
|
||||
case GED_DELETE:
|
||||
cur_elem=GrNumToQueue(root,cur_num);
|
||||
if (cur_elem!=root) {
|
||||
RemQue(cur_elem);
|
||||
Free(cur_elem);
|
||||
GrEditUpdate(tempb,root);
|
||||
}
|
||||
break;
|
||||
case GED_EDIT:
|
||||
break;
|
||||
}
|
||||
} while (i!=GED_CANCEL && i!=GED_END);
|
||||
Preempt(OFF);
|
||||
if (i==GED_END)
|
||||
Free(old_GrElem);
|
||||
else {
|
||||
Free(tempb->data);
|
||||
tempb->data=old_GrElem;
|
||||
tempb->size=old_size;
|
||||
}
|
||||
Preempt(old_preempt);
|
||||
GrElemsDel(root);
|
||||
}
|
||||
@@ -1,425 +0,0 @@
|
||||
ALIGN 8,0x90
|
||||
REVERSE_BITS_TABLE::
|
||||
$FG$$BG$ DU1 0x00,0x80,0x40,0xC0,0x20,0xA0,0x60,0xE0;
|
||||
DU1 0x10,0x90,0x50,0xD0,0x30,0xB0,0x70,0xF0;
|
||||
DU1 0x08,0x88,0x48,0xC8,0x28,0xA8,0x68,0xE8;
|
||||
DU1 0x18,0x98,0x58,0xD8,0x38,0xB8,0x78,0xF8;
|
||||
DU1 0x04,0x84,0x44,0xC4,0x24,0xA4,0x64,0xE4;
|
||||
DU1 0x14,0x94,0x54,0xD4,0x34,0xB4,0x74,0xF4;
|
||||
DU1 0x0C,0x8C,0x4C,0xCC,0x2C,0xAC,0x6C,0xEC;
|
||||
DU1 0x1C,0x9C,0x5C,0xDC,0x3C,0xBC,0x7C,0xFC;
|
||||
DU1 0x02,0x82,0x42,0xC2,0x22,0xA2,0x62,0xE2;
|
||||
DU1 0x12,0x92,0x52,0xD2,0x32,0xB2,0x72,0xF2;
|
||||
DU1 0x0A,0x8A,0x4A,0xCA,0x2A,0xAA,0x6A,0xEA;
|
||||
DU1 0x1A,0x9A,0x5A,0xDA,0x3A,0xBA,0x7A,0xFA;
|
||||
DU1 0x06,0x86,0x46,0xC6,0x26,0xA6,0x66,0xE6;
|
||||
DU1 0x16,0x96,0x56,0xD6,0x36,0xB6,0x76,0xF6;
|
||||
DU1 0x0E,0x8E,0x4E,0xCE,0x2E,0xAE,0x6E,0xEE;
|
||||
DU1 0x1E,0x9E,0x5E,0xDE,0x3E,0xBE,0x7E,0xFE;
|
||||
DU1 0x01,0x81,0x41,0xC1,0x21,0xA1,0x61,0xE1;
|
||||
DU1 0x11,0x91,0x51,0xD1,0x31,0xB1,0x71,0xF1;
|
||||
DU1 0x09,0x89,0x49,0xC9,0x29,0xA9,0x69,0xE9;
|
||||
DU1 0x19,0x99,0x59,0xD9,0x39,0xB9,0x79,0xF9;
|
||||
DU1 0x05,0x85,0x45,0xC5,0x25,0xA5,0x65,0xE5;
|
||||
DU1 0x15,0x95,0x55,0xD5,0x35,0xB5,0x75,0xF5;
|
||||
DU1 0x0D,0x8D,0x4D,0xCD,0x2D,0xAD,0x6D,0xED;
|
||||
DU1 0x1D,0x9D,0x5D,0xDD,0x3D,0xBD,0x7D,0xFD;
|
||||
DU1 0x03,0x83,0x43,0xC3,0x23,0xA3,0x63,0xE3;
|
||||
DU1 0x13,0x93,0x53,0xD3,0x33,0xB3,0x73,0xF3;
|
||||
DU1 0x0B,0x8B,0x4B,0xCB,0x2B,0xAB,0x6B,0xEB;
|
||||
DU1 0x1B,0x9B,0x5B,0xDB,0x3B,0xBB,0x7B,0xFB;
|
||||
DU1 0x07,0x87,0x47,0xC7,0x27,0xA7,0x67,0xE7;
|
||||
DU1 0x17,0x97,0x57,0xD7,0x37,0xB7,0x77,0xF7;
|
||||
DU1 0x0F,0x8F,0x4F,0xCF,0x2F,0xAF,0x6F,0xEF;
|
||||
DU1 0x1F,0x9F,0x5F,0xDF,0x3F,0xBF,0x7F,0xFF;
|
||||
$FU$$FG$$BG$$FU$$FG$$BG$
|
||||
MSG_DRAW_TASK_BORDER: DU1 "DrawTaskBorder",0;
|
||||
MSG_UPDATE_ODES: DU1 "UpdateOdes",0;
|
||||
////**************************PROCEDURE*************************
|
||||
ALIGN 8,0x90
|
||||
CP_PLOT_SCREEN_I1::
|
||||
PUSH EBP
|
||||
MOV EBP,ESP
|
||||
MOV EBX,SF_PARAM2[EBP]
|
||||
MOV EAX,SF_PARAM3[EBP]
|
||||
OR EBX,EBX
|
||||
JS @@100
|
||||
OR EAX,EAX
|
||||
JS @@100
|
||||
CMP EBX,U4 FS:[TSS_CRT_WIDTH]
|
||||
JGE @@100
|
||||
CMP EAX,U4 FS:[TSS_CRT_HEIGHT]
|
||||
JGE @@100
|
||||
IMUL U4 FS:[TSS_CRT_WIDTH]
|
||||
ADD EAX,U4 [SYS_TEXTBASE]
|
||||
ADD EBX,EAX
|
||||
MOV EAX,U4 SF_PARAM1[EBP]
|
||||
MOV U4 [EBX],EAX
|
||||
|
||||
POP EBP
|
||||
XOR EDX,EDX
|
||||
MOV EAX,1
|
||||
RET
|
||||
@@100: POP EBP
|
||||
XOR EDX,EDX
|
||||
XOR EAX,EAX
|
||||
RET
|
||||
////**************************PROCEDURE*************************
|
||||
ALIGN 8,0x90
|
||||
CP_PLOT_WINDOW_I1::
|
||||
PUSH EBP
|
||||
MOV EBP,ESP
|
||||
MOV EBX,U4 SF_PARAM2[EBP]
|
||||
MOV EAX,U4 SF_PARAM3[EBP]
|
||||
|
||||
OR EBX,EBX
|
||||
JS @@100
|
||||
ADD EBX,U4 FS:[TSS_WINDOW_LEFT]
|
||||
CMP EBX,U4 FS:[TSS_WINDOW_RIGHT]
|
||||
JG @@100
|
||||
OR EBX,EBX
|
||||
JS @@100
|
||||
CMP EBX,U4 FS:[TSS_CRT_WIDTH]
|
||||
JGE @@100
|
||||
|
||||
OR EAX,EAX
|
||||
JS @@100
|
||||
ADD EAX,U4 FS:[TSS_WINDOW_TOP]
|
||||
CMP EAX,U4 FS:[TSS_WINDOW_BOTTOM]
|
||||
JG @@100
|
||||
OR EAX,EAX
|
||||
JS @@100
|
||||
CMP EAX,U4 FS:[TSS_CRT_HEIGHT]
|
||||
JGE @@100
|
||||
|
||||
IMUL U4 FS:[TSS_CRT_WIDTH]
|
||||
ADD EAX,U4 [SYS_TEXTBASE]
|
||||
ADD EBX,EAX
|
||||
MOV EAX,U4 SF_PARAM1[EBP]
|
||||
MOV U4 [EBX],EAX
|
||||
|
||||
POP EBP
|
||||
XOR EDX,EDX
|
||||
MOV EAX,1
|
||||
RET
|
||||
@@100: POP EBP
|
||||
XOR EDX,EDX
|
||||
XOR EAX,EAX
|
||||
RET
|
||||
////**************************PROCEDURE*************************
|
||||
ALIGN 8,0x90
|
||||
CP_PLOT_BORDER_I1::
|
||||
PUSH EBP
|
||||
MOV EBP,ESP
|
||||
MOV EBX,U4 SF_PARAM2[EBP]
|
||||
MOV EAX,U4 SF_PARAM3[EBP]
|
||||
|
||||
MOV EDX,-4
|
||||
CMP EBX,EDX
|
||||
JL @@100
|
||||
ADD EBX,U4 FS:[TSS_WINDOW_LEFT]
|
||||
MOV EDX,U4 FS:[TSS_WINDOW_RIGHT]
|
||||
ADD EDX,4
|
||||
CMP EBX,EDX
|
||||
JG @@100
|
||||
OR EBX,EBX
|
||||
JS @@100
|
||||
CMP EBX,U4 FS:[TSS_CRT_WIDTH]
|
||||
JGE @@100
|
||||
|
||||
MOV EDX,-1
|
||||
CMP EAX,EDX
|
||||
JL @@100
|
||||
ADD EAX,U4 FS:[TSS_WINDOW_TOP]
|
||||
MOV EDX,U4 FS:[TSS_WINDOW_BOTTOM]
|
||||
INC EDX
|
||||
CMP EAX,EDX
|
||||
JG @@100
|
||||
OR EAX,EAX
|
||||
JS @@100
|
||||
CMP EAX,U4 FS:[TSS_CRT_HEIGHT]
|
||||
JGE @@100
|
||||
|
||||
IMUL U4 FS:[TSS_CRT_WIDTH]
|
||||
ADD EAX,U4 [SYS_TEXTBASE]
|
||||
ADD EBX,EAX
|
||||
MOV EAX,U4 SF_PARAM1[EBP]
|
||||
MOV U4 [EBX],EAX
|
||||
|
||||
POP EBP
|
||||
XOR EDX,EDX
|
||||
MOV EAX,1
|
||||
RET
|
||||
@@100: POP EBP
|
||||
XOR EDX,EDX
|
||||
XOR EAX,EAX
|
||||
RET
|
||||
////**************************PROCEDURE*************************
|
||||
ALIGN 8,0x90
|
||||
GR_UPDATE_WINDOWS::
|
||||
PUSHAD //-****
|
||||
MOV ESI,U4 FS:[TSS_ABSOLUTE_ADDRESS]
|
||||
MOV EDI,ESI
|
||||
JMP @@1
|
||||
|
||||
@@10: MOV EAX,U4 TSS_FS[EDI]
|
||||
MOV FS,AX
|
||||
PUSH ESI
|
||||
MOV ESI,MSG_UPDATE_ODES
|
||||
CALL FIND_EXTERN
|
||||
JZ @@11
|
||||
CALL ESI
|
||||
@@11: POP ESI
|
||||
BT U4 FS:[TSS_CRT_FLAGS],CRTf_SHOW
|
||||
JNC @@2
|
||||
PUSH ESI
|
||||
MOV ESI,MSG_DRAW_TASK_BORDER
|
||||
CALL FIND_EXTERN
|
||||
JZ @@12
|
||||
CALL ESI
|
||||
@@12: POP ESI
|
||||
BT U4 [SYS_FLAGS],SYSf_TASK_LINKS_ALTERED
|
||||
JC @@100
|
||||
@@1: MOV EAX,U4 FS:[TSS_UPDATE_WINDOW]
|
||||
OR EAX,EAX
|
||||
JZ @@2
|
||||
CALL EAX
|
||||
@@2: BT U4 [SYS_FLAGS],SYSf_TASK_LINKS_ALTERED
|
||||
JC @@100
|
||||
MOV EDI,U4 FS:[TSS_NEXT_TSS]
|
||||
CMP ESI,EDI
|
||||
JNE @@10
|
||||
@@100: MOV EAX,U4 TSS_FS[ESI]
|
||||
MOV FS,AX
|
||||
POPAD //+****
|
||||
RET
|
||||
////**************************PROCEDURE*************************
|
||||
ALIGN 8,0x90
|
||||
/*
|
||||
GrXorLine(&dst3,&src,&src2,d5,vga_image);
|
||||
for (col=0;col<d5;col++) {
|
||||
*dst3=*src^*src2;
|
||||
dst3+=4;
|
||||
src+=4;
|
||||
src2+=4;
|
||||
}
|
||||
*/
|
||||
GR_XOR_LINE::
|
||||
PUSH EBP
|
||||
MOV EBP,ESP
|
||||
PUSH ESI
|
||||
PUSH EDI
|
||||
MOV EAX,SF_PARAM2[EBP]
|
||||
MOV EDX,U4 [EAX]
|
||||
|
||||
MOV EAX,SF_PARAM3[EBP]
|
||||
MOV ESI,U4 [EAX]
|
||||
MOV ECX,SF_PARAM4[EBP]
|
||||
MOV EAX,SF_PARAM5[EBP]
|
||||
MOV EDI,U4 [EAX]
|
||||
|
||||
@@5: MOV EAX,U4 [ESI]
|
||||
XOR EAX,U4 [EDX]
|
||||
MOV U4 [ESI],EAX
|
||||
CMP U4 [EDI],EAX
|
||||
JNE @@7
|
||||
STOSD
|
||||
ADD ESI,4
|
||||
ADD EDX,4
|
||||
LOOP @@5
|
||||
MOV EAX,SF_PARAM5[EBP]
|
||||
MOV U4[EAX],EDI
|
||||
|
||||
MOV EAX,SF_PARAM1[EBP]
|
||||
MOV EDI,U4 [EAX]
|
||||
MOV ECX,SF_PARAM4[EBP]
|
||||
ADD EDI,ECX
|
||||
ADD EDI,ECX
|
||||
ADD EDI,ECX
|
||||
ADD EDI,ECX
|
||||
JMP @@100
|
||||
|
||||
@@6: MOV EAX,U4 [ESI]
|
||||
XOR EAX,U4 [EDX]
|
||||
MOV U4 [ESI],EAX
|
||||
@@7: STOSD
|
||||
ADD ESI,4
|
||||
ADD EDX,4
|
||||
LOOP @@6
|
||||
MOV EAX,SF_PARAM5[EBP]
|
||||
MOV U4[EAX],EDI
|
||||
|
||||
MOV EBX,REVERSE_BITS_TABLE
|
||||
MOV EAX,SF_PARAM3[EBP]
|
||||
MOV ESI,U4 [EAX]
|
||||
MOV ECX,SF_PARAM4[EBP]
|
||||
MOV EAX,SF_PARAM1[EBP]
|
||||
MOV EDI,U4 [EAX]
|
||||
@@10: LODSD
|
||||
XLATB
|
||||
ROR EAX,8
|
||||
XLATB
|
||||
ROR EAX,8
|
||||
XLATB
|
||||
ROR EAX,8
|
||||
XLATB
|
||||
ROR EAX,8
|
||||
STOSD
|
||||
LOOP @@10
|
||||
|
||||
@@100: MOV EAX,SF_PARAM3[EBP]
|
||||
MOV U4[EAX],ESI
|
||||
MOV EAX,SF_PARAM1[EBP]
|
||||
MOV U4[EAX],EDI
|
||||
MOV EAX,SF_PARAM2[EBP]
|
||||
MOV U4[EAX],EDX
|
||||
POP EDI
|
||||
POP ESI
|
||||
POP EBP
|
||||
RET
|
||||
////**************************PROCEDURE*************************
|
||||
ALIGN 8,0x90
|
||||
/*
|
||||
GrPlotChar(font_ptr,cur_ch.u1[1],&dst2,d1,d2);
|
||||
|
||||
for (plane=0x01;plane!=0x10;plane<<=1) {
|
||||
font_ptr2=font_ptr;
|
||||
if (cur_ch.u1[1] & plane) {
|
||||
for (ch_line=0;ch_line<FONT_HEIGHT;ch_line++) {
|
||||
*dst2|=*font_ptr2++;
|
||||
dst2+=d1;
|
||||
}
|
||||
} else {
|
||||
for (ch_line=0;ch_line<FONT_HEIGHT;ch_line++) {
|
||||
*dst2&=~*font_ptr2++;
|
||||
dst2+=d1;
|
||||
}
|
||||
}
|
||||
dst2+=d2;
|
||||
}
|
||||
*/
|
||||
GR_PLOT_CHAR::
|
||||
PUSH EBP
|
||||
MOV EBP,ESP
|
||||
PUSH ESI
|
||||
PUSH EDI
|
||||
MOV EDX,1 //EDX=plane
|
||||
MOV EBX,U4 SF_PARAM4[EBP] //EBX=d1
|
||||
MOV EAX,U4 SF_PARAM3[EBP] //EDI=dst2
|
||||
MOV EDI,U4 [EAX] //EDI=dst2
|
||||
@@10: MOV ESI,U4 SF_PARAM1[EBP] //ESI=font_ptr2
|
||||
TEST U4 SF_PARAM2[EBP],EDX
|
||||
JZ @@30
|
||||
|
||||
@@20: LODSD
|
||||
OR U1 [EDI],AL
|
||||
ADD EDI,EBX
|
||||
OR U1 [EDI],AH
|
||||
ADD EDI,EBX
|
||||
ROR EAX,16
|
||||
OR U1 [EDI],AL
|
||||
ADD EDI,EBX
|
||||
OR U1 [EDI],AH
|
||||
ADD EDI,EBX
|
||||
LODSD
|
||||
OR U1 [EDI],AL
|
||||
ADD EDI,EBX
|
||||
OR U1 [EDI],AH
|
||||
ADD EDI,EBX
|
||||
ROR EAX,16
|
||||
OR U1 [EDI],AL
|
||||
ADD EDI,EBX
|
||||
OR U1 [EDI],AH
|
||||
ADD EDI,EBX
|
||||
JMP @@40
|
||||
|
||||
@@30: LODSD
|
||||
NOT EAX
|
||||
AND U1 [EDI],AL
|
||||
ADD EDI,EBX
|
||||
AND U1 [EDI],AH
|
||||
ADD EDI,EBX
|
||||
ROR EAX,16
|
||||
AND U1 [EDI],AL
|
||||
ADD EDI,EBX
|
||||
AND U1 [EDI],AH
|
||||
ADD EDI,EBX
|
||||
LODSD
|
||||
NOT EAX
|
||||
AND U1 [EDI],AL
|
||||
ADD EDI,EBX
|
||||
AND U1 [EDI],AH
|
||||
ADD EDI,EBX
|
||||
ROR EAX,16
|
||||
AND U1 [EDI],AL
|
||||
ADD EDI,EBX
|
||||
AND U1 [EDI],AH
|
||||
ADD EDI,EBX
|
||||
|
||||
@@40: ADD EDI,U4 SF_PARAM5[EBP]
|
||||
SHL1 EDX
|
||||
CMP EDX,0x10
|
||||
JNE @@10
|
||||
|
||||
MOV EAX,SF_PARAM3[EBP]
|
||||
MOV U4[EAX],EDI
|
||||
POP EDI
|
||||
POP ESI
|
||||
POP EBP
|
||||
RET
|
||||
////**************************PROCEDURE*************************
|
||||
ALIGN 8,0x90
|
||||
/*
|
||||
GrPlotBackground(cur_ch.u1[1],&dst,d1,d2);
|
||||
|
||||
for (plane=0x10;plane!=0x100;plane=plane<<1) {
|
||||
d=(cur_ch.u1[1] & plane) ? 0xFF:0x00;
|
||||
for (ch_line=0;ch_line<FONT_HEIGHT;ch_line++) {
|
||||
*dst=d;
|
||||
dst+=d1;
|
||||
}
|
||||
dst+=d2;
|
||||
}
|
||||
*/
|
||||
GR_PLOT_BACKGROUND::
|
||||
PUSH EBP
|
||||
MOV EBP,ESP
|
||||
PUSH EDI
|
||||
MOV EDX,0x10 //EDX=plane
|
||||
MOV EBX,U4 SF_PARAM3[EBP] //EBX=d1
|
||||
MOV EAX,U4 SF_PARAM2[EBP] //EDI=dst
|
||||
MOV EDI,U4 [EAX] //EDI=dst
|
||||
|
||||
@@10: XOR EAX,EAX
|
||||
TEST U4 SF_PARAM1[EBP],EDX
|
||||
JZ @@20
|
||||
DEC EAX
|
||||
|
||||
@@20: MOV U1 [EDI],AL
|
||||
ADD EDI,EBX
|
||||
MOV U1 [EDI],AL
|
||||
ADD EDI,EBX
|
||||
MOV U1 [EDI],AL
|
||||
ADD EDI,EBX
|
||||
MOV U1 [EDI],AL
|
||||
ADD EDI,EBX
|
||||
MOV U1 [EDI],AL
|
||||
ADD EDI,EBX
|
||||
MOV U1 [EDI],AL
|
||||
ADD EDI,EBX
|
||||
MOV U1 [EDI],AL
|
||||
ADD EDI,EBX
|
||||
MOV U1 [EDI],AL
|
||||
ADD EDI,EBX
|
||||
|
||||
ADD EDI,U4 SF_PARAM4[EBP]
|
||||
SHL1 EDX
|
||||
CMP EDX,0x100
|
||||
JNE @@10
|
||||
|
||||
MOV EAX,SF_PARAM2[EBP]
|
||||
MOV U4[EAX],EDI
|
||||
POP EDI
|
||||
POP EBP
|
||||
RET
|
||||
|
||||
-1228
File diff suppressed because it is too large.
Load diff
-136
@@ -1,136 +0,0 @@
|
||||
#define JOY_CAL_FILE "::/LT/ADAM/JOY.DTZ"
|
||||
#define LTPORT 0x201
|
||||
#define CMAX 0x800
|
||||
|
||||
public I8 joyv[4],joymax[4],joymin[4],joyrest[4];
|
||||
public BoolU4 joyb[4],joy_calibrated=FALSE,joy_being_calibrated=FALSE;
|
||||
public I8 joysat=100,joynx=0,joyny=0; //Normalized
|
||||
public I8 joycx=grwidth>>1,joycy=grheight>>1,joycvx=0,joycvy=0;
|
||||
public I8 joytx=0,joyty=0; //Text row & col
|
||||
|
||||
void PollJoystick()
|
||||
{
|
||||
I8 i, j;
|
||||
I8 mask = 15;
|
||||
I8 scale2=24;
|
||||
BoolU4 old_preempt=Preempt(OFF);
|
||||
|
||||
for (i=0;i<4;i++)
|
||||
joyv[i]=0;
|
||||
OutP(LTPORT, 0);
|
||||
for (i=1; mask && i < CMAX; i++) {
|
||||
j = InP(LTPORT) ^ mask;
|
||||
if (j & 1) { joyv[0] = i; mask = mask ^ 1; }
|
||||
if (j & 2) { joyv[1] = i; mask = mask ^ 2; }
|
||||
if (j & 4) { joyv[2] = i; mask = mask ^ 4; }
|
||||
if (j & 8) { joyv[3] = i; mask = mask ^ 8; }
|
||||
}
|
||||
Preempt(old_preempt);
|
||||
j = InP(LTPORT);
|
||||
joyb[0] = !(j & 0x10);
|
||||
joyb[1] = !(j & 0x20);
|
||||
joyb[2] = !(j & 0x40);
|
||||
joyb[3] = !(j & 0x80);
|
||||
|
||||
if (joy_calibrated) {
|
||||
joynx=joysat*(joyv[0]-joyrest[0])/(joymax[0]-joymin[0]+1);
|
||||
if (AbsI8(joynx)<15)
|
||||
joycvx=0;
|
||||
else
|
||||
joycvx+=joynx-SignI8(joynx)*15;
|
||||
joyny=joysat*(joyv[1]-joyrest[1])/(joymax[1]-joymin[1]+1);
|
||||
if (AbsI8(joyny)<15)
|
||||
joycvy=0;
|
||||
else
|
||||
joycvy+=joyny-SignI8(joyny)*15;
|
||||
joycx+=joycvx/scale2;
|
||||
joycvx=70*joycvx/100;
|
||||
joycy+=joycvy/scale2;
|
||||
joycvy=70*joycvy/100;
|
||||
if (joycx < 0) joycx=0;
|
||||
if (joycx>=grwidth) joycx=grwidth-1;
|
||||
if (joycy < 0) joycy=0;
|
||||
if (joycy>=grheight) joycy=grheight-1;
|
||||
joytx=joycx/FONT_WIDTH;
|
||||
joyty=joycy/FONT_HEIGHT;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void JoyCalibration()
|
||||
{
|
||||
I8 i,x,y;
|
||||
I8 buf[3<<2];
|
||||
I8 old_ip=ip_pointer_type;
|
||||
joy_calibrated=FALSE;
|
||||
ip_pointer_type=IP_JOYSTICK0;
|
||||
GrBitMap *base=GrNew(grbase);
|
||||
base->color=ROP_XOR|GR_WHITE;
|
||||
for (i=0;i<4;i++)
|
||||
joyb[i]=0;
|
||||
coutln "$$CL$$Leave joystick and throttle centered\r\n and press button.";
|
||||
while (!(joyb[0] || joyb[1])) {
|
||||
SwapInNext;
|
||||
}
|
||||
for (i=0;i<4;i++) {
|
||||
joyrest[i]=joyv[i];
|
||||
joymax[i]=joyv[i];
|
||||
joymin[i]=joyv[i];
|
||||
}
|
||||
while (joyb[0] || joyb[1]) {
|
||||
SwapInNext;
|
||||
}
|
||||
coutln "$$CL$$Move all about including throttle and press button.";
|
||||
while (!(joyb[0] || joyb[1])) {
|
||||
x=joyv[0]>>1; y=joyv[1]>>1;
|
||||
if (x<3) x=3;
|
||||
if (y<3) y=3;
|
||||
GrLine3(base,x-3,y-3,0,x+3,y+3,0);
|
||||
GrLine3(base,x+3,y-3,0,x-3,y+3,0);
|
||||
x=joyv[2]>>1; y=joyv[3]>>1;
|
||||
if (x<3) x=3;
|
||||
if (y<3) y=3;
|
||||
GrLine3(base,x-3,y-3,0,x+3,y+3,0);
|
||||
GrLine3(base,x+3,y-3,0,x-3,y+3,0);
|
||||
for (i=0;i<4;i++) {
|
||||
if (joyv[i]>joymax[i]) joymax[i]=joyv[i];
|
||||
if (joyv[i]<joymin[i]) joymin[i]=joyv[i];
|
||||
}
|
||||
SwapInNext;
|
||||
}
|
||||
GrClear;
|
||||
joy_calibrated=TRUE;
|
||||
|
||||
//Save
|
||||
for (i=0;i<4;i++) {
|
||||
buf[i*3+0]=joymin[i];
|
||||
buf[i*3+1]=joymax[i];
|
||||
buf[i*3+2]=joyrest[i];
|
||||
}
|
||||
if (DriveIsWritable(':'))
|
||||
WriteFile(JOY_CAL_FILE,buf,sizeof(I8)*3<<2);
|
||||
ip_pointer_type=old_ip;
|
||||
GrDel(base);
|
||||
}
|
||||
|
||||
BoolU4 LoadJoystickCalibration()
|
||||
{
|
||||
U8 size,i;
|
||||
I8 *ptr,*buf=ReadFile(JOY_CAL_FILE,&size);
|
||||
joy_being_calibrated=TRUE;
|
||||
if (!size)
|
||||
JoyCalibration;
|
||||
else {
|
||||
ptr=buf;
|
||||
for (i=0;i<4;i++) {
|
||||
joymin[i]=ptr[0];
|
||||
joymax[i]=ptr[1];
|
||||
joyrest[i]=ptr[2];
|
||||
ptr=ptr+3*sizeof(I8);
|
||||
joy_calibrated=TRUE;
|
||||
}
|
||||
Free(buf);
|
||||
}
|
||||
joy_being_calibrated=FALSE;
|
||||
PollJoystick;
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
void CollectAccntList()
|
||||
{
|
||||
LTDirEntry *tempm1;
|
||||
SysAccntStruct *tempa;
|
||||
U8 my_flags=0;
|
||||
sys_accounts.next=&sys_accounts;
|
||||
sys_accounts.last=&sys_accounts;
|
||||
tempm1=FindFiles("/LT/ACCOUNTS/*",&my_flags);
|
||||
while (tempm1) {
|
||||
if ((tempm1->attr & LT_ATTR_DIR) && tempm1->name[0]!='.') {
|
||||
tempa=MAlloc(sizeof(SysAccntStruct));
|
||||
StrCpy(tempa->name,tempm1->name);
|
||||
tempa->flags=0;
|
||||
InsQue(tempa,sys_accounts.last);
|
||||
}
|
||||
tempm1=tempm1->next;
|
||||
}
|
||||
DelLTDirList(tempm1);
|
||||
}
|
||||
|
||||
public SysAccntStruct *FindSysAccnt(I1 *name)
|
||||
{
|
||||
SysAccntStruct *tempa;
|
||||
tempa=sys_accounts.next;
|
||||
while (tempa!=&sys_accounts) {
|
||||
if (!StrCmp(tempa->name,name))
|
||||
return tempa;
|
||||
tempa=tempa->next;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
public SysAccntStruct *PopUpGetSysAccnt()
|
||||
{
|
||||
Ltf *l=LtfNew;
|
||||
SysAccntStruct *tempa;
|
||||
|
||||
LtfPutS(l,"Select Account.\r\nCursor down and press SPACE.\r\n");
|
||||
|
||||
tempa=sys_accounts.next;
|
||||
while (tempa!=&sys_accounts) {
|
||||
LtfPrintF(l,"$$CM +LX 2,3$$$$BT, \"%s\" %d$$",tempa->name,tempa);
|
||||
tempa=tempa->next;
|
||||
}
|
||||
tempa=PopUpMenu(l);
|
||||
LtfDel(l);
|
||||
return tempa;
|
||||
}
|
||||
|
||||
void LoadAdam3()
|
||||
{
|
||||
SysAccntStruct *tempa=Fs->account;
|
||||
if (!Bts(&tempa->flags,SACTf_ADAM3_LOADED)) {
|
||||
Adam("ExecuteFile(\"::/LT/ACCOUNTS/%s/ADAM3.CPZ\");;",
|
||||
tempa->name);
|
||||
}
|
||||
}
|
||||
-2240
File diff suppressed because it is too large.
Load diff
@@ -1,189 +0,0 @@
|
||||
I8 mxx=grwidth>>1,
|
||||
myy=grheight>>1,
|
||||
mzz=0;
|
||||
BoolU4 mouse_buttons[5];
|
||||
U8 last_mouse_jiffy=0;
|
||||
|
||||
BoolU4 mouse_installed=FALSE;
|
||||
BoolU4 mouse_has_wheel=FALSE;
|
||||
BoolU4 mouse_has_ext_buttons=FALSE;
|
||||
BoolU4 mouse_evt=FALSE;
|
||||
BoolU4 mouse_irqs_working=FALSE;
|
||||
U8 mouse_evt_time;
|
||||
|
||||
|
||||
void MouseGetDeviceType()
|
||||
{
|
||||
U1 b;
|
||||
KbdMouseCmdAck(0xF2);
|
||||
b=KbdCmdRead;
|
||||
if (b==3)
|
||||
mouse_has_wheel=TRUE;
|
||||
else if (b==4)
|
||||
mouse_has_ext_buttons=TRUE;
|
||||
}
|
||||
|
||||
void MouseReset()
|
||||
{
|
||||
KbdCmdFlush;
|
||||
KbdCmdSend(KEYB_CTRL,0xA8); //Enable Mouse
|
||||
KbdCmdFlush;
|
||||
KbdCmdSend(KEYB_CTRL,0xA9); //check for mouse
|
||||
KbdCmdFlush;
|
||||
|
||||
KbdMouseCmdAck(0xFF); //Reset
|
||||
KbdCmdRead;
|
||||
KbdCmdRead;
|
||||
KbdMouseCmdAck(0xFF); //Reset
|
||||
KbdCmdRead;
|
||||
KbdCmdRead;
|
||||
KbdMouseCmdAck(0xF3);
|
||||
KbdMouseCmdAck(200);
|
||||
KbdMouseCmdAck(0xF3); // enable Mouse
|
||||
KbdMouseCmdAck(100); // Set Rate
|
||||
KbdMouseCmdAck(0xF3);
|
||||
KbdMouseCmdAck(80); //Resolution
|
||||
MouseGetDeviceType; // enable Mouse
|
||||
|
||||
KbdMouseCmdAck(0xF3);
|
||||
KbdMouseCmdAck(10);
|
||||
MouseGetDeviceType; // enable Mouse
|
||||
|
||||
KbdMouseCmdAck(0xE8); //Resolution
|
||||
KbdMouseCmdAck(0x03);
|
||||
KbdMouseCmdAck(0xE6);
|
||||
|
||||
KbdMouseCmdAck(0xF3); // Set Rate
|
||||
//if your mouse doesn't work, try this
|
||||
// KbdMouseCmdAck(40);
|
||||
KbdMouseCmdAck(100);
|
||||
|
||||
KbdMouseCmdAck(0xF4); // enable Mouse
|
||||
}
|
||||
|
||||
|
||||
void MouseHandler()
|
||||
{
|
||||
I8 i,j,dx,dy,dz,
|
||||
old_mxx=mxx,old_myy=myy,old_mzz=mzz;
|
||||
BoolU4 evt=FALSE,old_buttons[5];
|
||||
U1 mouse_buf[4];
|
||||
U8 evt_time=BootTime;
|
||||
|
||||
try {
|
||||
for (i=0;i<5;i++)
|
||||
old_buttons[i]=mouse_buttons[i];
|
||||
for (i=0;i<3;i++) {
|
||||
j=KbdCmdRead;
|
||||
if (j<0)
|
||||
throw;
|
||||
else
|
||||
mouse_buf[i]=j;
|
||||
}
|
||||
if (mouse_has_wheel || mouse_has_ext_buttons) {
|
||||
j=KbdCmdRead;
|
||||
if (j<0)
|
||||
throw;
|
||||
else
|
||||
mouse_buf[3]=j;
|
||||
} else
|
||||
mouse_buf[3]=0;
|
||||
Sti;
|
||||
mouse_buttons[0] = mouse_buf[0] & 1;
|
||||
mouse_buttons[1] = (mouse_buf[0] & 2) >> 1;
|
||||
mouse_buttons[2] = (mouse_buf[0] & 4) >> 2;
|
||||
mouse_buttons[3] = (mouse_buf[3] & 0x10) >> 4;
|
||||
mouse_buttons[4] = (mouse_buf[3] & 0x20) >> 5;
|
||||
if (mouse_buf[0] & 0x10)
|
||||
dx=mouse_buf[1]-256;
|
||||
else
|
||||
dx=mouse_buf[1];
|
||||
if (mouse_buf[0] & 0x20)
|
||||
dy=256-mouse_buf[2];
|
||||
else
|
||||
dy=-mouse_buf[2];
|
||||
if (mouse_buf[3] & 0x08)
|
||||
dz=(mouse_buf[3]&7)-8;
|
||||
else
|
||||
dz=mouse_buf[3]&7;
|
||||
|
||||
mxx+=dx;
|
||||
myy+=dy;
|
||||
mzz+=dz;
|
||||
|
||||
if (mxx < 0) mxx=0;
|
||||
if (mxx>=grwidth) mxx=grwidth-1;
|
||||
if (myy < 0) myy=0;
|
||||
if (myy>=grheight) myy=grheight-1;
|
||||
} catch {
|
||||
Fs->catch_except=TRUE;
|
||||
KbdCmdFlush;
|
||||
}
|
||||
for (i=0;i<5;i++)
|
||||
if (old_buttons[i]!=mouse_buttons[i])
|
||||
evt=TRUE;
|
||||
if (old_mxx!=mxx || old_myy!=myy || old_mzz!=mzz)
|
||||
evt=TRUE;
|
||||
if (evt) {
|
||||
mouse_evt_time=evt_time;
|
||||
last_mouse_jiffy=jiffies;
|
||||
mouse_evt=TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
void MouseIrqHandler()
|
||||
{
|
||||
mouse_irqs_working=TRUE;
|
||||
MouseHandler;
|
||||
}
|
||||
|
||||
|
||||
void PollMouse()
|
||||
{ //I can't get IRQ's working on some computers
|
||||
U8 old_flags=GetFlags;
|
||||
if (mouse_irqs_working) return;
|
||||
|
||||
// Cli;
|
||||
if (!Bt(&sys_irq_flags,1)) {//not in keybd IRQ
|
||||
if (InP(KEYB_CTRL) & 1) {
|
||||
KbdCmdSend(KEYB_CTRL,0x60);
|
||||
KbdCmdSend(KEYB_PORT,0x51); //disable kbd
|
||||
|
||||
MouseHandler;
|
||||
|
||||
KbdCmdSend(KEYB_CTRL,0x60);
|
||||
KbdCmdSend(KEYB_PORT,0x41); //enable kbd
|
||||
}
|
||||
}
|
||||
SetFlags(old_flags);
|
||||
}
|
||||
|
||||
|
||||
BoolU4 InstallMouseDriver()
|
||||
{
|
||||
BoolU4 result;
|
||||
I8 i;
|
||||
// U8 old_flags=GetFlags;
|
||||
// Cli;
|
||||
ext[EXT_IRQ0C]=NULL;
|
||||
mouse_evt=FALSE;
|
||||
for(i=0;i<5;i++)
|
||||
mouse_buttons[i]=0;
|
||||
mouse_has_wheel=FALSE;
|
||||
mouse_has_ext_buttons=FALSE;
|
||||
try {
|
||||
MouseReset;
|
||||
result=TRUE;
|
||||
mouse_evt=TRUE;
|
||||
ext[EXT_IRQ0C]=&MouseIrqHandler;
|
||||
} catch {
|
||||
Fs->catch_except=TRUE;
|
||||
result=FALSE;
|
||||
}
|
||||
mouse_installed=result;
|
||||
// SetFlags(old_flags);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Spawn(&InstallMouseDriver);
|
||||
Binary file not shown.
-1042
File diff suppressed because it is too large.
Load diff
Binary file not shown.
@@ -1,15 +0,0 @@
|
||||
$TX +CX "STARS & BARS"$
|
||||
$TX +CX "------------"$
|
||||
$TX +CX "Joystick Button #1 issues movement command"$
|
||||
$TX +CX "Joystick Throttle adjusts amount of movement"$
|
||||
$TX +CX "and controls repulsive VS attractive cmds"$
|
||||
|
||||
|
||||
$MA +A +CX "SPACE Restart"," "$
|
||||
$MA +A +CX "ESC Quit ","\33"$
|
||||
|
||||
$TX +CX "---------------------------"$
|
||||
$MA +A +CX "'1' No Map ","1"$
|
||||
$MA +A +CX "'2' Friendly Fire Power Map","2"$
|
||||
$MA +A +CX "'3' Lapse Time ","3"$
|
||||
|
||||
@@ -0,0 +1,181 @@
|
||||
//Change anything you want in this
|
||||
//account file or others.
|
||||
|
||||
//Set Time Zone
|
||||
local_time_offset=0*60*60*LTDATE_FREQ;
|
||||
|
||||
//$AN,"","mouse_move_scale"$adjust these to set mouse move scale
|
||||
mxx_scale=0.5;
|
||||
myy_scale=0.5;
|
||||
mzz_scale=1.0; //wheel
|
||||
|
||||
//don't change these
|
||||
mxx_prescale=mxx/mxx_scale;
|
||||
myy_prescale=myy/myy_scale;
|
||||
mzz_prescale=mzz/mzz_scale;
|
||||
|
||||
class RenameSymbolStruct
|
||||
{
|
||||
I1 find[256] fmtstr "$$DA -P ,255 \"Find :%s\"$$\r\n";
|
||||
I1 replace[256] fmtstr "$$DA -P ,255 \"Replace:%s\"$$\r\n";
|
||||
};
|
||||
|
||||
void RenameCurSymbol()
|
||||
{
|
||||
I1 *buf;
|
||||
RenameSymbolStruct r;
|
||||
BoolU4 old_preempt=Preempt(OFF);
|
||||
StrCpy(r.find,ws_cur_word);
|
||||
StrCpy(r.replace,ws_cur_word);
|
||||
Preempt(old_preempt);
|
||||
if (PopUpDoForm(&r,"RenameSymbolStruct")) {
|
||||
buf=MSPrintF("R(\"%s\",\"%s\",\"+r+l+a\");",r.find,r.replace);
|
||||
PopUp(buf,Fs);
|
||||
Free(buf);
|
||||
}
|
||||
}
|
||||
|
||||
void RenameFile()
|
||||
{
|
||||
I1 *buf;
|
||||
RenameSymbolStruct r;
|
||||
BoolU4 old_preempt=Preempt(OFF);
|
||||
StrCpy(r.find,ws_cur_word);
|
||||
StrCpy(r.replace,ws_cur_word);
|
||||
Preempt(old_preempt);
|
||||
if (PopUpDoForm(&r,"RenameSymbolStruct")) {
|
||||
buf=MSPrintF("R(\"%s\",\"%s\",\"+r+l+a\");",r.find,r.replace);
|
||||
PopUp(buf,Fs);
|
||||
Free(buf);
|
||||
}
|
||||
Move(r.find,r.replace);
|
||||
}
|
||||
|
||||
void FillinTime()
|
||||
{
|
||||
LTDate ltdt;
|
||||
ltdt=GetCurTimeLTDate;
|
||||
PrintF("$$IV 1$$----%D %T----$$IV 0$$\r",ltdt,ltdt);
|
||||
}
|
||||
|
||||
|
||||
BoolU8 MyPutKey(I8 ch,U8 sc)
|
||||
{ //ch=ASCII; sc=scancode
|
||||
|
||||
//You can customize keys. This routine
|
||||
//is called before the main editor
|
||||
//key handler $LK,"LtfPutKeyExt","MN:LtfPutKeyExt"$().
|
||||
//You can intercept any key.
|
||||
|
||||
//Return TRUE if you completely
|
||||
//handled the key.
|
||||
|
||||
nounusedwarn ch;
|
||||
U8 sc2=sc.u1[0];
|
||||
|
||||
if (sc2>=SC_F1 && sc2<=SC_F10 &&
|
||||
(sc & SCF_ALT) &&
|
||||
!(sc & SCF_CTRL)) {
|
||||
if (sc2==SC_F1) {
|
||||
if ((sc & SCF_SHIFT))
|
||||
PutS("$$FG LTPURPLE$$");
|
||||
else
|
||||
PutS("$$FG PURPLE$$");
|
||||
} else if (sc2==SC_F2) {
|
||||
if ((sc & SCF_SHIFT))
|
||||
PutS("$$FG LTRED$$");
|
||||
else
|
||||
PutS("$$FG,RED$$");
|
||||
} else if (sc2==SC_F3) {
|
||||
if ((sc & SCF_SHIFT))
|
||||
PutS("$$FG LTGREEN$$");
|
||||
else
|
||||
PutS("$$FG,GREEN$$");
|
||||
} else if (sc2==SC_F4) {
|
||||
if ((sc & SCF_SHIFT))
|
||||
PutS("$$FG LTBLUE$$");
|
||||
else
|
||||
PutS("$$FG$$");
|
||||
} else if (sc2==SC_F6) {
|
||||
if (!(sc & SCF_SHIFT))
|
||||
PopUp("WsInit(\"/LT\");");
|
||||
} else if (sc2==SC_F7) {
|
||||
if ((sc & SCF_SHIFT))
|
||||
LtfSafeInsert(Fs->cur_ltf,
|
||||
"$$HS+C$$$$FG$$$$HE$$");
|
||||
else
|
||||
FillinTime();
|
||||
} else if (sc2==SC_F8) {
|
||||
if ((sc & SCF_SHIFT))
|
||||
RenameFile();
|
||||
else
|
||||
RenameCurSymbol();
|
||||
} else if (sc2==SC_F9)
|
||||
PopUp("PunchIn;");
|
||||
else if (sc2==SC_F10)
|
||||
PopUp("PunchOut;");
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BoolU8 MyPutS(I1 *st)
|
||||
{
|
||||
nounusedwarn st;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
AddKeyDev(&MyPutKey,&MyPutS,0x20000000);
|
||||
|
||||
MPStart;
|
||||
Cd("/LT/Adam");;
|
||||
#include "PicWords2"
|
||||
#include "HOME/PicWords3"
|
||||
Cd("/LT/Utils/Boot");;
|
||||
#include "InsBoot"
|
||||
Cd("/LT/Utils");;
|
||||
#include "Disk20"
|
||||
#include "Diff"
|
||||
#include "Grep"
|
||||
#include "Merge"
|
||||
#include "S2T"
|
||||
#include "IDE"
|
||||
#include "LinkChk"
|
||||
#include "HeapLog"
|
||||
#include "ListFile"
|
||||
LoadMapFile("::/LT/OSMain/OS.MPZ"); //Enable Man()
|
||||
LoadMapFile("::/LT/Compiler/Compiler.MPZ"); //Enable Man()
|
||||
LoadMapFile("::/LT/Adam/GrAsm/GrAsm.MPZ"); //Enable Man()
|
||||
|
||||
|
||||
void StartUpTsks()
|
||||
{
|
||||
I1 buf[80];
|
||||
TssStruct *tss,*tss1;
|
||||
|
||||
InitLocalTask; //needed for disk access
|
||||
Preempt(ON); //off by default
|
||||
Silent(ON); //no output to screen
|
||||
|
||||
try {
|
||||
tss1=SpawnUser;
|
||||
tss=SpawnUser;
|
||||
WinToTop(tss1);
|
||||
WinTileVert;
|
||||
|
||||
PopUp("#include \"::/LT/Doc/StartSong.CPZ\";");
|
||||
|
||||
SPrintF(buf,"Boot Time:%h17Ts\r\n",BootTime);
|
||||
AdamLog(buf);
|
||||
XTalk(tss1,"#include \"DoIt\";\r");
|
||||
|
||||
WsInit("/LT");
|
||||
WordStat;
|
||||
} catch
|
||||
CatchAll;
|
||||
}
|
||||
|
||||
//This must be spawned because start-up files
|
||||
// may invoke the Adam() cmd.
|
||||
Spawn(&StartUpTsks,"Spawn Users");
|
||||
PrintF("\r\nOS Compile Time:%D %T\r\n",sys_compile_time,sys_compile_time);
|
||||
@@ -0,0 +1,51 @@
|
||||
/* When a fault occurs, a child process is
|
||||
spawned running this file and the parent
|
||||
gets suspended. You can modify what gets
|
||||
displayed during faults to assist debugging.
|
||||
|
||||
If you modify this file, you should place it
|
||||
into your HOME directory. This version is the
|
||||
default for accounts without a version in HOME.
|
||||
*/
|
||||
|
||||
TssStruct *tss=Fs->parent_tss;
|
||||
void **rsp_ptr=&tss->rsp,*rsp=tss->rsp,
|
||||
*rbp_ptr=&tss->rbp,*rbp=tss->rbp,
|
||||
*rip_ptr=&tss->rip,*rip=tss->rip;
|
||||
|
||||
switch (tss->fault_num)
|
||||
{
|
||||
case 0: //if divide except
|
||||
//push rip as param to ThrowDivide
|
||||
rsp-=8;
|
||||
*rsp_ptr=rsp;
|
||||
rsp[1]=rip;
|
||||
*rip_ptr=&ThrowDivide;
|
||||
Btr(&tss->task_flags,TSSf_SUSPENDED);
|
||||
Exit;
|
||||
case 0x10:
|
||||
rsp-=8;
|
||||
*rsp_ptr=rsp;
|
||||
rsp[1]=rip;
|
||||
*rip_ptr=&ThrowFloating;
|
||||
Btr(&tss->task_flags,TSSf_SUSPENDED);
|
||||
Exit;
|
||||
}
|
||||
|
||||
/*
|
||||
Raw(ON);
|
||||
coutln "Faulting TSS:",tss," IRQ#",tss->fault_num;
|
||||
PrintF("Fault Location:%P\r\n",*rip);
|
||||
Raw(OFF);
|
||||
*/
|
||||
|
||||
UseConsoleLtf(NULL);
|
||||
Bts(&Fs->crt_flags,CRTf_SHOW);
|
||||
|
||||
coutln "Faulting TSS:",tss," IRQ#",tss->fault_num;
|
||||
CallerRep(rbp,tss);
|
||||
StackRep(rsp);
|
||||
coutln "$$LK,\"See HOME/Fault.CPZ\",\"FI:HOME/Fault.CPZ\"$$";
|
||||
Dasm(rip-0x20,0x20);
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
$WW,1$This is a handy file which can be accessed with CTRL-SHIFT-F, known as a favorites file. I use it for links and "TODO" type stuff in my account.
|
||||
|
||||
If you modify this file, you should place it
|
||||
into your HOME directory. This version is the
|
||||
default for accounts without a version in HOME.
|
||||
|
||||
$LK+S,"Goto OS Systext","FA:::/LT/OSMain/SysText.CPZ,OS_SYSTEXT"$
|
||||
$LK,"Goto Compiler Systext","FA:::/LT/Compiler/CmpInit.CPZ,COMPILE_SYSTEXT"$
|
||||
|
||||
$LK,"::/LT/Doc/Help.TXZ","FI:::/LT/Doc/Help.TXZ"$
|
||||
$LK,"::/LT/Doc/GuideLines.TXZ","FI:::/LT/Doc/GuideLines.TXZ"$
|
||||
$LK,"::/LT/Doc/OSGlossary.GLZ","FI:::/LT/Doc/OSGlossary.GLZ"$
|
||||
$LK,"::/LT/Doc/Tips.TXZ","FI:::/LT/Doc/Tips.TXZ"$
|
||||
$LK,"::/LT/Doc/Dollar.TXZ","FI:::/LT/Doc/Dollar.TXZ"$
|
||||
|
||||
$FG,5$
|
||||
@@ -0,0 +1,181 @@
|
||||
//Change anything you want in this
|
||||
//account file or others.
|
||||
|
||||
//Set Time Zone
|
||||
local_time_offset=0*60*60*LTDATE_FREQ;
|
||||
|
||||
//$AN,"","mouse_move_scale"$adjust these to set mouse move scale
|
||||
mxx_scale=0.5;
|
||||
myy_scale=0.5;
|
||||
mzz_scale=1.0; //wheel
|
||||
|
||||
//don't change these
|
||||
mxx_prescale=mxx/mxx_scale;
|
||||
myy_prescale=myy/myy_scale;
|
||||
mzz_prescale=mzz/mzz_scale;
|
||||
|
||||
class RenameSymbolStruct
|
||||
{
|
||||
I1 find[256] fmtstr "$$DA -P ,255 \"Find :%s\"$$\r\n";
|
||||
I1 replace[256] fmtstr "$$DA -P ,255 \"Replace:%s\"$$\r\n";
|
||||
};
|
||||
|
||||
void RenameCurSymbol()
|
||||
{
|
||||
I1 *buf;
|
||||
RenameSymbolStruct r;
|
||||
BoolU4 old_preempt=Preempt(OFF);
|
||||
StrCpy(r.find,ws_cur_word);
|
||||
StrCpy(r.replace,ws_cur_word);
|
||||
Preempt(old_preempt);
|
||||
if (PopUpDoForm(&r,"RenameSymbolStruct")) {
|
||||
buf=MSPrintF("R(\"%s\",\"%s\",\"+r+l+a\");",r.find,r.replace);
|
||||
PopUp(buf,Fs);
|
||||
Free(buf);
|
||||
}
|
||||
}
|
||||
|
||||
void RenameFile()
|
||||
{
|
||||
I1 *buf;
|
||||
RenameSymbolStruct r;
|
||||
BoolU4 old_preempt=Preempt(OFF);
|
||||
StrCpy(r.find,ws_cur_word);
|
||||
StrCpy(r.replace,ws_cur_word);
|
||||
Preempt(old_preempt);
|
||||
if (PopUpDoForm(&r,"RenameSymbolStruct")) {
|
||||
buf=MSPrintF("R(\"%s\",\"%s\",\"+r+l+a\");",r.find,r.replace);
|
||||
PopUp(buf,Fs);
|
||||
Free(buf);
|
||||
}
|
||||
Move(r.find,r.replace);
|
||||
}
|
||||
|
||||
void FillinTime()
|
||||
{
|
||||
LTDate ltdt;
|
||||
ltdt=GetCurTimeLTDate;
|
||||
PrintF("$$IV 1$$----%D %T----$$IV 0$$\r",ltdt,ltdt);
|
||||
}
|
||||
|
||||
|
||||
|
||||
BoolU8 MyPutKey(I8 ch,U8 sc)
|
||||
{ //ch=ASCII; sc=scancode
|
||||
|
||||
//You can customize keys. This routine
|
||||
//is called before the main editor
|
||||
//key handler $LK,"LtfPutKeyExt","MN:LtfPutKeyExt"$().
|
||||
//You can intercept any key.
|
||||
|
||||
//Return TRUE if you completely
|
||||
//handled the key.
|
||||
|
||||
nounusedwarn ch;
|
||||
U8 sc2=sc.u1[0];
|
||||
|
||||
if (sc2>=SC_F1 && sc2<=SC_F10 &&
|
||||
(sc & SCF_ALT) &&
|
||||
!(sc & SCF_CTRL)) {
|
||||
if (sc2==SC_F1) {
|
||||
if ((sc & SCF_SHIFT))
|
||||
PutS("$$FG LTPURPLE$$");
|
||||
else
|
||||
PutS("$$FG PURPLE$$");
|
||||
} else if (sc2==SC_F2) {
|
||||
if ((sc & SCF_SHIFT))
|
||||
PutS("$$FG LTRED$$");
|
||||
else
|
||||
PutS("$$FG,RED$$");
|
||||
} else if (sc2==SC_F3) {
|
||||
if ((sc & SCF_SHIFT))
|
||||
PutS("$$FG LTGREEN$$");
|
||||
else
|
||||
PutS("$$FG,GREEN$$");
|
||||
} else if (sc2==SC_F4) {
|
||||
if ((sc & SCF_SHIFT))
|
||||
PutS("$$FG LTBLUE$$");
|
||||
else
|
||||
PutS("$$FG$$");
|
||||
} else if (sc2==SC_F6) {
|
||||
if (!(sc & SCF_SHIFT))
|
||||
PopUp("WsInit(\"/LT\");");
|
||||
} else if (sc2==SC_F7) {
|
||||
if ((sc & SCF_SHIFT))
|
||||
LtfSafeInsert(Fs->cur_ltf,
|
||||
"$$HS+C$$$$FG$$$$HE$$");
|
||||
else
|
||||
FillinTime();
|
||||
} else if (sc2==SC_F8) {
|
||||
if ((sc & SCF_SHIFT))
|
||||
RenameFile();
|
||||
else
|
||||
RenameCurSymbol();
|
||||
} else if (sc2==SC_F9)
|
||||
PopUp("PunchIn;");
|
||||
else if (sc2==SC_F10)
|
||||
PopUp("PunchOut;");
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BoolU8 MyPutS(I1 *st)
|
||||
{
|
||||
nounusedwarn st;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
AddKeyDev(&MyPutKey,&MyPutS,0x20000000);
|
||||
|
||||
Cd("/LT/Adam");;
|
||||
#include "PicWords2"
|
||||
#include "HOME/PicWords3"
|
||||
Cd("/LT/Utils/Boot");;
|
||||
#include "InsBoot"
|
||||
Cd("/LT/Utils");;
|
||||
#include "Disk20"
|
||||
#include "Diff"
|
||||
#include "Grep"
|
||||
#include "Merge"
|
||||
#include "S2T"
|
||||
#include "IDE"
|
||||
#include "LinkChk"
|
||||
#include "HeapLog"
|
||||
#include "ListFile"
|
||||
LoadMapFile("::/LT/OSMain/OS.MPZ"); //Enable Man()
|
||||
LoadMapFile("::/LT/Compiler/Compiler.MPZ"); //Enable Man()
|
||||
LoadMapFile("::/LT/Adam/GrAsm/GrAsm.MPZ"); //Enable Man()
|
||||
|
||||
|
||||
void StartUpTsks()
|
||||
{
|
||||
I1 buf[80];
|
||||
TssStruct *tss,*tss1;
|
||||
|
||||
InitLocalTask; //needed for disk access
|
||||
Preempt(ON); //off by default
|
||||
Silent(ON); //no output to screen
|
||||
|
||||
try {
|
||||
tss1=SpawnUser;
|
||||
tss=SpawnUser;
|
||||
WinToTop(tss1);
|
||||
WinTileVert;
|
||||
|
||||
PopUp("#include \"::/LT/Doc/StartSong.CPZ\";");
|
||||
|
||||
SPrintF(buf,"Boot Time:%h17Ts\r\n",BootTime);
|
||||
AdamLog(buf);
|
||||
XTalk(tss1,"#include \"DoIt\";\r");
|
||||
|
||||
WsInit("");
|
||||
// WordStat;
|
||||
} catch
|
||||
CatchAll;
|
||||
}
|
||||
|
||||
//This must be spawned because start-up files
|
||||
// may invoke the Adam() cmd.
|
||||
Spawn(&StartUpTsks,"Spawn Users");
|
||||
PrintF("\r\nOS Compile Time:%D %T\r\n",sys_compile_time,sys_compile_time);
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,9 @@
|
||||
// Create Pictures Here
|
||||
|
||||
void LoadUserPicWords()
|
||||
{
|
||||
//Call $LK,"AddPicWord","MN:AddPicWord"$()
|
||||
}
|
||||
|
||||
|
||||
LoadUserPicWords;
|
||||
@@ -0,0 +1,11 @@
|
||||
/*
|
||||
This is the startup file for servant tasks.
|
||||
|
||||
If you modify this file, you should place it
|
||||
into your HOME directory. This version is the
|
||||
default for accounts without a version in HOME.
|
||||
*/
|
||||
|
||||
UseConsoleLtf(NULL);
|
||||
Bts(&Fs->crt_flags,CRTf_SHOW);
|
||||
//Turn on preemption
|
||||
@@ -1,13 +1,19 @@
|
||||
/* This file gets included once into the
|
||||
"Adam" task's memory by $LK,"LoadAdam3","MN:LoadAdam3"$() placed in
|
||||
$LK,"HOME/USER.CPZ","FI:HOME/USER.CPZ"$. The declarations from this file
|
||||
are available to all tasks, since all tasks
|
||||
chain back to Adam.
|
||||
//Change anything you want in this
|
||||
//account file or others.
|
||||
|
||||
//Set Time Zone
|
||||
local_time_offset=0*60*60*LTDATE_FREQ;
|
||||
|
||||
//$AN,"","mouse_move_scale"$adjust these to set mouse move scale
|
||||
mxx_scale=0.5;
|
||||
myy_scale=0.5;
|
||||
mzz_scale=1.0; //wheel
|
||||
|
||||
//don't change these
|
||||
mxx_prescale=mxx/mxx_scale;
|
||||
myy_prescale=myy/myy_scale;
|
||||
mzz_prescale=mzz/mzz_scale;
|
||||
|
||||
If you modify this file, you should place it
|
||||
into your HOME directory. This version is the
|
||||
default for accounts without a version in HOME.
|
||||
*/
|
||||
|
||||
class RenameSymbolStruct
|
||||
{
|
||||
@@ -50,15 +56,25 @@ void FillinTime()
|
||||
{
|
||||
LTDate ltdt;
|
||||
ltdt=GetCurTimeLTDate;
|
||||
PrintF("$$IV 1$$----%D %T----$$IV 0$$\r",ltdt.date,ltdt.time);
|
||||
PrintF("$$IV 1$$----%D %T----$$IV 0$$\r",ltdt,ltdt);
|
||||
}
|
||||
|
||||
|
||||
BoolU4 My_EditPlugIns(Ltf *l,I8 ch,U8 sc)
|
||||
{ //You can customize these
|
||||
U8 sc2,ms=0;
|
||||
l;ch; //Ref, So not unused Warn
|
||||
sc2=sc.u1[0];
|
||||
|
||||
BoolU8 MyPutKey(I8 ch,U8 sc)
|
||||
{ //ch=ASCII; sc=scancode
|
||||
|
||||
//You can customize keys. This routine
|
||||
//is called before the main editor
|
||||
//key handler $LK,"LtfPutKeyExt","MN:LtfPutKeyExt"$().
|
||||
//You can intercept any key.
|
||||
|
||||
//Return TRUE if you completely
|
||||
//handled the key.
|
||||
|
||||
nounusedwarn ch;
|
||||
U8 sc2=sc.u1[0];
|
||||
|
||||
if (sc2>=SC_F1 && sc2<=SC_F10 &&
|
||||
(sc & SCF_ALT) &&
|
||||
!(sc & SCF_CTRL)) {
|
||||
@@ -71,12 +87,12 @@ BoolU4 My_EditPlugIns(Ltf *l,I8 ch,U8 sc)
|
||||
if ((sc & SCF_SHIFT))
|
||||
PutS("$$FG LTRED$$");
|
||||
else
|
||||
PutS("$$FG RED$$");
|
||||
PutS("$$FG,RED$$");
|
||||
} else if (sc2==SC_F3) {
|
||||
if ((sc & SCF_SHIFT))
|
||||
PutS("$$FG LTGREEN$$");
|
||||
else
|
||||
PutS("$$FG GREEN$$");
|
||||
PutS("$$FG,GREEN$$");
|
||||
} else if (sc2==SC_F4) {
|
||||
if ((sc & SCF_SHIFT))
|
||||
PutS("$$FG LTBLUE$$");
|
||||
@@ -105,17 +121,56 @@ BoolU4 My_EditPlugIns(Ltf *l,I8 ch,U8 sc)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BoolU8 MyPutS(I1 *st)
|
||||
{
|
||||
nounusedwarn st;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Cd("/LT/UTILS");;
|
||||
#include "BOOTINS"
|
||||
#include "DBG"
|
||||
#include "DIFF"
|
||||
#include "GREP"
|
||||
AddKeyDev(&MyPutKey,&MyPutS,0x20000000);
|
||||
|
||||
Cd("/LT/Adam");;
|
||||
#include "PicWords2"
|
||||
#include "HOME/PicWords3"
|
||||
Cd("/LT/Utils/Boot");;
|
||||
#include "InsBoot"
|
||||
Cd("/LT/Utils");;
|
||||
#include "Disk20"
|
||||
#include "Diff"
|
||||
#include "Grep"
|
||||
#include "Merge"
|
||||
#include "S2T"
|
||||
#include "HASHUTIL"
|
||||
#include "IDE"
|
||||
#include "BMP"
|
||||
#include "LinkChk"
|
||||
#include "HeapLog"
|
||||
#include "ListFile"
|
||||
LoadMapFile("::/LT/OSMain/OS.MPZ"); //Enable Man()
|
||||
LoadMapFile("::/LT/COMPILE/CMP.MPZ"); //Enable Man()
|
||||
LoadMapFile("::/LT/ADAM/ADAMASM.MPZ"); //Enable Man()
|
||||
LoadMapFile("::/LT/Compiler/Compiler.MPZ"); //Enable Man()
|
||||
LoadMapFile("::/LT/Adam/GrAsm/GrAsm.MPZ"); //Enable Man()
|
||||
|
||||
|
||||
void StartUpTsks()
|
||||
{
|
||||
I1 buf[80];
|
||||
TssStruct *tss;
|
||||
|
||||
InitLocalTask; //needed for disk access
|
||||
Preempt(ON); //off by default
|
||||
Silent(ON); //no output to screen
|
||||
|
||||
try {
|
||||
tss=SpawnUser;
|
||||
WinToTop(tss);
|
||||
WinTileVert;
|
||||
|
||||
XTalk(tss,"#include \"DoIt\";\r");
|
||||
|
||||
WsInit("");
|
||||
} catch
|
||||
CatchAll;
|
||||
}
|
||||
|
||||
//This must be spawned because start-up files
|
||||
// may invoke the Adam() cmd.
|
||||
Spawn(&StartUpTsks,"Spawn Users");
|
||||
PrintF("\r\nOS Compile Time:%D %T\r\n",sys_compile_time,sys_compile_time);
|
||||
@@ -0,0 +1,4 @@
|
||||
Cd("::/LT/Apps/MusicOrgan");;
|
||||
#include "Load";;
|
||||
JukeBox("Examples");
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
UseConsoleLtf("User.MUZ");
|
||||
PutSysText("ST_USER_STARTUP");
|
||||
Type("::/LT/Doc/Help.TXZ");
|
||||
Bts(&Fs->crt_flags,CRTf_SHOW);
|
||||
Preempt(ON);
|
||||
File renamed without changes.
@@ -0,0 +1 @@
|
||||
AutoFile("Tour");
|
||||
@@ -0,0 +1,37 @@
|
||||
public I8 PopUpTourPart()
|
||||
{
|
||||
I8 i;
|
||||
Ltf *l=LtfNew;
|
||||
LtfPutSExt(l,"$$FG PURPLE$$LoseThos Tours$$FG$$\r\n\r\n");
|
||||
LtfPutSExt(l,"$$CM +LX, 4,4$$$$BT, \"Part 1: The basics\",1$$");
|
||||
LtfPutSExt(l,"$$CM +LX, 4,4$$$$BT, \"Part 2: Editing and running programs\",2$$");
|
||||
LtfPutSExt(l,"$$CM +LX, 4,4$$$$BT, \"Part 3: Adding macros to your start menu\",3$$");
|
||||
LtfPutSExt(l,"$$CM +LX, 4,4$$$$BT, \"Part 4: WordStat\",4$$");
|
||||
LtfPutSExt(l,"$$CM +LX, 4,4$$$$BT, \"Part 5: Wow!!\",5$$");
|
||||
LtfPutSExt(l,"$$CM +LX, 4,4$$$$BT, \"Done\",-1$$");
|
||||
i=PopUpMenu(l);
|
||||
LtfDel(l);
|
||||
return i;
|
||||
}
|
||||
|
||||
I8 i;
|
||||
do {
|
||||
switch (i=PopUpTourPart)
|
||||
{
|
||||
case 1:
|
||||
ExecuteFile("::/LT/Accts/Tour/Tour1.AUZ");
|
||||
break;
|
||||
case 2:
|
||||
ExecuteFile("::/LT/Accts/Tour/Tour2.AUZ");
|
||||
break;
|
||||
case 3:
|
||||
ExecuteFile("::/LT/Accts/Tour/Tour3.AUZ");
|
||||
break;
|
||||
case 4:
|
||||
ExecuteFile("::/LT/Accts/Tour/Tour4.AUZ");
|
||||
break;
|
||||
case 5:
|
||||
ExecuteFile("::/LT/Accts/Tour/Tour5.AUZ");
|
||||
break;
|
||||
}
|
||||
} while (i>=1);
|
||||
@@ -0,0 +1,105 @@
|
||||
//This puts the cursor at the bottom
|
||||
Msg(MSG_KEY_DOWN,0,SC_CURSOR_DOWN|SCF_CTRL);
|
||||
PutS("\r");
|
||||
|
||||
PopUpOk(
|
||||
"After clicking 'OKAY', you will be at the\r\n"
|
||||
"command line.\r\n"
|
||||
"\r\n"
|
||||
"The syntax is like $$FG,GREEN$$C/C++$$FG$$ except you\r\n"
|
||||
"don't need $$FG,GREEN$$()$$FG$$ if there are no parameters.\r\n"
|
||||
"\r\n"
|
||||
"Type \"$$FG,GREEN$$Dir;$$FG$$\" and press $$FG,GREEN$$ENTER$$FG$$.\r\n\r\n"
|
||||
"You must remember the semicolon.\r\n"
|
||||
);
|
||||
|
||||
AFPmtStr("Dir;\r");
|
||||
Sleep(1000); //allow user time to see dir
|
||||
PutChar(CH_CR);
|
||||
|
||||
PopUpOk(
|
||||
"After clicking 'OKAY', you will be at the\r\n"
|
||||
"command line.\r\n\r\n"
|
||||
"Press the $$FG,GREEN$$WINDOW$$FG$$s key.\r\n\r\n"
|
||||
"This will access your macro/menu/help area.\r\n"
|
||||
"You can customize it. It's like your\r\n"
|
||||
"START menu.\r\n");
|
||||
|
||||
AFGetKey(SC_GUI);
|
||||
Sleep(1000);
|
||||
PopUpOk(
|
||||
"You can get to the menu/macro/help area\r\n"
|
||||
"by clicking on the word \"MENU\" in the\r\n"
|
||||
"title bar.\r\n");
|
||||
|
||||
PopUpOk(
|
||||
"$$UL,1$$$$FG,LTBLUE$$Blue Underlined Text are Macros$$FG$$$$UL,0$$\r\n"
|
||||
"\t$$FG,GREEN$$SPACE BAR$$FG$$\t=Left Mouse\t-->Execute Macro\r\n"
|
||||
"\r\n\r\n"
|
||||
"$$UL,1$$$$FG,LTRED$$Red Underlined Text are Links$$FG$$$$UL,0$$\r\n"
|
||||
"\t$$FG,GREEN$$SPACE BAR$$FG$$\t=Left Mouse\t-->Edit/View Link Doc\r\n"
|
||||
"\t$$FG,GREEN$$ENTER$$FG$$\t\t=Right Mouse\t-->Link Menu\r\n"
|
||||
"\r\n\r\n"
|
||||
"Exiting Documents/Forms\r\n"
|
||||
"\t$$FG,GREEN$$ESC$$FG$$\t=Left Double Mouse\t-->Save and Exit\r\n"
|
||||
"\t$$FG,GREEN$$CTRL-Q$$FG$$\t=Right Double Mouse\t-->Abort/Cancel/Quit or Back\r\n"
|
||||
);
|
||||
|
||||
PopUpOk(
|
||||
"$$FG,GREEN$$CTRL-ALT-ESC$$FG$$\tSpawn new user shell window\r\n"
|
||||
"$$FG,GREEN$$CTRL-ALT-X$$FG$$\tKill window\r\n"
|
||||
"$$FG,GREEN$$CTRL-ALT-C$$FG$$\tBreak(interrupt) program\r\n"
|
||||
);
|
||||
|
||||
PopUpOk(
|
||||
"After clicking 'OKAY', you will be back at\r\n"
|
||||
"the menu/macro/help area.\r\n\r\n"
|
||||
"Press $$FG,GREEN$$CURSOR-DOWN$$FG$$ nine times.\r\n");
|
||||
|
||||
//This puts the cursor at the top
|
||||
Msg(MSG_KEY_DOWN,0,SC_CURSOR_UP|SCF_CTRL);
|
||||
|
||||
I8 i;
|
||||
for (i=0;i<9;i++)
|
||||
AFGetKey(SC_CURSOR_DOWN);
|
||||
|
||||
PopUpOk(
|
||||
"After clicking 'OKAY', the cursor will be\r\n"
|
||||
"on top of a macro we wish to run.\r\n"
|
||||
"\r\n"
|
||||
"After clicking OKAY, press $$FG,GREEN$$SPACE$$FG$$.\r\n");
|
||||
AFPmtStr(" ");
|
||||
Sleep(1000);
|
||||
|
||||
PopUpOk(
|
||||
"The macro changed directories and did\r\n"
|
||||
"a $$FG,GREEN$$Dir;$$FG$$ command.\r\n\r\n"
|
||||
"The $$FG,RED$$RED$$FG$$ filenames listed are file\r\n"
|
||||
"links. Left-clicking will edit/view them.\r\n"
|
||||
"Right-clicking or pressing $$FG,GREEN$$ENTER$$FG$$\r\n"
|
||||
"when the cursor is on top will bring-up a\r\n"
|
||||
"menu of options.\r\n\r\n"
|
||||
"The $$FG LTBLUE$$BLUE$$FG$$ underline entries \"$$FG LTBLUE$$.$$FG$$\" and \"$$FG LTBLUE$$..$$FG$$\"\r\n"
|
||||
"are macros and will change directories.\r\n");
|
||||
|
||||
PopUpOk(
|
||||
"As you can see, the command line is not\r\n"
|
||||
"different from the help/menu/macro area.\r\n"
|
||||
"Both use the same commands and have the same\r\n"
|
||||
"'Widgets' available.\r\n\r\n"
|
||||
"Both utilize the same underlying document format.\r\n"
|
||||
"It is similar to $$FG,GREEN$$html$$FG$$ because it has ASCII\r\n"
|
||||
"behind it. LoseThos documents can include graphics.\r\n\r\n"
|
||||
"Press \"$$FG,GREEN$$CTRL-T$$FG$$\" after clicking 'OKAY' to toggle\r\n"
|
||||
"to plain text mode.\r\n");
|
||||
AFGetChar(20);
|
||||
Sleep(1000);
|
||||
|
||||
PopUpOk(
|
||||
"The widgets are bracketed with dollar sign\r\n"
|
||||
"characters. \"LK\" stands \"link\" and \"MA\"\r\n"
|
||||
"stands for \"macro\".\r\n\r\n"
|
||||
"Now, press \"$$FG,GREEN$$CTRL-T$$FG$$\" to toggle back to\r\n"
|
||||
"regular mode.\r");
|
||||
AFGetChar(20);
|
||||
Sleep(1000);
|
||||
@@ -0,0 +1,76 @@
|
||||
//This puts the cursor at the bottom
|
||||
Msg(MSG_KEY_DOWN,0,SC_CURSOR_DOWN|SCF_CTRL);
|
||||
PutS("\r");
|
||||
|
||||
PopUpOk(
|
||||
"Now, we're going to demonstrate how to work\r\n"
|
||||
"with programs. We'll change to the \LT\Demo\r\n"
|
||||
"directory. The change directory command\r\n"
|
||||
"will be typed for you and you just need\r\n"
|
||||
"to press $$FG,GREEN$$ENTER$$FG$$.\r\n\r\n"
|
||||
"Note, that directories are specified with\r\n"
|
||||
"a forward slash, not a backslash.\r\n"
|
||||
"Drives can be specified in a $$FG,GREEN$$Cd()$$FG$$ command\r\n"
|
||||
"and the boot drive is specified with \"$$FG,GREEN$$::$$FG$$\".");
|
||||
|
||||
PutS("Cd(\"::/LT/Demo\");Dir;");
|
||||
AFPmtStr("\r");
|
||||
|
||||
|
||||
PopUpOk(
|
||||
"Now, we're going to edit a file. Normally,\r\n"
|
||||
"you'll probably left-click on a directory\r\n"
|
||||
"listing to edit a file, but we're going to\r\n"
|
||||
"type it on the command line.\r\n\r\n"
|
||||
"Press $$FG,GREEN$$ENTER$$FG$$ to complete the command.\r\n");
|
||||
|
||||
PutS("Edit(\"ASCIIOrgan.CPZ\");");
|
||||
AFPmtStr("\r");
|
||||
|
||||
Sleep(1000);
|
||||
PopUpOk(
|
||||
"This program gets keys and plays frequencies.\r\n"
|
||||
"It quits when you press $$FG,GREEN$$ESC$$FG$$.\r\n\r\n"
|
||||
"There is no \"$$FG,GREEN$$main()$$FG$$\" function in LoseThos\r\n"
|
||||
"programs. Any program statements outside\r\n"
|
||||
"functions get executed when you $$FG,GREEN$$#include$$FG$$\r\n"
|
||||
"them at the command line.\r\n\r\n"
|
||||
"The \"$$FG,GREEN$$ASCIIOrgan;$$FG$$\" statement at the bottom\r\n"
|
||||
"will run the program when we $$FG,GREEN$$#include$$FG$$ it.\r\n");
|
||||
|
||||
PopUpOk(
|
||||
"The editor and most things exit when you press\r\n"
|
||||
"$$FG,GREEN$$ESC$$FG$$. $$FG,GREEN$$CTRL-Q$$FG$$ will abort (cancel) most things.\r\n\r\n"
|
||||
"The $$FG,GREEN$$ESC$$FG$$ key can be simulated with a left\r\n"
|
||||
"double-click, while the $$FG,GREEN$$CTRL-Q$$FG$$ key can be\r\n"
|
||||
"simulated with a right double-click. When\r\n"
|
||||
"you browse documentation, you'll left-click\r\n"
|
||||
"on links and right double-click to go back,\r\n"
|
||||
"unless you want to save changes to documents\r\n"
|
||||
"using left double-click.\r\n\r\n"
|
||||
"Press $$FG,GREEN$$CTRL-Q$$FG$$ to quit out of the editor.\r\n"
|
||||
);
|
||||
|
||||
AFGetChar(CH_CTRLQ);
|
||||
|
||||
PopUpOk(
|
||||
"Now, we'll run the ASCIIOrgan.CPZ program.\r\n"
|
||||
"Press $$FG,GREEN$$ENTER$$FG$$ at the command line to\r\n"
|
||||
"$$FG,GREEN$$#include$$FG$$ it. Then press keys to\r\n"
|
||||
"cause sounds and press $$FG,GREEN$$ESC$$FG$$ when\r\n"
|
||||
"you are done.\r\n");
|
||||
|
||||
PutS("#include \"ASCIIOrgan.CPZ\";");
|
||||
AFPmtStr("\r");
|
||||
AFUntilChar(CH_ESC);
|
||||
|
||||
PopUpOk(
|
||||
"The program is still in memory and we\r\n"
|
||||
"can start it again by typing \"$$FG,GREEN$$ASCIIOrgan;$$FG$$\".\r\n\r\n"
|
||||
"Press $$FG,GREEN$$ENTER$$FG$$ at the command line to\r\n"
|
||||
"run it again.\r\n");
|
||||
|
||||
PutS("ASCIIOrgan;");
|
||||
AFPmtStr("\r");
|
||||
AFUntilChar(27);
|
||||
|
||||
@@ -0,0 +1,110 @@
|
||||
//This puts the cursor at the bottom
|
||||
Msg(MSG_KEY_DOWN,0,SC_CURSOR_DOWN|SCF_CTRL);
|
||||
PutS("\rCd(\"::/LT/Demo\");Dir;\r");
|
||||
|
||||
PopUpOk(
|
||||
"Now, we're going to add the ASCIIOrgan.CPZ\r\n"
|
||||
"program to your start menu.\r\n\r\n"
|
||||
"Press the $$FG,GREEN$$WINDOW$$FG$$s key\r\n"
|
||||
"to get to your menu/macro/help area.\r\n");
|
||||
AFGetKey(SC_GUI);
|
||||
Msg(MSG_KEY_DOWN,0,SC_CURSOR_UP|SCF_CTRL);
|
||||
Sleep(1000);
|
||||
|
||||
PopUpOk(
|
||||
"Press $$FG,GREEN$$CTRL-L$$FG$$ to invoke the\r\n"
|
||||
"text-widget resource editor.\r\n"
|
||||
"\r\n"
|
||||
"($$FG,GREEN$$CTRL-R$$FG$$ invokes the\r\n"
|
||||
"graphic resource editor.)\r\n"
|
||||
);
|
||||
AFGetChar(12);
|
||||
|
||||
Sleep(100);
|
||||
PopUpOk(
|
||||
"Press $$FG,GREEN$$CURSOR-DOWN$$FG$$ until you reach\r\n"
|
||||
"\"Macro\".\r\n");
|
||||
I8 i;
|
||||
for (i=0;i<8;i++)
|
||||
AFGetKey(SC_CURSOR_DOWN);
|
||||
|
||||
PopUpOk(
|
||||
"Press $$FG,GREEN$$SPACE$$FG$$.\r\n");
|
||||
AFPmtStr(" ");
|
||||
Sleep(1000);
|
||||
|
||||
|
||||
PopUpOk(
|
||||
"Now, we'll fill-in the visible text\r\n"
|
||||
"of the macro.\r\n");
|
||||
AFDelayedPutS("Click Here");
|
||||
|
||||
Msg(MSG_KEY_DOWN,0,SC_CURSOR_DOWN);
|
||||
PopUpOk("Now, we'll fill-in the macro text.\r\n");
|
||||
AFDelayedPutS("Cd(\\\"::/LT/Demo\\\");;#include \\\"ASCIIOrgan.CPZ\\\";\\r");
|
||||
|
||||
PopUpOk("Press $$FG,GREEN$$ESC$$FG$$ to exit the form.\r\n");
|
||||
AFGetChar(CH_ESC);
|
||||
Sleep(1000);
|
||||
|
||||
PopUpOk(
|
||||
"Press $$FG,GREEN$$CTRL-SHIFT-ENTER$$FG$$ to insert a line feed.\r\n"
|
||||
"($$FG,GREEN$$CTRL-ENTER$$FG$$ does a page break and $$FG,GREEN$$ENTER$$FG$$\r\n"
|
||||
"would execute the macro.)\r\n");
|
||||
AFGetKey(SC_CR|SCF_CTRL|SCF_SHIFT);
|
||||
Sleep(1000);
|
||||
|
||||
Msg(MSG_KEY_DOWN,0,SC_CURSOR_UP|SCF_CTRL);
|
||||
PopUpOk(
|
||||
"Press $$FG,GREEN$$SPACE$$FG$$ to test it.\r\n");
|
||||
AFPmtStr(" ");
|
||||
AFUntilChar(CH_ESC);
|
||||
|
||||
PopUpOk(
|
||||
"Now, we'll do a fancier macro that pops-up\r\n"
|
||||
"a new window which dies when finished,\r\n"
|
||||
"returning memory to the system.\r\n");
|
||||
Msg(MSG_KEY_DOWN,0,SC_GUI);
|
||||
Msg(MSG_KEY_DOWN,0,SC_CURSOR_UP|SCF_CTRL);
|
||||
Msg(MSG_KEY_DOWN,12,0); //CTRL-L
|
||||
for (i=0;i<8;i++)
|
||||
Msg(MSG_KEY_DOWN,0,SC_CURSOR_DOWN);
|
||||
AFDelayedPutS(" Click here for Pop-up version");
|
||||
Msg(MSG_KEY_DOWN,0,SC_CURSOR_DOWN);
|
||||
AFDelayedPutS("Cd(\\\"::/LT/Demo\\\");;#include \\\"ASCIIOrgan.CPZ\\\";\\r");
|
||||
Msg(MSG_KEY_DOWN,0,SC_CURSOR_LEFT|SCF_CTRL);
|
||||
|
||||
PopUpOk(
|
||||
"Press $$FG,GREEN$$CURSOR-DOWN$$FG$$ until you reach\r\n"
|
||||
"the \"Pop-Up\" check-box.\r\n");
|
||||
for (i=0;i<2;i++)
|
||||
AFGetKey(SC_CURSOR_DOWN);
|
||||
PopUpOk(
|
||||
"Press $$FG,GREEN$$SPACE$$FG$$ to\r\n"
|
||||
"check the box.\r\n");
|
||||
AFPmtStr(" ");
|
||||
Sleep(500);
|
||||
|
||||
PopUpOk("Press $$FG,GREEN$$ESC$$FG$$ to exit the form.\r\n");
|
||||
AFGetChar(CH_ESC);
|
||||
Sleep(500);
|
||||
|
||||
PopUpOk("Press $$FG,GREEN$$CTRL-SHIFT-ENTER$$FG$$ to insert a line feed.\r\n");
|
||||
AFGetKey(SC_CR|SCF_CTRL|SCF_SHIFT");
|
||||
Sleep(500);
|
||||
|
||||
Msg(MSG_KEY_DOWN,0,SC_CURSOR_UP|SCF_CTRL);
|
||||
PopUpOk(
|
||||
"Press $$FG,GREEN$$SPACE$$FG$$ to test it.\r\n");
|
||||
AFPmtStr(" ");
|
||||
Sleep(5000);
|
||||
|
||||
PopUpOk(
|
||||
"Press $$FG,GREEN$$CTRL-S$$FG$$ to save your\r\n"
|
||||
"macro/menu/help area file, if you wish.\r\n");
|
||||
if (Fs->parent_tss->popup_tss) {
|
||||
PutChar(CH_CTRLQ);
|
||||
Sleep(100);
|
||||
}
|
||||
PutChar(CH_CTRLQ); //exit menu
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
PopUp("WsInit(\"::/LT\");");
|
||||
WordStat;
|
||||
|
||||
//This puts the cursor at the bottom
|
||||
Msg(MSG_KEY_DOWN,0,SC_CURSOR_DOWN|SCF_CTRL);
|
||||
PutS("\rCd(\"::/LT/Demo\");\r");
|
||||
|
||||
PopUpOk(
|
||||
"WordStat is an autocomplete feature\r\n"
|
||||
"which will also jump to source code.\r\n"
|
||||
"The function keys work with code, while\r\n"
|
||||
"the number keys work with the dictionary.\r\n\r\n"
|
||||
"We will now place some text on the command\r\n"
|
||||
"line and jump to source code.\r\n");
|
||||
PutS("InstallB");
|
||||
Sleep(1000);
|
||||
|
||||
PopUpOk(
|
||||
"After clicking $$FG,GREEN$$OKAY$$FG$$, look at\r\n"
|
||||
"the $$FG,GREEN$$InstallBoot$$FG$$ entry in the WordStat\r\n"
|
||||
"window. Notice it has a '$$FG,GREEN$$*$$FG$$' by it.\r\n"
|
||||
"This means a source code link is available.\r\n");
|
||||
Sleep(2000);
|
||||
|
||||
PopUpOk(
|
||||
"Press $$FG,GREEN$$CTRL-SHIFT-F1$$FG$$ to jump to source code.\r\n");
|
||||
AFGetKey(SC_F1|SCF_CTRL|SCF_SHIFT);
|
||||
Sleep(500);
|
||||
|
||||
PopUpOk(
|
||||
"Press $$FG,GREEN$$CTRL-Q$$FG$$ to quit the source code.\r\n");
|
||||
AFUntilChar(CH_CTRLQ);
|
||||
Sleep(100);
|
||||
sys_cur_focus_task=Fs;
|
||||
|
||||
PopUpOk(
|
||||
"Press $$FG,GREEN$$CTRL-F1$$FG$$ to autocomplete.\r\n");
|
||||
AFGetKey(SC_F1|SCF_CTRL);
|
||||
Sleep(500);
|
||||
|
||||
Msg(MSG_KEY_DOWN,CH_CR,SCF_CTRL|SCF_SHIFT);
|
||||
PutS("\r");
|
||||
|
||||
PopUpOk(
|
||||
"Tip: You can restart the WordStat window if you\r\n"
|
||||
"have closed it by pressing $$FG,GREEN$$CTRL-F1$$FG$$.\r\n");
|
||||
|
||||
PopUpOk(
|
||||
"You can also use the $$FG,GREEN$$Man()$$FG$$ function\r\n"
|
||||
"to jump to source code.\r\n");
|
||||
AFDelayedPutS("Man(\"InstallBoot\");");
|
||||
Sleep(1000);
|
||||
PutS("\r");
|
||||
|
||||
Sleep(2000);
|
||||
PopUpOk(
|
||||
"Press $$FG,GREEN$$CTRL-Q$$FG$$ to quit the source code.\r\n");
|
||||
AFUntilChar(CH_CTRLQ);
|
||||
@@ -0,0 +1,19 @@
|
||||
PopUpOk(
|
||||
"All text widgets work everywhere.\r\n"
|
||||
"The $$FG,GREEN$$Type()$$FG$$ command is like\r\n"
|
||||
"the DOS command of the same name\r\n"
|
||||
"or the UNIX, $$FG,GREEN$$cat$$FG$$ command.\r\n"
|
||||
"We will now send your menu document\r\n"
|
||||
"to the command line. They use the same\r\n"
|
||||
"document format and it is active!!.\r\n");
|
||||
|
||||
PopUpOk("Press $$FG,GREEN$$ENTER$$FG$$.");
|
||||
|
||||
//This puts the cursor at the bottom
|
||||
Msg(MSG_KEY_DOWN,0,SC_CURSOR_DOWN|SCF_CTRL);
|
||||
PutS("\r");
|
||||
|
||||
PutS("Type(\"HOME/User.MUZ\");");
|
||||
AFPmtStr("\r");
|
||||
|
||||
|
||||
Binary file not shown.
@@ -1,3 +1,4 @@
|
||||
#help_index "Utils"
|
||||
/*
|
||||
This is the startup file for new local users.
|
||||
|
||||
@@ -6,42 +7,31 @@ into your HOME directory. This version is the
|
||||
default for accounts without a version in HOME.
|
||||
*/
|
||||
|
||||
UseConsoleLtf("USER.MUZ");
|
||||
Fs->answers_displayed=2; //from 0-8
|
||||
UseConsoleLtf("User.MUZ");
|
||||
|
||||
LoadAdam3;
|
||||
|
||||
Fs->EditPlugIns=&My_EditPlugIns;
|
||||
Ltf *l=Fs->cur_ltf;
|
||||
l->EditPlugIns=&My_EditPlugIns;
|
||||
if (l=l->menu_ltf)
|
||||
l->EditPlugIns=&My_EditPlugIns;
|
||||
|
||||
U8 F(I1 *pattern,I1 *flags="+r+i")
|
||||
U8 F(I1 *pattern,I1 *flags=NULL)
|
||||
{
|
||||
return Grep(pattern,"/LT/"TEXT_FILE_MASK,flags);
|
||||
}
|
||||
|
||||
U8 R(I1 *pattern,I1 *replace_text=NULL,I1 *flags="+r+l")
|
||||
U8 R(I1 *pattern,I1 *replace_text=NULL,I1 *flags="+l-i")
|
||||
{
|
||||
return Grep(pattern,"/LT/"TEXT_FILE_MASK,flags,replace_text);
|
||||
}
|
||||
|
||||
U8 FD(I1 *pattern,I1 *flags="+r+i")
|
||||
U8 FD(I1 *pattern,I1 *flags=NULL)
|
||||
{
|
||||
return Grep(pattern,TEXT_FILE_MASK,flags);
|
||||
}
|
||||
|
||||
U8 RD(I1 *pattern,I1 *replace_text=NULL,I1 *flags="+r+l")
|
||||
U8 RD(I1 *pattern,I1 *replace_text=NULL,I1 *flags="+l-i")
|
||||
{
|
||||
return Grep(pattern,TEXT_FILE_MASK,flags,replace_text);
|
||||
}
|
||||
|
||||
PutSysText("ST_USER_STARTUP");
|
||||
Type("/LT/DOC/Help.TXZ");
|
||||
Type("::/LT/Doc/Help.TXZ");
|
||||
Fs->scroll_speed=10;
|
||||
Bts(&Fs->crt_flags,CRTf_SHOW);
|
||||
|
||||
|
||||
Type("/LT/DOC/StartUp.TXZ");
|
||||
|
||||
Preempt(ON);
|
||||
#help_index ""
|
||||
Binary file not shown.
@@ -0,0 +1,2 @@
|
||||
Type("::/LT/Doc/Customize.TXZ");
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
public double os_version=3.05;
|
||||
|
||||
#include "AdamExt.HPZ"
|
||||
|
||||
Load("GrAsm/GrAsm");
|
||||
#include "GrAsm/GrAsm.HPZ"
|
||||
|
||||
#include "KbdMouse"
|
||||
#include "InputPointer"
|
||||
#include "IncCompress"
|
||||
#include "Math"
|
||||
#include "ODE"
|
||||
Cd("::/LT/Adam/Gr");;
|
||||
#include "Gr"
|
||||
Cd("::/LT/Adam");;
|
||||
#include "Music"
|
||||
#include "Disk10"
|
||||
#include "DiskCDDVD"
|
||||
#include "Comm"
|
||||
#include "Remote"
|
||||
#include "JoyStick"
|
||||
#include "Utils"
|
||||
#include "Message"
|
||||
#include "Window"
|
||||
#include "LPT"
|
||||
Cd("::/LT/Adam/Ltf");;
|
||||
#include "Ltf"
|
||||
Cd("::/LT/Adam");;
|
||||
#include "AutoFile"
|
||||
#include "LogIn"
|
||||
Cd("::/LT/Adam/WordStat");;
|
||||
#include "WordStat"
|
||||
Cd("::/LT/Adam");;
|
||||
#include "Dbg"
|
||||
#include "HashUtils"
|
||||
#include "FileManager"
|
||||
|
||||
UseConsoleLtf(NULL);
|
||||
|
||||
adam_tss->win_top=2;
|
||||
adam_tss->win_bottom=10;
|
||||
sys_update_screen_tss=Spawn(&WinManagerTsk,"Window Manager");
|
||||
CollectAccntList;
|
||||
Bts(&Fs->crt_flags,CRTf_SHOW);
|
||||
|
||||
if (!(Fs->account=FindSysAccnt(sys_startup_account)))
|
||||
Fs->account=PopUpGetSysAccnt;
|
||||
sys_update_screen_tss->account=Fs->account;
|
||||
LoadAccntRegistry;
|
||||
|
||||
Cd("::/LT/Adam");;
|
||||
#include "WallPaper"
|
||||
|
||||
Cd("HOME");;
|
||||
#include "Adam3"
|
||||
@@ -0,0 +1,46 @@
|
||||
extern void UseConsoleLtf(I1 *menu_file);
|
||||
extern BoolU8 WinToTop(TssStruct *tss=NULL);
|
||||
extern U8 GetMsg(I8 *param1,I8 *param2,U8 mask=-2,TssStruct *tss=NULL);
|
||||
extern U8 ScanMsg(I8 *param1,I8 *param2,U8 mask=-2,TssStruct *tss=NULL);
|
||||
extern void PlotInputPointer(GrBitMap *base);
|
||||
extern void GrPlot0(GrBitMap *base,I8 x,I8 y);
|
||||
extern void DrawTaskBorder(TssStruct *tss);
|
||||
extern void UpdateOdes(TssStruct *tss);
|
||||
|
||||
extern void IDEClearAllBpts(Ltf *l);
|
||||
extern void IDEToggleBpt(Ltf *l);
|
||||
|
||||
extern U8 ltf_display_types[1],ltf_nondisplay_invisible_types[1],
|
||||
ltf_form_types[1],ltf_data_types[1];
|
||||
extern I8 PopUp(I1 *msg,TssStruct *parent=NULL,TssStruct **pu_tss=NULL);
|
||||
extern LtfEntry *LtfPutSExt(Ltf *l,I1 *st);
|
||||
extern I8 PopUpMenu(Ltf *l,I1 *help=NULL);
|
||||
extern Ltf *LtfNew();
|
||||
extern void LtfDel(Ltf *l);
|
||||
extern LtfEntry *LtfPrintF(Ltf *l,I1 *src,...);
|
||||
extern I1 *EditPicture();
|
||||
extern BoolU8 View();
|
||||
extern void IDEGo();
|
||||
extern void IDEStep(Ltf *l);
|
||||
extern void IDESetLineNum(Ltf *l);
|
||||
extern void IDE(I1 *filename);
|
||||
extern void LtfD(U1 *buf,U8 cnt=0x80);
|
||||
extern void LtfUpdateWinJoin(Ltf *l,BoolU4 to_screen,BoolU4 has_cursor,
|
||||
BoolU4 recalc,BoolU4 find_cur_entry,BoolU4 preempt,
|
||||
LtfEntry *pg_found=NULL,I8 num_del_entries=0);
|
||||
extern void LtfRecalc(Ltf *l);
|
||||
extern BoolU8 DoForm(U1 *D,I1 *class_name,
|
||||
I1 *help=NULL,BoolU4 help_is_file=FALSE,
|
||||
I1 *header=NULL,I1 *footer=NULL);
|
||||
|
||||
extern void WsFillin(I8 n);
|
||||
extern void WsMan(I8 n,TssStruct *parent=NULL);
|
||||
extern void WsdFillin(I8 n);
|
||||
extern void WsdDef(I8 n,TssStruct *parent=NULL);
|
||||
extern BoolU8 WordStat(BoolU8 val=ON);
|
||||
extern void WsdPopUpDef(I1 *st,I8 num=-1,TssStruct *parent=NULL);
|
||||
extern void FileManager(I1 *mask="/*",I1 *flags=NULL);
|
||||
extern void LtfHelpIndex(Ltf *l,I1 *index);
|
||||
extern void AccntOneTimePopUp(I8 flag_num,I1 *msg);
|
||||
|
||||
#define CTRL_L_HELP "::/LT/Doc/CtrlL.MUZ"
|
||||
Binary file not shown.
Binary file not shown.
+1410
File diff suppressed because it is too large.
Load diff
Binary file not shown.
@@ -1,198 +1,4 @@
|
||||
|
||||
public BoolU4 Copy(I1 *f1,I1 *f2=".")
|
||||
{
|
||||
BoolU4 result=TRUE;
|
||||
LTFileAccess *fa;
|
||||
LTDirEntry *tempm,*tempm1;
|
||||
U8 my_flags=0;
|
||||
if (!(tempm=FindFiles(f1,&my_flags)))
|
||||
return FALSE;
|
||||
if (IsDir(f2)) {
|
||||
fa=NewLTFileAccess(f2,TRUE);
|
||||
if (fa) {
|
||||
while (tempm) {
|
||||
tempm1=tempm->next;
|
||||
if (!(tempm->attr & LT_ATTR_DIR)) {
|
||||
if (!CopySingle(tempm->full_name,tempm->name))
|
||||
result=FALSE;
|
||||
}
|
||||
DelLTDirEntry(tempm);
|
||||
tempm=tempm1;
|
||||
}
|
||||
DelLTFileAccess(fa);
|
||||
}
|
||||
return result;
|
||||
} else
|
||||
return CopySingle(f1,f2);
|
||||
}
|
||||
|
||||
public BoolU4 Move(I1 *f1,I1 *f2)
|
||||
{
|
||||
if (Copy(f1,f2)) {
|
||||
Del(f1);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
U8 PutCopyTree(LTDirEntry *tempm,U8 src_dir_len,U8 dst_dir_len,I1 *dst_dir)
|
||||
{
|
||||
U8 result=0;
|
||||
I1 *st;
|
||||
while (tempm) {
|
||||
st=MAlloc(StrLen(tempm->full_name)+dst_dir_len+2);
|
||||
MemCpy(st,dst_dir,dst_dir_len);
|
||||
StrCpy(st+dst_dir_len,tempm->full_name+src_dir_len);
|
||||
if (tempm->attr & LT_ATTR_DIR) {
|
||||
MkDir(st);
|
||||
if (IsDir(st) && tempm->sub)
|
||||
result+=PutCopyTree(tempm->sub,src_dir_len,dst_dir_len,dst_dir);
|
||||
} else
|
||||
if (CopySingle(tempm->full_name,st))
|
||||
result++;
|
||||
Free(st);
|
||||
tempm=tempm->next;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public U8 CopyTree(I1 *src_mask,I1 *dst_mask)
|
||||
{ //returns count of copied files (not dirs)
|
||||
LTFileAccess *fa;
|
||||
LTDirEntry *tempm=NULL;
|
||||
U8 result=0,i1,i2,my_flags=(1<<FUf_RECURSE);
|
||||
I1 *st1,*st2;
|
||||
|
||||
fa=NewLTFileAccess(src_mask,TRUE);
|
||||
if (fa) {
|
||||
tempm=SysFindFiles(fa->mask,&my_flags);
|
||||
st1=CurDir;
|
||||
DelLTFileAccess(fa);
|
||||
i1=StrLen(st1);
|
||||
if (i1==3) i1--;
|
||||
|
||||
fa=NewLTFileAccess(dst_mask,TRUE,TRUE);
|
||||
if (fa) {
|
||||
st2=CurDir;
|
||||
i2=StrLen(st2);
|
||||
if (i2==3) i2--;
|
||||
result=PutCopyTree(tempm,i1,i2,st2);
|
||||
DelLTFileAccess(fa);
|
||||
Free(st2);
|
||||
}
|
||||
DelLTDirList(tempm);
|
||||
Free(st1);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void DoDelTree(LTDirEntry *tempm1)
|
||||
{
|
||||
U8 result=0;
|
||||
LTDirEntry *tempm2;
|
||||
while (tempm1) {
|
||||
tempm2=tempm1->next;
|
||||
if (tempm1->attr & LT_ATTR_DIR) {
|
||||
if (tempm1->sub)
|
||||
result+=DoDelTree(tempm1->sub);
|
||||
SysDel(tempm1->full_name,TRUE);
|
||||
}
|
||||
DelLTDirEntry(tempm1);
|
||||
tempm1=tempm2;
|
||||
}
|
||||
}
|
||||
|
||||
public BoolU4 DelTree(I1 *mask)
|
||||
{
|
||||
U8 my_flags=(1<<FUf_RECURSE);
|
||||
if (!IsDir(mask)) {
|
||||
coutln "Not a Directory";
|
||||
return FALSE;
|
||||
}
|
||||
DoDelTree(FindFiles(mask,&my_flags));
|
||||
SysDel(mask,TRUE);
|
||||
SysDel(mask,FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void DoDelMask(LTDirEntry *tempm1)
|
||||
{
|
||||
LTDirEntry *tempm2;
|
||||
while (tempm1) {
|
||||
tempm2=tempm1->next;
|
||||
if (tempm1->attr & LT_ATTR_DIR) {
|
||||
if (tempm1->sub)
|
||||
DoDelMask(tempm1->sub);
|
||||
} else
|
||||
Del(tempm1->full_name);
|
||||
DelLTDirEntry(tempm1);
|
||||
tempm1=tempm2;
|
||||
}
|
||||
}
|
||||
|
||||
public BoolU4 DelMask(I1 *mask)
|
||||
{ //Purges select filetypes from tree
|
||||
U8 my_flags=(1<<FUf_RECURSE);
|
||||
if (IsDir(mask)) {
|
||||
coutln "Not a Mask";
|
||||
return FALSE;
|
||||
}
|
||||
DoDelMask(FindFiles(mask,&my_flags));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
void TouchFile(I1 *filename,I1 *attr) //LTust one file
|
||||
{
|
||||
U1 *temp_st=NewString(filename),
|
||||
*cur_dir=NewString(filename);
|
||||
LTPartition *p=DriveToPartition(*filename);
|
||||
FlagsStruct f;
|
||||
LTDirEntry de;
|
||||
I1 buf[64];
|
||||
if (FindFile(filename,&de,FALSE,TRUE)) {
|
||||
if (!StrCmp(attr,"+?"))
|
||||
PrintF("%-32ts %s\r\n",filename,SPrintFFlags(buf,"ST_FILE_ATTRS",de.attr));
|
||||
else {
|
||||
GetFFlags(&f,"ST_FILE_ATTRS",attr);
|
||||
RemoveFirstSeg(cur_dir,":",temp_st);
|
||||
RemoveLastSeg(cur_dir,"/",temp_st);
|
||||
if (!*cur_dir)
|
||||
StrCpy(cur_dir,"/");
|
||||
de.attr=de.attr&f.off|f.on;
|
||||
de.datetime=GetCurTimeLTDate;
|
||||
NewLTDirEntry(p,cur_dir,&de,FALSE);
|
||||
}
|
||||
} else PutSysText("ST_FILE_NOT_FOUND");
|
||||
}
|
||||
|
||||
void TouchList(LTDirEntry *tempm1,I1 *attr)
|
||||
{
|
||||
LTDirEntry *tempm2;
|
||||
while (tempm1) {
|
||||
tempm2=tempm1->next;
|
||||
if (tempm1->attr & LT_ATTR_DIR) {
|
||||
if (tempm1->sub) {
|
||||
coutln SysText("ST_SCANNING_DIRECTORY"),tempm1->full_name;
|
||||
TouchList(tempm1->sub,attr);
|
||||
}
|
||||
} else
|
||||
TouchFile(tempm1->full_name,attr);
|
||||
DelLTDirEntry(tempm1);
|
||||
tempm1=tempm2;
|
||||
}
|
||||
}
|
||||
|
||||
//Attr "+?" =show
|
||||
// "+T" = resident
|
||||
//flags "+r"=recurse
|
||||
public void Touch(I1 *wild,I1 *attr="+?",I1 *flags="")
|
||||
{
|
||||
FlagsStruct f;
|
||||
GetFFlags(&f,"ST_FILE_UTIL_FLAGS",flags);
|
||||
TouchList(FindFiles(wild,&f.on),attr);
|
||||
}
|
||||
#help_index "File/CD DVD"
|
||||
|
||||
void FillBigEndianU2(U2 *dst,U2 w)
|
||||
{
|
||||
@@ -242,7 +48,7 @@ U8 DoCreateCDFile(LTFile *out_file,LTDirEntry *tempm,
|
||||
*de=dir_blk_buf,*de1;
|
||||
ISODirEntry *dir_blk_buf2=MAllocZ(CD_BLK_SIZE*128),
|
||||
*de2=dir_blk_buf2,*de12;
|
||||
U8 i,l;
|
||||
U8 i,n;
|
||||
|
||||
tempc=parent->user_data;
|
||||
|
||||
@@ -297,9 +103,9 @@ U8 DoCreateCDFile(LTFile *out_file,LTDirEntry *tempm,
|
||||
de1=de;
|
||||
de12=de2;
|
||||
if (tempm1->attr & LT_ATTR_DIR) {
|
||||
l=DoCreateCDFile(out_file,tempm1,de,de2,cur_blk,tempm,write);
|
||||
de+=sizeof(ISODirEntry)-1+l;
|
||||
de2+=sizeof(ISODirEntry)-1+l<<1;
|
||||
n=DoCreateCDFile(out_file,tempm1,de,de2,cur_blk,tempm,write);
|
||||
de+=sizeof(ISODirEntry)-1+n;
|
||||
de2+=sizeof(ISODirEntry)-1+n<<1;
|
||||
} else {
|
||||
tempc=tempm1->user_data;
|
||||
de->length=sizeof(ISODirEntry)-1;
|
||||
@@ -336,14 +142,14 @@ U8 DoCreateCDFile(LTFile *out_file,LTDirEntry *tempm,
|
||||
|
||||
in_file=FOpen(tempm1->full_name,"r");
|
||||
for (i=0;i<(FSize(in_file)+CD_BLK_SIZE-1)/CD_BLK_SIZE;i++) {
|
||||
l=4;
|
||||
if ((i+1)<<2>(FSize(in_file)+BLK_SIZE-1)/BLK_SIZE) {
|
||||
l=((FSize(in_file)+BLK_SIZE-1)/BLK_SIZE)%4;
|
||||
n=4;
|
||||
if ((i+1)<<2>(FSize(in_file)+BLK_SIZE-1)>>BLK_SIZE_BITS) {
|
||||
n=((FSize(in_file)+BLK_SIZE-1)>>BLK_SIZE_BITS)%4;
|
||||
MemSet(buf,0,CD_BLK_SIZE);
|
||||
}
|
||||
if (write) {
|
||||
FRBlks(in_file,buf,i<<2,l);
|
||||
FWBlks(out_file,buf,(*cur_blk)<<2,l);
|
||||
FRBlks(in_file,buf,i<<2,n);
|
||||
FWBlks(out_file,buf,(*cur_blk)<<2,n);
|
||||
}
|
||||
*cur_blk+=1;
|
||||
}
|
||||
@@ -384,21 +190,21 @@ U8 DoCreateCDFile(LTFile *out_file,LTDirEntry *tempm,
|
||||
}
|
||||
tempi->length+=tempi->name_len;
|
||||
|
||||
l=de+1-dir_blk_buf;
|
||||
l=(l+CD_BLK_SIZE-1)/CD_BLK_SIZE;
|
||||
FillU4Palindrome(&tempi->size,l*CD_BLK_SIZE);
|
||||
n=de+1-dir_blk_buf;
|
||||
n=(n+CD_BLK_SIZE-1)/CD_BLK_SIZE;
|
||||
FillU4Palindrome(&tempi->size,n*CD_BLK_SIZE);
|
||||
FillU4Palindrome(&tempi->location,*cur_blk);
|
||||
tempc->short_dir_blks=l;
|
||||
tempc->short_dir_blks=n;
|
||||
tempc->location=*cur_blk;
|
||||
FillU4Palindrome(&dir_blk_buf->size,l*CD_BLK_SIZE);
|
||||
FillU4Palindrome(&dir_blk_buf->size,n*CD_BLK_SIZE);
|
||||
FillU4Palindrome(&dir_blk_buf->location,*cur_blk);
|
||||
FillU2Palindrome(&tempi->volume_sequence_num,1);
|
||||
LTDateToISO(&tempi->date,tempm->datetime);
|
||||
if (write)
|
||||
coutln *cur_blk,":",tempm->full_name;
|
||||
if (write)
|
||||
FWBlks(out_file,dir_blk_buf,(*cur_blk)<<2,l<<2);
|
||||
*cur_blk+=l;
|
||||
FWBlks(out_file,dir_blk_buf,(*cur_blk)<<2,n<<2);
|
||||
*cur_blk+=n;
|
||||
|
||||
tempi2->length=sizeof(ISODirEntry)-1;
|
||||
tempi2->ext_attr_length=0;
|
||||
@@ -416,20 +222,20 @@ U8 DoCreateCDFile(LTFile *out_file,LTDirEntry *tempm,
|
||||
}
|
||||
}
|
||||
tempi2->length+=tempi2->name_len;
|
||||
l=de2+1-dir_blk_buf2;
|
||||
l=(l+CD_BLK_SIZE-1)/CD_BLK_SIZE;
|
||||
FillU4Palindrome(&tempi2->size,l*CD_BLK_SIZE);
|
||||
n=de2+1-dir_blk_buf2;
|
||||
n=(n+CD_BLK_SIZE-1)/CD_BLK_SIZE;
|
||||
FillU4Palindrome(&tempi2->size,n*CD_BLK_SIZE);
|
||||
FillU4Palindrome(&tempi2->location,*cur_blk);
|
||||
tempc->long_dir_blks=l;
|
||||
FillU4Palindrome(&dir_blk_buf2->size,l*CD_BLK_SIZE);
|
||||
tempc->long_dir_blks=n;
|
||||
FillU4Palindrome(&dir_blk_buf2->size,n*CD_BLK_SIZE);
|
||||
FillU4Palindrome(&dir_blk_buf2->location,*cur_blk);
|
||||
FillU2Palindrome(&tempi2->volume_sequence_num,1);
|
||||
LTDateToISO(&tempi2->date,tempm->datetime);
|
||||
if (write)
|
||||
coutln *cur_blk,":",tempm->full_name;
|
||||
if (write)
|
||||
FWBlks(out_file,dir_blk_buf2,(*cur_blk)<<2,l<<2);
|
||||
*cur_blk+=l;
|
||||
FWBlks(out_file,dir_blk_buf2,(*cur_blk)<<2,n<<2);
|
||||
*cur_blk+=n;
|
||||
|
||||
Free(dir_blk_buf);
|
||||
Free(dir_blk_buf2);
|
||||
@@ -539,11 +345,10 @@ public U8 CreateCDFile(I1 *filename,I1 src_drive,
|
||||
*iso2=MAllocZ(CD_BLK_SIZE),
|
||||
*iso3=MAllocZ(CD_BLK_SIZE);
|
||||
LTDirEntry *rootdir=MAllocZ(sizeof(LTDirEntry));
|
||||
U8 my_flags=(1<<FUf_RECURSE);
|
||||
U8 cur_blk=0,bsize,tabsize,tabsize2,first_free,max_depth;
|
||||
U4 *d;
|
||||
I1 mask[8];
|
||||
I1 *filename2=DefaultExtension(filename,"ISO");
|
||||
I1 *filename2;
|
||||
ElTorito *et=MAllocZ(CD_BLK_SIZE);
|
||||
U1 *buf=MAllocZ(CD_BLK_SIZE),
|
||||
*bootfile_buf=NULL;
|
||||
@@ -555,11 +360,15 @@ public U8 CreateCDFile(I1 *filename,I1 src_drive,
|
||||
ISODirEntry *tempi;
|
||||
CCdUserData *tempc;
|
||||
|
||||
if (!filename)
|
||||
filename=default_iso_name;
|
||||
filename2=DefaultExtension(filename,"ISO");
|
||||
|
||||
SPrintF(mask,"%c:/*",src_drive);
|
||||
if (bootfile)
|
||||
bootfile_buf=ReadFile(bootfile,&bsize);
|
||||
rootdir->attr=LT_ATTR_DIR;
|
||||
rootdir->sub=FindFiles(mask,&my_flags);
|
||||
rootdir->sub=FindFiles(mask,1<<FUf_RECURSE);
|
||||
rootdir->datetime=GetCurTimeLTDate;
|
||||
rootdir->user_data=MAllocZ(sizeof(CCdUserData));
|
||||
tempc=rootdir->user_data;
|
||||
@@ -731,90 +540,4 @@ public U8 CreateCDFile(I1 *filename,I1 src_drive,
|
||||
Free(filename2);
|
||||
return cur_blk;
|
||||
}
|
||||
|
||||
|
||||
public void SetDriveTextAttr(I1 drive=0,U1 attr)
|
||||
{
|
||||
LTPartition *p;
|
||||
try {
|
||||
p=DriveToPartition(drive);
|
||||
p->text_attr=attr;
|
||||
} catch {
|
||||
Fs->catch_except=TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
public void PrintFDriveTextAttr(I1 drive=0)
|
||||
{
|
||||
LTPartition *p=DriveToPartition(drive);
|
||||
U1 fg=p->text_attr&0xF,bg=p->text_attr>>4;
|
||||
if (fg!=bg)
|
||||
PrintF("$$FG,%d$$$$BG,%d$$",fg,bg);
|
||||
}
|
||||
|
||||
U8 SizeFlattenLTDirTree(LTDirEntry *tempm)
|
||||
{
|
||||
U8 result=0;
|
||||
while (tempm) {
|
||||
result+=LT_DIR_ENTRY_SIZE+1;
|
||||
if (tempm->attr & LT_ATTR_DIR)
|
||||
result+=SizeFlattenLTDirTree(tempm->sub);
|
||||
tempm=tempm->next;
|
||||
}
|
||||
return result+1;
|
||||
}
|
||||
|
||||
U8 FillFlattenLTDirTree(LTDirEntry *tempm,U1 *dst)
|
||||
{
|
||||
U8 result=0,i;
|
||||
while (tempm) {
|
||||
*dst++=1;
|
||||
result++;
|
||||
i=LT_DIR_ENTRY_SIZE;
|
||||
MemCpy(dst,&tempm->start,i);
|
||||
dst+=i;
|
||||
result+=i;
|
||||
if (tempm->attr & LT_ATTR_DIR) {
|
||||
i=FillFlattenLTDirTree(tempm->sub,dst);
|
||||
dst+=i;
|
||||
result+=i;
|
||||
}
|
||||
tempm=tempm->next;
|
||||
}
|
||||
*dst=0;
|
||||
return result+1;
|
||||
}
|
||||
|
||||
public U1 *FlattenLTDirTree(LTDirEntry *tempm,U8 *size=NULL)
|
||||
{
|
||||
U8 i=SizeFlattenLTDirTree(tempm);
|
||||
U1 *buf=MAlloc(i);
|
||||
FillFlattenLTDirTree(tempm,buf);
|
||||
if (size) *size=i;
|
||||
return buf;
|
||||
}
|
||||
|
||||
U1 *DoUnflattenLTDirTree(U1 *src,LTDirEntry **tempm)
|
||||
{
|
||||
U8 i;
|
||||
LTDirEntry *tempm1;
|
||||
if (*src++) {
|
||||
tempm1=MAllocZ(sizeof(LTDirEntry));
|
||||
*tempm=tempm1;
|
||||
i=LT_DIR_ENTRY_SIZE;
|
||||
MemCpy(&tempm1->start,src,i);
|
||||
src+=i;
|
||||
if (tempm1->attr & LT_ATTR_DIR)
|
||||
src=DoUnflattenLTDirTree(src,&tempm1->sub);
|
||||
src=DoUnflattenLTDirTree(src,&tempm1->next);
|
||||
} else
|
||||
*tempm=NULL;
|
||||
return src;
|
||||
}
|
||||
|
||||
public LTDirEntry *UnflattenLTDirTree(U1 *src)
|
||||
{
|
||||
LTDirEntry *tempm=NULL;
|
||||
DoUnflattenLTDirTree(src,&tempm);
|
||||
return tempm;
|
||||
}
|
||||
#help_index ""
|
||||
Binary file not shown.
@@ -0,0 +1,684 @@
|
||||
#help_index "File/Cmd Line (Typically)"
|
||||
|
||||
#define FILEMANAGER_MENU_NAME "::/LT/Doc/FileManager.MUZ"
|
||||
|
||||
class FMUncollapsedList
|
||||
{
|
||||
FMUncollapsedList *next;
|
||||
I1 *name;
|
||||
};
|
||||
|
||||
void AddTempDriveWizard()
|
||||
{
|
||||
TssStruct *tss;
|
||||
I1 *a_drive=NULL,*a_size=NULL,*a_type=NULL,*a_name=NULL,*a_default=NULL;
|
||||
I8 size,drive,type,drive2;
|
||||
LTPartition *p;
|
||||
PartitionRep;
|
||||
BoolU4 okay=FALSE,sure=FALSE,in_use,valid_drive2;
|
||||
cout "$$WW,1$$";
|
||||
|
||||
a_type =PmtStr("\r\n(R)am or (F)ile : ");
|
||||
type =ToUpper(*a_type);
|
||||
if (type=='R' || type=='F') {
|
||||
a_drive =PmtStr("\r\nNew Drive Letter: ");
|
||||
drive=ToUpper(*a_drive);
|
||||
if (drive>'A' && drive<='Z') {
|
||||
p=&local_partitions[drive-'A'];
|
||||
try {
|
||||
CheckLTPartition(p);
|
||||
in_use=TRUE;
|
||||
} catch {
|
||||
Fs->catch_except=TRUE;
|
||||
in_use=FALSE;
|
||||
}
|
||||
if (in_use)
|
||||
coutln "$$FG,RED$$Drive letter in use.$$FG$$";
|
||||
else {
|
||||
a_size =PmtStr("\r\nSize in Meg : ");
|
||||
size=AtoI(a_size)*0x100000>>BLK_SIZE_BITS;
|
||||
if (size<0x800)
|
||||
coutln "$$FG,RED$$Invalid size.$$FG$$";
|
||||
else {
|
||||
if (type=='F') {
|
||||
coutln "$$FG,RED$$Specify entire path, including drive, but leave-off "
|
||||
"the filename extension.$$FG$$";
|
||||
a_default=MSPrintF("%c:/Temp/Drive%c",default_drive,drive);
|
||||
a_name=PmtStr("\r\nFile Name (%s): ",a_default);
|
||||
if (*a_name==':')
|
||||
*a_name=default_drive;
|
||||
if (StrLen(a_name)<4 || a_name[1]!=':' ||
|
||||
Occurrences(a_name,'.'))
|
||||
coutln "$$FG,RED$$Invalid file name.$$FG$$";
|
||||
else {
|
||||
drive2=ToUpper(*a_name);
|
||||
p=&local_partitions[drive2-'A'];
|
||||
valid_drive2=FALSE;
|
||||
if (p->type==PT_LT) {
|
||||
try {
|
||||
CheckLTPartition(p);
|
||||
valid_drive2=TRUE;
|
||||
} catch
|
||||
Fs->catch_except=TRUE;
|
||||
}
|
||||
if (!valid_drive2)
|
||||
coutln "$$FG,RED$$Invalid drive in file name.$$FG$$";
|
||||
else
|
||||
okay=TRUE;
|
||||
}
|
||||
} else {
|
||||
if (size<<BLK_SIZE_BITS>7*UnusedSysMem/8)
|
||||
coutln "$$FG,RED$$Size is too big.$$FG$$";
|
||||
else
|
||||
okay=TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else
|
||||
coutln "$$FG,RED$$Invalid drive letter.$$FG$$";
|
||||
}
|
||||
|
||||
CrLf;
|
||||
if (okay)
|
||||
sure=AreYouSure;
|
||||
if (okay && sure) {
|
||||
tss=SpawnUser;
|
||||
tss->win_top=Fs->win_top;
|
||||
tss->win_bottom=(Fs->win_top+Fs->win_bottom)>>2-1;
|
||||
Fs-> win_top=tss->win_bottom+3;
|
||||
tss->win_right=Fs->win_right;
|
||||
tss->win_left=Fs->win_left;
|
||||
WinToTop(Fs);
|
||||
XTalk(tss,"AddDrives;\r");
|
||||
XTalk(tss,"%c",drive);
|
||||
if (type=='R') {
|
||||
XTalk(tss,"1");
|
||||
XTalk(tss,"%d\r",size);
|
||||
} else {
|
||||
XTalk(tss,"5");
|
||||
XTalk(tss,"%s\r",a_name);
|
||||
XTalk(tss,"Y");
|
||||
XTalk(tss,"%d\r",size);
|
||||
}
|
||||
XTalkWithWait(tss,"\r");
|
||||
Fs->win_top=tss->win_top;
|
||||
Kill(tss);
|
||||
PartitionRep;
|
||||
} else
|
||||
coutln "$$FG,RED$$Canceled$$FG$$";
|
||||
CrLf;
|
||||
PressAKey;
|
||||
Free(a_drive);
|
||||
Free(a_type);
|
||||
Free(a_size);
|
||||
Free(a_name);
|
||||
Free(a_default);
|
||||
}
|
||||
|
||||
void FMAddTempDrive()
|
||||
{
|
||||
PopUp("AddTempDriveWizard;\r",Fs);
|
||||
}
|
||||
|
||||
FMUncollapsedList *FMCollectUncollapsedList(Ltf *l)
|
||||
{
|
||||
LtfEntry *ll=l->dummy.next;
|
||||
FMUncollapsedList *result=NULL,*tempc;
|
||||
LTDirEntry *tempm;
|
||||
while (ll!=l) {
|
||||
if (ll->btype==LTFT_TREE) {
|
||||
if (!(ll->flags<FLF_COLLAPSED)) {
|
||||
if (tempm=ll->user_data) {
|
||||
tempc=MAlloc(sizeof(FMUncollapsedList));
|
||||
tempc->next=result;
|
||||
result=tempc;
|
||||
tempc->name=NewStr(tempm->full_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
ll=ll->next;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void FMMarkUncollapsed(Ltf *l,FMUncollapsedList *tempc,I1 *cur_entry,I1 *next_entry)
|
||||
{
|
||||
LtfEntry *ll=l->dummy.next;
|
||||
FMUncollapsedList *tempc1;
|
||||
LTDirEntry *tempm;
|
||||
while (ll!=l) {
|
||||
if (ll->btype==LTFT_TREE) {
|
||||
tempm=ll->user_data;
|
||||
tempc1=tempc;
|
||||
while (tempc1) {
|
||||
if (!StrCmp(tempc1->name,tempm->full_name)) {
|
||||
ll->flags&=~LTFLF_COLLAPSED;
|
||||
break;
|
||||
}
|
||||
tempc1=tempc1->next;
|
||||
}
|
||||
if (cur_entry) {
|
||||
if (!StrNCmp(cur_entry,tempm->full_name,StrLen(tempm->full_name))) {
|
||||
l->cur_entry=ll;
|
||||
if (StrLen(tempm->full_name)==StrLen(cur_entry))
|
||||
cur_entry=NULL;
|
||||
} else if (next_entry) {
|
||||
if (!StrNCmp(next_entry,tempm->full_name,StrLen(tempm->full_name))) {
|
||||
l->cur_entry=ll;
|
||||
if (StrLen(tempm->full_name)==StrLen(next_entry))
|
||||
cur_entry=NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (ll->btype==LTFT_MENU_VALUE) {
|
||||
tempm=ll->left_exp;
|
||||
if (cur_entry) {
|
||||
if (!StrNCmp(cur_entry,tempm->full_name,StrLen(tempm->full_name))) {
|
||||
l->cur_entry=ll;
|
||||
if (StrLen(tempm->full_name)==StrLen(cur_entry))
|
||||
cur_entry=NULL;
|
||||
} else if (next_entry) {
|
||||
if (!StrNCmp(next_entry,tempm->full_name,StrLen(tempm->full_name))) {
|
||||
l->cur_entry=ll;
|
||||
if (StrLen(tempm->full_name)==StrLen(next_entry))
|
||||
cur_entry=NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ll=ll->next;
|
||||
}
|
||||
}
|
||||
|
||||
void FMDelUncollapsedList(FMUncollapsedList *tempc)
|
||||
{
|
||||
FMUncollapsedList *tempc1;
|
||||
while (tempc) {
|
||||
tempc1=tempc->next;
|
||||
Free(tempc->name);
|
||||
Free(tempc);
|
||||
tempc=tempc1;
|
||||
}
|
||||
}
|
||||
|
||||
LTDirEntry *FMRebuildLtfDrive(I1 drive,Ltf *l,LTDirEntry **root,BoolU4 init)
|
||||
{
|
||||
U8 f=0;
|
||||
LtfEntry *ll;
|
||||
LTDirEntry *tempm,*tempm1;
|
||||
I1 *st;
|
||||
|
||||
GetFFlags(&f,SysText("ST_FILE_UTIL_FLAGS"),"+r");
|
||||
tempm=MAllocZ(sizeof(LTDirEntry));
|
||||
tempm->full_name=MSPrintF("%c:/",drive);
|
||||
StrCpy(tempm->name,"");
|
||||
st=MSPrintF("%c:/*",drive);
|
||||
if (init) {
|
||||
tempm1=FindFiles(st,f);
|
||||
tempm->sub=tempm1;
|
||||
} else
|
||||
tempm1=NULL;
|
||||
Free(st);
|
||||
ll=LtfPrintF(l,"$$TR,\"%s\"$$",tempm->full_name);
|
||||
ll->user_data=tempm;
|
||||
tempm->next=*root;
|
||||
*root=tempm;
|
||||
LtfPutSExt(l,"\r\n$$ID,+2$$");
|
||||
LtfBottom(l);
|
||||
if (init) {
|
||||
LTDirEntryToFileLtf(l,tempm1);
|
||||
while (tempm1) {
|
||||
tempm1->parent=tempm;
|
||||
tempm1=tempm1->next;
|
||||
}
|
||||
}
|
||||
LtfPutSExt(l,"$$ID,-2$$");
|
||||
return tempm;
|
||||
}
|
||||
|
||||
|
||||
void FMRebuildLtf(Ltf **l_,LTDirEntry **root)
|
||||
{
|
||||
LTPartition *p;
|
||||
I8 i;
|
||||
Ltf *l=*l_,*m,*b=sys_clipboard_ltf;
|
||||
FMUncollapsedList *tempc=NULL;
|
||||
I1 *cur_entry=NULL,*next_entry=NULL;
|
||||
LtfEntry *cl;
|
||||
LTDirEntry *tempm,*tempm1,*cur_tree_entry;
|
||||
if (l) {
|
||||
|
||||
cur_tree_entry=NULL;
|
||||
cl=l->cur_entry;
|
||||
if (cl->btype==LTFT_TREE)
|
||||
cur_tree_entry=cl->user_data;
|
||||
else if (cl->btype==LTFT_MENU_VALUE)
|
||||
cur_tree_entry=cl->left_exp;
|
||||
if (cur_tree_entry)
|
||||
cur_entry=NewStr(cur_tree_entry->full_name);
|
||||
|
||||
tempm=NULL;
|
||||
if (cl!=l)
|
||||
cl=cl->next;
|
||||
while (cl!=l) {
|
||||
if (cl->btype==LTFT_TREE)
|
||||
tempm=cl->user_data;
|
||||
else if (cl->btype==LTFT_MENU_VALUE)
|
||||
tempm=cl->left_exp;
|
||||
else
|
||||
tempm=NULL;
|
||||
if (tempm) {
|
||||
tempm1=tempm->parent;
|
||||
while (tempm1) {
|
||||
if (tempm1==cur_tree_entry) {
|
||||
tempm=NULL;
|
||||
break;
|
||||
} else
|
||||
tempm1=tempm1->parent;
|
||||
}
|
||||
if (tempm)
|
||||
break;
|
||||
}
|
||||
cl=cl->next;
|
||||
}
|
||||
if (tempm)
|
||||
next_entry=NewStr(tempm->full_name);
|
||||
|
||||
tempc=FMCollectUncollapsedList(l);
|
||||
Fs->cur_ltf=NULL;
|
||||
LtfDel(l);
|
||||
}
|
||||
if (*root) {
|
||||
DelLTDirList(*root);
|
||||
*root=NULL;
|
||||
}
|
||||
l=LtfNew;
|
||||
l->flags|=LTFF_FORM;
|
||||
m=LtfRead(FILEMANAGER_MENU_NAME);
|
||||
m->text_attribute=(WHITE<<4)+LTBLUE;
|
||||
l->menu_ltf=m;
|
||||
for (i=0;i<32;i++) {
|
||||
p=&local_partitions[i];
|
||||
if (p->type==PT_LT)
|
||||
FMRebuildLtfDrive(p->drive,l,root,TRUE);
|
||||
else if (p->type==PT_ISO9660) {
|
||||
if (p->bdev->flags<BDF_INITIALIZED)
|
||||
tempm=FMRebuildLtfDrive(p->drive,l,root,TRUE);
|
||||
else {
|
||||
tempm=FMRebuildLtfDrive(p->drive,l,root,FALSE);
|
||||
tempm->flags|=LTDEF_NOT_INITIALIZED;
|
||||
}
|
||||
tempm->flags|=LTDEF_REMOVABLE;
|
||||
}
|
||||
}
|
||||
LtfHome(l);
|
||||
FMMarkUncollapsed(l,tempc,cur_entry,next_entry);
|
||||
l->recalc_start=l;
|
||||
LtfCenter(l);
|
||||
LtfReset(b,TRUE);
|
||||
FMDelUncollapsedList(tempc);
|
||||
Free(cur_entry);
|
||||
Free(next_entry);
|
||||
*l_=l;
|
||||
Fs->cur_ltf=l;
|
||||
}
|
||||
|
||||
void FMRename(Ltf *l)
|
||||
{
|
||||
EditFileNameStruct fn;
|
||||
LtfEntry *ll=l->cur_entry;
|
||||
LTDirEntry *tempm=NULL,*parent;
|
||||
if (ll->btype==LTFT_MENU_VALUE) {
|
||||
tempm=ll->left_exp;
|
||||
if (parent=tempm->parent) {
|
||||
Cd(parent->full_name);
|
||||
StrCpy(fn.name,tempm->name);
|
||||
if (DoForm(fn.name,"EditFileNameStruct")) {
|
||||
Silent(ON);
|
||||
Move(tempm->name,fn.name);
|
||||
Silent(OFF);
|
||||
}
|
||||
}
|
||||
} else if (ll->btype==LTFT_TREE) {
|
||||
tempm=ll->user_data;
|
||||
if (parent=tempm->parent) {
|
||||
Cd(parent->full_name);
|
||||
StrCpy(fn.name,tempm->name);
|
||||
if (DoForm(fn.name,"EditFileNameStruct")) {
|
||||
if (StrCmp(tempm->name,fn.name)) {
|
||||
Silent(ON);
|
||||
CopyTree(tempm->name,fn.name);
|
||||
DelTree(tempm->name);
|
||||
Silent(OFF);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FMDelete(Ltf *l)
|
||||
{
|
||||
LtfEntry *cl=l->cur_entry;
|
||||
LTDirEntry *tempm;
|
||||
if (cl->btype==LTFT_MENU_VALUE) {
|
||||
tempm=cl->left_exp;
|
||||
Silent(ON);
|
||||
Del(tempm->full_name);
|
||||
Silent(OFF);
|
||||
} else if (cl->btype==LTFT_TREE) {
|
||||
tempm=cl->user_data;
|
||||
Silent(ON);
|
||||
DelTree(tempm->full_name);
|
||||
Silent(OFF);
|
||||
}
|
||||
}
|
||||
|
||||
void FMMount(Ltf *l)
|
||||
{
|
||||
LtfEntry *cl=l->cur_entry;
|
||||
LTDirEntry *tempm;
|
||||
if (cl->btype==LTFT_TREE)
|
||||
tempm=cl->user_data;
|
||||
else if (cl->btype==LTFT_MENU_VALUE)
|
||||
tempm=cl->left_exp;
|
||||
else
|
||||
tempm=NULL;
|
||||
if (tempm) {
|
||||
while (tempm->parent)
|
||||
tempm=tempm->parent;
|
||||
Silent(ON);
|
||||
ChangeDisk(*tempm->full_name);
|
||||
Silent(OFF);
|
||||
}
|
||||
}
|
||||
|
||||
void FMFormatDrive(Ltf *l)
|
||||
{
|
||||
LtfEntry *cl=l->cur_entry;
|
||||
LTDirEntry *tempm;
|
||||
I1 *st=NULL;
|
||||
if (cl->btype==LTFT_TREE)
|
||||
tempm=cl->user_data;
|
||||
else if (cl->btype==LTFT_MENU_VALUE)
|
||||
tempm=cl->left_exp;
|
||||
else
|
||||
tempm=NULL;
|
||||
if (tempm) {
|
||||
while (tempm->parent)
|
||||
tempm=tempm->parent;
|
||||
st=MSPrintF("Format Drive '%c'?\r\nAre You Sure?\r\n",*tempm->full_name);
|
||||
if (PopUpNoYes(st)) {
|
||||
Silent(ON);
|
||||
Format(*tempm->full_name,TRUE,FALSE);
|
||||
Silent(OFF);
|
||||
}
|
||||
}
|
||||
Free(st);
|
||||
}
|
||||
|
||||
void FMMakeISO(Ltf *l)
|
||||
{
|
||||
LtfEntry *cl=l->cur_entry;
|
||||
LTDirEntry *tempm;
|
||||
if (cl->btype==LTFT_TREE)
|
||||
tempm=cl->user_data;
|
||||
else if (cl->btype==LTFT_MENU_VALUE)
|
||||
tempm=cl->left_exp;
|
||||
else
|
||||
tempm=NULL;
|
||||
if (tempm) {
|
||||
while (tempm->parent)
|
||||
tempm=tempm->parent;
|
||||
Silent(ON);
|
||||
CreateCDFile(NULL,*tempm->full_name);
|
||||
Silent(OFF);
|
||||
}
|
||||
}
|
||||
|
||||
void FMBurnISO(Ltf *l)
|
||||
{
|
||||
LtfEntry *cl=l->cur_entry;
|
||||
LTDirEntry *tempm;
|
||||
if (cl->btype==LTFT_TREE)
|
||||
tempm=cl->user_data;
|
||||
else if (cl->btype==LTFT_MENU_VALUE)
|
||||
tempm=cl->left_exp;
|
||||
else
|
||||
tempm=NULL;
|
||||
if (tempm) {
|
||||
while (tempm->parent)
|
||||
tempm=tempm->parent;
|
||||
Silent(ON);
|
||||
WriteCDImage(*tempm->full_name,NULL);
|
||||
Silent(OFF);
|
||||
}
|
||||
}
|
||||
|
||||
void FMCopy(Ltf *l)
|
||||
{
|
||||
Ltf *b=sys_clipboard_ltf;
|
||||
I1 *st;
|
||||
LtfEntry *cl=l->cur_entry,*ll=b->dummy.next;
|
||||
LTDirEntry *tempm,*tempm1,*tempm2;
|
||||
if (cl->btype==LTFT_TREE) {
|
||||
tempm1=cl->user_data;
|
||||
while (ll!=b) {
|
||||
if (ll->btype==LTFT_MENU_VALUE) {
|
||||
tempm=ll->left_exp;
|
||||
tempm->flags|=LTDEF_PROCESSED;
|
||||
tempm2=tempm->parent;
|
||||
if (!tempm2 || !(tempm2->flags<DEF_PROCESSED)) {
|
||||
Silent(ON);
|
||||
Copy(tempm->full_name,tempm1->full_name);
|
||||
Silent(OFF);
|
||||
}
|
||||
} else if (ll->btype==LTFT_TREE) {
|
||||
tempm=ll->user_data;
|
||||
tempm->flags|=LTDEF_PROCESSED;
|
||||
tempm2=tempm->parent;
|
||||
if (!tempm2 || !(tempm2->flags<DEF_PROCESSED)) {
|
||||
Silent(ON);
|
||||
if (*tempm1->name)
|
||||
st=MSPrintF("%s/%s",tempm1->full_name,tempm->name);
|
||||
else
|
||||
st=MSPrintF("%s%s",tempm1->full_name,tempm->name);
|
||||
CopyTree(tempm->full_name,st);
|
||||
Free(st);
|
||||
Silent(OFF);
|
||||
}
|
||||
}
|
||||
ll=ll->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
I8 PopUpCancelPasteDel(I1 *header=NULL,I1 *footer=NULL)
|
||||
{
|
||||
I8 i;
|
||||
Ltf *l=LtfNew;
|
||||
if (header) LtfPutSExt(l,header);
|
||||
LtfPutSExt(l,"$$CM+LX,2,4 $$$$BT, \"RENAME \",7$$");
|
||||
LtfPutSExt(l,"$$CM+LX,28,0$$$$BT, \"DELETE \",2$$");
|
||||
LtfPutSExt(l,"$$CM+LX,2,4 $$$$BT, \"PASTE CLIPBOARD FILES\",1$$");
|
||||
LtfPutSExt(l,"$$CM+LX,2,4 $$$$BT, \"CHANGE DISK(MOUNT IT)\",3$$");
|
||||
LtfPutSExt(l,"$$CM+LX,2,4 $$$$BT, \"ADD TEMP DRIVE \",4$$");
|
||||
LtfPutSExt(l,"$$CM+LX,28,0$$$$BT, \"FORMAT \",6$$");
|
||||
LtfPutSExt(l,"$$CM+LX,2,4 $$$$BT, \"MAKE ISO FILE \",8$$");
|
||||
LtfPutSExt(l,"$$CM+LX,28,0$$$$BT, \"BURN ISO FILE \",9$$");
|
||||
LtfPutSExt(l,"$$CM+LX,2,4 $$$$BT, \"HELP \",5$$");
|
||||
LtfPutSExt(l,"$$CM+LX,28,0$$$$BT, \"CANCEL \",0$$");
|
||||
if (footer) LtfPutSExt(l,footer);
|
||||
i=PopUpMenu(l);
|
||||
LtfDel(l);
|
||||
return i;
|
||||
}
|
||||
|
||||
void FMRightClick()
|
||||
{
|
||||
I8 i=PopUpCancelPasteDel;
|
||||
if (i>0) {
|
||||
switch (i) {
|
||||
case 1:
|
||||
Msg(MSG_KEY_DOWN,0,SC_INSERT+SCF_SHIFT);
|
||||
break;
|
||||
case 2:
|
||||
Msg(MSG_KEY_DOWN,0x19,0);
|
||||
break;
|
||||
case 3:
|
||||
Msg(MSG_KEY_DOWN,'m',0);
|
||||
break;
|
||||
case 4:
|
||||
Msg(MSG_KEY_DOWN,'t',0);
|
||||
break;
|
||||
case 5:
|
||||
Msg(MSG_KEY_DOWN,0,SC_GUI);
|
||||
break;
|
||||
case 6:
|
||||
Msg(MSG_KEY_DOWN,'f',0);
|
||||
break;
|
||||
case 7:
|
||||
Msg(MSG_KEY_DOWN,CH_CR,0);
|
||||
break;
|
||||
case 8:
|
||||
Msg(MSG_KEY_DOWN,'M',0);
|
||||
break;
|
||||
case 9:
|
||||
Msg(MSG_KEY_DOWN,'B',0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void FileManager()
|
||||
{
|
||||
LTDirEntry *root=NULL,*tempm,*tempm1,*tempm2;
|
||||
U8 sc,ch,p1,p2,cmd;
|
||||
Ltf *l=NULL,*old_ltf=Fs->cur_ltf;
|
||||
void *old_update=Fs->update_win;
|
||||
BoolU4 old_preempt=Preempt(OFF);
|
||||
I1 *st,*old_cur_dir=NewStr(Fs->cur_dir);
|
||||
LTPartition *old_p=Fs->cur_partition;
|
||||
LtfEntry *cl=NULL,*ll;
|
||||
BoolU4 okay;
|
||||
|
||||
FMRebuildLtf(&l,&root);
|
||||
Fs->update_win=&LtfUpdateBothLtf;
|
||||
do {
|
||||
Preempt(OFF);
|
||||
if (cmd=ScanMsg(&p1,&p2,
|
||||
1<<MSG_KEY_DOWN|1<<MSG_IP_L_DOWN|1<<MSG_IP_L_UP|
|
||||
1<<MSG_IP_R_UP)) {
|
||||
WinSync;
|
||||
switch (cmd) {
|
||||
case MSG_IP_R_UP:
|
||||
FMRightClick;
|
||||
break;
|
||||
case MSG_IP_L_DOWN:
|
||||
cl=l->cur_entry;
|
||||
break;
|
||||
case MSG_IP_L_UP:
|
||||
if (cl) {
|
||||
if (cl->btype==LTFT_MENU_VALUE) {
|
||||
tempm=cl->left_exp;
|
||||
if (SetCursorPosition(Fs,p1/FONT_WIDTH+Fs->win_left,p2/FONT_HEIGHT+Fs->win_top,TRUE)) {
|
||||
ll=l->cur_entry;
|
||||
if (ll->btype==LTFT_TREE) {
|
||||
tempm1=ll->user_data;
|
||||
Silent(ON);
|
||||
Move(tempm->full_name,tempm1->full_name);
|
||||
Silent(OFF);
|
||||
PutKey(CH_SPACE,0); //toggle collapse again
|
||||
FMRebuildLtf(&l,&root);
|
||||
}
|
||||
}
|
||||
} else if (cl->btype==LTFT_TREE) {
|
||||
tempm=cl->user_data;
|
||||
if (SetCursorPosition(Fs,p1/FONT_WIDTH+Fs->win_left,p2/FONT_HEIGHT+Fs->win_top,TRUE)) {
|
||||
ll=l->cur_entry;
|
||||
if (ll->btype==LTFT_TREE) {
|
||||
tempm1=ll->user_data;
|
||||
okay=TRUE;
|
||||
tempm2=tempm1;
|
||||
while (tempm2) {
|
||||
if (tempm2!=tempm)
|
||||
tempm2=tempm2->parent;
|
||||
else {
|
||||
okay=FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (okay) {
|
||||
if (*tempm1->name)
|
||||
st=MSPrintF("%s/%s",tempm1->full_name,tempm->name);
|
||||
else
|
||||
st=MSPrintF("%s%s",tempm1->full_name,tempm->name);
|
||||
if (StrCmp(tempm->full_name,st)) {
|
||||
Silent(ON);
|
||||
CopyTree(tempm->full_name,st);
|
||||
DelTree(tempm->full_name);
|
||||
Silent(OFF);
|
||||
PutKey(CH_SPACE,0); //toggle collapse again
|
||||
FMRebuildLtf(&l,&root);
|
||||
}
|
||||
Free(st);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
cl=NULL;
|
||||
}
|
||||
break;
|
||||
case MSG_KEY_DOWN:
|
||||
ch=p1; sc=p2;
|
||||
if (ch==CH_CR) {
|
||||
FMRename(l);
|
||||
FMRebuildLtf(&l,&root);
|
||||
} else if (ch==0x19 || //ctrl-y
|
||||
(sc.u1[0]==SC_DELETE && !(sc&(SCF_SHIFT|SCF_CTRL)))) {
|
||||
FMDelete(l);
|
||||
FMRebuildLtf(&l,&root);
|
||||
} else if (ch=='m') {
|
||||
FMMount(l);
|
||||
FMRebuildLtf(&l,&root);
|
||||
} else if (ch=='M') {
|
||||
FMMakeISO(l);
|
||||
FMRebuildLtf(&l,&root);
|
||||
} else if (ch=='B') {
|
||||
FMBurnISO(l);
|
||||
FMRebuildLtf(&l,&root);
|
||||
} else if (ch=='t') {
|
||||
FMAddTempDrive;
|
||||
FMRebuildLtf(&l,&root);
|
||||
} else if (ch=='f') {
|
||||
FMFormatDrive(l);
|
||||
FMRebuildLtf(&l,&root);
|
||||
} else if (sc.u1[0]==SC_INSERT && sc&SCF_SHIFT && !(sc&SCF_CTRL)) {
|
||||
FMCopy(l);
|
||||
FMRebuildLtf(&l,&root);
|
||||
} else if (ch!=0x14 && ch!=CH_ESC && ch!=CH_CTRLQ) {//ctrl T not allowed
|
||||
if (ch!=CH_SPACE || l->cur_entry->btype!=LTFT_MENU_VALUE) {
|
||||
Preempt(old_preempt);
|
||||
PutKey(ch,sc);
|
||||
Preempt(OFF);
|
||||
LtfRecalc(Fs->cur_ltf);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
Fs->task_flags|=1<<TSSf_IDLE;
|
||||
WinSync;
|
||||
Fs->task_flags&=~(1<<TSSf_IDLE);
|
||||
}
|
||||
} while (ch!=CH_ESC && ch!=CH_CTRLQ);
|
||||
Fs->cur_ltf=old_ltf;
|
||||
Fs->update_win=old_update;
|
||||
Preempt(old_preempt);
|
||||
LtfDel(l);
|
||||
DelLTDirList(root);
|
||||
Drive(old_p->drive);
|
||||
Cd(old_cur_dir);
|
||||
Free(old_cur_dir);
|
||||
}
|
||||
#help_index ""
|
||||
@@ -0,0 +1,13 @@
|
||||
#help_index "Graphics"
|
||||
|
||||
extern GrBitMap *GrAlias(GrBitMap *base,TssStruct *tss);
|
||||
extern void GrDel(GrBitMap *base);
|
||||
|
||||
#include "GrMath"
|
||||
#include "GrScreen"
|
||||
#include "GrBitMap"
|
||||
#include "GrPlot"
|
||||
#include "GrChar"
|
||||
#include "GrElem"
|
||||
|
||||
#help_index ""
|
||||
File diff suppressed because it is too large.
Load diff
Binary file not shown.
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,569 @@
|
||||
#help_index "Graphics/Math"
|
||||
|
||||
I8 GrXOffsets[8]={-1,0,1,-1,1,-1,0,1},
|
||||
GrYOffsets[8]={-1,-1,-1,0,0,1,1,1};
|
||||
|
||||
public void Line(void *aux_data,
|
||||
I8 x1,I8 y1,I8 z1,
|
||||
I8 x2,I8 y2,I8 z2,
|
||||
void plot_cb(void *aux,I8 x,I8 y,I8 z),
|
||||
I8 step=1,I8 start=0)
|
||||
{
|
||||
I8 i,j,d,dx=x2-x1,dy=y2-y1,dz=z2-z1;
|
||||
I8 adx=AbsI8(dx),ady=AbsI8(dy),adz=AbsI8(dz);
|
||||
|
||||
if (adx>=ady) {
|
||||
if (adx>=adz) {
|
||||
if (d=adx) {
|
||||
if (dx>=0)
|
||||
dx=0x100000000;
|
||||
else
|
||||
dx=-0x100000000;
|
||||
dy=dy<<32/d;
|
||||
dz=dz<<32/d;
|
||||
}
|
||||
} else {
|
||||
if (d=adz) {
|
||||
dx=dx<<32/d;
|
||||
dy=dy<<32/d;
|
||||
if (dz>=0)
|
||||
dz=0x100000000;
|
||||
else
|
||||
dz=-0x100000000;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (ady>=adz) {
|
||||
if (d=ady) {
|
||||
dx=dx<<32/d;
|
||||
if (dy>=0)
|
||||
dy=0x100000000;
|
||||
else
|
||||
dy=-0x100000000;
|
||||
dz=dz<<32/d;
|
||||
}
|
||||
} else {
|
||||
if (d=adz) {
|
||||
dx=dx<<32/d;
|
||||
dy=dy<<32/d;
|
||||
if (dz>=0)
|
||||
dz=0x100000000;
|
||||
else
|
||||
dz=-0x100000000;
|
||||
}
|
||||
}
|
||||
}
|
||||
x1<<=32; y1<<=32; z1<<=32;
|
||||
for (j=0;j<start;j++) {
|
||||
x1+=dx; y1+=dy; z1+=dz;
|
||||
}
|
||||
if (step==1) {
|
||||
for (i=start;i<=d;i++) {
|
||||
plot_cb(aux_data,x1.i4[1],y1.i4[1],z1.i4[1]);
|
||||
x1+=dx; y1+=dy; z1+=dz;
|
||||
}
|
||||
} else {
|
||||
for (i=start;i<=d;i+=step) {
|
||||
plot_cb(aux_data,x1.i4[1],y1.i4[1],z1.i4[1]);
|
||||
for (j=0;j<step;j++) {
|
||||
x1+=dx; y1+=dy; z1+=dz;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Box(void *aux_data,
|
||||
I8 x1,I8 y1,I8 z1,
|
||||
I8 x2,I8 y2,I8 z2,
|
||||
I8 x3,I8 y3,I8 z3,
|
||||
void plot_cb(void *aux,I8 x,I8 y,I8 z))
|
||||
{
|
||||
I8 i,j,
|
||||
d1,dx1=x2-x1,dy1=y2-y1,dz1=z2-z1,
|
||||
d2,dx2=x3-x1,dy2=y3-y1,dz2=z3-z1,
|
||||
adx1=AbsI8(dx1),ady1=AbsI8(dy1),adz1=AbsI8(dz1),
|
||||
adx2=AbsI8(dx2),ady2=AbsI8(dy2),adz2=AbsI8(dz2);
|
||||
|
||||
if (adx1>=ady1)
|
||||
d1=(adx1>=adz1) ? adx1:adz1;
|
||||
else
|
||||
d1=(ady1>=adz1) ? ady1:adz1;
|
||||
d1<<=1;
|
||||
if (d1) {
|
||||
dx1=dx1<<32/d1;
|
||||
dy1=dy1<<32/d1;
|
||||
dz1=dz1<<32/d1;
|
||||
}
|
||||
|
||||
if (adx2>=ady2)
|
||||
d2=(adx2>=adz2) ? adx2:adz2;
|
||||
else
|
||||
d2=(ady2>=adz2) ? ady2:adz2;
|
||||
d2<<=1;
|
||||
if (d2) {
|
||||
dx2=dx2<<32/d2;
|
||||
dy2=dy2<<32/d2;
|
||||
dz2=dz2<<32/d2;
|
||||
}
|
||||
|
||||
x1<<=32; y1<<=32; z1<<=32;
|
||||
for (j=0;j<=d1;j++) {
|
||||
x2=x1; y2=y1; z2=z1;
|
||||
for (i=0;i<=d2;i++) {
|
||||
plot_cb(aux_data,x2.i4[1],y2.i4[1],z2.i4[1]);
|
||||
x2+=dx2; y2+=dy2; z2+=dz2;
|
||||
}
|
||||
x1+=dx1; y1+=dy1; z1+=dz1;
|
||||
}
|
||||
}
|
||||
|
||||
#help_index "Graphics/Math/3D Transformation"
|
||||
I8 gr_scale;
|
||||
gr_scale.u4[0]=0;
|
||||
gr_scale.u4[1]=1;
|
||||
|
||||
void *gr_screen_capture=NULL;
|
||||
public void GrRotate(I8 *r,I8 *x,I8 *y,I8 *z)
|
||||
{
|
||||
I8 x1,y1,z1,xx=*x,yy=*y,zz=*z;
|
||||
x1=(r[0]*xx+r[1]*yy+r[2]*zz+r[3])>>32;
|
||||
y1=(r[4]*xx+r[5]*yy+r[6]*zz+r[7])>>32;
|
||||
z1=(r[8]*xx+r[9]*yy+r[10]*zz+r[11])>>32;
|
||||
*x=x1;*y=y1;*z=z1;
|
||||
}
|
||||
|
||||
public void GrTransform(GrBitMap *base,I8 *x,I8 *y,I8 *z)
|
||||
{
|
||||
GrRotate(base->r,x,y,z);
|
||||
*x+=base->x;
|
||||
*y+=base->y;
|
||||
*z+=base->z;
|
||||
}
|
||||
|
||||
|
||||
public I8 *GrTheta(double theta,TssStruct *tss=NULL)
|
||||
{
|
||||
double my_cos,my_sin;
|
||||
I8 *r=MAllocZ(sizeof(I8)*16,tss);
|
||||
|
||||
my_cos=Cos(theta)*gr_scale;
|
||||
my_sin=Sin(theta)*gr_scale;
|
||||
r[0]=my_cos;
|
||||
r[5]=my_cos;
|
||||
r[4]=my_sin;
|
||||
r[1]=-my_sin;
|
||||
r[10]=gr_scale;
|
||||
return r;
|
||||
}
|
||||
|
||||
public I8 *GrPhi(double phi,TssStruct *tss=NULL)
|
||||
{
|
||||
double my_cos,my_sin;
|
||||
I8 *r=MAllocZ(sizeof(I8)*16,tss);
|
||||
|
||||
my_cos=Cos(phi)*gr_scale;
|
||||
my_sin=Sin(phi)*gr_scale;
|
||||
r[5]=my_cos;
|
||||
r[10]=my_cos;
|
||||
r[9]=my_sin;
|
||||
r[6]=-my_sin;
|
||||
r[0]=gr_scale;
|
||||
return r;
|
||||
}
|
||||
|
||||
public I8 *GrScaleMat(I8 *m1,double s,TssStruct *tss=NULL)
|
||||
{
|
||||
I8 i,*r=MAllocZ(sizeof(I8)*16,tss);
|
||||
for (i=0;i<16;i++)
|
||||
r[i]=m1[i]*s;
|
||||
return r;
|
||||
}
|
||||
|
||||
public I8 *GrMulMat(I8 *m1,I8 *m2,TssStruct *tss=NULL)
|
||||
{
|
||||
I8 *r=MAllocZ(sizeof(I8)*16,tss);
|
||||
I8 i,j,k;
|
||||
double d;
|
||||
for (i=0;i<4;i++) {
|
||||
for (j=0;j<4;j++) {
|
||||
for (k=0;k<4;k++) {
|
||||
d=m1[k+4*j];
|
||||
d*=m2[i+4*k];
|
||||
d/=gr_scale;
|
||||
r[i+4*j]+=d;
|
||||
}
|
||||
}
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
public I8 GrDetMat(I8 *m1)
|
||||
{
|
||||
I8 i;
|
||||
double m[16],d;
|
||||
for (i=0;i<16;i++)
|
||||
m[i]=m1[i]/(1.0*0x100000000);
|
||||
d=m[0]*(m[5]*m[10]-m[6]*m[9])-
|
||||
m[1]*(m[4]*m[10]-m[6]*m[8])+
|
||||
m[2]*(m[4]*m[9]-m[5]*m[8]);
|
||||
return d*0x100000000;
|
||||
}
|
||||
|
||||
public void GrScalePenWidth(GrBitMap *base)
|
||||
{
|
||||
I8 d;
|
||||
if (base->flags&BMF_TRANSFORMATION) {
|
||||
if (base->pen_width) {
|
||||
d=base->pen_width*GrDetMat(base->r)+0x80000000;
|
||||
base->pen_width=d.u4[1];
|
||||
if (base->pen_width<1)
|
||||
base->pen_width=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void GrSetIdent(I8 *r)
|
||||
{
|
||||
MemSet(r,0,16<<3);
|
||||
r[0].u4[1]=1;
|
||||
r[5].u4[1]=1;
|
||||
r[10].u4[1]=1;
|
||||
r[15].u4[1]=1;
|
||||
}
|
||||
|
||||
public void GrSetTranslation(I8 *r,I8 x,I8 y,I8 z)
|
||||
{
|
||||
r[3]=x<<32;
|
||||
r[7]=y<<32;
|
||||
r[11]=z<<32;
|
||||
}
|
||||
|
||||
#help_index "Graphics/Math"
|
||||
public void Circle(void *aux_data,
|
||||
I8 cx,I8 cy,I8 cz,
|
||||
I8 radius,
|
||||
void plot_cb(void *aux,I8 x,I8 y,I8 z),
|
||||
I8 step=1,
|
||||
double start_rad=0,
|
||||
double len_rad=pi2)
|
||||
{
|
||||
I8 i,j,len=len_rad*radius;
|
||||
I8 x,y,x1,y1,s1,s2,c;
|
||||
double t;
|
||||
if (radius<0) return;
|
||||
if (!radius) {
|
||||
plot_cb(aux_data,cx,cy,cz);
|
||||
return;
|
||||
}
|
||||
t=1.0/radius;
|
||||
s1=(1<<24)*Sin(t);
|
||||
s2=-s1;
|
||||
c=(1<<24)*Cos(t);
|
||||
if (start_rad) {
|
||||
x=radius*Cos(start_rad);
|
||||
y=-radius*Sin(start_rad);
|
||||
} else {
|
||||
x=radius;
|
||||
y=0;
|
||||
}
|
||||
x<<=8;
|
||||
y<<=8;
|
||||
for (i=0;i<=len;i+=step) {
|
||||
plot_cb(aux_data,cx+x>>8,cy+y>>8,cz);
|
||||
for (j=0;j<step;j++) {
|
||||
x1=(c*x+s1*y)>>24;
|
||||
y1=(s2*x+c*y)>>24;
|
||||
x=x1; y=y1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Ellipse(void *aux_data,
|
||||
I8 cx,I8 cy,I8 cz,
|
||||
I8 x_radius,I8 y_radius,
|
||||
void plot_cb(void *aux,I8 x,I8 y,I8 z),
|
||||
double rot_angle=0,
|
||||
I8 step=1,
|
||||
double start_rad=0,
|
||||
double len_rad=pi2)
|
||||
{
|
||||
I8 i,j,len;
|
||||
I8 x,y,x1,y1,x2,y2, s1,s2,c, s12,s22,c2;
|
||||
double t;
|
||||
if (x_radius<0 || y_radius<0 || step<1)
|
||||
return;
|
||||
if (!x_radius && !y_radius) {
|
||||
plot_cb(aux_data,cx,cy,cz);
|
||||
return;
|
||||
}
|
||||
if (x_radius>=y_radius) {
|
||||
t=1.0/x_radius;
|
||||
len=len_rad*x_radius;
|
||||
} else {
|
||||
t=1.0/y_radius;
|
||||
len=len_rad*y_radius;
|
||||
}
|
||||
|
||||
s1=(1<<24)*Sin(t);
|
||||
s2=-s1;
|
||||
c=(1<<24)*Cos(t);
|
||||
|
||||
s12=(1<<24)*Sin(rot_angle);
|
||||
s22=-s12;
|
||||
c2=(1<<24)*Cos(rot_angle);
|
||||
|
||||
if (start_rad) {
|
||||
x=x_radius*Cos(start_rad);
|
||||
y=-x_radius*Sin(start_rad);
|
||||
} else {
|
||||
x=x_radius;
|
||||
y=0;
|
||||
}
|
||||
x<<=8;
|
||||
y<<=8;
|
||||
x2=x;
|
||||
y2=y;
|
||||
|
||||
y1=y2*y_radius/x_radius;
|
||||
x=(c2*x2+s12*y1)>>24;
|
||||
y=(s22*x2+c2*y1)>>24;
|
||||
|
||||
for (i=0;i<=len;i+=step) {
|
||||
plot_cb(aux_data,cx+x>>8,cy+y>>8,cz);
|
||||
for (j=0;j<step;j++) {
|
||||
x1=(c*x2+s1*y2)>>24;
|
||||
y1=(s2*x2+c*y2)>>24;
|
||||
x2=x1;
|
||||
y2=y1;
|
||||
y1=y1*y_radius/x_radius;
|
||||
x=(c2*x1+s12*y1)>>24;
|
||||
y=(s22*x1+c2*y1)>>24;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public I8 DistP3I4(P3I4 *p1,P3I4 *p2)
|
||||
{
|
||||
return Sqrt(SqrI8(p1->x-p2->x)+SqrI8(p1->y-p2->y)+SqrI8(p1->z-p2->z));
|
||||
}
|
||||
|
||||
public void Bezier2(void *aux_data,P3I4 *ctrl,void plot_cb(void *aux,I8 x,I8 y,I8 z))
|
||||
{//2nd order
|
||||
I8 x,y,z,xx,yy,zz,dx,dy,dz,d_max;
|
||||
double x0=ctrl[0].x,y0=ctrl[0].y,z0=ctrl[0].z;
|
||||
double x1=ctrl[1].x-x0,y1=ctrl[1].y-y0,z1=ctrl[1].z-z0;
|
||||
double x2=ctrl[2].x-x0,y2=ctrl[2].y-y0,z2=ctrl[2].z-z0;
|
||||
double t,d=DistP3I4(&ctrl[0],&ctrl[1])+
|
||||
DistP3I4(&ctrl[1],&ctrl[2])+
|
||||
DistP3I4(&ctrl[2],&ctrl[0]),
|
||||
s=0.5/d,t1,t2;
|
||||
xx=x0; yy=y0; zz=z0;
|
||||
for (t=0.0;t<=1.0;t+=s) {
|
||||
t1=t*(1.0-t);
|
||||
t2=t*t;
|
||||
x=x0+x1*t1+x2*t2;
|
||||
y=y0+y1*t1+y2*t2;
|
||||
z=z0+z1*t1+z2*t2;
|
||||
dx=AbsI8(x-xx);
|
||||
dy=AbsI8(y-yy);
|
||||
dz=AbsI8(z-zz);
|
||||
if (dx>dy)
|
||||
d_max=dx;
|
||||
else
|
||||
d_max=dy;
|
||||
if (dz>d_max)
|
||||
d_max=dz;
|
||||
if (!d_max)
|
||||
s*=1.1;
|
||||
else {
|
||||
s*=0.9;
|
||||
plot_cb(aux_data,x,y,z);
|
||||
xx=x;yy=y;zz=z;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Bezier3(void *aux_data,P3I4 *ctrl,void plot_cb(void *aux,I8 x,I8 y,I8 z))
|
||||
{ //3rd order
|
||||
I8 x,y,z,xx,yy,zz,dx,dy,dz,d_max;
|
||||
double x0=ctrl[0].x,y0=ctrl[0].y,z0=ctrl[0].z;
|
||||
double x1=ctrl[1].x-x0,y1=ctrl[1].y-y0,z1=ctrl[1].z-z0;
|
||||
double x2=ctrl[2].x-x0,y2=ctrl[2].y-y0,z2=ctrl[2].z-z0;
|
||||
double x3=ctrl[3].x-x0,y3=ctrl[3].y-y0,z3=ctrl[3].z-z0;
|
||||
double t,d=DistP3I4(&ctrl[0],&ctrl[1])+
|
||||
DistP3I4(&ctrl[1],&ctrl[2])+
|
||||
DistP3I4(&ctrl[2],&ctrl[3])+
|
||||
DistP3I4(&ctrl[3],&ctrl[0]),
|
||||
s=0.5/d,nt,t1,t2,t3;
|
||||
xx=x0; yy=y0; zz=z0;
|
||||
for (t=0.0;t<=1.0;t+=s) {
|
||||
nt=1.0-t;
|
||||
t1=t*nt*nt;
|
||||
t2=t*t*nt;
|
||||
t3=t*t*t;
|
||||
x=x0+x1*t1+x2*t2+x3*t3;
|
||||
y=y0+y1*t1+y2*t2+y3*t3;
|
||||
z=z0+z1*t1+z2*t2+z3*t3;
|
||||
dx=AbsI8(x-xx);
|
||||
dy=AbsI8(y-yy);
|
||||
dz=AbsI8(z-zz);
|
||||
if (dx>dy)
|
||||
d_max=dx;
|
||||
else
|
||||
d_max=dy;
|
||||
if (dz>d_max)
|
||||
d_max=dz;
|
||||
if (!d_max)
|
||||
s*=1.1;
|
||||
else {
|
||||
s*=0.9;
|
||||
plot_cb(aux_data,x,y,z);
|
||||
xx=x;yy=y;zz=z;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void BSpline2(void *aux_data,P3I4 *ctrl,I8 cnt,void plot_cb(void *aux,I8 x,I8 y,I8 z),BoolU4 closed=FALSE)
|
||||
{ //2nd order
|
||||
I8 i,j;
|
||||
P3I4 *c;
|
||||
if (cnt<3) return;
|
||||
if (closed) {
|
||||
cnt++;
|
||||
c=MAlloc(sizeof(P3I4)*(cnt*2-1));
|
||||
j=1;
|
||||
for (i=0;i<cnt-2;i++) {
|
||||
c[j].x=(ctrl[i].x+ctrl[i+1].x)/2.0;
|
||||
c[j].y=(ctrl[i].y+ctrl[i+1].y)/2.0;
|
||||
c[j].z=(ctrl[i].z+ctrl[i+1].z)/2.0;
|
||||
j+=2;
|
||||
}
|
||||
c[j].x=(ctrl[0].x+ctrl[cnt-2].x)/2.0;
|
||||
c[j].y=(ctrl[0].y+ctrl[cnt-2].y)/2.0;
|
||||
c[j].z=(ctrl[0].z+ctrl[cnt-2].z)/2.0;
|
||||
|
||||
c[0].x=(c[1].x+c[j].x)/2.0;
|
||||
c[0].y=(c[1].y+c[j].y)/2.0;
|
||||
c[0].z=(c[1].z+c[j].z)/2.0;
|
||||
j=2;
|
||||
for (i=0;i<cnt-2;i++) {
|
||||
c[j].x=(c[j-1].x+c[j+1].x)/2.0;
|
||||
c[j].y=(c[j-1].y+c[j+1].y)/2.0;
|
||||
c[j].z=(c[j-1].z+c[j+1].z)/2.0;
|
||||
j+=2;
|
||||
}
|
||||
c[j].x=c[0].x;
|
||||
c[j].y=c[0].y;
|
||||
c[j].z=c[0].z;
|
||||
} else {
|
||||
c=MAlloc(sizeof(P3I4)*(cnt*2-1));
|
||||
c[0].x=ctrl[0].x;
|
||||
c[0].y=ctrl[0].y;
|
||||
c[0].z=ctrl[0].z;
|
||||
c[cnt*2-2].x=ctrl[cnt-1].x;
|
||||
c[cnt*2-2].y=ctrl[cnt-1].y;
|
||||
c[cnt*2-2].z=ctrl[cnt-1].z;
|
||||
j=1;
|
||||
for (i=0;i<cnt-1;i++) {
|
||||
c[j].x=(ctrl[i].x+ctrl[i+1].x)/2.0;
|
||||
c[j].y=(ctrl[i].y+ctrl[i+1].y)/2.0;
|
||||
c[j].z=(ctrl[i].z+ctrl[i+1].z)/2.0;
|
||||
j+=2;
|
||||
}
|
||||
j=2;
|
||||
for (i=0;i<cnt-2;i++) {
|
||||
c[j].x=(c[j-1].x+c[j+1].x)/2.0;
|
||||
c[j].y=(c[j-1].y+c[j+1].y)/2.0;
|
||||
c[j].z=(c[j-1].z+c[j+1].z)/2.0;
|
||||
j+=2;
|
||||
}
|
||||
}
|
||||
for (i=0;i<cnt*2-2;i+=2)
|
||||
Bezier2(aux_data,&c[i],plot_cb);
|
||||
Free(c);
|
||||
}
|
||||
|
||||
public void BSpline3(void *aux_data,P3I4 *ctrl,I8 cnt,void plot_cb(void *aux,I8 x,I8 y,I8 z),BoolU4 closed=FALSE)
|
||||
{ //3rd order
|
||||
I8 i,j;
|
||||
double x,y,z;
|
||||
P3I4 *c;
|
||||
if (cnt<3) return;
|
||||
if (closed) {
|
||||
cnt++;
|
||||
c=MAlloc(sizeof(P3I4)*(cnt*3-2));
|
||||
j=1;
|
||||
for (i=0;i<cnt-2;i++) {
|
||||
x=ctrl[i].x;
|
||||
y=ctrl[i].y;
|
||||
z=ctrl[i].z;
|
||||
c[j].x=(ctrl[i+1].x-x)/3.0+x;
|
||||
c[j].y=(ctrl[i+1].y-y)/3.0+y;
|
||||
c[j].z=(ctrl[i+1].z-z)/3.0+z;
|
||||
j++;
|
||||
c[j].x=2.0*(ctrl[i+1].x-x)/3.0+x;
|
||||
c[j].y=2.0*(ctrl[i+1].y-y)/3.0+y;
|
||||
c[j].z=2.0*(ctrl[i+1].z-z)/3.0+z;
|
||||
j+=2;
|
||||
}
|
||||
x=ctrl[cnt-2].x;
|
||||
y=ctrl[cnt-2].y;
|
||||
z=ctrl[cnt-2].z;
|
||||
c[j].x=(ctrl[0].x-x)/3.0+x;
|
||||
c[j].y=(ctrl[0].y-y)/3.0+y;
|
||||
c[j].z=(ctrl[0].z-z)/3.0+z;
|
||||
j++;
|
||||
c[j].x=2.0*(ctrl[0].x-x)/3.0+x;
|
||||
c[j].y=2.0*(ctrl[0].y-y)/3.0+y;
|
||||
c[j].z=2.0*(ctrl[0].z-z)/3.0+z;
|
||||
|
||||
c[0].x=(c[1].x+c[j].x)/2.0;
|
||||
c[0].y=(c[1].y+c[j].y)/2.0;
|
||||
c[0].z=(c[1].z+c[j].z)/2.0;
|
||||
|
||||
j=3;
|
||||
for (i=0;i<cnt-2;i++) {
|
||||
c[j].x=(c[j-1].x+c[j+1].x)/2.0;
|
||||
c[j].y=(c[j-1].y+c[j+1].y)/2.0;
|
||||
c[j].z=(c[j-1].z+c[j+1].z)/2.0;
|
||||
j+=3;
|
||||
}
|
||||
c[j].x=c[0].x;
|
||||
c[j].y=c[0].y;
|
||||
c[j].z=c[0].z;
|
||||
} else {
|
||||
c=MAlloc(sizeof(P3I4)*(cnt*3-2));
|
||||
c[0].x=ctrl[0].x;
|
||||
c[0].y=ctrl[0].y;
|
||||
c[0].z=ctrl[0].z;
|
||||
c[cnt*3-3].x=ctrl[cnt-1].x;
|
||||
c[cnt*3-3].y=ctrl[cnt-1].y;
|
||||
c[cnt*3-3].z=ctrl[cnt-1].z;
|
||||
j=1;
|
||||
for (i=0;i<cnt-1;i++) {
|
||||
x=ctrl[i].x;
|
||||
y=ctrl[i].y;
|
||||
z=ctrl[i].z;
|
||||
c[j].x=(ctrl[i+1].x-x)/3.0+x;
|
||||
c[j].y=(ctrl[i+1].y-y)/3.0+y;
|
||||
c[j].z=(ctrl[i+1].z-z)/3.0+z;
|
||||
j++;
|
||||
c[j].x=2.0*(ctrl[i+1].x-x)/3.0+x;
|
||||
c[j].y=2.0*(ctrl[i+1].y-y)/3.0+y;
|
||||
c[j].z=2.0*(ctrl[i+1].z-z)/3.0+z;
|
||||
j+=2;
|
||||
}
|
||||
j=3;
|
||||
for (i=0;i<cnt-2;i++) {
|
||||
c[j].x=(c[j-1].x+c[j+1].x)/2.0;
|
||||
c[j].y=(c[j-1].y+c[j+1].y)/2.0;
|
||||
c[j].z=(c[j-1].z+c[j+1].z)/2.0;
|
||||
j+=3;
|
||||
}
|
||||
}
|
||||
for (i=0;i<cnt*3-3;i+=3)
|
||||
Bezier3(aux_data,&c[i],plot_cb);
|
||||
Free(c);
|
||||
}
|
||||
|
||||
#help_index "Graphics"
|
||||
@@ -0,0 +1,728 @@
|
||||
public void GrPlot(GrBitMap *base,I8 x,I8 y)
|
||||
{ //Clipping but No transformation or pen width
|
||||
BoolU4 draw=TRUE;
|
||||
if (base->brush) {
|
||||
GrBlot(base,x,y,base->brush);
|
||||
return;
|
||||
}
|
||||
if (base->flags & BMF_SCREEN_BITMAP) {
|
||||
if (x<0) draw=FALSE;
|
||||
x+=base->win_tss->win_pixel_left;
|
||||
if (x>base->win_tss->win_pixel_right) draw=FALSE;
|
||||
|
||||
if (y<0) draw=FALSE;
|
||||
y+=base->win_tss->win_pixel_top;
|
||||
if (y>base->win_tss->win_pixel_bottom) draw=FALSE;
|
||||
if (x>=base->width) draw=FALSE;
|
||||
if (y>=base->height) draw=FALSE;
|
||||
if (IsPixelCovered(base->win_tss,x,y)) draw=FALSE;
|
||||
} else {
|
||||
if (x<0) draw=FALSE;
|
||||
if (x>=base->width) draw=FALSE;
|
||||
if (y<0) draw=FALSE;
|
||||
if (y>=base->height) draw=FALSE;
|
||||
}
|
||||
if (draw)
|
||||
GrPlot0(base,x,y);
|
||||
}
|
||||
|
||||
public I8 GrPeek(GrBitMap *base,I8 x,I8 y)
|
||||
{ //Clipping but No transformation
|
||||
BoolU4 peek=TRUE;
|
||||
if (base->flags & BMF_SCREEN_BITMAP) {
|
||||
if (x<0) peek=FALSE;
|
||||
x+=base->win_tss->win_pixel_left;
|
||||
if (x>base->win_tss->win_pixel_right) peek=FALSE;
|
||||
|
||||
if (y<0) peek=FALSE;
|
||||
y+=base->win_tss->win_pixel_top;
|
||||
if (y>base->win_tss->win_pixel_bottom) peek=FALSE;
|
||||
if (x>=base->width) peek=FALSE;
|
||||
if (y>=base->height) peek=FALSE;
|
||||
if (IsPixelCovered(base->win_tss,x,y)) peek=FALSE;
|
||||
} else {
|
||||
if (x<0) peek=FALSE;
|
||||
if (x>=base->width) peek=FALSE;
|
||||
if (y<0) peek=FALSE;
|
||||
if (y>=base->height) peek=FALSE;
|
||||
}
|
||||
if (peek)
|
||||
return GrPeek0(base,x,y);
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
#define CC_LEFT 1
|
||||
#define CC_RIGHT 2
|
||||
#define CC_TOP 4
|
||||
#define CC_BOTTOM 8
|
||||
|
||||
U8 ClipCode(I8 x,I8 y,I8 right,I8 bottom)
|
||||
{
|
||||
U8 result;
|
||||
if (y>bottom)
|
||||
result=CC_BOTTOM;
|
||||
else if (y<0)
|
||||
result=CC_TOP;
|
||||
else
|
||||
result=0;
|
||||
if (x>right)
|
||||
result|=CC_RIGHT;
|
||||
else if (x<0)
|
||||
result|=CC_LEFT;
|
||||
return result;
|
||||
}
|
||||
|
||||
public BoolU8 ClipLine(GrBitMap *base,I8 *x1,I8 *y1,I8 *x2,I8 *y2)
|
||||
{
|
||||
I8 x,y,right,bottom;
|
||||
U8 cc,cc1,cc2;
|
||||
if (base->flags & BMF_SCREEN_BITMAP) {
|
||||
right=base->win_tss->win_pixel_right-base->win_tss->win_pixel_left-1;
|
||||
if (base->width-1<right)
|
||||
right=base->width-1;
|
||||
bottom=base->win_tss->win_pixel_bottom-base->win_tss->win_pixel_top-1;
|
||||
if (base->height-1<bottom)
|
||||
bottom=base->height-1;
|
||||
} else {
|
||||
right=base->width-1;
|
||||
bottom=base->height-1;
|
||||
}
|
||||
cc1=ClipCode(*x1,*y1,right,bottom);
|
||||
cc2=ClipCode(*x2,*y2,right,bottom);
|
||||
do {
|
||||
if (!(cc1|cc2))
|
||||
return TRUE;
|
||||
if (cc1&cc2)
|
||||
return FALSE;
|
||||
|
||||
if (cc1)
|
||||
cc=cc1;
|
||||
else
|
||||
cc=cc2;
|
||||
|
||||
if (cc&CC_BOTTOM) {
|
||||
x=*x1+(*x2-*x1)*(bottom-*y1)/(*y2-*y1);
|
||||
y=bottom;
|
||||
} else if (cc&CC_TOP) {
|
||||
x=*x1+(*x2-*x1)*(-*y1)/(*y2-*y1);
|
||||
y=0;
|
||||
} else if (cc&CC_RIGHT) {
|
||||
y=*y1+(*y2-*y1)*(right-*x1)/(*x2-*x1);
|
||||
x=right;
|
||||
} else {
|
||||
y=*y1+(*y2-*y1)*(-*x1)/(*x2-*x1);
|
||||
x=0;
|
||||
}
|
||||
|
||||
if (cc==cc1) {
|
||||
*x1=x;
|
||||
*y1=y;
|
||||
cc1=ClipCode(*x1,*y1,right,bottom);
|
||||
} else {
|
||||
*x2=x;
|
||||
*y2=y;
|
||||
cc2=ClipCode(*x2,*y2,right,bottom);
|
||||
}
|
||||
} while (TRUE);
|
||||
}
|
||||
|
||||
I8 GrFloodFillRay(GrBitMap *base,I8 x,I8 y)
|
||||
{
|
||||
I8 cnt,j,x1,ray_len,ray_len2;
|
||||
|
||||
cnt=ray_len=GrRayLen(base,&x,y);
|
||||
|
||||
y--;
|
||||
j=ray_len;
|
||||
x1=x;
|
||||
while (j>0) {
|
||||
if (ray_len2=GrRayLenMinus(base,x1,y))
|
||||
cnt+=GrFloodFillRay(base,x1,y);
|
||||
j-=ray_len2+1;
|
||||
x1-=ray_len2+1;
|
||||
}
|
||||
|
||||
y+=2;
|
||||
j=ray_len;
|
||||
x1=x;
|
||||
while (j>0) {
|
||||
if (ray_len2=GrRayLenMinus(base,x1,y))
|
||||
cnt+=GrFloodFillRay(base,x1,y);
|
||||
j-=ray_len2+1;
|
||||
x1-=ray_len2+1;
|
||||
}
|
||||
return cnt;
|
||||
}
|
||||
|
||||
|
||||
public I8 GrFloodFill(GrBitMap *base,I8 x,I8 y,BoolU4 not_color=TRUE)
|
||||
{
|
||||
I8 cnt=0,j,c,old_color2=base->color2,old_flags=base->flags;
|
||||
GrBitMap *old_brush;
|
||||
if (base->flags & BMF_DONT_DRAW) //TODO
|
||||
return 0;
|
||||
old_brush=base->brush;
|
||||
base->brush=NULL;
|
||||
j=GrPeek(base,x,y);
|
||||
if (j>=0) {
|
||||
switch (base->type) {
|
||||
case BMT_COLOR4:
|
||||
if (not_color) {
|
||||
base->color2=base->color&0xFFFFFF;
|
||||
base->flags|=BMF_FILL_NOT_COLOR;
|
||||
} else {
|
||||
base->color2=j;
|
||||
if (base->color2==base->color&0xFFFFFF)
|
||||
break;
|
||||
base->flags&=~BMF_FILL_NOT_COLOR;
|
||||
}
|
||||
if (not_color && j!=base->color2 ||
|
||||
!not_color)
|
||||
cnt=GrFloodFillRay(base,x,y);
|
||||
break;
|
||||
case BMT_MONO:
|
||||
c=(base->color&0xFFFFFF)?1:0;
|
||||
if (not_color) {
|
||||
base->color2=c;
|
||||
base->flags|=BMF_FILL_NOT_COLOR;
|
||||
} else {
|
||||
base->color2=(j)?1:0;
|
||||
if (base->color2==c)
|
||||
break;
|
||||
base->flags&=~BMF_FILL_NOT_COLOR;
|
||||
}
|
||||
if (not_color && j!=c ||
|
||||
!not_color)
|
||||
cnt=GrFloodFillRay(base,x,y);
|
||||
break;
|
||||
}
|
||||
}
|
||||
base->brush=old_brush;
|
||||
base->flags=old_flags;
|
||||
base->color2=old_color2;
|
||||
return cnt;
|
||||
}
|
||||
|
||||
public void GrPlot2(GrBitMap *base,I8 x,I8 y,I8 z)
|
||||
{ //Clipping and transformation but no pen_width
|
||||
if (base->flags & BMF_TRANSFORMATION) {
|
||||
GrRotate(base->r,&x,&y,&z);
|
||||
x+=base->x;
|
||||
y+=base->y;
|
||||
z+=base->z;
|
||||
}
|
||||
GrPlot(base,x,y);
|
||||
}
|
||||
|
||||
public void GrPlot3(GrBitMap *base,I8 x,I8 y,I8 z)
|
||||
{ //clipping and transformation and pen width
|
||||
|
||||
I8 i,j,w,old_color,dist;
|
||||
if (base->flags & BMF_TRANSFORMATION) {
|
||||
GrRotate(base->r,&x,&y,&z);
|
||||
x+=base->x;
|
||||
y+=base->y;
|
||||
z+=base->z;
|
||||
}
|
||||
w=base->pen_width>>1;
|
||||
if (w<=0)
|
||||
GrPlot(base,x,y);
|
||||
else if (base->pen_width<GR_NUM_PEN_BRUSHES) {
|
||||
old_color=base->color;
|
||||
if (base->color.u1[3]==ROPB_EQU)
|
||||
base->color.u1[3]=ROPB_TRANSPARENT;
|
||||
if (GrBlot(base,x-w,y-w,gr_pen_brushes[base->pen_width])) {
|
||||
if (base->flags & BMF_SCREEN_BITMAP) {
|
||||
x+=base->win_tss->win_pixel_left;
|
||||
y+=base->win_tss->win_pixel_top;
|
||||
}
|
||||
if (base->flags & BMF_LOCATE_NEAREST) {
|
||||
dist=DistI8(x,y,base->cur_x,base->cur_y);
|
||||
if (dist<base->nearest_dist) {
|
||||
base->nearest_sub_grelem=base->cur_sub_grelem;
|
||||
base->nearest_dist=dist;
|
||||
}
|
||||
}
|
||||
}
|
||||
base->color=old_color;
|
||||
} else if (base->pen_width & 1) {
|
||||
for (i=-w;i<=w;i++)
|
||||
for (j=-w;j<=w;j++)
|
||||
GrPlot(base,x+i,y+j);
|
||||
} else {
|
||||
for (i=-w;i<w;i++)
|
||||
for (j=-w;j<w;j++)
|
||||
GrPlot(base,x+i,y+j);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void GrPlot4(GrBitMap *base,I8 x,I8 y)
|
||||
{ //Plot with base->brush
|
||||
BoolU4 draw=TRUE;
|
||||
|
||||
if (x<0) draw=FALSE;
|
||||
x+=base->win_tss->win_pixel_left;
|
||||
if (x>base->win_tss->win_pixel_right) draw=FALSE;
|
||||
|
||||
if (y<0) draw=FALSE;
|
||||
y+=base->win_tss->win_pixel_top;
|
||||
if (y>base->win_tss->win_pixel_bottom) draw=FALSE;
|
||||
|
||||
if (x>=base->width) draw=FALSE;
|
||||
if (y>=base->height) draw=FALSE;
|
||||
|
||||
if (draw) {
|
||||
if (base->brush)
|
||||
GrBlot(base,x,y,base->brush);
|
||||
else
|
||||
GrPlot0(base,x,y);
|
||||
}
|
||||
}
|
||||
|
||||
void GrLinePlot(GrBitMap *base,I8 x,I8 y,I8 z)
|
||||
{
|
||||
nounusedwarn z;
|
||||
GrPlot(base,x,y);
|
||||
}
|
||||
|
||||
public void GrLine(GrBitMap *base,I8 x1,I8 y1,I8 x2,I8 y2,I8 step=1,I8 start=0)
|
||||
{
|
||||
if (ClipLine(base,&x1,&y1,&x2,&y2))
|
||||
Line(base,x1,y1,0,x2,y2,0,&GrLinePlot,step,start);
|
||||
}
|
||||
|
||||
public void GrCircle(GrBitMap *base,I8 cx,I8 cy,I8 radius,
|
||||
I8 step=1,double start_rad=0,double len_rad=pi2)
|
||||
{
|
||||
Circle(base,cx,cy,0,radius,&GrLinePlot,step,start_rad,len_rad);
|
||||
}
|
||||
|
||||
public void GrEllipse(GrBitMap *base,
|
||||
I8 cx,I8 cy,
|
||||
I8 x_radius,I8 y_radius,
|
||||
double rot_angle=0,
|
||||
I8 step=1,
|
||||
double start_rad=0,
|
||||
double len_rad=pi2)
|
||||
{
|
||||
Ellipse(base,cx,cy,0,x_radius,y_radius,&GrLinePlot,rot_angle,step,start_rad,len_rad);
|
||||
}
|
||||
|
||||
public void Gr2Bezier(GrBitMap *base,P3I4 *ctrl)
|
||||
{
|
||||
Bezier2(base,ctrl,&GrLinePlot);
|
||||
}
|
||||
|
||||
public void Gr3Bezier(GrBitMap *base,P3I4 *ctrl)
|
||||
{
|
||||
Bezier3(base,ctrl,&GrLinePlot);
|
||||
}
|
||||
|
||||
public void Gr2BSpline(GrBitMap *base,P3I4 *ctrl,I8 cnt,BoolU4 closed=FALSE)
|
||||
{
|
||||
BSpline2(base,ctrl,cnt,&GrLinePlot,closed);
|
||||
}
|
||||
|
||||
public void Gr3BSpline(GrBitMap *base,P3I4 *ctrl,I8 cnt,BoolU4 closed=FALSE)
|
||||
{
|
||||
BSpline3(base,ctrl,cnt,&GrLinePlot,closed);
|
||||
}
|
||||
|
||||
public void GrLine2(GrBitMap *base,I8 x1,I8 y1,I8 z1,I8 x2,I8 y2,I8 z2,I8 step=1,I8 start=0)
|
||||
{ //transformation but not pen width
|
||||
if (base->flags & BMF_TRANSFORMATION) {
|
||||
GrRotate(base->r,&x1,&y1,&z1);
|
||||
x1+=base->x;
|
||||
y1+=base->y;
|
||||
z1+=base->z;
|
||||
GrRotate(base->r,&x2,&y2,&z2);
|
||||
x2+=base->x;
|
||||
y2+=base->y;
|
||||
z2+=base->z;
|
||||
}
|
||||
if (ClipLine(base,&x1,&y1,&x2,&y2))
|
||||
Line(base,x1,y1,0,x2,y2,0,&GrLinePlot,step,start);
|
||||
}
|
||||
|
||||
void GrLine3Plot(GrBitMap *base,I8 x,I8 y,I8 z)
|
||||
{
|
||||
GrPlot3(base,x,y,z);
|
||||
}
|
||||
|
||||
public void GrLine3(GrBitMap *base,I8 x1,I8 y1,I8 z1,I8 x2,I8 y2,I8 z2,I8 step=1,I8 start=0)
|
||||
{ //transformation with pen width
|
||||
U8 old_flags=base->flags;
|
||||
|
||||
if (base->flags & BMF_TRANSFORMATION) {
|
||||
GrRotate(base->r,&x1,&y1,&z1);
|
||||
x1+=base->x;
|
||||
y1+=base->y;
|
||||
z1+=base->z;
|
||||
GrRotate(base->r,&x2,&y2,&z2);
|
||||
x2+=base->x;
|
||||
y2+=base->y;
|
||||
z2+=base->z;
|
||||
}
|
||||
if (ClipLine(base,&x1,&y1,&x2,&y2)) {
|
||||
base->flags&=~BMF_TRANSFORMATION;
|
||||
Line(base,x1,y1,0,x2,y2,0,&GrLine3Plot,step,start);
|
||||
base->flags=old_flags;
|
||||
}
|
||||
}
|
||||
|
||||
public void GrText3(GrBitMap *base,I8 x1,I8 y1,I8 z1,I1 *s)
|
||||
{ //transformation
|
||||
if (base->flags & BMF_TRANSFORMATION) {
|
||||
GrRotate(base->r,&x1,&y1,&z1);
|
||||
x1+=base->x;
|
||||
y1+=base->y;
|
||||
z1+=base->z;
|
||||
}
|
||||
GrText(base,x1,y1,s);
|
||||
}
|
||||
|
||||
public void GrCircle3(GrBitMap *base,I8 cx,I8 cy,I8 cz,I8 radius,
|
||||
I8 step=1,double start_rad=0,double len_rad=pi2)
|
||||
{ //transformation with pen width
|
||||
I8 x,y,z;
|
||||
double m1,a1,m2;
|
||||
if (base->flags & BMF_TRANSFORMATION) {
|
||||
base->flags&=~BMF_TRANSFORMATION;
|
||||
GrRotate(base->r,&cx,&cy,&cz);
|
||||
cx+=base->x;
|
||||
cy+=base->y;
|
||||
cz+=base->z;
|
||||
|
||||
radius<<=24;
|
||||
|
||||
x=radius; y=0; z=0;
|
||||
GrRotate(base->r,&x,&y,&z);
|
||||
R2P(&m1,&a1,x,y);
|
||||
|
||||
x=0; y=radius; z=0;
|
||||
GrRotate(base->r,&x,&y,&z);
|
||||
m2=Sqrt(x*x+y*y);
|
||||
|
||||
Ellipse(base,cx,cy,cz,
|
||||
m1/0x1000000,m2/0x1000000,
|
||||
&GrLine3Plot,-a1,step,start_rad,len_rad);
|
||||
base->flags|=BMF_TRANSFORMATION;
|
||||
} else
|
||||
Circle(base,cx,cy,cz,radius,&GrLine3Plot,step,start_rad,len_rad);
|
||||
}
|
||||
|
||||
|
||||
public void GrEllipse3(GrBitMap *base,
|
||||
I8 cx,I8 cy,I8 cz,
|
||||
I8 x_radius,I8 y_radius,
|
||||
double rot_angle=0,
|
||||
I8 step=1,
|
||||
double start_rad=0,
|
||||
double len_rad=pi2)
|
||||
{
|
||||
I8 x,y,z;
|
||||
double m1,a1,m2,a2,s,c;
|
||||
if (base->flags & BMF_TRANSFORMATION) {
|
||||
base->flags&=~BMF_TRANSFORMATION;
|
||||
GrRotate(base->r,&cx,&cy,&cz);
|
||||
cx+=base->x;
|
||||
cy+=base->y;
|
||||
cz+=base->z;
|
||||
|
||||
c=Cos(rot_angle);
|
||||
s=Sin(rot_angle);
|
||||
|
||||
x_radius<<=24;
|
||||
y_radius<<=24;
|
||||
|
||||
x=x_radius*c;
|
||||
y=x_radius*s;
|
||||
z=0;
|
||||
GrRotate(base->r,&x,&y,&z);
|
||||
R2P(&m1,&a1,x,y);
|
||||
|
||||
x=-y_radius*s;
|
||||
y=y_radius*c;
|
||||
z=0;
|
||||
GrRotate(base->r,&x,&y,&z);
|
||||
R2P(&m2,&a2,x,y);
|
||||
m2=m2*Abs(Sin(a2-a1));
|
||||
|
||||
Ellipse(base,cx,cy,cz,
|
||||
m1/0x1000000,m2/0x1000000,&GrLine3Plot,-a1,step,start_rad,len_rad);
|
||||
base->flags|=BMF_TRANSFORMATION;
|
||||
} else
|
||||
Ellipse(base,cx,cy,cz,x_radius,y_radius,&GrLine3Plot,rot_angle,step,start_rad,len_rad);
|
||||
}
|
||||
|
||||
|
||||
public I8 GrFloodFill3(GrBitMap *base,I8 x1,I8 y1,I8 z1,BoolU4 not_color=TRUE)
|
||||
{ //transformation
|
||||
I8 cnt,old_flags=base->flags;
|
||||
|
||||
if (base->flags & BMF_TRANSFORMATION) {
|
||||
GrRotate(base->r,&x1,&y1,&z1);
|
||||
x1+=base->x;
|
||||
y1+=base->y;
|
||||
z1+=base->z;
|
||||
}
|
||||
base->flags&=~BMF_TRANSFORMATION;
|
||||
cnt=GrFloodFill(base,x1,y1,not_color);
|
||||
base->flags=old_flags;
|
||||
return cnt;
|
||||
}
|
||||
|
||||
public void GrBox3(GrBitMap *base,I8 x,I8 y,I8 z,I8 w,I8 h)
|
||||
{ //Clipping and transformation
|
||||
I8 x2,y2,z2,x3,y3,z3;
|
||||
GrBitMap *old_brush=base->brush;
|
||||
|
||||
if (base->flags & BMF_TRANSFORMATION) {
|
||||
base->brush=NULL;
|
||||
x2=x+w; y2=y; z2=z;
|
||||
x3=x; y3=y+h; z3=z;
|
||||
GrRotate(base->r,&x,&y,&z);
|
||||
x+=base->x;
|
||||
y+=base->y;
|
||||
z+=base->z;
|
||||
GrRotate(base->r,&x2,&y2,&z2);
|
||||
x2+=base->x;
|
||||
y2+=base->y;
|
||||
z2+=base->z;
|
||||
GrRotate(base->r,&x3,&y3,&z3);
|
||||
x3+=base->x;
|
||||
y3+=base->y;
|
||||
z3+=base->z;
|
||||
Box(base,x,y,z,x2,y2,z2,x3,y3,z3,&GrLinePlot);
|
||||
base->brush=old_brush;
|
||||
} else
|
||||
GrBox(base,x,y,w,h);
|
||||
}
|
||||
|
||||
public BoolU8 GrBlot3(GrBitMap *base,I8 x1,I8 y1,I8 z1,GrBitMap *img)
|
||||
{ //Clipping and transformation
|
||||
I8 reg i,j,w=img->width,h=img->height,old_color=base->color,reg color,
|
||||
d1,dx1,dy1,dz1,
|
||||
reg d2,dx2,dy2,dz2,
|
||||
adx1,ady1,adz1,
|
||||
adx2,ady2,adz2,
|
||||
x2,y2,z2,x3,y3,z3,
|
||||
dw,reg dh,x,y;
|
||||
GrBitMap *old_brush=base->brush;
|
||||
|
||||
if (base->flags & BMF_TRANSFORMATION) {
|
||||
x2=x1+w; y2=y1; z2=z1;
|
||||
x3=x1; y3=y1+h; z3=z1;
|
||||
GrRotate(base->r,&x1,&y1,&z1);
|
||||
x1+=base->x;
|
||||
y1+=base->y;
|
||||
z1+=base->z;
|
||||
GrRotate(base->r,&x2,&y2,&z2);
|
||||
x2+=base->x;
|
||||
y2+=base->y;
|
||||
z2+=base->z;
|
||||
GrRotate(base->r,&x3,&y3,&z3);
|
||||
x3+=base->x;
|
||||
y3+=base->y;
|
||||
z3+=base->z;
|
||||
|
||||
dx1=x2-x1; dy1=y2-y1; dz1=z2-z1;
|
||||
dx2=x3-x1; dy2=y3-y1; dz2=z3-z1;
|
||||
adx1=AbsI8(dx1); ady1=AbsI8(dy1); adz1=AbsI8(dz1);
|
||||
adx2=AbsI8(dx2); ady2=AbsI8(dy2); adz2=AbsI8(dz2);
|
||||
|
||||
if (adx1>=ady1)
|
||||
d1=(adx1>=adz1) ? adx1:adz1;
|
||||
else
|
||||
d1=(ady1>=adz1) ? ady1:adz1;
|
||||
d1<<=1;
|
||||
if (d1) {
|
||||
dx1=dx1<<32/d1;
|
||||
dy1=dy1<<32/d1;
|
||||
dz1=dz1<<32/d1;
|
||||
} else
|
||||
return FALSE;
|
||||
|
||||
if (adx2>=ady2)
|
||||
d2=(adx2>=adz2) ? adx2:adz2;
|
||||
else
|
||||
d2=(ady2>=adz2) ? ady2:adz2;
|
||||
d2<<=1;
|
||||
if (d2) {
|
||||
dx2=dx2<<32/d2;
|
||||
dy2=dy2<<32/d2;
|
||||
dz2=dz2<<32/d2;
|
||||
} else
|
||||
return FALSE;
|
||||
|
||||
base->brush=NULL;
|
||||
|
||||
x=0;y=0;
|
||||
dw=w<<32/d1;
|
||||
dh=h<<32/d2;
|
||||
|
||||
x1<<=32; y1<<=32; z1<<=32;
|
||||
for (j=0;j<=d1;j++) {
|
||||
x2=x1; y2=y1; z2=z1;
|
||||
y=0;
|
||||
for (i=0;i<=d2;i++) {
|
||||
color=GrPeek(img,x.i4[1],y.i4[1]);
|
||||
if (color>=0 &&
|
||||
(old_color.u1[3]!=ROPB_TRANSPARENT ||
|
||||
color&0xFFFFFF!=img->bkcolor&0xFFFFFF)) {
|
||||
base->color=old_color&0xFF000000+color;
|
||||
GrPlot(base,x2.i4[1],y2.i4[1]);
|
||||
}
|
||||
x2+=dx2; y2+=dy2; z2+=dz2;
|
||||
y+=dh;
|
||||
}
|
||||
x1+=dx1; y1+=dy1; z1+=dz1;
|
||||
x+=dw;
|
||||
}
|
||||
base->color=old_color;
|
||||
base->brush=old_brush;
|
||||
return TRUE; //TODO: check off screen
|
||||
} else
|
||||
return GrBlot(base,x1,y1,img);
|
||||
}
|
||||
|
||||
public void Gr2Bezier3(GrBitMap *base,P3I4 *ctrl)
|
||||
{
|
||||
I8 i,x,y,z;
|
||||
P3I4 *ctrl2;
|
||||
if (base->flags & BMF_TRANSFORMATION) {
|
||||
ctrl2=MAlloc(sizeof(P3I4)*3);
|
||||
for (i=0;i<3;i++) {
|
||||
x=ctrl[i].x;
|
||||
y=ctrl[i].y;
|
||||
z=ctrl[i].z;
|
||||
GrRotate(base->r,&x,&y,&z);
|
||||
ctrl2[i].x=x+base->x;
|
||||
ctrl2[i].y=y+base->y;
|
||||
ctrl2[i].z=z+base->z;
|
||||
}
|
||||
base->flags&=~BMF_TRANSFORMATION;
|
||||
Bezier2(base,ctrl2,&GrLine3Plot);
|
||||
base->flags|=BMF_TRANSFORMATION;
|
||||
Free(ctrl2);
|
||||
} else
|
||||
Bezier2(base,ctrl,&GrLine3Plot);
|
||||
}
|
||||
|
||||
public void Gr3Bezier3(GrBitMap *base,P3I4 *ctrl)
|
||||
{
|
||||
I8 i,x,y,z;
|
||||
P3I4 *ctrl2;
|
||||
if (base->flags & BMF_TRANSFORMATION) {
|
||||
ctrl2=MAlloc(sizeof(P3I4)*4);
|
||||
for (i=0;i<4;i++) {
|
||||
x=ctrl[i].x;
|
||||
y=ctrl[i].y;
|
||||
z=ctrl[i].z;
|
||||
GrRotate(base->r,&x,&y,&z);
|
||||
ctrl2[i].x=x+base->x;
|
||||
ctrl2[i].y=y+base->y;
|
||||
ctrl2[i].z=z+base->z;
|
||||
}
|
||||
base->flags&=~BMF_TRANSFORMATION;
|
||||
Bezier3(base,ctrl2,&GrLine3Plot);
|
||||
base->flags|=BMF_TRANSFORMATION;
|
||||
Free(ctrl2);
|
||||
} else
|
||||
Bezier3(base,ctrl,&GrLine3Plot);
|
||||
}
|
||||
|
||||
public void Gr2BSpline3(GrBitMap *base,P3I4 *ctrl,I8 cnt,BoolU4 closed=FALSE)
|
||||
{
|
||||
I8 i,x,y,z;
|
||||
P3I4 *ctrl2;
|
||||
if (base->flags & BMF_TRANSFORMATION) {
|
||||
ctrl2=MAlloc(sizeof(P3I4)*cnt);
|
||||
for (i=0;i<cnt;i++) {
|
||||
x=ctrl[i].x;
|
||||
y=ctrl[i].y;
|
||||
z=ctrl[i].z;
|
||||
GrRotate(base->r,&x,&y,&z);
|
||||
ctrl2[i].x=x+base->x;
|
||||
ctrl2[i].y=y+base->y;
|
||||
ctrl2[i].z=z+base->z;
|
||||
}
|
||||
base->flags&=~BMF_TRANSFORMATION;
|
||||
BSpline2(base,ctrl2,cnt,&GrLine3Plot,closed);
|
||||
base->flags|=BMF_TRANSFORMATION;
|
||||
Free(ctrl2);
|
||||
} else
|
||||
BSpline2(base,ctrl,cnt,&GrLine3Plot,closed);
|
||||
}
|
||||
|
||||
public void Gr3BSpline3(GrBitMap *base,P3I4 *ctrl,I8 cnt,BoolU4 closed=FALSE)
|
||||
{
|
||||
I8 i,x,y,z;
|
||||
P3I4 *ctrl2;
|
||||
if (base->flags & BMF_TRANSFORMATION) {
|
||||
ctrl2=MAlloc(sizeof(P3I4)*cnt);
|
||||
for (i=0;i<cnt;i++) {
|
||||
x=ctrl[i].x;
|
||||
y=ctrl[i].y;
|
||||
z=ctrl[i].z;
|
||||
GrRotate(base->r,&x,&y,&z);
|
||||
ctrl2[i].x=x+base->x;
|
||||
ctrl2[i].y=y+base->y;
|
||||
ctrl2[i].z=z+base->z;
|
||||
}
|
||||
base->flags&=~BMF_TRANSFORMATION;
|
||||
BSpline3(base,ctrl2,cnt,&GrLine3Plot,closed);
|
||||
base->flags|=BMF_TRANSFORMATION;
|
||||
Free(ctrl2);
|
||||
} else
|
||||
BSpline3(base,ctrl,cnt,&GrLine3Plot,closed);
|
||||
}
|
||||
|
||||
|
||||
void GrLinePlot4(GrBitMap *base,I8 x,I8 y,I8 z)
|
||||
{
|
||||
nounusedwarn z;
|
||||
GrPlot4(base,x,y);
|
||||
}
|
||||
|
||||
public void GrLine4(GrBitMap *base,I8 x1,I8 y1,I8 x2,I8 y2,I8 step=1,I8 start=0)
|
||||
{ //Line with base->brush
|
||||
if (ClipLine(base,&x1,&y1,&x2,&y2))
|
||||
Line(base,x1,y1,0,x2,y2,0,&GrLinePlot4,step,start);
|
||||
}
|
||||
|
||||
public void GrSpeedLine(GrBitMap *base,I8 x1,I8 y1,I8 x2,I8 y2,double speed)
|
||||
{
|
||||
U8 old_flags=base->flags;
|
||||
I8 old_pen_width=base->pen_width;
|
||||
if (ClipLine(base,&x1,&y1,&x2,&y2)) {
|
||||
base->pen_width=base->speedline_scale*speed;
|
||||
base->flags&=~BMF_TRANSFORMATION;
|
||||
GrLine3(base,x1,y1,0,x2,y2,0);
|
||||
base->flags=old_flags;
|
||||
base->pen_width=old_pen_width;
|
||||
}
|
||||
}
|
||||
|
||||
public void GrSpeedLine2(GrBitMap *base,I8 x1,I8 y1,I8 z1,I8 x2,I8 y2,I8 z2,double speed)
|
||||
{ //transformation but not pen width
|
||||
U8 old_flags=base->flags;
|
||||
|
||||
if (base->flags & BMF_TRANSFORMATION) {
|
||||
GrRotate(base->r,&x1,&y1,&z1);
|
||||
x1+=base->x;
|
||||
y1+=base->y;
|
||||
z1+=base->z;
|
||||
GrRotate(base->r,&x2,&y2,&z2);
|
||||
x2+=base->x;
|
||||
y2+=base->y;
|
||||
z2+=base->z;
|
||||
}
|
||||
base->flags&=~BMF_TRANSFORMATION;
|
||||
GrSpeedLine(base,x1,y1,x2,y2,speed);
|
||||
base->flags=old_flags;
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,593 @@
|
||||
IMPORT sys_update_screen_tss;
|
||||
|
||||
ALIGN 8,OC_NOP
|
||||
NORMAL_KEY_SCAN_DECODE_TABLE::
|
||||
DU1 0,CH_ESC,"1234567890-=",8,9;
|
||||
DU1 "qwertyuiop[]",CH_CR,0,"as";
|
||||
DU1 "dfghjkl;'\`",0,"\\zxcv";
|
||||
DU1 "bnm,./",0,'*',0,CH_SPACE,0,0,0,0,0,0;
|
||||
DU1 0,0,0,0,0,0,0,0,0,0,'-',0,0,0,'+',0;
|
||||
SHIFT_KEY_SCAN_DECODE_TABLE::
|
||||
DU1 0,CH_ESC,"!@#$$%^&*()_+",8,9;
|
||||
DU1 "QWERTYUIOP{}",CH_CR,0,"AS";
|
||||
DU1 "DFGHJKL:\"~",0,"|ZXCV";
|
||||
DU1 "BNM<>?",0,'*',0,CH_SHIFT_SPACE,0,0,0,0,0,0;
|
||||
DU1 0,0,0,0,0,0,0,0,0,0,'-',0,0,0,'+',0;
|
||||
CTRL_KEY_SCAN_DECODE_TABLE::
|
||||
DU1 0,CH_ESC,"1234567890-=",8,9;
|
||||
DU1 17,23,5,18,20,25,21,9,15,16,"[]",CH_CR,0,1,19;
|
||||
DU1 4,6,7,8,CH_LINE_FEED,11,12,";'\`",0,"\\",26,24,3,22;
|
||||
DU1 2,14,13,",./",0,'*',0,CH_SPACE,0,0,0,0,0,0;
|
||||
DU1 0,0,0,0,0,0,0,0,0,0,'-',0,0,0,'+',0;
|
||||
|
||||
ALIGN 8,OC_NOP
|
||||
////**************************PROCEDURE*************************
|
||||
ALIGN 8,OC_NOP
|
||||
CP_PLOT_SCREEN_I1::
|
||||
PUSH RBP
|
||||
MOV RBP,RSP
|
||||
MOV RBX,U8 SF_PARAM2[RBP]
|
||||
MOV RAX,U8 SF_PARAM3[RBP]
|
||||
OR RBX,RBX
|
||||
JS @@100
|
||||
OR RAX,RAX
|
||||
JS @@100
|
||||
CMP RBX,TEXT_COLS
|
||||
JGE @@100
|
||||
CMP RAX,TEXT_ROWS
|
||||
JGE @@100
|
||||
IMUL2 RAX,TEXT_COLS
|
||||
ADD RBX,RAX
|
||||
SHL RBX,2
|
||||
ADD RBX,U8 [SYS_TEXTBASE]
|
||||
MOV RAX,U8 SF_PARAM1[RBP]
|
||||
MOV U4 [RBX],EAX
|
||||
|
||||
POP RBP
|
||||
MOV RAX,1
|
||||
RET
|
||||
@@100: POP RBP
|
||||
XOR EAX,EAX
|
||||
RET
|
||||
////**************************PROCEDURE*************************
|
||||
ALIGN 8,OC_NOP
|
||||
CP_PLOT_WIN_I1::
|
||||
PUSH RBP
|
||||
MOV RBP,RSP
|
||||
MOV RBX,U8 SF_PARAM3[RBP]
|
||||
MOV RAX,U8 SF_PARAM4[RBP]
|
||||
MOV RCX,U8 SF_PARAM1[RBP]
|
||||
|
||||
OR RBX,RBX
|
||||
JS @@100
|
||||
ADD RBX,U8 TSS_WIN_LEFT[RCX]
|
||||
CMP RBX,U8 TSS_WIN_RIGHT[RCX]
|
||||
JG @@100
|
||||
OR RBX,RBX
|
||||
JS @@100
|
||||
CMP RBX,TEXT_COLS
|
||||
JGE @@100
|
||||
|
||||
OR RAX,RAX
|
||||
JS @@100
|
||||
ADD RAX,U8 TSS_WIN_TOP[RCX]
|
||||
CMP RAX,U8 TSS_WIN_BOTTOM[RCX]
|
||||
JG @@100
|
||||
OR RAX,RAX
|
||||
JS @@100
|
||||
CMP RAX,TEXT_ROWS
|
||||
JGE @@100
|
||||
|
||||
IMUL2 RAX,TEXT_COLS
|
||||
ADD RBX,RAX
|
||||
SHL RBX,2
|
||||
ADD RBX,U8 [SYS_TEXTBASE]
|
||||
MOV RAX,U8 SF_PARAM2[RBP]
|
||||
MOV U4 [RBX],EAX
|
||||
|
||||
POP RBP
|
||||
MOV RAX,1
|
||||
RET
|
||||
@@100: POP RBP
|
||||
XOR EAX,EAX
|
||||
RET
|
||||
|
||||
////**************************PROCEDURE*************************
|
||||
ALIGN 8,OC_NOP
|
||||
/*
|
||||
BoolU4 PlotWinStr2(TssStruct *tss,I1 *s,I8 len,
|
||||
U8 attr,I8 x,I8 y)
|
||||
*/
|
||||
ALIGN 8,OC_NOP
|
||||
CP_PLOT_WIN_STR2::
|
||||
PUSH RBP
|
||||
MOV RBP,RSP
|
||||
MOV R10,U8 [SYS_TEXTBASE]
|
||||
PUSH RSI
|
||||
PUSH RDI
|
||||
MOV RBX,U8 SF_PARAM1[RBP]
|
||||
MOV RSI,U8 SF_PARAM2[RBP]
|
||||
MOV RDI,U8 SF_PARAM5[RBP]
|
||||
MOV RCX,U8 SF_PARAM3[RBP]
|
||||
|
||||
OR RDI,RDI
|
||||
JNS @@10
|
||||
ADD RCX,RDI
|
||||
SUB RSI,RDI
|
||||
XOR EDI,EDI
|
||||
@@10: ADD RDI,U8 TSS_WIN_LEFT[RBX]
|
||||
MOV RDX,RCX
|
||||
ADD RDX,RDI
|
||||
DEC RDX
|
||||
CMP RDX,U8 TSS_WIN_RIGHT[RBX]
|
||||
JLE @@11
|
||||
MOV RAX,RDX
|
||||
SUB RAX,U8 TSS_WIN_RIGHT[RBX]
|
||||
SUB RDX,RAX
|
||||
SUB RCX,RAX
|
||||
@@11: OR RDI,RDI
|
||||
JNS @@12
|
||||
ADD RCX,RDI
|
||||
SUB RSI,RDI
|
||||
XOR EDI,EDI
|
||||
@@12: INC RDX
|
||||
SUB RDX,TEXT_COLS
|
||||
JLE @@13
|
||||
SUB RCX,RDX
|
||||
@@13: CMP RCX,1
|
||||
JL @@100
|
||||
|
||||
MOV RAX,U8 SF_PARAM6[RBP]
|
||||
OR RAX,RAX
|
||||
JS @@100
|
||||
ADD RAX,U8 TSS_WIN_TOP[RBX]
|
||||
CMP RAX,U8 TSS_WIN_BOTTOM[RBX]
|
||||
JG @@100
|
||||
OR RAX,RAX
|
||||
JS @@100
|
||||
CMP RAX,TEXT_ROWS
|
||||
JGE @@100
|
||||
|
||||
IMUL2 RAX,TEXT_COLS
|
||||
ADD RDI,RAX
|
||||
SHL RDI,2
|
||||
ADD RDI,R10
|
||||
MOV RAX,U8 SF_PARAM4[RBP]
|
||||
@@20: LODSB
|
||||
STOSD
|
||||
LOOP @@20
|
||||
|
||||
POP RDI
|
||||
POP RSI
|
||||
POP RBP
|
||||
MOV RAX,TRUE
|
||||
RET
|
||||
|
||||
@@100: POP RDI
|
||||
POP RSI
|
||||
POP RBP
|
||||
XOR EAX,EAX
|
||||
RET
|
||||
////**************************PROCEDURE*************************
|
||||
ALIGN 8,OC_NOP
|
||||
/*
|
||||
BoolU4 PlotAttr(TssStruct *tss,I8 len,
|
||||
U8 attr,I8 x,I8 y)
|
||||
*/
|
||||
ALIGN 8,OC_NOP
|
||||
CP_PLOT_ATTR::
|
||||
PUSH RBP
|
||||
MOV RBP,RSP
|
||||
MOV R10,U8 [SYS_TEXTBASE]
|
||||
PUSH RSI
|
||||
PUSH RDI
|
||||
MOV RBX,U8 SF_PARAM1[RBP]
|
||||
MOV RDI,U8 SF_PARAM4[RBP]
|
||||
MOV RCX,U8 SF_PARAM2[RBP]
|
||||
|
||||
OR RDI,RDI
|
||||
JNS @@10
|
||||
ADD RCX,RDI
|
||||
XOR EDI,EDI
|
||||
@@10: ADD RDI,U8 TSS_WIN_LEFT[RBX]
|
||||
MOV RDX,RCX
|
||||
ADD RDX,RDI
|
||||
DEC RDX
|
||||
CMP RDX,U8 TSS_WIN_RIGHT[RBX]
|
||||
JLE @@11
|
||||
MOV RAX,RDX
|
||||
SUB RAX,U8 TSS_WIN_RIGHT[RBX]
|
||||
SUB RDX,RAX
|
||||
SUB RCX,RAX
|
||||
@@11: OR RDI,RDI
|
||||
JNS @@12
|
||||
ADD RCX,RDI
|
||||
XOR EDI,EDI
|
||||
@@12: INC RDX
|
||||
SUB RDX,TEXT_COLS
|
||||
JLE @@13
|
||||
SUB RCX,RDX
|
||||
@@13: CMP RCX,1
|
||||
JL @@100
|
||||
|
||||
MOV RAX,U8 SF_PARAM5[RBP]
|
||||
OR RAX,RAX
|
||||
JS @@100
|
||||
ADD RAX,U8 TSS_WIN_TOP[RBX]
|
||||
CMP RAX,U8 TSS_WIN_BOTTOM[RBX]
|
||||
JG @@100
|
||||
OR RAX,RAX
|
||||
JS @@100
|
||||
CMP RAX,TEXT_ROWS
|
||||
JGE @@100
|
||||
|
||||
IMUL2 RAX,TEXT_COLS
|
||||
ADD RDI,RAX
|
||||
SHL RDI,2
|
||||
ADD RDI,R10
|
||||
MOV RBX,U8 SF_PARAM3[RBP]
|
||||
MOV RSI,RDI
|
||||
@@20: LODSD
|
||||
OR AL,AL
|
||||
JNZ @@21
|
||||
MOV RAX,RBX
|
||||
STOSD
|
||||
LOOP @@20
|
||||
|
||||
@@21: POP RDI
|
||||
POP RSI
|
||||
POP RBP
|
||||
MOV RAX,TRUE
|
||||
RET
|
||||
|
||||
@@100: POP RDI
|
||||
POP RSI
|
||||
POP RBP
|
||||
XOR EAX,EAX
|
||||
RET
|
||||
////**************************PROCEDURE*************************
|
||||
ALIGN 8,OC_NOP
|
||||
CP_PLOT_BORDER_I1::
|
||||
PUSH RBP
|
||||
MOV RBP,RSP
|
||||
MOV R10,U8 [SYS_TEXTBASE]
|
||||
MOV RBX,U8 SF_PARAM3[RBP]
|
||||
MOV RAX,U8 SF_PARAM4[RBP]
|
||||
MOV RCX,U8 SF_PARAM1[RBP]
|
||||
|
||||
MOV RDX,-1
|
||||
CMP RBX,RDX
|
||||
JL @@100
|
||||
ADD RBX,U8 TSS_WIN_LEFT[RCX]
|
||||
MOV RDX,U8 TSS_WIN_RIGHT[RCX]
|
||||
INC RDX
|
||||
CMP RBX,RDX
|
||||
JG @@100
|
||||
OR RBX,RBX
|
||||
JS @@100
|
||||
CMP RBX,TEXT_COLS
|
||||
JGE @@100
|
||||
|
||||
MOV RDX,-1
|
||||
CMP RAX,RDX
|
||||
JL @@100
|
||||
ADD RAX,U8 TSS_WIN_TOP[RCX]
|
||||
MOV RDX,U8 TSS_WIN_BOTTOM[RCX]
|
||||
INC RDX
|
||||
CMP RAX,RDX
|
||||
JG @@100
|
||||
OR RAX,RAX
|
||||
JS @@100
|
||||
CMP RAX,TEXT_ROWS
|
||||
JGE @@100
|
||||
|
||||
IMUL2 RAX,TEXT_COLS
|
||||
ADD RBX,RAX
|
||||
SHL RBX,2
|
||||
ADD RBX,R10
|
||||
MOV RAX,U8 SF_PARAM2[RBP]
|
||||
MOV U4 [RBX],EAX
|
||||
|
||||
POP RBP
|
||||
MOV RAX,TRUE
|
||||
RET
|
||||
@@100: POP RBP
|
||||
XOR EAX,EAX
|
||||
RET
|
||||
////**************************PROCEDURE*************************
|
||||
ALIGN 8,OC_NOP
|
||||
/*
|
||||
GrXorLineU8(&dst3,&src,&src2,d5b,vga_image,reverse_table);
|
||||
for (col=0;col<d5a;col++) {
|
||||
*dst3=*src^*src2;
|
||||
dst3+=8;
|
||||
src+=8;
|
||||
src2+=8;
|
||||
}
|
||||
*/
|
||||
GR_XOR_LINE_U8::
|
||||
PUSH RBP
|
||||
MOV RBP,RSP
|
||||
PUSH RSI
|
||||
PUSH RDI
|
||||
|
||||
MOV RAX,U8 SF_PARAM2[RBP]
|
||||
MOV RDX,U8 [RAX]
|
||||
MOV RAX,U8 SF_PARAM3[RBP]
|
||||
MOV RSI,U8 [RAX] //rsi=src2
|
||||
MOV RBX,U8 SF_PARAM6[RBP] //rbx=reverse table
|
||||
MOV RCX,U8 SF_PARAM4[RBP] //rcx=d5
|
||||
MOV RAX,U8 SF_PARAM5[RBP]
|
||||
MOV RDI,U8 [RAX] //rdi=vga image
|
||||
|
||||
MOV RAX,U8 SF_PARAM1[RBP]
|
||||
MOV R8,U8 [RAX] //rbp=vga dst
|
||||
|
||||
@@5: MOV RAX,U8 [RDX]
|
||||
XOR RAX,U8 [RSI]
|
||||
CMP U8 [RDI],RAX
|
||||
JE @@7
|
||||
MOV U8 [RDI],RAX
|
||||
XLATB
|
||||
ROR RAX,8
|
||||
XLATB
|
||||
ROR RAX,8
|
||||
XLATB
|
||||
ROR RAX,8
|
||||
XLATB
|
||||
ROR RAX,8
|
||||
XLATB
|
||||
ROR RAX,8
|
||||
XLATB
|
||||
ROR RAX,8
|
||||
XLATB
|
||||
ROR RAX,8
|
||||
XLATB
|
||||
ROR RAX,8
|
||||
MOV U8 [R8],RAX
|
||||
@@7: ADD RDI,8
|
||||
ADD R8,8
|
||||
ADD RSI,8
|
||||
ADD RDX,8
|
||||
LOOP @@5
|
||||
|
||||
MOV RAX,U8 SF_PARAM1[RBP]
|
||||
MOV U8 [RAX],R8
|
||||
MOV RAX,U8 SF_PARAM5[RBP]
|
||||
MOV U8 [RAX],RDI
|
||||
MOV RAX,U8 SF_PARAM3[RBP]
|
||||
MOV U8 [RAX],RSI
|
||||
MOV RAX,U8 SF_PARAM2[RBP]
|
||||
MOV U8 [RAX],RDX
|
||||
POP RDI
|
||||
POP RSI
|
||||
POP RBP
|
||||
RET
|
||||
|
||||
////**************************PROCEDURE*************************
|
||||
GR_XOR_BITMAP_U8::
|
||||
PUSH RBP
|
||||
MOV RBP,RSP
|
||||
PUSH RSI
|
||||
PUSH RDI
|
||||
|
||||
MOV RSI,SF_PARAM2[RBP]
|
||||
MOV RDI,SF_PARAM1[RBP]
|
||||
MOV RCX,SF_PARAM3[RBP]
|
||||
@@1: LODSQ
|
||||
XOR RAX,U8 [RDI]
|
||||
STOSQ
|
||||
LOOP @@1
|
||||
|
||||
POP RDI
|
||||
POP RSI
|
||||
POP RBP
|
||||
RET
|
||||
////**************************PROCEDURE*************************
|
||||
ALIGN 8,OC_NOP
|
||||
/*
|
||||
GrPlotChar(font_ptr,cur_ch.u1[1],&dst2,d1,d2);
|
||||
|
||||
for (plane=0x01;plane!=0x10;plane<<=1) {
|
||||
font_ptr2=font_ptr;
|
||||
if (cur_ch.u1[1] & plane) {
|
||||
for (ch_line=0;ch_line<FONT_HEIGHT;ch_line++) {
|
||||
*dst2|=*font_ptr2++;
|
||||
dst2+=d1;
|
||||
}
|
||||
} else {
|
||||
for (ch_line=0;ch_line<FONT_HEIGHT;ch_line++) {
|
||||
*dst2&=~*font_ptr2++;
|
||||
dst2+=d1;
|
||||
}
|
||||
}
|
||||
dst2+=d2;
|
||||
}
|
||||
*/
|
||||
GR_PLOT_CHAR::
|
||||
PUSH RBP
|
||||
MOV RBP,RSP
|
||||
PUSH RSI
|
||||
PUSH RDI
|
||||
MOV RDX,1 //EDX=plane
|
||||
MOV RBX,U8 SF_PARAM4[RBP] //RBX=d1
|
||||
MOV RAX,U8 SF_PARAM3[RBP]
|
||||
MOV RDI,U8 [RAX] //RDI=dst2
|
||||
@@10: MOV RSI,U8 SF_PARAM1[RBP] //RSI=font_ptr2
|
||||
TEST U8 SF_PARAM2[RBP],RDX
|
||||
JZ @@30
|
||||
|
||||
@@20: LODSQ
|
||||
OR U1 [RDI],AL
|
||||
ADD RDI,RBX
|
||||
ROR RAX,8
|
||||
OR U1 [RDI],AL
|
||||
ADD RDI,RBX
|
||||
ROR RAX,8
|
||||
OR U1 [RDI],AL
|
||||
ADD RDI,RBX
|
||||
ROR RAX,8
|
||||
OR U1 [RDI],AL
|
||||
ADD RDI,RBX
|
||||
ROR RAX,8
|
||||
OR U1 [RDI],AL
|
||||
ADD RDI,RBX
|
||||
ROR RAX,8
|
||||
OR U1 [RDI],AL
|
||||
ADD RDI,RBX
|
||||
ROR RAX,8
|
||||
OR U1 [RDI],AL
|
||||
ADD RDI,RBX
|
||||
ROR RAX,8
|
||||
OR U1 [RDI],AL
|
||||
ADD RDI,RBX
|
||||
JMP @@40
|
||||
|
||||
@@30: LODSQ
|
||||
NOT RAX
|
||||
AND U1 [RDI],AL
|
||||
ADD RDI,RBX
|
||||
ROR RAX,8
|
||||
AND U1 [RDI],AL
|
||||
ADD RDI,RBX
|
||||
ROR RAX,8
|
||||
AND U1 [RDI],AL
|
||||
ADD RDI,RBX
|
||||
ROR RAX,8
|
||||
AND U1 [RDI],AL
|
||||
ADD RDI,RBX
|
||||
ROR RAX,8
|
||||
AND U1 [RDI],AL
|
||||
ADD RDI,RBX
|
||||
ROR RAX,8
|
||||
AND U1 [RDI],AL
|
||||
ADD RDI,RBX
|
||||
ROR RAX,8
|
||||
AND U1 [RDI],AL
|
||||
ADD RDI,RBX
|
||||
ROR RAX,8
|
||||
AND U1 [RDI],AL
|
||||
ADD RDI,RBX
|
||||
|
||||
@@40: ADD RDI,U8 SF_PARAM5[RBP]
|
||||
SHL1 RDX
|
||||
CMP RDX,0x10
|
||||
JNE U4 @@10
|
||||
|
||||
MOV RAX,U8 SF_PARAM3[RBP]
|
||||
MOV U8 [RAX],RDI
|
||||
POP RDI
|
||||
POP RSI
|
||||
POP RBP
|
||||
RET
|
||||
////**************************PROCEDURE*************************
|
||||
ALIGN 8,OC_NOP
|
||||
/*
|
||||
GrPlotBackground(cur_ch.u1[1],&dst,d1,d2);
|
||||
|
||||
for (plane=0x10;plane!=0x100;plane=plane<<1) {
|
||||
d=(cur_ch.u1[1] & plane) ? 0xFF:0x00;
|
||||
for (ch_line=0;ch_line<FONT_HEIGHT;ch_line++) {
|
||||
*dst=d;
|
||||
dst+=d1;
|
||||
}
|
||||
dst+=d2;
|
||||
}
|
||||
*/
|
||||
GR_PLOT_BACKGROUND::
|
||||
PUSH RBP
|
||||
MOV RBP,RSP
|
||||
PUSH RDI
|
||||
MOV RDX,0x10 //EDX=plane
|
||||
MOV RBX,U8 SF_PARAM3[RBP] //RBX=d1
|
||||
MOV RAX,U8 SF_PARAM2[RBP] //RDI=dst
|
||||
MOV RDI,U8 [RAX] //RDI=dst
|
||||
|
||||
@@10: XOR EAX,EAX
|
||||
TEST U8 SF_PARAM1[RBP],RDX
|
||||
JZ @@20
|
||||
DEC RAX
|
||||
|
||||
@@20: MOV U1 [RDI],AL
|
||||
ADD RDI,RBX
|
||||
MOV U1 [RDI],AL
|
||||
ADD RDI,RBX
|
||||
MOV U1 [RDI],AL
|
||||
ADD RDI,RBX
|
||||
MOV U1 [RDI],AL
|
||||
ADD RDI,RBX
|
||||
MOV U1 [RDI],AL
|
||||
ADD RDI,RBX
|
||||
MOV U1 [RDI],AL
|
||||
ADD RDI,RBX
|
||||
MOV U1 [RDI],AL
|
||||
ADD RDI,RBX
|
||||
MOV U1 [RDI],AL
|
||||
ADD RDI,RBX
|
||||
|
||||
ADD RDI,U8 SF_PARAM4[RBP]
|
||||
SHL1 RDX
|
||||
CMP RDX,0x100
|
||||
JNE @@10
|
||||
|
||||
MOV RAX,U8 SF_PARAM2[RBP]
|
||||
MOV U8 [RAX],RDI
|
||||
POP RDI
|
||||
POP RBP
|
||||
RET
|
||||
|
||||
/*****
|
||||
BoolU4 IsPixelCovered(TssStruct *tss,I8 x,I8 y)
|
||||
{
|
||||
if (tss==sys_update_screen_tss) return FALSE;
|
||||
tss=tss->next_tss;
|
||||
while (tss!=sys_update_screen_tss) {
|
||||
if (Bt(&tss->crt_flags,CRTf_SHOW)) { //no short circuit logic
|
||||
if (x>=tss->win_border_pixel_left) {
|
||||
if (x<=tss->win_border_pixel_right) {
|
||||
if (y>=tss->win_border_pixel_top) {
|
||||
if (y<=tss->win_border_pixel_bottom) {
|
||||
return TRUE;
|
||||
}}}}}
|
||||
tss=tss->next_tss;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
*********/
|
||||
CP_IS_PIXEL_COVERED::
|
||||
PUSH RBP
|
||||
MOV RBP,RSP
|
||||
MOV RAX,U8 SF_PARAM1[RBP]
|
||||
MOV RBX,U8 SF_PARAM2[RBP]
|
||||
MOV RCX,U8 SF_PARAM3[RBP]
|
||||
MOV RDX,U8 [sys_update_screen_tss]
|
||||
BT U4 TSS_CRT_FLAGS[RAX],CRTf_ON_TOP
|
||||
JC @@100
|
||||
PUSHFD
|
||||
CLI
|
||||
MOV RAX,U8 TSS_NEXT_TSS[RAX]
|
||||
JMP @@30
|
||||
|
||||
@@1: BT U4 TSS_CRT_FLAGS[RAX],CRTf_SHOW
|
||||
JNC @@20
|
||||
CMP RBX,U8 TSS_WIN_BORDER_PIXEL_LEFT[RAX]
|
||||
JL @@20
|
||||
CMP RCX,U8 TSS_WIN_BORDER_PIXEL_TOP[RAX]
|
||||
JL @@20
|
||||
CMP RBX,U8 TSS_WIN_BORDER_PIXEL_RIGHT[RAX]
|
||||
JG @@20
|
||||
CMP RCX,U8 TSS_WIN_BORDER_PIXEL_BOTTOM[RAX]
|
||||
JG @@20
|
||||
POPFD
|
||||
MOV RAX,TRUE
|
||||
POP RBP
|
||||
RET
|
||||
|
||||
@@20: MOV RAX,U8 TSS_NEXT_TSS[RAX]
|
||||
@@30: CMP RAX,RDX
|
||||
JNE @@1
|
||||
POPFD
|
||||
|
||||
@@100: XOR EAX,EAX
|
||||
POP RBP
|
||||
RET
|
||||
Binary file not shown.
@@ -0,0 +1,19 @@
|
||||
#help_index "Graphics"
|
||||
public LTextern CP_IS_PIXEL_COVERED BoolU4 IsPixelCovered(TssStruct *tss,I8 x,I8 y);
|
||||
|
||||
LTextern GR_XOR_LINE_U8 void GrXorLineU8(U8 **dst3,U8 **src,U8 **src2,U8 d5b,
|
||||
void **vga,U1 *reverse_bit_tab);
|
||||
LTextern GR_XOR_BITMAP_U8 void GrXorBitMapU8(U8 *b1,U8 *b2,U8 cnt);
|
||||
LTextern GR_PLOT_CHAR void GrPlotChar(U1 *font_ptr,U1 attr,U1 **dst2,U8 d1,U8 d2);
|
||||
LTextern GR_PLOT_BACKGROUND void GrPlotBackground(U1 attr,U1 **dst,U8 d1,U8 d2);
|
||||
//The callback is void Plot(aux_data,x,y,z)
|
||||
|
||||
#help_index "Graphics/Char"
|
||||
public LTextern CP_PLOT_SCREEN_I1 BoolU4 PlotScreenChar(U8 w,I8 x,I8 y);
|
||||
public LTextern CP_PLOT_WIN_I1 BoolU4 PlotWinChar(TssStruct *tss,U8 w,I8 x,I8 y);
|
||||
public LTextern CP_PLOT_WIN_STR2 BoolU4 PlotWinStr2(
|
||||
TssStruct *tss,I1 *s,I8 len,U8 attr,I8 x,I8 y);
|
||||
public LTextern CP_PLOT_ATTR BoolU4 PlotWinAttr(
|
||||
TssStruct *tss,I8 len,U8 attr,I8 x,I8 y);
|
||||
public LTextern CP_PLOT_BORDER_I1 BoolU4 PlotBorderChar(TssStruct *tss,U8 w,I8 x,I8 y);
|
||||
#help_index ""
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,397 @@
|
||||
#help_index "Hash/Reports"
|
||||
|
||||
class HashRepStruct
|
||||
{
|
||||
SysHashEntry *h;
|
||||
I1 *index;
|
||||
};
|
||||
|
||||
|
||||
I8 CompareHashEntries(HashRepStruct *h1,HashRepStruct *h2)
|
||||
{
|
||||
return StrCmp(h1->h->str,h2->h->str);
|
||||
}
|
||||
|
||||
I8 CompareHashEntries2(HashRepStruct *h1,HashRepStruct *h2)
|
||||
{
|
||||
ClassStruct *tempc1=h1->h,*tempc2=h2->h;
|
||||
I8 i1=0,i2=0;
|
||||
if (tempc1->type & HTT_FUNCTION)
|
||||
i1=tempc1->executable_address;
|
||||
if (tempc2->type & HTT_FUNCTION)
|
||||
i2=tempc2->executable_address;
|
||||
return i1-i2;
|
||||
}
|
||||
|
||||
I8 HelpIndexCnt(I1 *ptr,I1 *index)
|
||||
{
|
||||
I1 cnt=0,ch;
|
||||
I8 index_len=StrLen(index);
|
||||
while (*ptr) {
|
||||
if (!StrNCmp(ptr,index,index_len))
|
||||
cnt++;
|
||||
while (ch=*ptr++)
|
||||
if (ch==';')
|
||||
break;
|
||||
if (!ch)
|
||||
ptr--;
|
||||
}
|
||||
return cnt;
|
||||
}
|
||||
|
||||
I1 *HelpIndexStr(I1 **ptr_,I1 *index)
|
||||
{
|
||||
I1 *ptr=*ptr_,*ptr2,ch,*result;
|
||||
I8 index_len=StrLen(index);
|
||||
while (*ptr) {
|
||||
ptr2=ptr;
|
||||
while (ch=*ptr++)
|
||||
if (ch==';')
|
||||
break;
|
||||
if (!ch)
|
||||
ptr--;
|
||||
*ptr_=ptr;
|
||||
if (!StrNCmp(ptr2,index,index_len)) {
|
||||
if (ch==';')
|
||||
ptr--;
|
||||
*ptr=0;
|
||||
result=NewStr(ptr2);
|
||||
*ptr=ch;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
I8 CompareHashEntries3(HashRepStruct *h1,HashRepStruct *h2)
|
||||
{
|
||||
I8 i,i1=0,i2=0;
|
||||
i=StrCmp(h1->index,h2->index);
|
||||
if (i)
|
||||
return i;
|
||||
else {
|
||||
if (h1->h->type&HTT_HELP_FILE)
|
||||
i1=1;
|
||||
if (h2->h->type&HTT_HELP_FILE)
|
||||
i2=1;
|
||||
i=i2-i1;
|
||||
if (i)
|
||||
return i;
|
||||
else
|
||||
return StrCmp(h1->h->str,h2->h->str);
|
||||
}
|
||||
}
|
||||
|
||||
//Possible choices for first parameter, "h" include
|
||||
// "adam_tss->hash_table"
|
||||
// "Fs->hash_table"
|
||||
public void HashRep(SysHashTable *h=NULL,
|
||||
U8 mask=HTT_ALL,I1 *outname=NULL,I1 *flags=NULL,I1 mapfile_drive=0,I1 *index=NULL,
|
||||
Ltf *l_=NULL)
|
||||
{
|
||||
SysHashTable *tempht;
|
||||
SysHashEntry *ptr,*temph;
|
||||
HashRepStruct *list;
|
||||
U8 cnt,i,j,k,size,f=0;
|
||||
I1 buf[512],*buf4,*last_index=NewStr(""),*cur_index;
|
||||
Ltf *l,*l1;
|
||||
BoolU4 recurse,publics,map;
|
||||
LtfBinEntry *tempb;
|
||||
DbgInfo *dbg;
|
||||
BoolU4 old_preempt=Preempt(OFF);
|
||||
|
||||
GetFFlags(&f,SysText("ST_FILE_UTIL_FLAGS"),"+r+p");
|
||||
GetFFlags(&f,SysText("ST_FILE_UTIL_FLAGS"),flags);
|
||||
recurse=Bt(&f,FUf_RECURSE);
|
||||
publics=Bt(&f,FUf_PUBLIC);
|
||||
map =Bt(&f,FUf_MAP);
|
||||
|
||||
if (!h) h=Fs->hash_table;
|
||||
|
||||
if (outname) {
|
||||
l=LtfNew;
|
||||
l->flags|=LTFF_NO_CURSOR;
|
||||
StrCpy(l->filename.name,outname);
|
||||
} else
|
||||
l=NULL;
|
||||
if (l_)
|
||||
l=l_;
|
||||
|
||||
cnt=0;
|
||||
tempht=h;
|
||||
while (tempht) {
|
||||
for (i=0;i<=tempht->mask;i++) {
|
||||
temph=tempht->body[i];
|
||||
while (temph) {
|
||||
if (!(temph->type & (HTT_IMPORT | HTT_PRIVATE)) &&
|
||||
temph->type & mask &&
|
||||
(temph->type & HTT_PUBLIC || !publics))
|
||||
if (!index)
|
||||
cnt++;
|
||||
else
|
||||
if (cur_index=temph->index)
|
||||
cnt+=HelpIndexCnt(cur_index,index);
|
||||
temph=temph->next;
|
||||
}
|
||||
}
|
||||
if (recurse)
|
||||
tempht=tempht->next;
|
||||
else
|
||||
break;
|
||||
}
|
||||
if (!cnt) goto end_hash;
|
||||
|
||||
list=MAllocZ(cnt*sizeof(HashRepStruct));
|
||||
j=0;
|
||||
tempht=h;
|
||||
while (tempht) {
|
||||
for (i=0;i<=tempht->mask;i++) {
|
||||
temph=tempht->body[i];
|
||||
while (temph) {
|
||||
if (!(temph->type & (HTT_IMPORT | HTT_PRIVATE)) &&
|
||||
temph->type & mask &&
|
||||
(temph->type & HTT_PUBLIC || !publics))
|
||||
if (!index)
|
||||
list[j++].h=temph;
|
||||
else
|
||||
if (cur_index=temph->index)
|
||||
if (k=HelpIndexCnt(cur_index,index)) {
|
||||
while (k--) {
|
||||
list[j].index=HelpIndexStr(&cur_index,index);
|
||||
list[j++].h=temph;
|
||||
}
|
||||
}
|
||||
temph=temph->next;
|
||||
}
|
||||
}
|
||||
if (recurse)
|
||||
tempht=tempht->next;
|
||||
else
|
||||
break;
|
||||
}
|
||||
Preempt(old_preempt);
|
||||
|
||||
if (map)
|
||||
QSort(list,cnt,sizeof(HashRepStruct),&CompareHashEntries2);
|
||||
else if (index)
|
||||
QSort(list,cnt,sizeof(HashRepStruct),&CompareHashEntries3);
|
||||
else
|
||||
QSort(list,cnt,sizeof(HashRepStruct),&CompareHashEntries);
|
||||
|
||||
for (i=0;i<cnt;i++) {
|
||||
ptr=list[i].h;
|
||||
dbg=NULL;
|
||||
if (index)
|
||||
if (cur_index=list[i].index) {
|
||||
if (StrCmp(cur_index,last_index)) {
|
||||
Free(last_index);
|
||||
last_index=NewStr(cur_index);
|
||||
if (l)
|
||||
LtfPrintF(l,"$$FG,GREEN$$%s$$FG$$\r\n",cur_index);
|
||||
else
|
||||
PrintF("$$FG,GREEN$$%s$$FG$$\r\n",cur_index);
|
||||
}
|
||||
}
|
||||
if (index && ptr->type & HTT_HELP_FILE) {
|
||||
if (l) {
|
||||
l1=LtfRead(ptr->str);
|
||||
EditInsertLtf(l,l1);
|
||||
LtfDel(l1);
|
||||
} else
|
||||
Type(ptr->str);
|
||||
} else {
|
||||
if (ptr->source_link) {
|
||||
buf4=NewStr(ptr->source_link);
|
||||
if (mapfile_drive && StrLen(buf4)>3)
|
||||
buf4[3]=mapfile_drive;
|
||||
if (l && ptr->type & HTT_FUNCTION) {
|
||||
dbg=ptr><(ClassStruct *)->debug;
|
||||
if (dbg) {
|
||||
size=offset(DbgInfo.body)+
|
||||
sizeof(void *)*
|
||||
(dbg->max_line-dbg->min_line+2);
|
||||
if (size>MSize(dbg)) {
|
||||
coutln "Corrupt Map Entry";
|
||||
dbg=NULL;
|
||||
} else {
|
||||
if (dbg->min_line<=dbg->max_line) {
|
||||
tempb=MAllocZ(sizeof(LtfBinEntry));
|
||||
tempb->type=LTFBT_GENERIC_DATA;
|
||||
tempb->size=size;
|
||||
tempb->data=MAlloc(size);
|
||||
MemCpy(tempb->data,dbg,size);
|
||||
tempb->num=l->cur_bin_num;
|
||||
tempb->use_cnt=1;
|
||||
InsQue(tempb,l->bin_root.last);
|
||||
} else
|
||||
dbg=NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (dbg)
|
||||
SPrintF(buf,"$$LK+BI,\"%-18s \",\"%s\",%d$$",
|
||||
ptr->str,buf4,l->cur_bin_num++);
|
||||
else
|
||||
SPrintF(buf,"$$LK,\"%-18s \",\"%s\"$$",
|
||||
ptr->str,buf4);
|
||||
Free(buf4);
|
||||
} else
|
||||
SPrintF(buf,"%-18ts ",ptr->str);
|
||||
|
||||
if (l)
|
||||
LtfPutSExt(l,buf);
|
||||
else
|
||||
PutS(buf);
|
||||
|
||||
if (!index) {
|
||||
if (ptr->type & HTT_FUNCTION)
|
||||
SPrintF(buf,"%08X",ptr><(ClassStruct *)->executable_address);
|
||||
else if (ptr->type & HTT_STR_CONST)
|
||||
SPrintF(buf,"%-8tQ",ptr><(StrConstStruct *)->data);
|
||||
else if (ptr->type & HTT_GLBL_VAR)
|
||||
SPrintF(buf,"%08X",ptr><(GlblVarStruct *)->data_address);
|
||||
else if (ptr->type & HTT_SYSTEXT)
|
||||
SPrintF(buf,"%-8tQ %04tX",ptr->user_data0,ptr->user_data1);
|
||||
else
|
||||
SPrintF(buf,"%08X",ptr->user_data0);
|
||||
SPrintF(buf+StrLen(buf)," %04X ",ptr->use_cnt);
|
||||
} else
|
||||
*buf=0;
|
||||
|
||||
k=ptr->type;
|
||||
if (publics)
|
||||
k&=~HTT_PUBLIC;
|
||||
|
||||
for (j=0;j<32;j++)
|
||||
if (Bt(&k,j))
|
||||
SPrintF(buf+StrLen(buf),"%Z ",j,"ST_HTT_TYPES");
|
||||
StrCat(buf,"\r\n");
|
||||
if (l)
|
||||
LtfPutSExt(l,buf);
|
||||
else
|
||||
PutS(buf);
|
||||
}
|
||||
Free(list[i].index);
|
||||
}
|
||||
Free(list);
|
||||
|
||||
end_hash:
|
||||
if (l) {
|
||||
if (!l_) {
|
||||
LtfWrite(l);
|
||||
LtfDel(l);
|
||||
} else {
|
||||
if (l->dummy.next==l)
|
||||
LtfPutSExt(l,"No Match");
|
||||
}
|
||||
}
|
||||
Free(last_index);
|
||||
}
|
||||
|
||||
public void HFunsRep(I1 *flags="",I1 *index=NULL)
|
||||
{
|
||||
HashRep(Fs->hash_table,HTT_FUNCTION,NULL,flags,0,index);
|
||||
}
|
||||
|
||||
public void HMapRep(I1 *flags="-p+m",I1 *index=NULL)
|
||||
{
|
||||
HashRep(Fs->hash_table,HTT_FUNCTION,NULL,flags,0,index);
|
||||
}
|
||||
|
||||
public void HVarsRep(I1 *flags="",I1 *index=NULL)
|
||||
{
|
||||
HashRep(Fs->hash_table,HTT_GLBL_VAR,NULL,flags,0,index);
|
||||
}
|
||||
|
||||
public void HClassesRep(I1 *flags="-p",I1 *index=NULL)
|
||||
{
|
||||
HashRep(Fs->hash_table,HTT_CLASS,NULL,flags,0,index);
|
||||
}
|
||||
|
||||
public void HDefinesRep(I1 *flags="-p",I1 *index=NULL)
|
||||
{
|
||||
HashRep(Fs->hash_table,HTT_STR_CONST,NULL,flags,0,index);
|
||||
}
|
||||
|
||||
public void HSymsRep(I1 *flags="-p",I1 *index=NULL)
|
||||
{
|
||||
HashRep(Fs->hash_table,HTT_SYS_SYMBOL,NULL,flags,0,index);
|
||||
}
|
||||
|
||||
public void HSysTextsRep(I1 *flags="-p",I1 *index=NULL)
|
||||
{
|
||||
HashRep(Fs->hash_table,HTT_SYSTEXT,NULL,flags,0,index);
|
||||
}
|
||||
|
||||
public void HAllRep(I1 *index=NULL)
|
||||
{
|
||||
HashRep(Fs->hash_table,HTT_ALL,NULL,"-p",0,index);
|
||||
}
|
||||
|
||||
public void LtfHelpIndex(Ltf *l,I1 *index)
|
||||
{
|
||||
HashRep(Fs->hash_table,HTT_ALL,NULL,NULL,0,index,l);
|
||||
}
|
||||
|
||||
public void PopUpHelpIndex(I1 *index,TssStruct *parent=NULL)
|
||||
{
|
||||
I1 *buf;
|
||||
buf=MSPrintF("LtfHelpIndex(Fs->cur_ltf,\"%s\");View;",index);
|
||||
PopUp(buf,parent);
|
||||
Free(buf);
|
||||
}
|
||||
|
||||
#help_index "Hash"
|
||||
public void LoadMapFile(I1 *filename)
|
||||
{
|
||||
I1 *st,*name=DefaultExtension(filename,"MPZ");
|
||||
I1 *absname=AbsoluteFileName(name);
|
||||
Ltf *l=LtfRead(name);
|
||||
LtfEntry *cl;
|
||||
SysHashEntry *temph;
|
||||
U8 i,j,base=0;
|
||||
DbgInfo *dbg;
|
||||
|
||||
RemoveLastSeg(absname,".");
|
||||
if (absname[1]==':' && StrLen(absname)>2) {
|
||||
temph=FindLocalHash(absname+2,HTT_MODULE);
|
||||
if (temph)
|
||||
base=temph->user_data0;
|
||||
}
|
||||
|
||||
if (!l) return;
|
||||
cl=l->dummy.next;
|
||||
while (cl!=l) {
|
||||
if (cl->btype==LTFT_LINK) {
|
||||
st=MStrUtil(cl->display,SU_REMOVE_TRAILING);
|
||||
if (temph=FindLocalHash(st,HTT_ALL)) {
|
||||
Free(temph->source_link);
|
||||
temph->source_link=cl->aux_str;
|
||||
cl->aux_str=NULL;
|
||||
dbg=temph->debug;
|
||||
if (!dbg && cl->bin_data) {
|
||||
dbg=cl->bin_data->data;
|
||||
if (dbg) {
|
||||
if (cl->bin_data->size>MSize(dbg))
|
||||
coutln "Corrupt Map Entry";
|
||||
else {
|
||||
cl->bin_data->data=NULL;
|
||||
temph->debug=dbg;
|
||||
for (i=dbg->min_line;i<=dbg->max_line+1;i++) {
|
||||
j=i-dbg->min_line;
|
||||
if (dbg->body[j])
|
||||
dbg->body[j]=dbg->body[j]+base;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Free(st);
|
||||
}
|
||||
cl=cl->next;
|
||||
}
|
||||
LtfDel(l);
|
||||
Free(name);
|
||||
Free(absname);
|
||||
}
|
||||
#help_index ""
|
||||
@@ -1,3 +1,5 @@
|
||||
#help_index "Compression"
|
||||
|
||||
#define ICT_U2 1
|
||||
#define ICT_U4 2
|
||||
#define ICT_U8 3
|
||||
@@ -35,7 +37,7 @@ class IntermediateIncCompressStruct
|
||||
void IncCompressRange(U1 *ref,U8 ref_size,U1 *b,U8 range_start,U8 range_end,
|
||||
IntermediateIncCompressStruct *root,U8 type_size)
|
||||
{
|
||||
I8 i,j,k,l,best_k=0,best_j,best_i;
|
||||
I8 i,j,k,n,best_k=0,best_j,best_i;
|
||||
IntermediateIncCompressStruct *tempc;
|
||||
|
||||
//$BK,1$TODO: improve this algorithm$BK,0$
|
||||
@@ -43,8 +45,8 @@ void IncCompressRange(U1 *ref,U8 ref_size,U1 *b,U8 range_start,U8 range_end,
|
||||
for (i=range_start;i<range_end;i++) {
|
||||
for (j=0;j<ref_size;j++) {
|
||||
k=0;
|
||||
l=(ref_size-j<range_end-i) ? ref_size-j:range_end-i;
|
||||
while (ref[j+k]==b[i+k] && k<l)
|
||||
n=(ref_size-j<range_end-i) ? ref_size-j:range_end-i;
|
||||
while (ref[j+k]==b[i+k] && k<n)
|
||||
k++;
|
||||
if (k>best_k) {
|
||||
best_k=k;
|
||||
@@ -68,6 +70,10 @@ void IncCompressRange(U1 *ref,U8 ref_size,U1 *b,U8 range_start,U8 range_end,
|
||||
|
||||
|
||||
public IncCompressStructU2 *IncCompress(U1 *ref,U8 ref_size,U1 *b,U8 size)
|
||||
//This is for incremental compression.
|
||||
//In theory it works when only a few
|
||||
//changes have been made. Might be
|
||||
//better just to stick with $LK,"CompressBuf","MN:CompressBuf"$().
|
||||
{
|
||||
U8 i,j=0,l=0,m=0,ic_type;
|
||||
U1 *u1,*result;
|
||||
@@ -302,3 +308,4 @@ public U1 *IncExpand(U1 *ref,IncCompressStructU2 *b,U8 *size=NULL)
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#help_index ""
|
||||
@@ -1,10 +1,15 @@
|
||||
#help_index "Input Pointer"
|
||||
#help_file "::/LT/Doc/InputPointer.TXZ"
|
||||
|
||||
#define IP_NULL 0
|
||||
#define IP_JOYSTICK0 1
|
||||
#define IP_JOYSTICK1 2
|
||||
#define IP_MOUSE 3
|
||||
|
||||
public I8 ipx=-100,ipy=-100,ipz=0;
|
||||
public I8 ip_speed=0;
|
||||
public I8 ipx=0,ipy=0,ipz=0,ip_throttle=0;
|
||||
public I8 ipx_snap=1,ipy_snap=1,ipz_snap=1;
|
||||
public I8 ipx_snap_offset=0,ipy_snap_offset=0,ipz_snap_offset=0;
|
||||
public double ip_speed=0;
|
||||
public I8 ip_pointer_type=IP_NULL;
|
||||
public I8 iptx=ipx/FONT_WIDTH,ipty=ipy/FONT_HEIGHT;
|
||||
public BoolU4 ip_on=TRUE, //Show or hide cursor
|
||||
@@ -12,3 +17,5 @@ public BoolU4 ip_on=TRUE, //Show or hide cursor
|
||||
ip_lb=FALSE,ip_cb=FALSE,ip_rb=FALSE; //Left/center/right buttons
|
||||
public BoolU4 ip_has_wheel=FALSE;
|
||||
public LTDate last_ip_move_time=BootTime;
|
||||
|
||||
#help_index ""
|
||||
Binary file not shown.
@@ -0,0 +1,738 @@
|
||||
time_stamp_freq=SYS_TIMER_FREQ*(
|
||||
GetTimeStamp-time_stamp_start)/
|
||||
(ReadSysTimer-sys_timer_start);
|
||||
time_stamp_kHz_freq=time_stamp_freq/1000;
|
||||
|
||||
|
||||
#help_index "Char/Input"
|
||||
|
||||
U8Fifo *scan_code_fifo=NewU8Fifo(128);
|
||||
|
||||
U8 last_down_scan_code=0;
|
||||
|
||||
void KbdCmdSend(U8 port, U1 val,BoolU4 *btimeout=NULL)
|
||||
{
|
||||
LTDate timeout=BootTime+LTDATE_FREQ/10;
|
||||
do {
|
||||
if (!(InP(KEYB_CTRL)&2)) {
|
||||
timeout=0;
|
||||
break;
|
||||
}
|
||||
} while (BootTime<timeout);
|
||||
if (!timeout) {
|
||||
OutP(port, val);
|
||||
if (btimeout) *btimeout=FALSE;
|
||||
} else
|
||||
if (btimeout) *btimeout=TRUE;
|
||||
}
|
||||
|
||||
I8 KbdCmdRead(BoolU4 *btimeout=NULL)
|
||||
{
|
||||
LTDate timeout=BootTime+LTDATE_FREQ/10;
|
||||
do {
|
||||
if (InP(KEYB_CTRL) & 1) {
|
||||
if (btimeout) *btimeout=FALSE;
|
||||
return InP(KEYB_PORT);
|
||||
}
|
||||
} while (BootTime<timeout);
|
||||
if (btimeout) *btimeout=TRUE;
|
||||
return -1;
|
||||
}
|
||||
|
||||
void KbdCmdFlush(I8 Hz=50)
|
||||
{
|
||||
LTDate timeout;
|
||||
if (Hz) {
|
||||
timeout=BootTime+LTDATE_FREQ/Hz;
|
||||
do InP(KEYB_PORT);
|
||||
while (BootTime<timeout);
|
||||
} else
|
||||
while (InP(KEYB_CTRL)&1)
|
||||
InP(KEYB_PORT);
|
||||
}
|
||||
|
||||
void KbdSetLEDs(U8 sc)
|
||||
{
|
||||
BoolU4 old_preempt=Preempt(OFF);
|
||||
U1 v=0;
|
||||
AssignBit(&v,0,Bt(&sc,SCf_SCROLL));
|
||||
AssignBit(&v,1,Bt(&sc,SCf_NUM));
|
||||
AssignBit(&v,2,Bt(&sc,SCf_CAPS));
|
||||
KbdCmdSend(KEYB_PORT,0xED);
|
||||
KbdCmdSend(KEYB_PORT,v);
|
||||
Preempt(old_preempt);
|
||||
}
|
||||
|
||||
void KbdMouseCmdAck(U1 val,BoolU4 *btimeout=NULL)
|
||||
{
|
||||
U8 timeout=5;
|
||||
BoolU4 my_btimeout=FALSE;
|
||||
do {
|
||||
KbdCmdSend(KEYB_CTRL,0xD4,&my_btimeout);
|
||||
if (my_btimeout) goto here;
|
||||
KbdCmdSend(KEYB_PORT,val,&my_btimeout);
|
||||
if (my_btimeout) goto here;
|
||||
if (KbdCmdRead==0xFA)
|
||||
break;
|
||||
here:
|
||||
if (my_btimeout)
|
||||
KbdCmdFlush;
|
||||
} while (--timeout);
|
||||
if (timeout) {
|
||||
if (btimeout) *btimeout=FALSE;
|
||||
} else {
|
||||
if (btimeout) *btimeout=TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
I1 ScanCodeToASCII(U8 sc)
|
||||
{
|
||||
I1 *table=NORMAL_KEY_SCAN_DECODE_TABLE;
|
||||
if (sc & SCF_E0_PREFIX)
|
||||
return 0;
|
||||
if (sc & SCF_CTRL)
|
||||
table=CTRL_KEY_SCAN_DECODE_TABLE;
|
||||
else if (sc & SCF_SHIFT) {
|
||||
if (!(sc & SCF_CAPS))
|
||||
table=SHIFT_KEY_SCAN_DECODE_TABLE;
|
||||
} else {
|
||||
if (sc & SCF_CAPS)
|
||||
table=SHIFT_KEY_SCAN_DECODE_TABLE;
|
||||
}
|
||||
sc&=0x7F;
|
||||
if (sc>=0x50)
|
||||
return 0;
|
||||
else
|
||||
return table[sc];
|
||||
}
|
||||
|
||||
U1 scan_code_map[0x100]={
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,SC_SHIFT,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,SC_CR,SC_CTRL,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0x35,0,0,SC_ALT,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,SC_HOME,SC_CURSOR_UP,SC_PAGE_UP,0,SC_CURSOR_LEFT,0,SC_CURSOR_RIGHT,0,SC_END,
|
||||
SC_CURSOR_DOWN,SC_PAGE_DOWN,SC_INSERT,SC_DELETE,0,0,0,0,0,0,0,0,SC_GUI,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
};
|
||||
|
||||
|
||||
U1 num_lock_map[0x100]={
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,8,9,10,0,5,6,7,0,2,
|
||||
3,4,11,0x34,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,SC_CR,SC_CTRL,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0x35,0,0,SC_ALT,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,SC_HOME,SC_CURSOR_UP,SC_PAGE_UP,0,SC_CURSOR_LEFT,0,SC_CURSOR_RIGHT,0,SC_END,
|
||||
SC_CURSOR_DOWN,SC_PAGE_DOWN,SC_INSERT,SC_DELETE,0,0,0,0,0,0,0,0,SC_GUI,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
};
|
||||
|
||||
|
||||
|
||||
public void SetTypeMatic(U1 delay)
|
||||
{
|
||||
KbdCmdSend(KEYB_CTRL,0xA7); //Disable Mouse
|
||||
KbdCmdSend(KEYB_CTRL,0xAE); //Enable Keyboard
|
||||
KbdCmdSend(KEYB_PORT,0xF3);
|
||||
KbdCmdSend(KEYB_PORT,delay); //Typematic rate
|
||||
KbdCmdSend(KEYB_CTRL,0xA8); //Enable Mouse
|
||||
}
|
||||
|
||||
#help_index "Char/Conversion"
|
||||
|
||||
public I1 *ASCIIToKeyName(I8 ch,BoolU4 include_ctrl=TRUE)
|
||||
{
|
||||
I8 i;
|
||||
I1 buf[64];
|
||||
*buf=0;
|
||||
if (ch) {
|
||||
if (ch<26) {
|
||||
if (ch==CH_CR)
|
||||
StrCat(buf,"ENTER");
|
||||
else if (ch==CH_ESC)
|
||||
StrCat(buf,"ESC");
|
||||
else if (ch==CH_BACKSPACE)
|
||||
StrCat(buf,"BACKSPACE");
|
||||
else if (ch==CH_TAB)
|
||||
StrCat(buf,"TAB");
|
||||
else if (ch==CH_CURSOR)
|
||||
StrCat(buf,"CURSOR");
|
||||
else {
|
||||
if (include_ctrl)
|
||||
StrCat(buf,"CTRL ");
|
||||
buf[i=StrLen(buf)]=ch-1+'A';
|
||||
buf[i+1]=0;
|
||||
}
|
||||
} else if (Bt(printable_chars_bitmap,ch)) {
|
||||
if (ch==CH_SPACE)
|
||||
StrCat(buf,"SPACE");
|
||||
else if (ch==CH_SHIFT_SPACE)
|
||||
StrCat(buf,"SHIFT_SPACE");
|
||||
else {
|
||||
buf[i=StrLen(buf)]=ch;
|
||||
buf[i+1]=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
return NewStr(buf);
|
||||
}
|
||||
|
||||
public I1 *ScanCodeToKeyName(I8 sc)
|
||||
{
|
||||
I8 ch=ScanCodeToASCII(sc);
|
||||
I1 buf[64],*st;
|
||||
*buf=0;
|
||||
if (sc&SCF_CTRL)
|
||||
StrCat(buf,"CTRL ");
|
||||
if (sc&SCF_ALT)
|
||||
StrCat(buf,"ALT ");
|
||||
if (sc&SCF_SHIFT)
|
||||
StrCat(buf,"SHIFT ");
|
||||
if (ch) {
|
||||
st=ASCIIToKeyName(ch,FALSE);
|
||||
StrCpy(buf+StrLen(buf),st);
|
||||
Free(st);
|
||||
} else {
|
||||
switch (sc.u1[0]) {
|
||||
case SC_BACKSPACE:StrCat(buf,"BACK"); break;
|
||||
case SC_CAPS: StrCat(buf,"CAPS"); break;
|
||||
case SC_NUM: StrCat(buf,"NUM"); break;
|
||||
case SC_SCROLL: StrCat(buf,"SCROLL"); break;
|
||||
case SC_CURSOR_UP:StrCat(buf,"UP"); break;
|
||||
case SC_CURSOR_DOWN:StrCat(buf,"DOWN"); break;
|
||||
case SC_CURSOR_LEFT:StrCat(buf,"LEFT"); break;
|
||||
case SC_CURSOR_RIGHT:StrCat(buf,"RIGHT"); break;
|
||||
case SC_PAGE_UP:StrCat(buf,"PAGE_UP"); break;
|
||||
case SC_PAGE_DOWN:StrCat(buf,"PAGE_DOWN"); break;
|
||||
case SC_HOME: StrCat(buf,"HOME"); break;
|
||||
case SC_END: StrCat(buf,"END"); break;
|
||||
case SC_INSERT: StrCat(buf,"INSERT"); break;
|
||||
case SC_DELETE: StrCat(buf,"DELETE"); break;
|
||||
case SC_F1: StrCat(buf,"F1"); break;
|
||||
case SC_F2: StrCat(buf,"F2"); break;
|
||||
case SC_F3: StrCat(buf,"F3"); break;
|
||||
case SC_F4: StrCat(buf,"F4"); break;
|
||||
case SC_F5: StrCat(buf,"F5"); break;
|
||||
case SC_F6: StrCat(buf,"F6"); break;
|
||||
case SC_F7: StrCat(buf,"F7"); break;
|
||||
case SC_F8: StrCat(buf,"F8"); break;
|
||||
case SC_F9: StrCat(buf,"F9"); break;
|
||||
case SC_F10: StrCat(buf,"F10"); break;
|
||||
case SC_F11: StrCat(buf,"F11"); break;
|
||||
case SC_F12: StrCat(buf,"F12"); break;
|
||||
case SC_GUI: StrCat(buf,"WINDOWS"); break;
|
||||
case SC_PRTSCRN1: StrCat(buf,"PRTSCRN1"); break;
|
||||
case SC_PRTSCRN2: StrCat(buf,"PRTSCRN2"); break;
|
||||
}
|
||||
}
|
||||
return NewStr(buf);
|
||||
}
|
||||
|
||||
|
||||
#help_index "Training"
|
||||
|
||||
I8 display_keys_row=TEXT_ROWS/2;
|
||||
public BoolU4 kbd_display_special_keys=FALSE;
|
||||
|
||||
void DisplayKeysPopUp()
|
||||
{
|
||||
I8 i;
|
||||
I1 *st;
|
||||
InitLocalTask;
|
||||
Fs->win_left=TEXT_COLS/2-8;
|
||||
Fs->win_top=display_keys_row;
|
||||
Fs->win_right=TEXT_COLS/2+8;
|
||||
Fs->win_bottom=Fs->win_top;
|
||||
Fs->text_attribute=(YELLOW<<4)+BLACK;
|
||||
Fs->border_attribute=(YELLOW<<4)+BLACK;
|
||||
Btr(&Fs->crt_flags,CRTf_HAS_CLOSE_WIN);
|
||||
UseConsoleLtf(NULL);
|
||||
Fs->cur_ltf->flags&=~LTFF_ATTR_BY_PARTITION;
|
||||
Fs->aux_ltf->flags&=~LTFF_ATTR_BY_PARTITION;
|
||||
Fs->cur_ltf->start_text_attribute=(YELLOW<<4)+BLACK;
|
||||
Fs->aux_ltf->start_text_attribute=(YELLOW<<4)+BLACK;
|
||||
st=ScanCodeToKeyName(last_down_scan_code);
|
||||
PrintF("%s",st);
|
||||
Free(st);
|
||||
LtfRecalc(Fs->cur_ltf);
|
||||
Bts(&Fs->crt_flags,CRTf_SHOW);
|
||||
|
||||
display_keys_row+=4;
|
||||
for (i=0;i<1000;i++) {
|
||||
WinToTop(Fs);
|
||||
Sleep(1);
|
||||
}
|
||||
display_keys_row-=4;
|
||||
}
|
||||
|
||||
void DisplaySpecialKeys(I8 sc)
|
||||
{
|
||||
I8 ch;
|
||||
if (!(sc&SCF_KEY_UP) &&
|
||||
sc&SCF_NEW_KEY ) {
|
||||
ch=ScanCodeToASCII(sc);
|
||||
if (!ch || (ch<CH_SPACE+1 && ch!=CH_CR && ch!=CH_ESC) ||
|
||||
sc & (SCF_ALT|SCF_CTRL)) {
|
||||
switch (sc.u1[0]) {
|
||||
case SC_CTRL:
|
||||
case SC_ALT:
|
||||
case SC_SHIFT:
|
||||
break;
|
||||
case SC_BACKSPACE:
|
||||
case SC_INSERT:
|
||||
case SC_DELETE:
|
||||
case SC_CURSOR_UP:
|
||||
case SC_CURSOR_DOWN:
|
||||
case SC_CURSOR_LEFT:
|
||||
case SC_CURSOR_RIGHT:
|
||||
case SC_PAGE_UP:
|
||||
case SC_PAGE_DOWN:
|
||||
if (sc&(SCF_CTRL|SCF_ALT|SCF_SHIFT))
|
||||
Spawn(&DisplayKeysPopUp,"DISPLAY KEY");
|
||||
break;
|
||||
default:
|
||||
Spawn(&DisplayKeysPopUp,"DISPLAY KEY");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#help_index "Char/Input"
|
||||
void InitKbd()
|
||||
{
|
||||
sys_cur_scan_code=0;
|
||||
KbdCmdFlush;
|
||||
KbdCmdSend(KEYB_CTRL,0xA7); //Disable Mouse
|
||||
KbdCmdSend(KEYB_CTRL,0xAE); //Enable Keyboard
|
||||
KbdCmdSend(KEYB_PORT,0xF0);
|
||||
KbdCmdSend(KEYB_PORT,0x02);
|
||||
KbdSetLEDs(sys_cur_scan_code);
|
||||
Btr(&sys_semas[SYS_SEMA_KEY_PRESSED],0);
|
||||
OutP(0x21,InP(0x21)&~2);
|
||||
}
|
||||
|
||||
void KbdHandler()
|
||||
{
|
||||
U8 ch,sc,sc2=0,sc3,sc_raw;
|
||||
|
||||
U1FifoRemove(kbdmouse_fifo,&sc2);
|
||||
if (sc2==0xE0) {
|
||||
U1FifoRemove(kbdmouse_fifo,&sc2);
|
||||
AssignBit(&sc2,SCf_KEY_UP,sc2 & 0x80);
|
||||
Bts(&sc2,SCf_E0_PREFIX);
|
||||
} else {
|
||||
AssignBit(&sc2,SCf_KEY_UP,sc2 & 0x80);
|
||||
Btr(&sc2,SCf_E0_PREFIX);
|
||||
}
|
||||
|
||||
sc=sys_cur_scan_code.u4[0]&~0x1FF;
|
||||
sc_raw=sc2;
|
||||
if (sc & SCF_NUM) {
|
||||
if (sc3=num_lock_map[sc2.u1[0]])
|
||||
sc2.u1[0]=sc3;
|
||||
} else {
|
||||
if (sc3=scan_code_map[sc2.u1[0]])
|
||||
sc2.u1[0]=sc3;
|
||||
}
|
||||
if (sc2==SC_SHIFT) {
|
||||
sc|=SCF_SHIFT;
|
||||
goto new_key_done;
|
||||
}
|
||||
if (sc2==SC_SHIFT+SCF_KEY_UP) {
|
||||
sc&=~SCF_SHIFT;
|
||||
goto new_key_done;
|
||||
}
|
||||
|
||||
if (sc2==SC_CTRL) {
|
||||
sc|=SCF_CTRL;
|
||||
goto new_key_done;
|
||||
}
|
||||
if (sc2==SC_CTRL+SCF_KEY_UP) {
|
||||
sc&=~SCF_CTRL;
|
||||
goto new_key_done;
|
||||
}
|
||||
|
||||
if (sc2==SC_ALT) {
|
||||
sc|=SCF_ALT;
|
||||
goto new_key_done;
|
||||
}
|
||||
if (sc2==SC_ALT+SCF_KEY_UP) {
|
||||
sc&=~SCF_ALT;
|
||||
goto new_key_done;
|
||||
}
|
||||
|
||||
if (sc2==SC_CAPS)
|
||||
goto new_key_done;
|
||||
if (sc2==SC_CAPS+SCF_KEY_UP) {
|
||||
sc^=SCF_CAPS;
|
||||
KbdSetLEDs(sc);
|
||||
goto new_key_done;
|
||||
}
|
||||
|
||||
if (sc2==SC_NUM)
|
||||
goto new_key_done;
|
||||
if (sc2==SC_NUM+SCF_KEY_UP) {
|
||||
sc^=SCF_NUM;
|
||||
KbdSetLEDs(sc);
|
||||
goto new_key_done;
|
||||
}
|
||||
|
||||
if (sc2==SC_SCROLL)
|
||||
goto new_key_done;
|
||||
if (sc2==SC_SCROLL+SCF_KEY_UP) {
|
||||
sc^=SCF_SCROLL;
|
||||
KbdSetLEDs(sc);
|
||||
goto new_key_done;
|
||||
}
|
||||
|
||||
if (sc & SCF_CTRL && sc & SCF_ALT) {
|
||||
if (sc2==SC_DELETE) {
|
||||
Bts(sys_flags,SYSf_CTRL_ALT_DEL);
|
||||
goto mostly_done;
|
||||
}
|
||||
if (sc2==1) {
|
||||
Bts(sys_flags,SYSf_CTRL_ALT_ESC);
|
||||
goto mostly_done;
|
||||
}
|
||||
if (sc2==15) {
|
||||
Bts(sys_flags,SYSf_CTRL_ALT_TAB);
|
||||
goto mostly_done;
|
||||
}
|
||||
if (!(sc2 & SCF_KEY_UP)) {
|
||||
if (ch=ScanCodeToASCII(sc2&0xFF)) {
|
||||
if (ch>='a' && ch<='z') {
|
||||
if (ctrl_alt_letter_routines[ch-'a']) {
|
||||
CallInd(ctrl_alt_letter_routines[ch-'a']);
|
||||
goto mostly_done;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
new_key_done:
|
||||
sc|=SCF_NEW_KEY;
|
||||
mostly_done:
|
||||
sys_cur_scan_code=sc|sc2|
|
||||
(sc|sc_raw)<<32;
|
||||
|
||||
if (kbd_display_special_keys)
|
||||
DisplaySpecialKeys(sys_cur_scan_code);
|
||||
if (Btr(&sys_cur_scan_code,SCf_NEW_KEY)) {
|
||||
Btr(&sys_cur_scan_code,32+SCf_NEW_KEY);
|
||||
U8FifoInsert(scan_code_fifo,sys_cur_scan_code);
|
||||
if (!(sys_cur_scan_code&SCF_KEY_UP))
|
||||
last_down_scan_code=sys_cur_scan_code;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#help_index "Input Pointer"
|
||||
public double mxx_scale=0.5,
|
||||
myy_scale=0.5,
|
||||
mzz_scale=1.0;
|
||||
|
||||
public I8 mxx_prescale=GR_WIDTH/mxx_scale/2.0,
|
||||
myy_prescale=GR_HEIGHT/myy_scale/2.0,
|
||||
mzz_prescale=0/mzz_scale;
|
||||
|
||||
public I8 mxx=GR_WIDTH>>1,
|
||||
myy=GR_HEIGHT>>1,
|
||||
mzz=0;
|
||||
|
||||
BoolU4 mouse_buttons[5];
|
||||
|
||||
BoolU4 mouse_installed=FALSE;
|
||||
U8 mouse_install_attempts=0;
|
||||
BoolU4 mouse_has_wheel=FALSE;
|
||||
BoolU4 mouse_has_ext_buttons=FALSE;
|
||||
BoolU4 mouse_evt=FALSE;
|
||||
BoolU4 mouse_irqs_working=FALSE;
|
||||
|
||||
U8 mouse_pkt_size=3;
|
||||
|
||||
BoolU8 MouseGetDeviceType()
|
||||
{
|
||||
BoolU4 my_btimeout;
|
||||
U1 b;
|
||||
KbdMouseCmdAck(0xF2,&my_btimeout);
|
||||
if (my_btimeout)
|
||||
return FALSE;
|
||||
b=KbdCmdRead;
|
||||
if (b==3)
|
||||
mouse_has_wheel=TRUE;
|
||||
else if (b==4)
|
||||
mouse_has_ext_buttons=TRUE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BoolU8 MouseReset()
|
||||
{
|
||||
I8 i;
|
||||
BoolU4 my_btimeout,result=FALSE;
|
||||
|
||||
mouse_has_wheel=FALSE;
|
||||
mouse_has_ext_buttons=FALSE;
|
||||
|
||||
KbdCmdFlush;
|
||||
KbdCmdSend(KEYB_CTRL,0xAD,&my_btimeout); //Disable Kbd
|
||||
if (my_btimeout) goto done;
|
||||
KbdCmdSend(KEYB_CTRL,0xA8,&my_btimeout); //Enable Mouse
|
||||
if (my_btimeout) goto done;
|
||||
|
||||
KbdMouseCmdAck(0xFF,&my_btimeout); //Reset
|
||||
if (my_btimeout) goto done;
|
||||
|
||||
for (i=0;i<250;i++) {
|
||||
KbdCmdRead(&my_btimeout);
|
||||
if (!my_btimeout)
|
||||
break;
|
||||
}
|
||||
KbdCmdRead(&my_btimeout);
|
||||
|
||||
KbdMouseCmdAck(0xF3,&my_btimeout);
|
||||
if (my_btimeout) goto done;
|
||||
KbdMouseCmdAck(200,&my_btimeout);
|
||||
if (my_btimeout) goto done;
|
||||
KbdMouseCmdAck(0xF3,&my_btimeout); // enable Mouse
|
||||
if (my_btimeout) goto done;
|
||||
KbdMouseCmdAck(100,&my_btimeout); // Set Rate
|
||||
if (my_btimeout) goto done;
|
||||
KbdMouseCmdAck(0xF3,&my_btimeout);
|
||||
if (my_btimeout) goto done;
|
||||
KbdMouseCmdAck(80,&my_btimeout); //Resolution
|
||||
if (my_btimeout) goto done;
|
||||
if (!MouseGetDeviceType) goto done; // enable Mouse
|
||||
|
||||
KbdMouseCmdAck(0xF3,&my_btimeout);
|
||||
if (my_btimeout) goto done;
|
||||
KbdMouseCmdAck(10,&my_btimeout);
|
||||
if (my_btimeout) goto done;
|
||||
if (!MouseGetDeviceType) goto done; // enable Mouse
|
||||
|
||||
KbdMouseCmdAck(0xE8,&my_btimeout); //Resolution
|
||||
if (my_btimeout) goto done;
|
||||
KbdMouseCmdAck(0x03,&my_btimeout);
|
||||
if (my_btimeout) goto done;
|
||||
KbdMouseCmdAck(0xE6,&my_btimeout);
|
||||
if (my_btimeout) goto done;
|
||||
|
||||
KbdMouseCmdAck(0xF3,&my_btimeout); // Set Rate
|
||||
if (my_btimeout) goto done;
|
||||
KbdMouseCmdAck(100,&my_btimeout);
|
||||
if (my_btimeout) goto done;
|
||||
|
||||
KbdMouseCmdAck(0xF4,&my_btimeout); // enable Mouse
|
||||
if (my_btimeout) goto done;
|
||||
result=TRUE;
|
||||
done:
|
||||
KbdCmdSend(KEYB_CTRL,0xAE); //Enable Keyboard
|
||||
if (mouse_has_wheel || mouse_has_ext_buttons)
|
||||
mouse_pkt_size=4;
|
||||
else
|
||||
mouse_pkt_size=3;
|
||||
if (!result)
|
||||
KbdCmdSend(KEYB_CTRL,0xA7); //Disable Mouse
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void MouseHandler()
|
||||
{
|
||||
I8 i,dx,dy,dz,old_x=mxx,old_y=myy,old_z=mzz;
|
||||
U1 mouse_buf[4];
|
||||
BoolU4 old_buttons[5];
|
||||
|
||||
for (i=0;i<5;i++)
|
||||
old_buttons[i]=mouse_buttons[i];
|
||||
|
||||
for (i=0;i<4;i++)
|
||||
if (!U1FifoRemove(kbdmouse_fifo,&mouse_buf[i]))
|
||||
mouse_buf[i]=0;
|
||||
|
||||
mouse_buttons[0] = mouse_buf[0] & 1;
|
||||
mouse_buttons[1] = (mouse_buf[0] & 2) >> 1;
|
||||
mouse_buttons[2] = (mouse_buf[0] & 4) >> 2;
|
||||
mouse_buttons[3] = (mouse_buf[3] & 0x10) >> 4;
|
||||
mouse_buttons[4] = (mouse_buf[3] & 0x20) >> 5;
|
||||
if (mouse_buf[0] & 0x10)
|
||||
dx=mouse_buf[1]-256;
|
||||
else
|
||||
dx=mouse_buf[1];
|
||||
if (mouse_buf[0] & 0x20)
|
||||
dy=256-mouse_buf[2];
|
||||
else
|
||||
dy=-mouse_buf[2];
|
||||
if (mouse_buf[3] & 0x08)
|
||||
dz=(mouse_buf[3]&7)-8;
|
||||
else
|
||||
dz=mouse_buf[3]&7;
|
||||
|
||||
mxx_prescale+=dx;
|
||||
myy_prescale+=dy;
|
||||
mzz_prescale+=dz;
|
||||
|
||||
mxx=mxx_prescale*mxx_scale;
|
||||
myy=myy_prescale*myy_scale;
|
||||
mzz=mzz_prescale*mzz_scale;
|
||||
|
||||
if (mxx < 0) {
|
||||
mxx=0;
|
||||
mxx_prescale=0;
|
||||
}
|
||||
if (mxx>=GR_WIDTH) {
|
||||
mxx=GR_WIDTH-1;
|
||||
mxx_prescale=mxx/mxx_scale;
|
||||
}
|
||||
if (myy < 0) {
|
||||
myy=0;
|
||||
myy_prescale=0;
|
||||
}
|
||||
if (myy>=GR_HEIGHT) {
|
||||
myy=GR_HEIGHT-1;
|
||||
myy_prescale=myy/myy_scale;
|
||||
}
|
||||
if (mxx!=old_x||myy!=old_y||mzz!=old_z)
|
||||
mouse_evt=TRUE;
|
||||
else
|
||||
for (i=0;i<5;i++)
|
||||
if (mouse_buttons[i]!=old_buttons[i]) {
|
||||
mouse_evt=TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
U8 kbdmouse_timeout=0;
|
||||
|
||||
void ResetKbdMouse(I8 Hz=50)
|
||||
{
|
||||
Btr(&sys_semas[SYS_SEMA_KEY_PRESSED],0);
|
||||
KbdCmdFlush(Hz);
|
||||
U1FifoFlush(kbdmouse_fifo);
|
||||
U8FifoFlush(scan_code_fifo);
|
||||
kbdmouse_timeout=0;
|
||||
OutP(0x21,InP(0x21)&~2);
|
||||
}
|
||||
|
||||
BoolU8 InstallMouseDriver()
|
||||
{
|
||||
I8 i;
|
||||
Preempt(ON);
|
||||
mouse_installed=FALSE;
|
||||
for(i=0;i<5;i++)
|
||||
mouse_buttons[i]=0;
|
||||
if (MouseReset)
|
||||
mouse_installed=TRUE;
|
||||
ResetKbdMouse;
|
||||
mouse_install_attempts++;
|
||||
mouse_evt=mouse_installed;
|
||||
return mouse_installed;
|
||||
}
|
||||
|
||||
void HandleKbdMouse()
|
||||
{
|
||||
U1 i;
|
||||
if (U1FifoCnt(kbdmouse_fifo)) {
|
||||
if (kbdmouse_timeout &&
|
||||
GetTimeStamp>kbdmouse_timeout) {
|
||||
ResetKbdMouse;
|
||||
return;
|
||||
}
|
||||
if (Btr(&sys_semas[SYS_SEMA_KEY_PRESSED],0)) {
|
||||
while (U1FifoCnt(kbdmouse_fifo)) {
|
||||
if (U1FifoCnt(kbdmouse_fifo)==1) {
|
||||
U1FifoPeek(kbdmouse_fifo,&i);
|
||||
if (i==0xE0) {
|
||||
if (!kbdmouse_timeout)
|
||||
kbdmouse_timeout=GetTimeStamp+time_stamp_freq/50;
|
||||
Bts(&sys_semas[SYS_SEMA_KEY_PRESSED],0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
kbdmouse_timeout=0;
|
||||
KbdHandler;
|
||||
OutP(0x21,InP(0x21)&~2);
|
||||
}
|
||||
} else {
|
||||
if (!mouse_installed)
|
||||
U1FifoFlush(kbdmouse_fifo);
|
||||
else {
|
||||
if (U1FifoCnt(kbdmouse_fifo)>=mouse_pkt_size) {
|
||||
kbdmouse_timeout=0;
|
||||
mouse_evt_time=GetTimeStamp;
|
||||
while (U1FifoCnt(kbdmouse_fifo)>=mouse_pkt_size)
|
||||
MouseHandler;
|
||||
} else
|
||||
if (!kbdmouse_timeout)
|
||||
kbdmouse_timeout=GetTimeStamp+time_stamp_freq/50;
|
||||
}
|
||||
}
|
||||
} else
|
||||
kbdmouse_timeout=0;
|
||||
}
|
||||
|
||||
#define KBDMOUSE_POLL_RATE 500
|
||||
U8 last_kbdmouse_poll_time=GetTimeStamp;
|
||||
|
||||
extern void PollKbdMouse();
|
||||
|
||||
TssStruct *poll_kbdmouse_tss=NULL;
|
||||
|
||||
void PollKbdMouseTsk()
|
||||
{ //Poll for a minute
|
||||
I8 i;
|
||||
for (i=0;i<KBDMOUSE_POLL_RATE*60;i++) {
|
||||
PollKbdMouse();
|
||||
Sleep(1000/KBDMOUSE_POLL_RATE);
|
||||
}
|
||||
poll_kbdmouse_tss=NULL;
|
||||
}
|
||||
|
||||
void PollKbdMouse()
|
||||
{
|
||||
U8 poll_time=GetTimeStamp;
|
||||
if (poll_time-last_kbdmouse_poll_time<time_stamp_freq/KBDMOUSE_POLL_RATE)
|
||||
return;
|
||||
if (poll_time-last_kbdmouse_poll_time>time_stamp_freq/KBDMOUSE_POLL_RATE*4) {
|
||||
last_kbdmouse_poll_time=poll_time;
|
||||
ResetKbdMouse(0);
|
||||
if (!poll_kbdmouse_tss)
|
||||
poll_kbdmouse_tss=Spawn(&PollKbdMouseTsk,"Poll KbdMouse");
|
||||
} else {
|
||||
last_kbdmouse_poll_time=poll_time;
|
||||
while (InP(KEYB_CTRL)&1) {
|
||||
U1FifoInsert(kbdmouse_fifo,InP(KEYB_PORT));
|
||||
HandleKbdMouse;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#help_index ""
|
||||
|
||||
|
||||
InitKbd;
|
||||
Spawn(&InstallMouseDriver);
|
||||
Binary file not shown.
Binary file not shown.
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"
|
||||
| ||||