//
// The "veditrc" file when VEDIT is named "vedit".
//
/////////////////////////////////////////////////////////////////////////////
// Part 1 - Configure according to vedit.key and vedit.cfg
//	    Configure according to terminal type
//
Get_Environment(7,"TERM")
Get_Environment(8,"HOME")
Get_Environment(9,"VEDIT_PATH")
if (Reg_Size(9)==0) { Reg_Set(9,"/usr/lib/vedit3") }
Key_Load("|@(9)/vedit.key",NOERR)
Config_Load("|@(9)/vedit.cfg",NOERR)
//
// Some terminals support 8-bit graphics characters directly.
// This is equivalent to the "-o8" invocation option.
// The QNX console (TERM=qnx) automatically uses 8-bit graphics chars.
//
if (Reg_Compare(7,"qnxt")==0 || Reg_Compare(7,"qansi")==0) {
    Config(H_IO_OPT, Config(H_IO_OPT) | 08)
}
//
// If on QNX console (TERM=qnx), enable scroll bars and full borders.
// Also put the status line on the bottom and the menu bar on top.
// These settings would significantly slow down screen updates on a 
// serial connected CRT terminal, but are usually preferred on a fast console.
//
if (Reg_Compare(7,"qnx")==0) {
    Config(WIN_BRD,3)
    Config(S_DSP_BRD,2)			//Full borders for on-line help
    Config(S_STAT_OPT,2)		//Status line on bottom, menu bar on top
} else {
    Config(WIN_BRD,1)
    Config(S_DSP_BRD,1)			//Minimal borders for on-line help
    Config(S_STAT_OPT,1)		//Status line on top, hidden menu
}
//
/////////////////////////////////////////////////////////////////////////////
// Part 2 - Optional key assignments
//	    Setup {USER} menu
//
//	The optional commands below can perform the following functions:
//
//	<Ctrl-F5> is assigned to compare two windows.
//	<Ctrl-F12> is assigned to configure VEDIT to a dBASE III ".DBF" file
//
//	To enable any function, delete the "// " from the corresponding line:
//
// Key_Add("Ctrl-F5",'[VISUAL EXIT] if((#100=Win_Next)!=Win_Num){ Compare(Win_Status(#100)+BUFFER) } else { Alert() }',OK)
// Key_Add("Ctrl-F12",'[VISUAL EXIT] BOF() Char(8) #100 = Cur_Char Char() #100 += Cur_Char * 256 Config(F_REC_HEAD, #100, LOCAL) Char() #100 = Cur_Char Char() #100 += Cur_Char * 256 Config(F_F_TYPE, #100, LOCAL) BOF() Line()',OK)
//
//	The following command adds the {USER} menu to the main menu.
//	By default, USER.MNU contains some of the macros listed in Appendix E
//	(Application Notes). You can delete and add custom editing functions
//	to the {USER} menu as desired. See the on-line help topic "CUSTOM"
//	for more information.
//
Reg_Load(124,"user.mnu",EXTRA+NOERR)
Key_Add("Alt-U","[MENU]U",OK)		//<Alt-U> is hot-key for {USER} menu
//
/////////////////////////////////////////////////////////////////////////////
// Part 3 - Setup the "File-Open" event macro in T-Reg 110.  It sets 
//	    configuration parameters according to the filename extension.
//
// NOTE: To enable the file-open event macro, change the "0" in the
//	 following Config() command to "1".
//
Config(F_E_F_MACRO,0)		//Disable the "File-Open" event macro.
//
Reg_Set(110,`
#109=Buf_Num
Out_Reg(109) Name_Write(NOMSG+NOCR) Out_Reg(0)
Buf_Switch(36)
Buf_Empty(OK)
Reg_Ins(109)
//
// Test if this is a ".c" ".cpp" or ".h" file...
//
BOF()
if ( Search(".c|>",NOERR)==1 || Search(".cpp|>",NOERR)==1 || Search(".h|>",NOERR)==1 ) {
Buf_Switch(#109)
Config(PG_AUTO_IND,1,LOCAL)
Config(PG_IND_INC,4,LOCAL)
Config(W_LF_MARG,0,LOCAL)
Config(W_RT_MARG,0,LOCAL)
Config_Tab(4;LOCAL)
Goto ENDMACRO
}
//
// Test if this is a ".txt" word processing file...
//
BOF()
if ( Search(".txt|>",NOERR)==1 ) {
Buf_Switch(#109)
Config(PG_AUTO_IND,1,LOCAL)
Config(PG_IND_INC,4,LOCAL)
Config(W_LF_MARG,0,LOCAL)
Config(W_RT_MARG,72,LOCAL)
Config_Tab(4;LOCAL)
Goto ENDMACRO
}
//
// Test if this is an ".asm" or ".ext" file...
//
BOF()
if ( Search(".asm|>",NOERR)==1 || Search(".ext|>",NOERR)==1 ) {
Buf_Switch(#109)
Config(PG_AUTO_IND,0,LOCAL)
Config(PG_IND_INC,8,LOCAL)
Config(PG_CASE_CONV,2,LOCAL)
Config(PG_CONV_C,59,LOCAL)
Config(W_LF_MARG,0,LOCAL)
Config(W_RT_MARG,0,LOCAL)
Config_Tab(4;LOCAL)
Goto ENDMACRO
}
//
// Close buffer 36.
//
:ENDMACRO:
Buf_Switch(36)
Buf_Quit(OK)
Buf_Switch(#109)
`)
//
/////////////////////////////////////////////////////////////////////////////
// Part 4 - Chain to user's "/HOME/.veditrc" file if there is one.
//
Chain_File(100,"|@(8)/.veditrc",NOERR)
