SparrowOSTS_121127.ISO
This commit is contained in:
1 parent
0e9364ff4c
commit
e57428affb
1218 files changed
+247142
-165507
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.
@@ -1,181 +0,0 @@
|
|||||||
//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);
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
/* 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);
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
$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$
|
|
||||||
@@ -1,181 +0,0 @@
|
|||||||
//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.
@@ -1,9 +0,0 @@
|
|||||||
// Create Pictures Here
|
|
||||||
|
|
||||||
void LoadUserPicWords()
|
|
||||||
{
|
|
||||||
//Call $LK,"AddPicWord","MN:AddPicWord"$()
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
LoadUserPicWords;
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
/*
|
|
||||||
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,176 +0,0 @@
|
|||||||
//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;
|
|
||||||
|
|
||||||
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);
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
Cd("::/LT/Apps/MusicOrgan");;
|
|
||||||
#include "Load";;
|
|
||||||
JukeBox("Examples");
|
|
||||||
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
UseConsoleLtf("User.MUZ");
|
|
||||||
PutSysText("ST_USER_STARTUP");
|
|
||||||
Type("::/LT/Doc/Help.TXZ");
|
|
||||||
Bts(&Fs->crt_flags,CRTf_SHOW);
|
|
||||||
Preempt(ON);
|
|
||||||
Binary file not shown.
@@ -1 +0,0 @@
|
|||||||
AutoFile("Tour");
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
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);
|
|
||||||
@@ -1,105 +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"
|
|
||||||
"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);
|
|
||||||
@@ -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;");
|
|
||||||
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);
|
|
||||||
|
|
||||||
@@ -1,110 +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 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
|
|
||||||
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
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);
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
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,37 +0,0 @@
|
|||||||
#help_index "Utils"
|
|
||||||
/*
|
|
||||||
This is the startup file for new local users.
|
|
||||||
|
|
||||||
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("User.MUZ");
|
|
||||||
|
|
||||||
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="+l-i")
|
|
||||||
{
|
|
||||||
return Grep(pattern,"/LT/"TEXT_FILE_MASK,flags,replace_text);
|
|
||||||
}
|
|
||||||
|
|
||||||
U8 FD(I1 *pattern,I1 *flags=NULL)
|
|
||||||
{
|
|
||||||
return Grep(pattern,TEXT_FILE_MASK,flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
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");
|
|
||||||
Fs->scroll_speed=10;
|
|
||||||
Bts(&Fs->crt_flags,CRTf_SHOW);
|
|
||||||
Preempt(ON);
|
|
||||||
#help_index ""
|
|
||||||
Binary file not shown.
@@ -1,2 +0,0 @@
|
|||||||
Type("::/LT/Doc/Customize.TXZ");
|
|
||||||
|
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
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"
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
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,543 +0,0 @@
|
|||||||
#help_index "File/CD DVD"
|
|
||||||
|
|
||||||
void FillBigEndianU2(U2 *dst,U2 w)
|
|
||||||
{
|
|
||||||
U2 *src=&w;
|
|
||||||
dst->u1[0]=src->u1[1];
|
|
||||||
dst->u1[1]=src->u1[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
void FillBigEndianU4(U4 *dst,U8 d)
|
|
||||||
{
|
|
||||||
U8 *src=&d;
|
|
||||||
dst->u1[0]=src->u1[3];
|
|
||||||
dst->u1[1]=src->u1[2];
|
|
||||||
dst->u1[2]=src->u1[1];
|
|
||||||
dst->u1[3]=src->u1[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
void FillU2Palindrome(U2Palindrome *dst,U2 w)
|
|
||||||
{
|
|
||||||
FillBigEndianU2(&dst->big,w);
|
|
||||||
dst->little=w;
|
|
||||||
}
|
|
||||||
|
|
||||||
void FillU4Palindrome(U4Palindrome *dst,U8 d)
|
|
||||||
{
|
|
||||||
FillBigEndianU4(&dst->big,d);
|
|
||||||
dst->little=d;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class CCdUserData
|
|
||||||
{
|
|
||||||
U8 location,path_entry_num,
|
|
||||||
short_dir_blks,long_dir_blks;
|
|
||||||
};
|
|
||||||
|
|
||||||
U8 DoCreateCDFile(LTFile *out_file,LTDirEntry *tempm,
|
|
||||||
ISODirEntry *tempi,ISODirEntry *tempi2,
|
|
||||||
U8 *cur_blk,
|
|
||||||
LTDirEntry *parent,BoolU4 write)
|
|
||||||
{
|
|
||||||
CCdUserData *tempc;
|
|
||||||
LTDirEntry *tempm1,*tempm2;
|
|
||||||
LTFile *in_file;
|
|
||||||
U1 *buf=MAlloc(CD_BLK_SIZE),*ptr1,*ptr2;
|
|
||||||
ISODirEntry *dir_blk_buf=MAllocZ(CD_BLK_SIZE*128),
|
|
||||||
*de=dir_blk_buf,*de1;
|
|
||||||
ISODirEntry *dir_blk_buf2=MAllocZ(CD_BLK_SIZE*128),
|
|
||||||
*de2=dir_blk_buf2,*de12;
|
|
||||||
U8 i,n;
|
|
||||||
|
|
||||||
tempc=parent->user_data;
|
|
||||||
|
|
||||||
de->length=sizeof(ISODirEntry)-1;
|
|
||||||
de->ext_attr_length=0;
|
|
||||||
FillU2Palindrome(&de->volume_sequence_num,1);
|
|
||||||
LTDateToISO(&de->date,tempm->datetime);
|
|
||||||
de->flags=ISO_ATTR_DIR;
|
|
||||||
de->name_len=1;
|
|
||||||
de->name=0;
|
|
||||||
de->length+=de->name_len;
|
|
||||||
de+=de->length;
|
|
||||||
|
|
||||||
de->length=sizeof(ISODirEntry)-1;
|
|
||||||
de->ext_attr_length=0;
|
|
||||||
FillU4Palindrome(&de->location,tempc->location);
|
|
||||||
FillU4Palindrome(&de->size,tempc->short_dir_blks*CD_BLK_SIZE);
|
|
||||||
FillU2Palindrome(&de->volume_sequence_num,1);
|
|
||||||
LTDateToISO(&de->date,parent->datetime);
|
|
||||||
de->flags=ISO_ATTR_DIR;
|
|
||||||
de->name_len=1;
|
|
||||||
de->name=1;
|
|
||||||
de->length+=de->name_len;
|
|
||||||
de+=de->length;
|
|
||||||
|
|
||||||
de2->length=sizeof(ISODirEntry)-1;
|
|
||||||
de2->ext_attr_length=0;
|
|
||||||
FillU2Palindrome(&de2->volume_sequence_num,1);
|
|
||||||
LTDateToISO(&de2->date,tempm->datetime);
|
|
||||||
de2->flags=ISO_ATTR_DIR;
|
|
||||||
de2->name_len=1;
|
|
||||||
de2->name=0;
|
|
||||||
de2->length=de2->length+de2->name_len;
|
|
||||||
de2+=de2->length;
|
|
||||||
|
|
||||||
de2->length=sizeof(ISODirEntry)-1;
|
|
||||||
de2->ext_attr_length=0;
|
|
||||||
FillU4Palindrome(&de2->location,tempc->location+tempc->short_dir_blks);
|
|
||||||
FillU4Palindrome(&de2->size,tempc->long_dir_blks*CD_BLK_SIZE);
|
|
||||||
FillU2Palindrome(&de2->volume_sequence_num,1);
|
|
||||||
LTDateToISO(&de2->date,parent->datetime);
|
|
||||||
de2->flags=ISO_ATTR_DIR;
|
|
||||||
de2->name_len=1;
|
|
||||||
de2->name=1;
|
|
||||||
de2->length+=de2->name_len;
|
|
||||||
de2+=de2->length;
|
|
||||||
|
|
||||||
tempm1=tempm->sub;
|
|
||||||
while (tempm1) {
|
|
||||||
tempm2=tempm1->next;
|
|
||||||
if (!write) tempm1->user_data=MAllocZ(sizeof(CCdUserData));
|
|
||||||
de1=de;
|
|
||||||
de12=de2;
|
|
||||||
if (tempm1->attr & LT_ATTR_DIR) {
|
|
||||||
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;
|
|
||||||
de->ext_attr_length=0;
|
|
||||||
FillU4Palindrome(&de->location,*cur_blk);
|
|
||||||
tempc->location=*cur_blk;
|
|
||||||
if (write)
|
|
||||||
coutln *cur_blk,":",tempm1->full_name;
|
|
||||||
FillU4Palindrome(&de->size,tempm1->size);
|
|
||||||
FillU2Palindrome(&de->volume_sequence_num,1);
|
|
||||||
LTDateToISO(&de->date,tempm1->datetime);
|
|
||||||
de->flags=0;
|
|
||||||
de->name_len=StrLen(tempm1->name);
|
|
||||||
StrCpy(&de->name,tempm1->name);
|
|
||||||
de->length=de->length+de->name_len;
|
|
||||||
de+=de->length;
|
|
||||||
|
|
||||||
de2->length=sizeof(ISODirEntry)-1;
|
|
||||||
de2->ext_attr_length=0;
|
|
||||||
FillU4Palindrome(&de2->location,*cur_blk);
|
|
||||||
FillU4Palindrome(&de2->size,tempm1->size);
|
|
||||||
FillU2Palindrome(&de2->volume_sequence_num,1);
|
|
||||||
LTDateToISO(&de2->date,tempm1->datetime);
|
|
||||||
de2->flags=0;
|
|
||||||
de2->name_len=StrLen(tempm1->name)<<1;
|
|
||||||
ptr1=&de2->name;
|
|
||||||
ptr2=&tempm1->name;
|
|
||||||
for (i=0;i<de2->name_len;i=i+2) {
|
|
||||||
ptr1++;
|
|
||||||
*ptr1++=*ptr2++;
|
|
||||||
}
|
|
||||||
de2->length+=de2->name_len;
|
|
||||||
de2+=de2->length;
|
|
||||||
|
|
||||||
in_file=FOpen(tempm1->full_name,"r");
|
|
||||||
for (i=0;i<(FSize(in_file)+CD_BLK_SIZE-1)/CD_BLK_SIZE;i++) {
|
|
||||||
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,n);
|
|
||||||
FWBlks(out_file,buf,(*cur_blk)<<2,n);
|
|
||||||
}
|
|
||||||
*cur_blk+=1;
|
|
||||||
}
|
|
||||||
FClose(in_file);
|
|
||||||
}
|
|
||||||
if ((de1-dir_blk_buf)/CD_BLK_SIZE!=
|
|
||||||
(de -dir_blk_buf)/CD_BLK_SIZE) {
|
|
||||||
i=de1->length;
|
|
||||||
MemCpy(buf,de1,i);
|
|
||||||
MemSet(de1,0,i);
|
|
||||||
de=dir_blk_buf+((de-dir_blk_buf)/CD_BLK_SIZE)*CD_BLK_SIZE;
|
|
||||||
MemCpy(de,buf,i);
|
|
||||||
de+=i;
|
|
||||||
}
|
|
||||||
if ((de12-dir_blk_buf2)/CD_BLK_SIZE!=
|
|
||||||
(de2 -dir_blk_buf2)/CD_BLK_SIZE) {
|
|
||||||
i=de12->length;
|
|
||||||
MemCpy(buf,de12,i);
|
|
||||||
MemSet(de12,0,i);
|
|
||||||
de2=dir_blk_buf2+((de2-dir_blk_buf2)/CD_BLK_SIZE)*CD_BLK_SIZE;
|
|
||||||
MemCpy(de2,buf,i);
|
|
||||||
de2+=i;
|
|
||||||
}
|
|
||||||
tempm1=tempm2;
|
|
||||||
}
|
|
||||||
|
|
||||||
tempc=tempm->user_data;
|
|
||||||
|
|
||||||
tempi->length=sizeof(ISODirEntry)-1;
|
|
||||||
tempi->ext_attr_length=0;
|
|
||||||
tempi->flags=ISO_ATTR_DIR;
|
|
||||||
if (!tempm->name[0]) {
|
|
||||||
tempi->name_len=1;
|
|
||||||
tempi->name=1;
|
|
||||||
} else {
|
|
||||||
tempi->name_len=StrLen(tempm->name);
|
|
||||||
StrCpy(&tempi->name,tempm->name);
|
|
||||||
}
|
|
||||||
tempi->length+=tempi->name_len;
|
|
||||||
|
|
||||||
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=n;
|
|
||||||
tempc->location=*cur_blk;
|
|
||||||
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,n<<2);
|
|
||||||
*cur_blk+=n;
|
|
||||||
|
|
||||||
tempi2->length=sizeof(ISODirEntry)-1;
|
|
||||||
tempi2->ext_attr_length=0;
|
|
||||||
tempi2->flags=ISO_ATTR_DIR;
|
|
||||||
if (!tempm->name[0]) {
|
|
||||||
tempi2->name_len=1;
|
|
||||||
tempi->name=1;
|
|
||||||
} else {
|
|
||||||
tempi2->name_len=StrLen(tempm->name)<<1;
|
|
||||||
ptr1=&tempi2->name;
|
|
||||||
ptr2=&tempm->name;
|
|
||||||
for (i=0;i<tempi2->name_len;i=i+2) {
|
|
||||||
ptr1++;
|
|
||||||
*ptr1++=*ptr2++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
tempi2->length+=tempi2->name_len;
|
|
||||||
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=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,n<<2);
|
|
||||||
*cur_blk+=n;
|
|
||||||
|
|
||||||
Free(dir_blk_buf);
|
|
||||||
Free(dir_blk_buf2);
|
|
||||||
Free(buf);
|
|
||||||
return tempi->name_len;
|
|
||||||
}
|
|
||||||
|
|
||||||
U8 CDTableLength(LTDirEntry *tempm,U8 *size1,U8 *size2,U8 cur_depth)
|
|
||||||
//returns depth
|
|
||||||
{
|
|
||||||
LTDirEntry *tempm1=tempm->sub;
|
|
||||||
U8 max_depth=cur_depth,i;
|
|
||||||
while (tempm1) {
|
|
||||||
if (tempm1->attr & LT_ATTR_DIR) {
|
|
||||||
*size1+=sizeof(ISOPathTableEntry)-2+((StrLen(tempm1->name)+1) & -0x2);
|
|
||||||
*size2+=sizeof(ISOPathTableEntry)-2+StrLen(tempm1->name)<<1;
|
|
||||||
i=CDTableLength(tempm1,size1,size2,cur_depth+1);
|
|
||||||
if (i>max_depth) max_depth=i;
|
|
||||||
}
|
|
||||||
tempm1=tempm1->next;
|
|
||||||
}
|
|
||||||
return max_depth;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CDFillPathTable(LTDirEntry *tempm,
|
|
||||||
ISOPathTableEntry *itabbuf,ISOPathTableEntry *itabbuf2,
|
|
||||||
U8 parent_entry_num,BoolU4 big_endian,U8 *first_free,I8 cur_level,I8 output_level)
|
|
||||||
{
|
|
||||||
I1 *ptr1,*ptr2;
|
|
||||||
U8 i;
|
|
||||||
ISOPathTableEntry *tabbuf=*itabbuf;
|
|
||||||
ISOPathTableEntry *tabbuf2=*itabbuf2;
|
|
||||||
LTDirEntry *tempm1=tempm->sub,*tempm2;
|
|
||||||
CCdUserData *tempc;
|
|
||||||
|
|
||||||
if (cur_level==output_level) {
|
|
||||||
while (tempm1) {
|
|
||||||
if (tempm1->attr & LT_ATTR_DIR) {
|
|
||||||
tempc=tempm1->user_data;
|
|
||||||
tempc->path_entry_num=*first_free;
|
|
||||||
tabbuf->name_len=StrLen(tempm1->name);
|
|
||||||
if (big_endian) {
|
|
||||||
FillBigEndianU4(&tabbuf->blk,tempc->location);
|
|
||||||
FillBigEndianU2(&tabbuf->parent_entry_num,parent_entry_num);
|
|
||||||
} else {
|
|
||||||
tabbuf->blk=tempc->location;
|
|
||||||
tabbuf->parent_entry_num=parent_entry_num;
|
|
||||||
}
|
|
||||||
StrCpy(&tabbuf->name,tempm1->name);
|
|
||||||
|
|
||||||
tabbuf+=sizeof(ISOPathTableEntry)-2+
|
|
||||||
((StrLen(tempm1->name)+1) & -0x2);
|
|
||||||
|
|
||||||
tabbuf2->name_len=StrLen(tempm1->name)<<1;
|
|
||||||
if (big_endian) {
|
|
||||||
FillBigEndianU4(&tabbuf2->blk,tempc->location+tempc->short_dir_blks);
|
|
||||||
FillBigEndianU2(&tabbuf2->parent_entry_num,parent_entry_num);
|
|
||||||
} else {
|
|
||||||
tabbuf2->blk=tempc->location+tempc->short_dir_blks;
|
|
||||||
tabbuf2->parent_entry_num=parent_entry_num;
|
|
||||||
}
|
|
||||||
ptr1=&tabbuf2->name;
|
|
||||||
ptr2=&tempm1->name;
|
|
||||||
for (i=0;i<tabbuf2->name_len;i=i+2) {
|
|
||||||
ptr1++;
|
|
||||||
*ptr1++=*ptr2++;
|
|
||||||
}
|
|
||||||
tabbuf2+=sizeof(ISOPathTableEntry)-2+
|
|
||||||
StrLen(tempm1->name)<<1;
|
|
||||||
*first_free+=1;
|
|
||||||
}
|
|
||||||
tempm1=tempm1->next;
|
|
||||||
}
|
|
||||||
*itabbuf=tabbuf;
|
|
||||||
*itabbuf2=tabbuf2;
|
|
||||||
}
|
|
||||||
tempm1=tempm->sub;
|
|
||||||
while (tempm1) {
|
|
||||||
tempm2=tempm1->next;
|
|
||||||
if (tempm1->attr & LT_ATTR_DIR) {
|
|
||||||
tempc=tempm1->user_data;
|
|
||||||
CDFillPathTable(tempm1,itabbuf,itabbuf2,tempc->path_entry_num,
|
|
||||||
big_endian,first_free,cur_level+1,output_level);
|
|
||||||
}
|
|
||||||
tempm1=tempm2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class ElTorito
|
|
||||||
{
|
|
||||||
U2 w[16];
|
|
||||||
U1 bootable; //88=bootable 00=not bootable
|
|
||||||
U1 media_type; //0=no emulation 4=hard disk
|
|
||||||
U2 load_seg; //0000->07C0
|
|
||||||
U1 sys_type;
|
|
||||||
U1 zero;
|
|
||||||
U2 sector_cnt;
|
|
||||||
U4 load_rba; //start address of virtual disk
|
|
||||||
U1 zero2[20];
|
|
||||||
};
|
|
||||||
|
|
||||||
public U8 CreateCDFile(I1 *filename,I1 src_drive,
|
|
||||||
I1 *bootfile=NULL)
|
|
||||||
{
|
|
||||||
ISOPrimaryDescriptor *iso =MAllocZ(CD_BLK_SIZE),
|
|
||||||
*iso1=MAllocZ(CD_BLK_SIZE),
|
|
||||||
*iso2=MAllocZ(CD_BLK_SIZE),
|
|
||||||
*iso3=MAllocZ(CD_BLK_SIZE);
|
|
||||||
LTDirEntry *rootdir=MAllocZ(sizeof(LTDirEntry));
|
|
||||||
U8 cur_blk=0,bsize,tabsize,tabsize2,first_free,max_depth;
|
|
||||||
U4 *d;
|
|
||||||
I1 mask[8];
|
|
||||||
I1 *filename2;
|
|
||||||
ElTorito *et=MAllocZ(CD_BLK_SIZE);
|
|
||||||
U1 *buf=MAllocZ(CD_BLK_SIZE),
|
|
||||||
*bootfile_buf=NULL;
|
|
||||||
ISOPathTableEntry *tabbuf=NULL,*tabbuf2=NULL,
|
|
||||||
*itabbuf,*itabbuf2;
|
|
||||||
BoolU4 okay=TRUE;
|
|
||||||
U8 i,j;
|
|
||||||
LTFile *out_file=NULL;
|
|
||||||
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,1<<FUf_RECURSE);
|
|
||||||
rootdir->datetime=GetCurTimeLTDate;
|
|
||||||
rootdir->user_data=MAllocZ(sizeof(CCdUserData));
|
|
||||||
tempc=rootdir->user_data;
|
|
||||||
tempc->path_entry_num=1;
|
|
||||||
|
|
||||||
if (okay) {
|
|
||||||
cur_blk=CD_FILE_OFFSET>>2;
|
|
||||||
if (bootfile_buf)
|
|
||||||
cur_blk+=2;
|
|
||||||
DoCreateCDFile(out_file,rootdir,
|
|
||||||
&iso->root_directory_record,
|
|
||||||
&iso2->root_directory_record,
|
|
||||||
&cur_blk,rootdir,FALSE);
|
|
||||||
tabsize=sizeof(ISOPathTableEntry);
|
|
||||||
tabsize2=sizeof(ISOPathTableEntry);
|
|
||||||
max_depth=CDTableLength(rootdir,&tabsize,&tabsize2,1);
|
|
||||||
FillU4Palindrome(&iso->path_table_size,tabsize);
|
|
||||||
FillU4Palindrome(&iso2->path_table_size,tabsize2);
|
|
||||||
tabsize=(tabsize+CD_BLK_SIZE-1)/CD_BLK_SIZE;
|
|
||||||
cur_blk+=tabsize<<1;
|
|
||||||
tabsize2=(tabsize2+CD_BLK_SIZE-1)/CD_BLK_SIZE;
|
|
||||||
cur_blk+=tabsize2<<1;
|
|
||||||
}
|
|
||||||
if (okay) {
|
|
||||||
if (FileAttr(filename2) & LT_ATTR_CONTIGUOUS)
|
|
||||||
out_file=FOpen(filename2,"wc",cur_blk<<2);
|
|
||||||
else
|
|
||||||
out_file=FOpen(filename2,"w",cur_blk<<2);
|
|
||||||
if (!out_file)
|
|
||||||
okay=FALSE;
|
|
||||||
}
|
|
||||||
if (okay) {
|
|
||||||
cur_blk=0;
|
|
||||||
while (cur_blk<CD_FILE_OFFSET>>2) {
|
|
||||||
FWBlks(out_file,buf,cur_blk<<2,4);
|
|
||||||
cur_blk++;
|
|
||||||
}
|
|
||||||
iso->type=ISOT_PRIMARY_VOLUME_DESC;
|
|
||||||
StrCpy(iso->id,"CD001");
|
|
||||||
iso->version=1;
|
|
||||||
FillU2Palindrome(&iso->volume_set_size,1);
|
|
||||||
FillU2Palindrome(&iso->volume_sequence_number,1);
|
|
||||||
FillU2Palindrome(&iso->logical_block_size,CD_BLK_SIZE);
|
|
||||||
iso->file_structure_version=1;
|
|
||||||
|
|
||||||
iso2->type=ISOT_SUPPLEMENTARY_DESC;
|
|
||||||
StrCpy(iso2->id,"CD001");
|
|
||||||
iso2->version=1;
|
|
||||||
FillU2Palindrome(&iso2->volume_set_size,1);
|
|
||||||
FillU2Palindrome(&iso2->volume_sequence_number,1);
|
|
||||||
FillU2Palindrome(&iso2->logical_block_size,CD_BLK_SIZE);
|
|
||||||
iso2->file_structure_version=1;
|
|
||||||
|
|
||||||
iso1->type=ISOT_BOOT_RECORD;
|
|
||||||
StrCpy(iso1->id,"CD001");
|
|
||||||
iso1->version=1;
|
|
||||||
StrCpy(iso1+7,"EL TORITO SPECIFICATION");
|
|
||||||
|
|
||||||
cur_blk=CD_FILE_OFFSET>>2;
|
|
||||||
|
|
||||||
if (bootfile_buf) {
|
|
||||||
d=iso1+0x47;
|
|
||||||
*d=cur_blk;
|
|
||||||
et->w[0]=1;
|
|
||||||
StrCpy(&et->w[2],"LoseThos");
|
|
||||||
et->w[15]=0xAA55;
|
|
||||||
j=0;
|
|
||||||
for (i=0;i<16;i++) //Checksum
|
|
||||||
j+=et->w[i];
|
|
||||||
et->w[14]=-j;
|
|
||||||
if (bootfile_buf)
|
|
||||||
et->bootable=0x88;
|
|
||||||
et->media_type=0; //0=no emu 2=1.44meg 4=hard drive
|
|
||||||
et->sector_cnt=4;
|
|
||||||
et->load_rba=cur_blk+1;
|
|
||||||
coutln cur_blk,": Pre Boot Blk";
|
|
||||||
FWBlks(out_file,et,cur_blk<<2,4);
|
|
||||||
cur_blk++;
|
|
||||||
|
|
||||||
coutln cur_blk,": Boot Blk";
|
|
||||||
FWBlks(out_file,bootfile_buf,cur_blk<<2,4);
|
|
||||||
cur_blk++;
|
|
||||||
}
|
|
||||||
|
|
||||||
DoCreateCDFile(out_file,rootdir,
|
|
||||||
&iso->root_directory_record,
|
|
||||||
&iso2->root_directory_record,
|
|
||||||
&cur_blk,rootdir,TRUE);
|
|
||||||
|
|
||||||
tabbuf=MAllocZ(tabsize*CD_BLK_SIZE);
|
|
||||||
iso->type_l_path_table=cur_blk;
|
|
||||||
tabbuf->name_len=2; //Fill-in adam entry
|
|
||||||
tempi=&iso->root_directory_record;
|
|
||||||
tabbuf->blk=tempi->location.little;
|
|
||||||
tabbuf->parent_entry_num=1;
|
|
||||||
tabbuf2=MAllocZ(tabsize2*CD_BLK_SIZE);
|
|
||||||
iso2->type_l_path_table=cur_blk+tabsize;
|
|
||||||
tabbuf2->name_len=2; //Fill-in adam entry
|
|
||||||
tempi=&iso2->root_directory_record;
|
|
||||||
tabbuf2->blk=tempi->location.little;
|
|
||||||
tabbuf2->parent_entry_num=1;
|
|
||||||
itabbuf=tabbuf+sizeof(ISOPathTableEntry);
|
|
||||||
itabbuf2=tabbuf2+sizeof(ISOPathTableEntry);
|
|
||||||
first_free=2;
|
|
||||||
for (i=1;i<=max_depth;i++)
|
|
||||||
CDFillPathTable(rootdir,&itabbuf,&itabbuf2,
|
|
||||||
1,FALSE,&first_free,1,i);
|
|
||||||
coutln cur_blk,": Path Table 0";
|
|
||||||
FWBlks(out_file,tabbuf,cur_blk<<2,tabsize<<2);
|
|
||||||
cur_blk+=tabsize;
|
|
||||||
coutln cur_blk,": Path Table 1";
|
|
||||||
FWBlks(out_file,tabbuf2,cur_blk<<2,tabsize2<<2);
|
|
||||||
cur_blk+=tabsize2;
|
|
||||||
|
|
||||||
|
|
||||||
MemSet(tabbuf,0,tabsize*CD_BLK_SIZE);
|
|
||||||
FillBigEndianU4(&iso->type_m_path_table,cur_blk);
|
|
||||||
tabbuf->name_len=2; //Fill-in adam entry
|
|
||||||
tempi=&iso->root_directory_record;
|
|
||||||
tabbuf->blk=tempi->location.big;
|
|
||||||
FillBigEndianU2(&tabbuf->parent_entry_num,1);
|
|
||||||
MemSet(tabbuf2,0,tabsize2*CD_BLK_SIZE);
|
|
||||||
FillBigEndianU4(&iso2->type_m_path_table,cur_blk+tabsize);
|
|
||||||
tabbuf2->name_len=2; //Fill-in adam entry
|
|
||||||
tempi=&iso2->root_directory_record;
|
|
||||||
tabbuf2->blk=tempi->location.big;
|
|
||||||
FillBigEndianU2(&tabbuf2->parent_entry_num,1);
|
|
||||||
itabbuf=tabbuf+sizeof(ISOPathTableEntry);
|
|
||||||
itabbuf2=tabbuf2+sizeof(ISOPathTableEntry);
|
|
||||||
first_free=2;
|
|
||||||
for (i=1;i<=max_depth;i++)
|
|
||||||
CDFillPathTable(rootdir,&itabbuf,&itabbuf2,
|
|
||||||
1,TRUE,&first_free,1,i);
|
|
||||||
coutln cur_blk,": Path Table 2";
|
|
||||||
FWBlks(out_file,tabbuf,cur_blk<<2,tabsize<<2);
|
|
||||||
cur_blk+=tabsize;
|
|
||||||
coutln cur_blk,": Path Table 3";
|
|
||||||
FWBlks(out_file,tabbuf2,cur_blk<<2,tabsize2<<2);
|
|
||||||
cur_blk+=tabsize2;
|
|
||||||
|
|
||||||
DelLTDirList(rootdir); //TODO: Free user_data
|
|
||||||
FillU4Palindrome(&iso->volume_space_size,cur_blk);
|
|
||||||
FillU4Palindrome(&iso2->volume_space_size,cur_blk);
|
|
||||||
FWBlks(out_file,iso,16<<2,4);
|
|
||||||
|
|
||||||
iso3->type=ISOT_TERMINATOR;
|
|
||||||
StrCpy(iso3->id,"CD001");
|
|
||||||
iso3->version=1;
|
|
||||||
if (bootfile_buf) {
|
|
||||||
FWBlks(out_file,iso1,17<<2,4);
|
|
||||||
FWBlks(out_file,iso2,18<<2,4);
|
|
||||||
FWBlks(out_file,iso3,19<<2,4);
|
|
||||||
} else {
|
|
||||||
FWBlks(out_file,iso2,17<<2,4);
|
|
||||||
FWBlks(out_file,iso3,18<<2,4);
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
cur_blk=0;
|
|
||||||
|
|
||||||
FClose(out_file);
|
|
||||||
Free(tabbuf);
|
|
||||||
Free(tabbuf2);
|
|
||||||
Free(et);
|
|
||||||
Free(bootfile_buf);
|
|
||||||
Free(iso);
|
|
||||||
Free(iso1);
|
|
||||||
Free(iso2);
|
|
||||||
Free(iso3);
|
|
||||||
Free(filename2);
|
|
||||||
return cur_blk;
|
|
||||||
}
|
|
||||||
#help_index ""
|
|
||||||
Binary file not shown.
@@ -1,684 +0,0 @@
|
|||||||
#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 ""
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
#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
@@ -1,569 +0,0 @@
|
|||||||
#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"
|
|
||||||
@@ -1,728 +0,0 @@
|
|||||||
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.
@@ -1,593 +0,0 @@
|
|||||||
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.
@@ -1,19 +0,0 @@
|
|||||||
#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.
@@ -1,397 +0,0 @@
|
|||||||
#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,311 +0,0 @@
|
|||||||
#help_index "Compression"
|
|
||||||
|
|
||||||
#define ICT_U2 1
|
|
||||||
#define ICT_U4 2
|
|
||||||
#define ICT_U8 3
|
|
||||||
|
|
||||||
class IncCompressStructU2
|
|
||||||
{
|
|
||||||
U2 match_start;
|
|
||||||
U2 match_size;
|
|
||||||
U2 diff_size;
|
|
||||||
U0 diff_data;
|
|
||||||
};
|
|
||||||
|
|
||||||
class IncCompressStructU4
|
|
||||||
{
|
|
||||||
U4 match_start;
|
|
||||||
U2 match_size;
|
|
||||||
U2 diff_size;
|
|
||||||
U0 diff_data;
|
|
||||||
};
|
|
||||||
|
|
||||||
class IncCompressStructU8
|
|
||||||
{
|
|
||||||
U8 match_start;
|
|
||||||
U2 match_size;
|
|
||||||
U2 diff_size;
|
|
||||||
U0 diff_data;
|
|
||||||
};
|
|
||||||
|
|
||||||
class IntermediateIncCompressStruct
|
|
||||||
{
|
|
||||||
IntermediateIncCompressStruct *next,*last;
|
|
||||||
U8 match_start_ref,match_start,match_size;
|
|
||||||
};
|
|
||||||
|
|
||||||
void IncCompressRange(U1 *ref,U8 ref_size,U1 *b,U8 range_start,U8 range_end,
|
|
||||||
IntermediateIncCompressStruct *root,U8 type_size)
|
|
||||||
{
|
|
||||||
I8 i,j,k,n,best_k=0,best_j,best_i;
|
|
||||||
IntermediateIncCompressStruct *tempc;
|
|
||||||
|
|
||||||
//$BK,1$TODO: improve this algorithm$BK,0$
|
|
||||||
|
|
||||||
for (i=range_start;i<range_end;i++) {
|
|
||||||
for (j=0;j<ref_size;j++) {
|
|
||||||
k=0;
|
|
||||||
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;
|
|
||||||
best_j=j;
|
|
||||||
best_i=i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (best_k>type_size) {
|
|
||||||
if (range_start+type_size<best_i)
|
|
||||||
IncCompressRange(ref,ref_size,b,range_start,best_i,root,type_size);
|
|
||||||
tempc=MAlloc(sizeof(IntermediateIncCompressStruct));
|
|
||||||
tempc->match_start_ref=best_j;
|
|
||||||
tempc->match_start=best_i;
|
|
||||||
tempc->match_size=best_k;
|
|
||||||
InsQue(tempc,root->last);
|
|
||||||
if (best_i+best_k+type_size<range_end)
|
|
||||||
IncCompressRange(ref,ref_size,b,best_i+best_k,range_end,root,type_size);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
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;
|
|
||||||
U2 *u2;
|
|
||||||
U4 *u4;
|
|
||||||
U8 *u8;
|
|
||||||
IntermediateIncCompressStruct root,*tempc,*tempc1;
|
|
||||||
IncCompressStructU2 *tempi2;
|
|
||||||
IncCompressStructU4 *tempi4;
|
|
||||||
IncCompressStructU8 *tempi8;
|
|
||||||
root.next=&root;
|
|
||||||
root.last=&root;
|
|
||||||
if (ref_size<=0xFFFF && size<=0xFFFF) {
|
|
||||||
ic_type=ICT_U2;
|
|
||||||
i=sizeof(U1)+size+2*sizeof(U2);
|
|
||||||
IncCompressRange(ref,ref_size,b,0,size,&root,sizeof(IncCompressStructU2));
|
|
||||||
if (root.next==&root)
|
|
||||||
i+=sizeof(IncCompressStructU2);
|
|
||||||
else {
|
|
||||||
tempc=root.next;
|
|
||||||
while (tempc!=&root) {
|
|
||||||
i-=tempc->match_size-sizeof(IncCompressStructU2);
|
|
||||||
tempc=tempc->next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (ref_size<=0xFFFFFFFF && size<=0xFFFFFFFF) {
|
|
||||||
ic_type=ICT_U4;
|
|
||||||
i=sizeof(U1)+size+2*sizeof(U4);
|
|
||||||
IncCompressRange(ref,ref_size,b,0,size,&root,sizeof(IncCompressStructU4));
|
|
||||||
if (root.next==&root)
|
|
||||||
i+=sizeof(IncCompressStructU4);
|
|
||||||
else {
|
|
||||||
tempc=root.next;
|
|
||||||
while (tempc!=&root) {
|
|
||||||
i-=tempc->match_size-sizeof(IncCompressStructU4);
|
|
||||||
tempc=tempc->next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ic_type=ICT_U8;
|
|
||||||
i=sizeof(U1)+size+2*sizeof(U8);
|
|
||||||
IncCompressRange(ref,ref_size,b,0,size,&root,sizeof(IncCompressStructU8));
|
|
||||||
if (root.next==&root)
|
|
||||||
i+=sizeof(IncCompressStructU8);
|
|
||||||
else {
|
|
||||||
tempc=root.next;
|
|
||||||
while (tempc!=&root) {
|
|
||||||
i-=tempc->match_size-sizeof(IncCompressStructU8);
|
|
||||||
tempc=tempc->next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
result=MAlloc(i);
|
|
||||||
u1=result;
|
|
||||||
*u1=ic_type;
|
|
||||||
switch (ic_type) {
|
|
||||||
case ICT_U2:
|
|
||||||
u2=result+sizeof(U1);
|
|
||||||
*u2=i;
|
|
||||||
u2+=sizeof(U2);
|
|
||||||
*u2=size;
|
|
||||||
tempi2=u2+sizeof(U2);
|
|
||||||
|
|
||||||
tempc=root.next;
|
|
||||||
while (tempc!=&root) {
|
|
||||||
tempc1=tempc->next;
|
|
||||||
if (l || tempc->match_start-(j+l)) {
|
|
||||||
tempi2->match_start=m;
|
|
||||||
tempi2->match_size=l;
|
|
||||||
tempi2->diff_size=tempc->match_start-(j+l);
|
|
||||||
if (tempi2->diff_size)
|
|
||||||
MemCpy(&tempi2->diff_data,b+j+l,tempi2->diff_size);
|
|
||||||
tempi2+=sizeof(IncCompressStructU2)+tempi2->diff_size;
|
|
||||||
}
|
|
||||||
m=tempc->match_start_ref;
|
|
||||||
j=tempc->match_start;
|
|
||||||
l=tempc->match_size;
|
|
||||||
Free(tempc);
|
|
||||||
tempc=tempc1;
|
|
||||||
}
|
|
||||||
tempi2->match_start=m;
|
|
||||||
tempi2->match_size=l;
|
|
||||||
tempi2->diff_size=size-(j+l);
|
|
||||||
if (tempi2->diff_size)
|
|
||||||
MemCpy(&tempi2->diff_data,b+j+l,tempi2->diff_size);
|
|
||||||
break;
|
|
||||||
case ICT_U4:
|
|
||||||
u4=result+sizeof(U1);
|
|
||||||
*u4=i;
|
|
||||||
u4+=sizeof(U4);
|
|
||||||
*u4=size;
|
|
||||||
tempi4=u4+sizeof(U4);
|
|
||||||
|
|
||||||
//$BK,1$TODO: deal with >65536 matches and differences$BK,0$
|
|
||||||
tempc=root.next;
|
|
||||||
while (tempc!=&root) {
|
|
||||||
tempc1=tempc->next;
|
|
||||||
if (l || tempc->match_start-(j+l)) {
|
|
||||||
tempi4->match_start=m;
|
|
||||||
tempi4->match_size=l;
|
|
||||||
tempi4->diff_size=tempc->match_start-(j+l);
|
|
||||||
if (tempi4->diff_size)
|
|
||||||
MemCpy(&tempi4->diff_data,b+j+l,tempi4->diff_size);
|
|
||||||
tempi4+=sizeof(IncCompressStructU4)+tempi4->diff_size;
|
|
||||||
}
|
|
||||||
m=tempc->match_start_ref;
|
|
||||||
j=tempc->match_start;
|
|
||||||
l=tempc->match_size;
|
|
||||||
Free(tempc);
|
|
||||||
tempc=tempc1;
|
|
||||||
}
|
|
||||||
tempi4->match_start=m;
|
|
||||||
tempi4->match_size=l;
|
|
||||||
tempi4->diff_size=size-(j+l);
|
|
||||||
if (tempi4->diff_size)
|
|
||||||
MemCpy(&tempi4->diff_data,b+j+l,tempi4->diff_size);
|
|
||||||
break;
|
|
||||||
case ICT_U8:
|
|
||||||
u8=result+sizeof(U1);
|
|
||||||
*u8=i;
|
|
||||||
u8+=sizeof(U8);
|
|
||||||
*u8=size;
|
|
||||||
tempi8=u8+sizeof(U8);
|
|
||||||
|
|
||||||
//$BK,1$TODO: deal with >65536 matches and differences$BK,0$
|
|
||||||
tempc=root.next;
|
|
||||||
while (tempc!=&root) {
|
|
||||||
tempc1=tempc->next;
|
|
||||||
if (l || tempc->match_start-(j+l)) {
|
|
||||||
tempi8->match_start=m;
|
|
||||||
tempi8->match_size=l;
|
|
||||||
tempi8->diff_size=tempc->match_start-(j+l);
|
|
||||||
if (tempi8->diff_size)
|
|
||||||
MemCpy(&tempi8->diff_data,b+j+l,tempi8->diff_size);
|
|
||||||
tempi8+=sizeof(IncCompressStructU8)+tempi8->diff_size;
|
|
||||||
}
|
|
||||||
m=tempc->match_start_ref;
|
|
||||||
j=tempc->match_start;
|
|
||||||
l=tempc->match_size;
|
|
||||||
Free(tempc);
|
|
||||||
tempc=tempc1;
|
|
||||||
}
|
|
||||||
tempi8->match_start=m;
|
|
||||||
tempi8->match_size=l;
|
|
||||||
tempi8->diff_size=size-(j+l);
|
|
||||||
if (tempi8->diff_size)
|
|
||||||
MemCpy(&tempi8->diff_data,b+j+l,tempi8->diff_size);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public U1 *IncExpand(U1 *ref,IncCompressStructU2 *b,U8 *size=NULL)
|
|
||||||
{
|
|
||||||
U1 *result,*dst,*u1=b,*b_end;
|
|
||||||
U2 *u2;
|
|
||||||
U4 *u4;
|
|
||||||
U8 *u8=b,s,ic_type;
|
|
||||||
IncCompressStructU2 *tempi2;
|
|
||||||
IncCompressStructU4 *tempi4;
|
|
||||||
IncCompressStructU8 *tempi8;
|
|
||||||
|
|
||||||
ic_type=*u1;
|
|
||||||
|
|
||||||
switch (ic_type) {
|
|
||||||
case ICT_U2:
|
|
||||||
u2=b+sizeof(U1);
|
|
||||||
b_end=b+*u2;
|
|
||||||
u2+=sizeof(U2);
|
|
||||||
s=*u2;
|
|
||||||
break;
|
|
||||||
case ICT_U4:
|
|
||||||
u4=b+sizeof(U1);
|
|
||||||
b_end=b+*u4;
|
|
||||||
u4+=sizeof(U4);
|
|
||||||
s=*u4;
|
|
||||||
break;
|
|
||||||
case ICT_U8:
|
|
||||||
u8=b+sizeof(U1);
|
|
||||||
b_end=b+*u8;
|
|
||||||
u8+=sizeof(U8);
|
|
||||||
s=*u8;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
result=MAlloc(s);
|
|
||||||
if (size) *size=s;
|
|
||||||
dst=result;
|
|
||||||
|
|
||||||
switch (ic_type) {
|
|
||||||
case ICT_U2:
|
|
||||||
tempi2=b+sizeof(U1)+2*sizeof(U2);
|
|
||||||
while (tempi2<b_end) {
|
|
||||||
if (tempi2->match_size) {
|
|
||||||
MemCpy(dst,ref+tempi2->match_start,tempi2->match_size);
|
|
||||||
dst+=tempi2->match_size;
|
|
||||||
}
|
|
||||||
if (tempi2->diff_size) {
|
|
||||||
MemCpy(dst,&tempi2->diff_data,tempi2->diff_size);
|
|
||||||
dst+=tempi2->diff_size;
|
|
||||||
}
|
|
||||||
tempi2+=sizeof(IncCompressStructU2)+tempi2->diff_size;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case ICT_U4:
|
|
||||||
tempi4=b+sizeof(U1)+2*sizeof(U4);
|
|
||||||
while (tempi4<b_end) {
|
|
||||||
if (tempi4->match_size) {
|
|
||||||
MemCpy(dst,ref+tempi4->match_start,tempi4->match_size);
|
|
||||||
dst+=tempi4->match_size;
|
|
||||||
}
|
|
||||||
if (tempi4->diff_size) {
|
|
||||||
MemCpy(dst,&tempi4->diff_data,tempi4->diff_size);
|
|
||||||
dst+=tempi4->diff_size;
|
|
||||||
}
|
|
||||||
tempi4+=sizeof(IncCompressStructU4)+tempi4->diff_size;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case ICT_U8:
|
|
||||||
tempi8=b+sizeof(U1)+2*sizeof(U8);
|
|
||||||
while (tempi8<b_end) {
|
|
||||||
if (tempi8->match_size) {
|
|
||||||
MemCpy(dst,ref+tempi8->match_start,tempi8->match_size);
|
|
||||||
dst+=tempi8->match_size;
|
|
||||||
}
|
|
||||||
if (tempi8->diff_size) {
|
|
||||||
MemCpy(dst,&tempi8->diff_data,tempi8->diff_size);
|
|
||||||
dst+=tempi8->diff_size;
|
|
||||||
}
|
|
||||||
tempi8+=sizeof(IncCompressStructU8)+tempi8->diff_size;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
#help_index ""
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
#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=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
|
|
||||||
ip_lb_last=FALSE,ip_rb_last=FALSE,
|
|
||||||
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.
@@ -1,738 +0,0 @@
|
|||||||
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.
@@ -1,930 +0,0 @@
|
|||||||
#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
@@ -1,313 +0,0 @@
|
|||||||
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"
|
|
||||||
| |||||||