About the menus.xml file

 < Day Day Up > 

The menus.xml file contains a structured list of menu bars, menus, menu commands, separators, shortcut lists, and keyboard shortcuts. These items are described by XML tags that you can edit in a text editor.

NOTE

Be careful when making changes to menus. Dreamweaver ignores any menu or menu command that contains an XML syntax error.


A menu bar (tagged with opening and closing menubar tags) is a discrete menu or set of menus for example, there's a main menu bar, a separate Site window menu bar (which appears only on Windows, not the Macintosh), and a menu bar for each context menu. Each menu bar contains one or more menus; a menu is contained in a menu tag. Each menu contains one or more menu commands, each described by a menuitem tag and its attributes. A menu can also contain separators (described by separator tags) and submenus.

In addition to the keyboard shortcuts associated with menu commands, Dreamweaver provides a variety of other keyboard shortcuts, including alternate shortcuts and shortcuts that are available only in certain contexts. For example, Control+Y (Windows) or Command+Y (Macintosh) is the shortcut for Redo; but Control+Shift+Z or Command+Shift+Z is an alternate shortcut for Redo. These alternates and other shortcuts that can't be represented in the tags for menu commands are defined in shortcut lists in the menus.xml file. Each shortcut list (described by a shortcutlist tag) contains one or more shortcuts, each of which is described by a shortcut tag.

The following sections describe the syntax of the menus.xml tags. Optional attributes are marked in the attribute lists with curly braces ({}); all attributes not marked with curly braces are required.

<menubar>

Description

Provides information about a menu bar in the Dreamweaver menu structure.

Attributes

 name, {app}, id, {platform} 

  • name The name of the menu bar. Although name is a required attribute, you can give it the value "".

  • app The name of the application in which the menu bar is available. Not currently used.

  • id The menu ID for the menu bar. Each menu ID in the menus.xml file should be unique.

  • platform Indicates that the menu bar should appear only on the given platform. Valid values are "win" and "mac".

Contents

This tag must contain one or more menu tags.

Container

None.

Example

The main (Document window) menu bar uses the following menubar tag:

 <menubar name="Main Window" > <!-- menu tags here --> </menubar> 

<menu>

Description

Provides information about a menu or submenu to appear in the Dreamweaver menu structure.

Attributes

 name, {app}, id, {platform}, {showIf} 

  • name The name of the menu as it will appear on the menu bar. To set the menu's access key (mnemonic) in Windows, use an underscore (_) before the access letter. The underscore is automatically removed on the Macintosh.

  • app The name of the application in which the menu is available. Not currently used.

  • id The menu ID for the menu. Every ID in the file should be unique.

  • platform Indicates that the menu should appear only on the given platform. Valid values are "win" and "mac".

  • showIf Specifies that the menu should appear only if the given Dreamweaver enabler is the value TRue. The possible enablers are: _SERVERMODEL_ASP, _SERVERMODEL_ASPNET, _SERVERMODEL_JSP, _SERVERMODEL_CFML (for all versions of Macromedia ColdFusion), _SERVERMODEL_CFML_UD4 (for UltraDev version 4 of ColdFusion), _SERVERMODEL_PHP, _FILE_TEMPLATE, _VIEW_CODE, _VIEW_DESIGN, _VIEW_LAYOUT, _VIEW_EXPANDED_TABLES, and _VIEW_STANDARD. You can specify multiple enablers by placing a comma (which means AND) between the enablers. You can specify NOT with "!". For example, if you want the menu to appear only in Code view for an ASP page, specify the attribute as showIf="_VIEW_CODE, _SERVERMODEL_ASP".

Contents

This tag can contain one or more menuitem tags, and one or more separator tags. It can also contain other menu tags (to create submenus) and standard HTML comment tags.

Container

This tag must be contained in a menubar tag.

Example

 <menu name="_File" >   <!-- menuitem, separator, menu, and comment tags here --> </menu> 

<menuitem>

Description

Defines a menu command for a Dreamweaver menu.

Attributes

name, id, {app}, {key}, {platform}, {enabled}, {arguments}, {command}, {file}, {checked}, {dynamic}, {isdomrequired}, {showIf}

  • name The menu command name that appears in the menu. An underscore indicates that the following letter is the command's access key (mnemonic), for Windows only.

  • id Used by Dreamweaver to identify the item. This ID must be unique throughout the menu structure. If you add new menu commands to menus.xml, ensure uniqueness by using your company name or another unique string as a prefix for each menu command's ID.

  • app The name of the application in which the menu command is available. Not currently used.

  • key The keyboard shortcut for the command, if any. Use the following strings to specify modifier keys:

    • Cmd specifies the Control key (Windows) or Command key (Macintosh).

    • Alt and Opt interchangeably specify the Alt key (Windows) or Option key (Macintosh).

    • Shift specifies the Shift key on both platforms.

    • Ctrl specifies the Control key on both platforms.

    • A Plus (+) sign separates modifier keys if a given shortcut uses more than one modifier. For example, Cmd+Opt+5 in the key attribute means the menu command is executed when the user presses Control+Alt+5 (Windows) or Command+Option+5 (Macintosh).

    • Special keys are specified by name: F1 tHRough F12, PgDn, PgUp, Home, End, Ins, Del, Tab, Esc, BkSp, and Space. Modifier keys can also be applied to special keys.

  • platform Indicates on which platform the item appears. Valid values are "win", meaning Windows, or "mac", meaning Macintosh. If you don't specify the platform attribute, the menu command appears on both platforms. If you want a menu command to behave differently on different platforms, supply two menu commands with the same name (but different IDs): one with platform="win" and the other with platform="mac".

  • enabled Provides JavaScript code (usually a JavaScript function call) that determines whether the menu command is currently enabled. If the function returns the value false, the menu command is dimmed. The default value is "true", but it's best to always specify a value for clarity even if the value is "true".

  • arguments Provides arguments for Dreamweaver to pass to the code in the JavaScript file that you specify in the file attribute. Enclose arguments in single quotation marks ('), inside the double quotation marks (") used to delimit an attribute's value.

  • command Specifies a JavaScript expression that's executed when the user selects this item from the menu. For complex JavaScript code, use a JavaScript file (specified in the file attribute) instead. You must specify either file or command for each menu command.

  • file The name of an HTML file containing JavaScript that controls the menu command. Specify a path to the file relative to the Configuration folder. (For example, the Help > Welcome menu command specifies file="Commands/Welcome.htm".) The file attribute overrides the command, enabled, and checked attributes. You must specify either file or command for each menu command. For information on creating a command file using the History panel, see Dreamweaver Help. For information on writing your own JavaScript commands, see Chapter 7, "Commands," on page 167.

  • checked A JavaScript expression that indicates whether the menu command has a check mark next to it in the menu; if the expression evaluates as true, the item appears with a check mark.

  • dynamic If present, indicates that a menu command is to be determined dynamically, by an HTML file; the file contains JavaScript code to set the text and state of the menu command. If you specify a tag as dynamic, you must also specify a file attribute.

  • isdomrequired Indicates whether to synchronize the Design view and the Code view before executing the code for this menu command. Valid values are "TRue" (the default) and "false". If you set this attribute to "false", it means that the changes to the file that this menu command makes do not use the Dreamweaver DOM. For information about the DOM, see Chapter 5, "The Dreamweaver Document Object Model," on page 127).

  • showIf Specifies that the menuitem should appear only if the given Dreamweaver enabler has value TRue. The possible enablers are: _SERVERMODEL_ASP, _SERVERMODEL_ASPNET, _SERVERMODEL_JSP, _SERVERMODEL_CFML (for all versions of ColdFusion), _SERVERMODEL_CFML_UD4 (for UltraDev version 4 of ColdFusion), _SERVERMODEL_PHP, _FILE_TEMPLATE, _VIEW_CODE, _VIEW_DESIGN, _VIEW_LAYOUT, _VIEW_EXPANDED_TABLES, and _VIEW_STANDARD. You can specify multiple enablers by placing a comma (which means AND) between the enablers. You can specify NOT with "!". For example, if you want the menu command to appear in Code view but not for a ColdFusion page, specify the attribute as showIf="_VIEW_CODE, !_SERVERMODEL_CFML".

Contents

None (empty tag).

Container

This tag must be contained in a menu tag.

Example

<menuitem name="_New" key="Cmd+N" enabled="true" command="dw.createDocument()" />

<separator>

Description

Indicates that a separator should appear at the corresponding location in the menu.

Attributes

 {app} 

  • app The name of the application in which the separator is shown. Not currently used.

Contents

None (empty tag).

Container

This tag must be contained in a menu tag.

