Arbortext Command Language > Using the Arbortext Command Language > Modifying the Default Menus
  
Modifying the Default Menus
With Arbortext Editor, it is possible to modify the default menus for an entire installation, for a particular document, for a particular user or group of users, or for a particular document. You may want to modify the order in which some items appear on the Arbortext Editor menus, delete menu commands, add custom functions to existing menus, or add new menus to the menu bar. It is also possible to replace the entire existing menu structure. You can also include shortcut menus for any window.
A single menu configuration file is used for all document types because there are no document-type specific items in the default menus. Arbortext Editor loads the file editmenu.cf from the lib subdirectory of Arbortext パス. A different default editmenu.cf file may be loaded by setting the environment variable APTMENUFILE to the path name of the menu configuration file.
The commands menu_add, menu_change, menu_delete, menu_copy, and menu_move let you customize the menus. The menu_reset command restores the menus to their default states. The menu_save and menu_load commands create and load a menu configuration file, which can be used to store your customized menus. (You need to maintain the correct path names to the menu configuration file if you move the document type to a new directory.)
For specific information on each command, click on the name of the command listed below:
The type of menu customization determines which customization file it should be included in.
To modify the default menus for a particular document type, place the commands to modify or load menus in the document type instance command file.
For a document, place the commands to modify or load menus in the document command file in the directory containing the document docname file.
To replace the default menu configuration file for all of the document types, set the environment variable $APTMENUFILE to the path name of the new menu configuration file.
To replace the default menu configuration file for a particular document type, use the menu_load command to load a menu configuration file, typically named menu.cf.
* 
Arbortext does not recommend using menu_load regularly to configure your menu bar. The menu_load command causes the entire menu bar and all its items to be replaced. Therefore, Arbortext recommends adding, deleting, or changing only those items or menus necessary, while maintaining as much of the built-in functionality provided by the default menus as possible.
Arbortext Editor reads the document type command files (doctype.acl and doctype.js) and then the document type instance command files (instance.acl and instance.js) in the document type directory if they exist, before reading document command files (docname.acl and docname.js). The document type instance command files are read when the document type is loaded and whenever documents are switched. This allows document type-specific changes to the menus using the menu_add, menu_delete and menu_change commands, or another configuration file to be read using menu_load.
Because the document type instance command file is read each time you open a document of the same document type, any menu modification commands should be conditionalized using tests. For example:
if (!menu_exists(".MyMenu")) {
menu_add -menu . ".MyMenu"
menu_add ".MyMenu." "Some item" -cmd {some_command;}
}
Related Topics
Menu paths
Special characters in menu paths
Shortcut menus