- Written and documented by David Deley


1:     2:     3:     4:     5:     6:     7:     8:     9:     10:     11:     12.1:     12.2:     12.3:     12.4:    

Introduction to CMac Chapter 6: Command Map Report

A great way to learn about CMAC is to examine some real code. The Multi-Edit\src folder (e.g. C:\Program Files\Multi-Edit 9.10\src) contains all the CMAC macro source code for Multi-Edit. (NOTE: If you do not have a \src folder under Multi-Edit then you need to reinstall Multi-Edit and check the box "Macro Source". See http://www.multiedit.com/forums/viewtopic.php?p=1380#1380))

INSIDE MULTI-EDIT
In Multi-Edit look at HELP -> Command Map Report (it's about half way down the HELP pulldown menu). This lists all the functions that Multi-Edit has available, what keys are assigned to which functions, and what Multi-Edit CMAC macro is invoked for each function.

Here is a condensed sample output:

Code:
"WCMDMAP" Command Map List
WCmd   Name              T  Key1     Key2    Cmd
;--- File Operations ---
101    Open file         1  F3               LoadFile /E=1
103    New file/window   1                   MakeWin /NL=1
104    Close file        1  Shift+F3 Ctrl+F4 WinOp /T=1
105    Save file         1  F2               SaveFile /NP=1/RLN=1

This tells us the "Open File" command is assigned to key F3, and it runs macro "LoadFile" passing the parameter "/E=1". Unfortun ately it doesn't tell us which file in the Multi-Edit\src folder has the "LoadFile" code. (Depending on what version of Multi-Edit you have, it's either in the file "MeUtil1.s" or in file "MeUtil.s")

One way to find a macro is to do a SEARCH -> FILE FIND and search all the "*.s" files in the Multi-Edit\src folder for the string "LoadFile", and then wade through the results to find where it's defined.

A second more refined way is to use regular expressions. Classic:

Code:
{int}|{str}|{void}|{real}|{macro}<b1>LoadFile

or Unix style:

Code:
(int)|(str)|(void)|(real)|(macro)<b1>LoadFile

For more on regular expressions click the "Alias" button to see a vast array of predefined regular expressions ready for you to use, such as the <b1> used above.

A third way is to use the Multi-Edit "tags" feature, which I'll describe in a future post. (See http://www.multieditsoftware.com/forums/viewtopic.php?t=401)

The Command Map Report is a gold mine of information about how Multi-Edit works, and what macros are available for you to use.

(Note 1: http://www.multiedit.com/downloads/windows/macros/showcmd.zip contains macro showkeys, which will create a command map sorted by key name, and macro showcmds, which will create a command map sorted by command name.)

MULTI-EDIT KEYS/COMMANDS
This is where you go to find what any Multi-Edit key does, or if you wish to change what a key does.

Go to TOOLS -> CUSTOMIZE, set the left side to "General" (at the top):

Image

Click on the "Keys/Commands..." button. Then scroll down to the "File Operations" section and highlight the line "Open file":

Image

Click on the "Edit" button (top right): <
Image

This tells us the command name is "Open File", it's a macro, the run macro command line is once again "LoadFile /E=1", and that function key F3 is assigned to this macro.

NOTE: You change the primary or secondary key by clicking on the Image button next to the field. This is where you go if you want to change what a particular key does.

You can add your own user defined macros to the "Command Mapping" window (above). There's a section near the bottom titled "User-defined Operations" specifically for you. Just highlight a line where you want the new command to be inserted and click "Insert".

MULTI-EDIT MENUS
This is where you go to find what any Multi-Edit menu item does, or if you wish to add or remove menu items.

Go to TOOLS -> CUSTOMIZE, set the left side to "General" (as before), click on the "Menus..." button.

Image

Highlight "Main" and click on the "Edit" button (top right side).

Image

Highlight "Open" under "File", then click on the "Edit" button (top right side) and we'll have a look at what the Multi-Edit FILE -> OPEN menu item does.

Image

This tells us the menu text is "Open..." [The ampersand (&) before the "O" in "Open..." means the "O" will be underlined, so the user can press the "O" key to go straight to that menu item.] The command is the "Open file" command, which we can verify by clicking on the Image button to the right of the Command field, and we end up again at our Command Mapping menu.

This shows the Multi-Edit menu item FILE -> OPEN is mapped to the Open File command.

You can add your own custom addition to any Multi-Edit menu by highlighting where you want the new menu item to go and then clicking the "Insert" button.


TOOLBARS/BOXES
This is where you go to find what any Multi-Edit toolbar button does, or if you want to add or remove buttons from the toolbar.

Go to TOOLS -> CUSTOMIZE, set the left side to "General" (as before), click on the "Toolbars/Boxes..." button.

Image

Highlight "Main" and click on the "Edit" button (top right)

Image

This "Edit Toolbox" window which comes up shows what buttons are shown on the main Multi-Edit toolbar (across the top, just below the menu bar "File Edit Search View Text Project Macro Tools Window Tags Vcs Help"), and it shows what the buttons currently do. (Note you can change style from "Small Icon" to "Big Icon" if you wish.)

Highlight the "Open File" line and click "Edit" (top right side). This brings us again to the "Command Mapping" window (above), showing that the Image button on the main toolbar is mapped to the "Open file" command.

You can add buttons to the toolbar by highlighting where you want the new button to go, then clicking the "Insert" button. The "Command Mapping" window will come up, and you can select the button you want to add to the toolbar.


*.DB files:
All of the information for the Command Map Report and key assignments are stored in a database file in the Multi-Edit\Config\ folder. There are several to choose from. The default is "Wcmdmap.db" There are a few other options:

Code:
  FILE
Wcmdmap.db   - Default key assignments
Borland.db   - Borland IDE Emulation
Brief.db     - Brief Emulation
Wordstar.db  - Wordstar Emulation
Vstudio.db   - Visual Studio Emulation
Go to TOOLS -> CUSTOMIZE, set the left side to "General" (at the top), press the Image button next to the field "Command Set:". Select "Default" and click the "Edit" button. You'll see the file name is WCMDMAP (i.e. Wcmdmap.db). Then click "Cancel" so nothing is changed.

For more information see the topic "Modifying a Command Map" in the Multi-Edit help (HELP->CONTENTS, or F1 key).

RELATED ARTICLE:
Introduction to CMAC: 11. Defining a key to run a macro

 


1:     2:     3:     4:     5:     6:     7:     8:     9:     10:     11:     12.1:     12.2:     12.3:     12.4: