|
| 1 | +// |
| 2 | +// This is the file that defines the actual layout and type of the commands. |
| 3 | +// It is divided in different sections (e.g. command definition, command |
| 4 | +// placement, ...), with each defining a specific set of properties. |
| 5 | +// See the comment before each section for more details about how to |
| 6 | +// use it. |
| 7 | +// |
| 8 | + |
| 9 | +// The CTC compiler (the tool that translates this file into the binary |
| 10 | +// format that VisualStudio will consume) has the ability to run a preprocessor |
| 11 | +// on the ctc file; this preprocessor is (usually) the C++ preprocessor, so |
| 12 | +// it is possible to define includes and macros with the same syntax used |
| 13 | +// in C++ files. Using this ability of the compiler here, we include some files |
| 14 | +// defining some of the constants that we will use inside the file. |
| 15 | + |
| 16 | +#include "stdidcmd.h" // This is the file that defines the IDs for all the |
| 17 | + // commands exposed by VisualStudio. |
| 18 | + |
| 19 | +#include "vsshlids.h" // This header contains the command ids for the menus |
| 20 | + // provided by the shell. |
| 21 | + |
| 22 | +#include "msobtnid.h" // Definition of some CTC specific constants. In this sample |
| 23 | + // we use it for the IDs inside the guidOfficeIcon group. |
| 24 | + |
| 25 | + |
| 26 | +#include "CommandIds.h" // Definition of the IDs of the commands and CTC elements |
| 27 | + // specific for this sample. |
| 28 | + |
| 29 | +#include "Resource.h" // Definition of the IDs of the resources used by this package; |
| 30 | + // Here it is used to include the bitmap with the images used for |
| 31 | + // the commands. |
| 32 | + |
| 33 | +#include "Guids.h" // This is the file with the definition of the Guid |
| 34 | + // specific for this sample. |
| 35 | + |
| 36 | +// shorthand macros for a more compact and manageable table |
| 37 | +#define OI_NOID guidOfficeIcon:msotcidNoIcon |
| 38 | +#define DIS_DEF DEFAULTDISABLED | DEFAULTINVISIBLE | DYNAMICVISIBILITY |
| 39 | +#define VIS_DEF COMMANDWELLONLY |
| 40 | + |
| 41 | + |
| 42 | +// The CMDS_SECTION section is where we the commands, menus and menu groups are defined. |
| 43 | +// This section uses a Guid to identify the package that provides the command defined |
| 44 | +// inside it. |
| 45 | +CMDS_SECTION guidcppCheckVisualStudioAddInPkg |
| 46 | + |
| 47 | + // Inside this section we have different sub-sections: one for the menus, another |
| 48 | + // for the menu groups, one for the buttons (the actual commands), one for the combos |
| 49 | + // and the last one for the bitmaps used. Each element is identified by a command id that |
| 50 | + // is a unique pair of guid and numeric identifier; the guid part of the identifier is usually |
| 51 | + // called "command set" and is used to group different command inside a logically related |
| 52 | + // group; your package should define its own command set in order to avoid collisions |
| 53 | + // with command ids defined by other packages. |
| 54 | + |
| 55 | + // This is the sub-section that defines the menus and toolbars. |
| 56 | + MENUS_BEGIN |
| 57 | + // To define an element in this group you need an ID, a parent group, a display priority, |
| 58 | + // a menu type, a name and a default text. |
| 59 | + |
| 60 | + // NewMenu Relative to Group Priority Type Name Text |
| 61 | + guidcppCheckVisualStudioAddInCmdSet:cppCheckToolBar, guidcppCheckVisualStudioAddInCmdSet:cppCheckToolBar, 0x100, TOOLBAR, "cppCheckToolBar", "cppCheck Toolbar"; |
| 62 | + |
| 63 | + MENUS_END |
| 64 | + |
| 65 | + // In this section you can define new menu groups. A menu group is a container for |
| 66 | + // other menus or buttons (commands); from a visual point of view you can see the |
| 67 | + // group as the part of a menu contained between two lines. The parent of a group |
| 68 | + // must be a menu. |
| 69 | + NEWGROUPS_BEGIN |
| 70 | + // NewGroup Parent Group Priority |
| 71 | + guidcppCheckVisualStudioAddInCmdSet:cppCheckMenuGroup, guidSHLMainMenu:IDM_VS_MENU_TOOLS, 0x0600; |
| 72 | + |
| 73 | + guidcppCheckVisualStudioAddInCmdSet:cppCheckToolBarGroup, guidcppCheckVisualStudioAddInCmdSet:cppCheckToolBar, 0x100; |
| 74 | + |
| 75 | + |
| 76 | + NEWGROUPS_END |
| 77 | + |
| 78 | + // Button section. |
| 79 | + // This section defines the elements the user can interact with, like a menu command or a button |
| 80 | + // or combo box in a toolbar. |
| 81 | + BUTTONS_BEGIN |
| 82 | + // To define a menu group you have to specify its ID, the parent menu and its display priority. |
| 83 | + // Some commands are not defined as shared, so they use our package CLSID |
| 84 | + // as the command set GUID. Also, by specifying blank for the FLAGS, the command is |
| 85 | + // default visible and enabled. Other valid values for FLAGS are the following: |
| 86 | + // DEFAULTDISABLED, DEFAULTINVISIBLE, DYNAMICVISIBILITY, TEXTCHANGES |
| 87 | + // These values for FLAGS can be or'ed together, e.g. "DEFAULTINVISIBLE | DYNAMICVISIBILITY" |
| 88 | + // If you do not want an image next to your command, set the image to "guidOfficeIcon:msotcidNoIcon" |
| 89 | + |
| 90 | + // Command Parent Group Priority Image Type Visibility |
| 91 | + guidcppCheckVisualStudioAddInCmdSet:cmdidcppCheckConfig, guidcppCheckVisualStudioAddInCmdSet:cppCheckMenuGroup, 0x0100, guidcppCheckVisualStudioAddInCmdSet:bmpPic1, BUTTON, , "cppCheck Config"; |
| 92 | + guidcppCheckVisualStudioAddInCmdSet:cmdidcppCheckParseFile, guidcppCheckVisualStudioAddInCmdSet:cppCheckMenuGroup, 0x0200, guidcppCheckVisualStudioAddInCmdSet:bmpPic2, BUTTON, , "cppCheck Parse File"; |
| 93 | + guidcppCheckVisualStudioAddInCmdSet:cmdidcppCheckParseProject, guidcppCheckVisualStudioAddInCmdSet:cppCheckMenuGroup, 0x0300, guidcppCheckVisualStudioAddInCmdSet:bmpPic2, BUTTON, , "cppCheck Parse Project"; |
| 94 | + guidcppCheckVisualStudioAddInCmdSet:cmdidcppCheckParseSolution, guidcppCheckVisualStudioAddInCmdSet:cppCheckMenuGroup, 0x0400, guidcppCheckVisualStudioAddInCmdSet:bmpPic2, BUTTON, , "cppCheck Parse Solution"; |
| 95 | + |
| 96 | + |
| 97 | + guidcppCheckVisualStudioAddInCmdSet:cmdidMyZoom, guidcppCheckVisualStudioAddInCmdSet:cppCheckToolBarGroup, 0x100, guidOfficeIcon:msotcidZoom, BUTTON, , "cppCheck Config"; |
| 98 | + |
| 99 | + BUTTONS_END |
| 100 | + |
| 101 | + // The bitmaps section is used to define the bitmaps that are used for the commands. |
| 102 | + BITMAPS_BEGIN |
| 103 | + // The bitmap id is defined in a way that is a little bit different from the others: |
| 104 | + // the declaration starts with a guid for the bitmap strip, then there is the resource id of the |
| 105 | + // bitmap strip containing the bitmaps and then there are the numeric ids of the elements used |
| 106 | + // inside a button definition. An important aspect of this declaration is that the element id |
| 107 | + // must be the actual index (1-based) of the bitmap inside the bitmap strip. |
| 108 | + |
| 109 | + // Bitmap Bitmap Index, Bitmap Index, ... |
| 110 | + guidcppCheckVisualStudioAddInCmdSet:IDB_MENU_IMAGES, bmpPic1, bmpPic2, bmpPicSmile, bmpPicX, bmpPicArrows; |
| 111 | + BITMAPS_END |
| 112 | + |
| 113 | +CMDS_END |
| 114 | + |
| 115 | +// Within this section you can specify the set of commands defined somewhere else that your |
| 116 | +// packages uses; for instance if your package uses the standard ‘Copy’ command, you don’t |
| 117 | +// need to define it, because it is defined by the shell, but you have to use this section |
| 118 | +// of the CTC file to notify the shell that your package uses it using this section. |
| 119 | + |
| 120 | +CMDUSED_SECTION |
| 121 | + |
| 122 | +CMDUSED_END |
| 123 | + |
| 124 | +// Inside this section, we have the ability to place menu groups inside some other menu or |
| 125 | +// menu / commands inside other groups. |
| 126 | +// For instance, it is possible to place one of VisualStudio's menus or commands inside one of our |
| 127 | +// groups or one of our groups inside a menu defined somewhere else. |
| 128 | +CMDPLACEMENT_SECTION |
| 129 | + // Command Group Priority |
| 130 | + |
| 131 | +CMDPLACEMENT_END |
| 132 | + |
| 133 | + |
| 134 | +VISIBILITY_SECTION |
| 135 | + // Command GUID when visible |
| 136 | + |
| 137 | + |
| 138 | + |
| 139 | +VISIBILITY_END |
| 140 | + |
| 141 | +// This section is where you can associate a command with a keyboard shortcut; this association is |
| 142 | +// valid within a specific UI context, that is when the shell is inside a specific mode, e.g. during |
| 143 | +// debugging, editing a file or when the user is using a specific designer. |
| 144 | +KEYBINDINGS_SECTION |
| 145 | + // To define a binding, you have to specify the sequence of keys to press to activate the command |
| 146 | + // (keystate); the syntax to use is <key>[:<special keys>] where the special keys section can be |
| 147 | + // empty. The accepted special keys and their representation are: |
| 148 | + // Alt - A |
| 149 | + // Control - C |
| 150 | + // Shift - S |
| 151 | + // Windows Key - W |
| 152 | + // For example, if you want to define a binding for <Control>C the definition will be 'C':C; if the |
| 153 | + // binding is <Control><Alt>C, then the keybinding is 'C':AC. |
| 154 | + // |
| 155 | + // Notice that Visual Studio has a lot of components and commands, so it can be difficult to find a |
| 156 | + // key binding not used by somebody else; if the key bindings are conflicting only one will be used |
| 157 | + // and one problem is that the shell will not inform the user that a conflict was found. The only |
| 158 | + // way to detect the problem is to start Visual Studio under debugger, try to execute any command |
| 159 | + // and look if there is a message in the output window about a duplicated accelerator found. |
| 160 | + |
| 161 | + // Command when available emulation keystate |
| 162 | + |
| 163 | +KEYBINDINGS_END |
0 commit comments