Use Case
| • | You want to change the order in which toolbar buttons or menu items appear. |
Relevant Architecture
Relevant Files
| • | ClearCanvas.Desktop.Executable.exe.config |
Sample Code
<action-models>
<action-model id="ClearCanvas.Desktop.DesktopWindow:global-menus">
...
<action id="ClearCanvas.ImageViewer.Tools.Standard.PanTool:activate"
path="global-menus/MenuTools/MenuStandard/MenuPan" group-hint="Tools.Image.Manipulation.Pan" />
<action id="ClearCanvas.ImageViewer.Tools.Standard.ZoomTool:activate"
path="global-menus/MenuTools/MenuStandard/MenuZoom" group-hint="Tools.Image.Manipulation.Zoom" />
<action id="ClearCanvas.ImageViewer.Tools.Standard.ProbeTool:activate"
path="global-menus/MenuTools/MenuStandard/MenuProbe" group-hint="Tools.Image.Interrogation.Probe" />
...
</action-model>
<action-model id="ClearCanvas.Desktop.DesktopWindow:global-toolbars">
...
<action id="ClearCanvas.ImageViewer.Tools.Standard.ZoomTool:activate"
path="global-toolbars/ToolbarStandard/ToolbarZoom" group-hint="Tools.Image.Manipulation.Zoom" />
<action id="ClearCanvas.ImageViewer.Tools.Standard.ProbeTool:activate"
path="global-toolbars/ToolbarStandard/ToolbarProbe" group-hint="Tools.Image.Interrogation.Probe" />
<action id="ClearCanvas.ImageViewer.Tools.Standard.PanTool:activate"
path="global-toolbars/ToolbarStandard/ToolbarPan" group-hint="Tools.Image.Manipulation.Pan" />
...
</action-model>
</action-models>
Remarks
The order of both toolbar buttons and menu items is easily adjusted by editing an XML fragment similar to the one above in the ClearCanvas.Desktop.Executable.exe.config file, located in the CC installation directory. Note that, as of SDK 1.2, the action model is no longer saved in the user.config file, since there was no UI to edit it.
In the sample above, the order of tools on the menu is Pan, Zoom, Probe, whereas on the toolbar, it's Zoom, Probe, Pan.
Note that, in Debug builds only, there is a menu item under Tools > Utilities > Export Action Model that allows you to export the current in-memory action model to a file. This is particularly useful when you are unsure of the text to add to the action model xml for your custom tools. Simply start the application and ensure that your tools' menu and toolbar items have been shown; for example, if they are image viewer tools, open a study first. Then export the action model to a file. The text in the exported file can then be pasted into ClearCanvas.Desktop.Executable.exe.config in order to override the default action model.
Examples in Code Base
| • | \ImageViewer\ImageViewer_dist.config |