I have now given this some detailed thought.
Motivation:
Over the years I have accumulated many changes & additions I like to make to the standard distribution menus. This causes three problems (I operate in a Client / Server configuration, where the Server directory contains only unmodified standard distribution files):
1 - There is a lot of unnecessary duplication between my menus and the standard ones.
2 - My directory structure is cluttered with extra folders & files:
\\Server\System
\\Server\System\Rsrc
\\Server\System\Rsrc\Menus.odc
\\Server\Dev
\\Server\Dev\Rsrc
\\Server\Dev\Rsrc\Menus.odc
\\Server\Form
\\Server\Form\Rsrc
\\Server\Form\Rsrc\Menus.odc
\\Server\Text
\\Server\Text\Rsrc
\\Server\Text\Rsrc\Menus.odc
3 - (This is the serious one!) Keeping my menus consistent with changes in the standard ones is inconvenient and error prone.
So I propose adding a mechanism whereby only desired changes to the standard menus need be listed in the Client directory; all the changes would be in a single file, which might be called
\\Client\MenuDeltas.odc
There are two things to discuss: how this mechanism should behave in detail (ie what is its feature set), and how it might be implemented. This posting only addresses the first point; I shall make another posting with some brief comments on the second later. There is little point discussing the implementation in detail until the feature set becomes at least somewhat stable.
Description of Behaviour:
There would be a single file describing all the desired menu changes. It would look just like the current menus, except for a few small changes I will describe below.
The first change is that it would have no "INCLUDE" lines.
Some terminology:
The text from, and including, "MENU" to the next "END" I call a
menu. Each menu file contains several menus.
The lines between adjacent structure keywords "MENU", "SEPARATOR" & "END" I call a
paragraph.
Each line in a paragraph I call an
item, which comprises a
label, a
shortcut, a
command, and a
guard.
Each menu is followed by a
menuname. It may also be followed by a
menuguard.
The standard menus are read from file, as are the
delta menus. These are then merged as follows:
1 - Each standard menu is associated with a delta menu if possible. Association means they have the same menuname and menuguard.
2 - Non-associated standard menus are kept unmodified. Non-associated delta menus are discarded.
3 - In associated menus each paragraph of the standard menu is associated with the corresponding paragraph of the delta menu. By corresponding I mean the first standard paragraph is associated with the first delta paragraph, and so on.
4 - Items in associated paragraphs are associated if they have the same label.
Associated standard items are replaced by the corresponding delta item.
Non-associated items are listed in the order: standard items followed by delta items.
This is the basic behaviour, but it can be refined by using non-standard delta menu file features as follows:
1 - If, in the delta menu file, either of the keywords "MENU" or "SEPARATOR" is followed by a "+" sign a new paragraph is inserted; it takes its items from the delta menu only.
2 - If, in the delta menu file, either of the keywords "MENU" or "SEPARATOR" is followed by a "-" sign the next paragraph in the standard menu is deleted.
3 - If, in the delta menu file, an item has shortcut "-", and no command or guard, the associated item is deleted from the standard menu.
4 - If, in the delta menu file, a non-associated item is preceeded by an integer, it not inserted after the standard items in that paragraph, but in the position indicated by the number.
5 - If, in the delta menu file, a non-associated menu is followed by an integer, it is not discarded, but inserted as the n th menu in the file.
I give an example below of the delta menu I would use for my Tools menu; it is much shorter than current full menu I need to have.
Code: Select all
MENU "#Dev:&Tools"
"ViewSizer..." "" "StdCmds.OpenToolDialog ('Wands/Rsrc/ViewSizer', '(Wands)ViewSizer')"
"TextCmds.SingletonGuard"
"Mascara..." "" "StdCmds.OpenToolDialog ('Wands/Rsrc/Mascara', '(Wands)Mascara')" "TextCmds.EditGuard"
SEPARATOR
3 "Insert Commander End" "" "DevCommanders.DepositEnd; StdCmds.PasteView" "StdCmds.PasteViewGuard"
SEPARATOR
SEPARATOR
"#Dev:&Create Target" "T" "StdLinks.CreateTarget" "StdLinks.CreateGuard"
SEPARATOR
SEPARATOR +
"Insert Left" "*F5" "DevSelectors.DepositLeft; StdCmds.PasteView" "StdCmds.PasteViewGuard"
"Insert Middle" "*F6" "DevSelectors.DepositMiddle; StdCmds.PasteView" "StdCmds.PasteViewGuard"
"Insert Right" "*F7" "DevSelectors.DepositRight; StdCmds.PasteView" "StdCmds.PasteViewGuard"
END