Example

 <separator /> 

<shortcutlist>

Description

Specifies a shortcut list in the menus.xml file.

Attributes

 {app}, id, {platform} 

  • app The name of the application in which the shortcut list is available. Not currently used.

  • id The ID for the shortcut list. It should be the same as the menu ID for the menu bar (or context menu) in Dreamweaver that the shortcuts are associated with. Valid values are "DWMainWindow", "DWMainSite", "DWTimelineContext", and "DWHTMLContext".

  • platform Indicates that the shortcut list should appear only on the given platform. Valid values are "win" and "mac".

Contents

This tag can contain one or more shortcut tags. It can also contain one or more comment tags (which use the same syntax as HTML comment tags).

Container

None.

Example

 <shortcutlist > <!-- shortcut and comment tags here --> </shortcutlist> 

<shortcut>

Description

Specifies a keyboard shortcut in the menus.xml file.

Attributes

 key, {app}, {platform}, {file}, {arguments}, {command}, id, {name} 

  • key The key combination that activates the keyboard shortcut. For syntax details, see <menuitem>.

  • app The name of the application in which the shortcut is available. Not currently used.

  • platform Specifies that the shortcut works only on the indicated platform. Valid values are "win" and "mac". If you do not specify this attribute, the shortcut works on both platforms.

  • file The path to a file containing the JavaScript code that Dreamweaver executes when you use the keyboard shortcut. The file attribute overrides the command attribute. You must specify either file or command for each shortcut.

  • arguments Provides arguments for Dreamweaver to pass to the code in the JavaScript file that you specify in the file attribute. Enclose arguments in single quotation marks ('), inside the double quotation marks (") used to delimit an attribute's value.

  • command The JavaScript code that Dreamweaver executes when you use the keyboard shortcut. Specify either file or command for each shortcut.

  • id A unique identifier for a shortcut.

  • name A name for the command executed by the keyboard shortcut, in the style of a menu command name. For example, the name attribute for the F12 shortcut is "Preview in Primary Browser".

Contents

None (empty tag).

Container

This tag must be contained in a shortcutlist tag.

Example

 <shortcut key="Cmd+Shift+Z" file="Menus/MM/Edit_Clipboard.htm" arguments="'redo'"  /> 

<tool>

Description

Represents one tool; it contains all the shortcuts for the tool as subtags in the menus.xml file.

Attributes

 {name}, id 

  • name A localized version of the tool name.

  • id The internal tool identifier that identifies the tool to which the shortcuts apply.

Contents

This tag can contain one or more activate, override, or action tags.

Container

This tag must be contained in a menu tag.

Example

 <tool name="Hand tool" >   <!-- tool tags here --> </tool> 

<action>

Description

Contains the key combination and JavaScript to execute when the tool is active and the key combination is pressed.

Attributes

 {name}, key, command, id 

  • name A localized version of the action.

  • key The key combination used to execute the action. For syntax details, see <menuitem>.

  • command The JavaScript statements to execute. This attribute has the same format as the command attribute of <shortcut>.

  • id A unique ID used to reference the action.

Contents

None (empty tag).

Container

This tag must be contained in a tool tag.

Example

<action name="Set magnification to 50%" key="5" command="dw.activeViewScale = 0.50" id ="DWTools_Zoom_50" />

<activate>

Description

Contains the key combination to activate the tool.

Attributes

 {name}, key, id 

  • name A localized version of the action.

  • key The key combination used to activate the tool. For syntax details, see <menuitem>.

  • id A unique ID used to reference the action.

Contents

None (empty tag).

Container

This tag must be contained in a tool tag.

Example

 <activate name="Switch to Hand tool" key="H"  /> 

<override>

Description

Contains the key combination to temporarily activate the tool. While in another modal tool, the user can press and hold this key to switch to this tool.

Attributes

 {name}, key, id 

  • name A localized version of the action.

  • key The key combination used to quickly activate the tool. For syntax details, see <menuitem>.

  • id A unique ID used to reference the action.

Contents

None (empty tag).

Container

This tag must be contained in a tool tag.

Example

 <override name="Quick switch to Hand tool" key="Space"  /> 

     < Day Day Up > 


    Developing Extensions for Macromedia Dreamweaver 8
    Developing Extensions for Macromedia Dreamweaver 8
    ISBN: 0321395409
    EAN: 2147483647
    Year: 2005
    Pages: 282

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net