CodeWiz - Developer Studio Add-In

Version 1.40

Teemu Lätti

 


Introduction



What is it?

CodeWiz is a Developer Studio Add-In. Add-Ins are small DLLs which add functionality to your development environment. If you have ever used Macros, Add-Ins do the same thing but in more powerful way.

CodeWiz is designed specifically for professional C++ developers. It contains several commands which help you with the most basic coding activities you do daily. See the Commands section.

Why not use Macros?

I used to have several Macros installed into my Developer Studio, and they had some really nice features. For example I could not live without the "Friend File" macro after using it for a while.

But then there was always this hassle to set them up (keyboard shortcuts and stuff). And the worst thing was that they crashed my DevStudio several times and were really slow to load up and use.

In this Add-In I can get all the functionality I want at once, and the installation is really fast to do. Since the DLL is always loaded in memory as a compiled executable, it is very fast to use and much more reliable. And have you ever tried to present a dialog or any other complex user interface from a Macro?

Which versions of Developer Studio are supported?

This Add-In is fully tested with Microsoft Visual Studio version 6 (should also work fine with version 5) and Microsoft eMbedded Visual C++. Version for Microsoft Visual Studio .NET can be found from http://www.cupla.net/CodeWiz2/.

Where can I find the latest version?

CodeWiz is freeware. Download latest version of CodeWiz from http://www.cupla.net/CodeWiz/CodeWiz.zip

The latest version of this page can be found from http://www.cupla.net/CodeWiz

 


Installation


New Installation

Download CodeWiz.zip (or open directly here).
Unpack all the files into any directory you want.
Open your Developer Studio and choose the menu "Tools / Customize".
Click to the "Add-ins and Macro files" page.
Choose "Browse".
Locate "CodeWiz.dll". Be sure to have the file type as "Add-ins (.dll)".
Now the DLL is loaded and should have the checkmark on it. Close the window.
A new toolbar with two buttons has appeared and CodeWiz is ready for use.

Install Updated Version

Close your Developer Studio and overwrite the files with newer versions.
If you want to keep your existing code templates, save the file "CodeWiz.txt".
Please Note! Sometimes it is required to follow the "New Installation" procedure to update the add-in.


Commands


Friend File (CTRL-1)

Switches between the source and the header file. For example if you have a file called "MainFrame.cpp" active, this command will open and activate a file called "MainFrame.h".

The following file extensions are supported (in search order):

        Source files:  .cpp .c   .cc
        Header files:  .h   .hpp       
 

If the searched file is not found in the current directory, the command will search from additional directories, which you can specify in Options. This enables you to keep your header and source files in different sub-directories. You can also use environment variables when specifying these directories.

Friend Member (CTRL-2)

Same as above, but also searches for the function or variable currently selected (or in the current line). Good way to quickly go to the member declaration and back.

Browse (CTRL-4)

Opens a Browse dialog, where you can shuffle through all the function and class declarations in the current file. Type part of the name, and the list will be filtered to contain only matching items.

If you press 'Backspace' when the edit box is empty, you can see a list of all the files in the current project. Another press gives you all the projects in the workspace.

Copy/Paste Members (CTRL-5 / CTRL-6)

These are very useful commands, which save you the trouble of reformatting your functions when typing them into the header file.

You start by selecting a function in the implementation file. Just paint the function(s) or leave the cursor in the same line with the function name. Then press CTRL-5. Now the function declaration has been copied into memory.

Go to the header file (use CTRL-1) and go inside the class declaration. Choose a place for your function and press CTRL-6. The function is automatically reformatted for the header file!

This also works vice versa and you are able to copy multiple functions at the same time. It actually works for data members as well, so you can copy statics for which you need an instance in the source file.

The reformatting is very smart. All additional prefixes ("static", "virtual") and default parameters are commented out in the source file and uncommented when copied to the header file.

(Un)Commentize (CTRL-7)

Fast way to temporarely commentize a block of code. Commentizes each line of the selected text with //-comments. If the text is already in comments, reverses the action. If the selection is in a middle of a line, /* */-comments are used to commentize to selected text.

Reverse (CTRL-8)

Reverses assignment operations on each line of the selected text. The following formats of assignments are recognized:

 
        m_nLine=nLine;           <->  nLine=m_nLine;
        a.SetLine(nLine);        <->  nLine=a.GetLine();
        a.SetCol(b.get_Line());  <->  b.set_Line(a.GetCol());
        a << b;                  <->  a >> b;

Step Up/Down (CTRL-PageUp / PageDown)

Steps up or down in the current file. Stops in function or class declarations and some keywords.

Project Statistics

Shows statistics for projects in the current workspace. Example output:

 
    Project CodeWiz
               Files     Bytes   Lines
      Source      21    191262    8412
      Header      22     48682    1702
      Other       11     38345
      All         54    278289   10114

Clean

Searches the directory of your choise for futile intermediate files and deletes them freeing much disk space. You can select the directory and any file types you want to be deleted.

File Properties

Shows the standard Windows File Properties dialog for the current file.

Toggle File Read-only

Toggles the read-only file attribute of the current file.

Copy Filename

Copies the full path of the currently open file to the clipboard.

Copy File

Copies the currently open file to the clipboard, so it can be pasted to explorer window.

Add Breakpoints

Adds breakpoints in the beginning of each function in the current file. If selected in Options, also adds bookmarks to each function.

Options

