Document directory
- Run doxygen
- Insert doxygen comments
- Build solution stats
- Dependency and inheritance Graph
- Swap. H <->. cpp
- Colorize
- } End
- # Region/# endregion for C ++
- Search the Web
Visual Studio. NET doxygen plug-in-kingtools:
Http://www.codeproject.com/macro/KingsTools.asp
- Download installer-1847 KB
- Download source-47 KB
Introduction
As good as Visual Studio. net is, I still miss some features in it. but MS knew that they couldn't fulfill every wish so they provided a way to write addins. that's what I 've ve done. sure, most of the functions in my tools cocould also be done with macros, But I wanted them all packed together with an installer.
Tools
- Run doxygen
- Insert doxygen comments
- Build solution stats
- Dependency Graph
- Inheritance Graph
- Swap. H <->. cpp
- Colorize
- } End
- # Region/# endregion for C ++
- Search the Web
Run doxygen
This command First pops up a dialog box in which you can configure the output doxygen shold produce. for those who don't know doxygen: It's a free tool to generate source documentations. it can produce documentation in different formats like HTML and even Windows Help format! See the http://www.doxygen.org/for details. since the dialog box doesn't offer all possible settings for doxygen, you can always edit the file doxyfile. CFG manually which is created the first time you run it. all settings in that file override the settings you enter in the dialog box.
If you set doxygen to generate HTML output, the resultingIndex.htmlIs opened inside the IDE. A winhelp output (Index. CHM) Will be opened outside the IDE.
The command available from the Tools menu builds the documentation for the whole solution. if you don't want that for example if you have several third party projects in your solution then you can build the documentation also for single projects. to do that the kingstools Add a command to the right click menu in the Solution Explorer.
If you want to update doxygen to a newer version (as soon as one is released) simply overwriteDoxygen.exeIn the installation directory. The same applies toDot.exe.
Todo: Find a way to integrate the generated Windows Help file into vs help.
Insert doxygen comments
Doxygen needs comments that follow certain conventions to build documentation from. this part of the tools inserts them for you. either from the right click menu in the code editor window or from the submenu under tools-> kings tools. just place the caret over a method or Class header. the inserted comment for a method or function wocould look like this:
/** * * /param one * /param two * /param three * /return */BOOL myfunction(int one, int two, int three);
You now have to simply insert a description in the second comment line and descriptions for each parameter of the function/method. And of course a description of the return value.
You can customize the function comments by editing the files "functionheadertop.txt", "functionparams.txt" and "functionheaderbottom.txt ". please read the comments inside those files on how to do that. if you don't want to change the function comments for all your projects then you can place any of those files into your project directory (that way it will be used for your project) or inside the folder of your source files (that way it will be used only for the files inside that specific folder ).
The inserted comment for a class looks like this:
/** * /ingroup projectname * * /par requirements * win98 or later, win2k or later, win95 with IE4 or later, winNT4 with IE4 * or later * * /author user * * /par license * This code is absolutely free to use and modify. The code is provided * "as is" with no expressed or implied warranty. The author accepts no * liability if it causes any damage to your computer, causes your pet to * fall ill, increases baldness or makes your car start emitting strange * noises when you start it up. This code has no bugs, just undocumented * features! * * /version 1.0 * /date 06-2002 * /todo * /bug * /warning * */class CRegBase
The '/ingroup projectname' means that the class is inside the project 'projectname '. that statement helps doxygen to group classes together. insert the description of the class right after that statement. if you want to include pictures to restrict strate the class, use '/image html "picture.jpg "'. for more helpful tags you can use please check out the doxygen website. the '/PAR requireents' section you have to modify yourself to fit the truth of your class. it's not necessary for doxygen, but I found it very useful to give that information inside a Class documentation. the name after the '/author' tag is the currently logged in user. maybe you want to change that too to include an email address.
You can customize the class comments by editing the file "classheader.txt" please read the comments inside that file on how to do that. if you don't want to change the class comments for all your projects then you can place that files into your project directory (that way it will be used for your project) or inside the folder of your source files (that way it will be used only for the files inside that specific folder ).
The last few tags shocould be self-explanatory. Under the line '/version' I usually insert short descriptions of what changed between versions.
Build solution stats
This is a simple line counter. it counts all the lines of all files in your solution, grouped by projects. the generated HTML file with the counted lines (Code, comments, empty) is then opened in the IDE. since I haven'tfound a way to add a file directly to a solution and not to a project the file is just opened for view in the IDE.
Dependency and inheritance Graph
These two commands build graphs of the class relations in your solution. see my previous article about this. the difference to my old tool is that it now generates graphs for all projects in the solution and puts all the graphs in one single HTML page.
Swap. H <->. cpp
This is something a simple macro cocould also do: It swaps between header and code files. for better accessibility it also is on the right click menu of the Code Editor. really nothing special but it can be useful sometimes.
Colorize
This tool goes through all files of the current solution and looks for class, function and macronames. It then writes them toUsertype. datFile, makes the IDE to read that file and deletes it again. after you run this tool, all class, function and macronames of your solution appear colored in the code editor. default color is the same color as normal keywords, but you can change that under tools-> options, in the Options dialog select environment-> fonts and colors.
If you don't want the colors anymore, just run the command 'Disable coloring' and everything will be in normal colors again. I didn't want to overwrite some possibleUsertype. datFile already created by some user so the tool simply creates a temporaryUsertype. datFile instead. if you want to have the colors again the next time the IDE starts, you either have to rerun the command (doesn't take very long to execute) or change the code of the tool yourself.
} End
Have you ever wrote a bunch of code which looked like this:
OK, I admit this isn't a very good style of programming, but sometimes it can't be avoided. and in those cases the code is horrible to read because you don't know which closing brace belongs to which opening statement without scrolling or using the macro 'edit. gotobrace 'several times. this tool provides a function which inserts comments after the closing brace automatically. the code snippet maid look like this:
Comments are only inserted for closing bracesif
,while
,for
Andswitch
Statements.
If you don't want to insert comments automatically while editing, you can turn off this function. if you just don't want those comments at specific places you have to move the caret either upwards (instead of downwards which happens if you press Enter) or click with the mouse so that the caret doesn't go to the line below the closing brace. comments are also not inserted when the Opening brace is less than two lines above.
# Region/# endregion for C ++
Vs. net introduced to possibility to outline portions of text in the code editor. that's a very useful feature wthat helps navigating through big bunches of code. but the outlined sections are not saved between sessions. VB and C # provide keywords to outline sections. in VB its '# region' and '# End Region', in C # Its '# region' and '# endregion '. only for C ++ MS didn't provide such keywords (at least I haven't found them yet ). with this tool you can now enable that feature for C ++ too. to prevent Compiler Errors for those who have not installed this tool I used '// # region' and '// # endregion' as the keywords. with the comment lines before the compiler won't complain. use those keywords like this:
Whenever you open a document with such keywords the tool will automatically create outlining sections. the Section are also created when you type the '// # endregion 'keyword and a matching' // # region 'is found. as you can see, you can easily nest the sections. the code above wowould then look like this:
This function can't be deactivated. If you don't want it, simply don't use those keywords
Search the Web
These two small Addons perform a simple web site search either in the Google groups or on CP. select a piece of text in the Code Editor, right click to pop up the menu and then select where to search for the selected text. that's all. the search results will be opened inside. net.
Install
To install the tools, just double-click *. MSI file and follow the instructions. if the tools are not automatically activated the next time you start the IDE, then please activate them under tools-> Add-In manager. make sure you select both The addin and the box 'startup '.
All additional files needed for the tools are also packed in the installer, including doxygen and the dot files. So you don't have to grab them separately from the web.
Source
Full source code is provided with these tools. the addin is written in VB. net cause first there was just one simple tool that I wanted immediately-and VB is good enough for that. then the tool grew and I added more functions. so the code is surely not the best example for good programming (no plan, no structure-> chaos ). but maybe it might still be of interest for those who want to write their own addins. it shows a way to create submenus and how to add a toolbar.