So anyways, I figured out why Vedit would not allow me to rename my tools menu.
If you remember, I just ignored the default ustartup.vdm and used a modified version of my old startup.vdm as my ustartup.vdm
However the default ustartup.vdm has code in it related to the tools & user menus.
Since my custom version of the ustartup did not contain said code, my tool menu was not renamed.
Now as I understand it, the startup.vdm is not to be changed at all. It has several warnings about doing so.
The problem as I see it is that if we accept that the startup.vdm should not be altered, then we need the principle that the startup.vdm makes no assumptions about what is in the ustartup.vdm.
I mean there is no way to know what an user might do in the ustartup.
So I have created a special hacked version of the startup.vdm that makes (at least with regards to the menus) any assumptions as to the contents of the ustartup.vdm
(You might want to have open startup.vdm open in vedit as you read further to understand my changes.)
So first looking at the original startup you have the section where t-regs 103 to 106 are set to their default values.
Instead I replace it with:
//------- Initialize {USER} and {TOOLS} registers -----------------
//
// After Ustartup.vdm is run, these registers will hold default files and names for the {USER} and {TOOLS} menus.
// The USTARTUP.VDM file, if enabled, will give them the users' preferred values.
//
Config_String(USER_MENU,"&User")
Config_String(TOOL_MENU,"&Tools")
Reg_Empty(103) // Default file for {USER} menu
Reg_Empty(104) // Default name for {USER} menu
Reg_Empty(105) // Default file for {TOOLS} menu, when
// Config(U_TOOLS_MENU) = "4"
Reg_Empty(106) // Default name for {TOOLS} menu
//
I am just making sure the registers are empty here. The theory being that if an user uses the standard ustartup and uncomments the lines pertaining to the menus, these registers will be assigned values.
If like me the user has dumped the standard ustartup, and has a custom version (or user did not uncomment the related lines), these values will remain null
So the startup file in both cases executes ustartup if this feature is enabled.
Then it loads the user menu, again I have altered the code:
//------- Load the {USER} menu -----------------------------------------------
//
// Add the {USER} menu to the main menu by loading the file USER.MNU.
// By default, USER.MNU contains some of the macros listed in Appendix E
// (Application Notes). You can place your own custom editing functions
// in the {USER} menu by modifying the USER.MNU file or by loading a
// different file. See the help topic "{USER} and {TOOLS} menus".
//
If(reg_size(103)>0) {
if ( File_Exist("|(USER_MACRO)\|@(103)",NOERR) ) {
Reg_Load(124,"|(USER_MACRO)\|@(103)",NOERR)
}
}
If(reg_size(104)>0) {
Config_String(USER_MENU,@(104))
}
Here you will notice it tests the size of t-regs 103 & 104, if they are still zero in size, the code does not execute. The only time it does is when the user uncomments the related lines in the standard ustarup.
Then the startup.vdm loads the tool menu, again I changed the code:
//------- Load the {TOOLS} menu ----------------------------------------------
//
// Add a {TOOLS} menu depending upon the setting of
// {CONFIG, Misc, TOOLS menu}:
//
// 0 Do not load any {TOOLS} menu.
// 1 (Default) Load the Compiler support menu from COMPILE.MNU.
// However, if VEDIT is running as a trial version, instead load
// the {TUTOR} menu from TUTOR.MNU.
// 2 Load the Compiler support menu from COMPILE.MNU.
// 3 Load the Java support menu from JAVA.MNU.
// 4 Load a user defined {TOOLS} menu from TOOLS.MNU.
//
#120 = Config(U_TOOLS_MENU)
if (#120==1) {
if (Is_TV) {
if (OS_Type==1) {
Reg_Load(123,"|(HOME)\tutor\tutorw.mnu",EXTRA+NOERR)
if (AppWidth>640) { Config_String(TOOL_MENU,"&Tutorial") }
else { Config_String(TOOL_MENU,"&Tutor") }
}
else { Reg_Load(123,"tutor.mnu",EXTRA+NOERR) }
}
else { #120 = 2 }
}
if (#120==2 || #120==3) {
Call_File(Reg_Free,"compile.vdm",NOERR)
Config_String(TOOL_MENU,"&Tools")
}
if (#120==4) {
if(reg_size(105)>0) {Reg_Load(123,@(105),EXTRA+NOERR)} //Load a custom tools.mnu
else {Reg_Load(123,"tools.mnu",EXTRA+NOERR)}
If(reg_size(106>0)) {
Config_String(TOOL_MENU,@(106)) //Give it the desired name
}
}
My changes are under the If(#120==4) section and
again, you will notice it tests the size of t-regs 105 & 106, if they are still zero in size, the code does not execute. The only time it does is when the user uncomments the related lines in the standard ustarup.
So my hacked version makes no assumptions of what is in the ustartup.vdm. With my hacked version my menus load correctly, and are named correctly.
For the advanced users, thet can setup their menus in the ustartup using thier own code, yet my version will work just fine for the newish user.
I have attached my hacked version of startup.vdm to this file. I have named it hacked.vdm so you can download it and look at it without worry about altering your setup.
I am using my hacked version as my startup.vdm at the moment, and have no problems. You use my hacked version at YOUR OWN RISK.
Scott
|
|