Enables you to change various settings that configure how CodeWiz behaves. Also contains features “Save To UNIX File Format” and “Ensure Windows File Format”, which enable you to define in which format VisualStudio saves source files.


Code Templates


Code Templates are small segments of code you can write in advance and then quickly insert to your code later. This saves a lot of extra typing if you write much similar looking code.

Whenever you are editing your code, you simply go to the place you want to insert the template and then press CTRL-0 (or select the second toolbar button). In the popup-menu you can see a list of all the available templates.

With CodeWiz you can also have macros inside your Code Templates which will be replaced with their values when inserting. For example, see the following template:

        ##+ Get inline
               inline $(member.type/void)
                       Get$(member.short)() const
                               { return $(member.name); };
        ##-
 

The name of the template is "Get inline" and you can find it under "Helpers"-submenu. Addition to macros, you can also include environment variables.

This template includes several macros which all use the member previously copied into memory with "Copy Members" command (see the Commands section). When you insert this template into your code, all the $() strings will be replaced with their corresponding values. For example, lets assume you have copied the member "BOOL m_bEnabled;" and insert the template. The output will be:

        inline BOOL    GetEnabled() const     { return m_bEnabled; };
 

This kind of helper functions you will probably write quite a lot, if you keep your class members private.

All the code templates are stored in a special file called "CodeWiz.txt". If you want to customize your templates or add new ones, just edit this file. For quickly editing the file, choose "Edit" from the menu. Note that this command automatically sets the file type to source-file, so you can see the code in correct colors. After editing, remember to select "Reload" to apply changes.


Version History


 

Version 1.40 (3.1.2007)

* Website updated.
* Minor fixes.

 

Version 1.39 (13.4.2005)

* Added option to show class names in Browse.


Version 1.38 (19.11.2004)

* Added macro for upper-case variable name in code templates.
- Fixed extension of selection when opening menus (when used together with some other add-ins).


Version 1.37 (30.8.2004)

Please Note! Updating to this version and above requires to follow the "New Installation" procedure.
* Added new paste options.
* Added support for asking user parameters for code templates.
* Added support for keyboard shortcuts for code templates.
- Fixed Browse to correctly handle namespaces.
- Miscellaneous UI fixes.


Version 1.36 (16.6.2004)

- Fixed bug in Browse (not detecting all functions).


Version 1.35 (1.6.2004)

- Fixed problems with Microsoft eMbedded Visual C++ v4.0.


Version 1.34 (5.5.2004)

- Fixed problems with Microsoft eMbedded Visual C++.

- Changed contact information.


Version 1.33 (17.10.2003)

- Fixed Browse jam in some source files.

- Fixed nonworking Browse in some source files.

- Added option for adding bookmarks with breakpoints.

- Added option for pasting default parameters to source files.

- Added features “Toggle File Read-only” and “Copy File”.

- Changed commentize to work in the middle of a line.

- Change StepDown/Up to step back to previous point inside function.

- Changed destructor to virtual in code templates.

- Changed company name.

- Small UI changes.


Version 1.32 (12.03.2002)

- Removed annoying error messages, when the user is not logged in as an administrator.
- Changed loading of the code templates file to be shared, so other instances of DevStudio can access it at the same time.
- Changed Friend Member to be case-sensitive.
- Changed Commentize to automatically commentize scopes.
- Added file extensions to options.
- Added "Open Folder"-command.
- Added "Copy Filename"-command.

Version 1.31

- Email and web-page addresses changed.
- Fixed the fix for Browse to detect correctly constructors.

Version 1.30

- Fixed copy/paste bug in Developer Studio 6. This problem has been annoying users (including me) from the very beginning. Thanks to Jay R Blumenstein for pointing out the cause and the fix.
- Fixed Browse to detect correctly functions, which have spaces before the bracket (as in "Func ()").
- Fixed Browse to detect correctly constructors, which have base class and member initialization (as in "Class::Class() : BaseClass()").
- Fixed Copy Members to copy class name correctly when no space between the class name and the bracket '{'.
- Changed Clean to show total bytes in more readable manner.
- Changed the report dialog (for Clean and Project Statistics) to automatically scroll to the end of the report.

Version 1.29

- Added support for environment variables.
- Fixed copy/paste. Did not work for format "int *Func()" and added extra spaces after each declaration in header files.

Version 1.28

- Changed "Step Up/Down" to stop at beg/end of file.
- Fixed "Step Up/Down". Did not recognize function which were prefixed with comments.
- Fixed "Reverse". Did not work through CTRL+8.

Version 1.27

- Changed implementation of "Save to UNIX File Format" and "Ensure Windows File Format".
- Fixed "Browse". Did not find class name correctly if it was prefixed with "ATL_NO_VTABLE" or other macros.
- Added ".cc" as new source file extension.
- Changed "Step Up/Down" to recognize more function formats.

 


Disclaimer and Copyright


This software is being supplied as "AS IS" without any warranties, expressed or implied, of the intended behavior. The developer takes no responsibility for any damages this software might cause.

This software is copyright Elektrobit. This version is freeware. It can be freely distributed if a) no fees of any sort are taken and b) the whole package is always distributed as a whole without any changes to the content. Any future versions and/or subsequent products have their own individual copyrights and might well be commercial.

If you have any comments or suggestions, please don't hesitate to contact me at codewiz001@cupla.net. Most of the commands are designed for my personal use, so many useful features must be missing. All suggestions are welcome.