http://inconnect.com/~tempest/devstudio.html
Environment: VC5/VC6
News Flash!
Workspace Whiz!, the successor to the Workspace Utilities, will soon make its
public debut. It sports a number of new features, some of which are described
below.
Please visit the Workspace
Whiz! website to register your email address. You’ll be informed when Workspace
Whiz! is released.
- Complete installer, compliments of Wise
Solutions. - New look!
- Most dialogs are now resizable, through Hans Buhler’s dynamic controls interface.
- The File Open dialog’s filenames are right-clickable and have a context
menu associated with them. - The entire tag system has been rewritten. File changes are automatically
detected on dialog entry, and the update time is very quick. In other words,
the tag support should never fall out of sync with your workspace. In addition,
a file is written to the workspace directory called Tags.WW, containing a
binary representation of the CTags text output. MORE SPEED! Hooray! - Added a variety of Preferences dialogs to tune Workspace Whiz! to your liking.
- Added file history support, so your movements through files using Workspace
Whiz! commands can be tracked (similar to the History on web browsers). - Added dialog skin support.
- Current project/entire workspace scoping in the Find File Dialog.
- Complete code template support, similar to DevStudio’s AppWizard facility
but far easier to use. - And lots more…
Introduction
The Workspace Utilities Visual Studio add-in provides a number of useful workspace-related
functions.
Workspace File Open:
- Incremental matching of files throughout all the files in the workspace.
- Unnecessary to type symbols.
- Group opening of matched files.
- Ability to add external projects or workspaces to the incremental search.
- Turn on/off projects contained within the workspace file view.
Workspace Header Flip:
- Workspace-wide header/source swapping. If the file is not in the workspace,
checks for it on disk. If not in the same directory on disk, checks the directories
specified in the Tools->Options->Directories->Include and Source
categories.
Workspace Find Tag:
- Built using Darren Hiebert’s excellent Exuberant
Ctags software, this add-in allows incremental searching of any identifier
in the workspace (including the extra projects added through the Workspace
File Open). Please download the latest executable from the Exuberant
Ctags site.
Workspace Compiler File Open:
- Incremental matching of files throughout all the files in the global include
and source paths. - Unnecessary to type symbols.
- Group opening of matched files.
Multiple Precompiled Headers per Project:
- An "addition" (although not really) to the Project Settings Precompiled
Header menu that allows more than one precompiled header per project. It turns
out that this is not a .DSP file limitation, but rather, a Visual Studio limitation.
This add-in solves the problem.
Installing the Workspace Utilities
The installation program should take care of the Workspace Utilities installation.
In the event that something goes wrong, please see the directions below:
- Close down all instances of Visual Studio.
- Run the installer.
- Copy CTAGS.EXE to a location within your PATH. (While ugly, the Windows
directory works well.) Download the latest executable from the Exuberant
Ctags site. - Open Visual Studio.
- Go to Tools->Customize->Add-ins and Macro Files.
- Click the check on Workspace Utilities Addin v1.75 Alpha 1.
- Click Close.
Setting up the Workspace Utilities
If you want keyboard keys attached to the Workspace Utilities commands:
- Go to Tools->Customize->Keyboard.
- Pull the Category combobox down to Add-ins.
- Select WUFileOpen.
- I assigned Ctrl-O, replacing the old File Open. Remember to distinguish
between the Main and Text modes. - A list of commonly used keys are listed below.
WUCompilerFileOpen | Main | Ctrl-D |
WUFileOpen | Main | Ctrl-O |
WUFindNextFile | Main | Ctrl-Shift-. (period) |
WUFindNextTag | Main | Ctrl-. (period) |
WUFindPreviousFile | Main | Ctrl-Shift-, (comma) |
WUFindPrevTag | Main | Ctrl-, (comma) |
WUFindTagAtCursor | Text | Ctrl-; (semicolon) |
WUFindTagAtCursorDlg | Text | Ctrl-Shift-; (semicolon) |
WUFindTagDlg | Main | Ctrl-‘ (apostrophe) |
WUHeaderFlip | Main | Ctrl-H (making Ctrl-R be FindReplace) |
Using Workspace File Open
Basic Navigation
When you click the WF or CF button on the toolbar, the Workspace File Open
or Workspace Compiler File Open command is activated. If there isn’t a workspace
loaded when the WF button is pressed, the default File Open dialog is used.
Otherwise, a dialog box entitled “Find and Open File” is opened.
While in the edit field, the up/down arrow keys and page up/down keys may be
used to move the file highlight bar. Holding shift while pressing the up/down/page
up/page down keys highlights multiple files. The home/end/left/right keys move
the cursor in the edit field. As letters are typed in the edit field, files
are incrementally matched and displayed in the list box. The search is not case-sensitive
and only alpha-numeric characters are counted. Non alpha-numeric characters
can be typed, but they are ignored. (For example, if there is a file in a project
called !_ABC1_FW!.doc, it is only necessary to type ABC1FW.doc.)
Use a period to specify a file extension. If only .h files are needed and they
all start with the letter ‘A’, it is only necessary to type “a.h” (without the
quotes, of course).
Use the slash key ‘/’ to perform a substring search. If you want all files
that have the word window in them, type "/window".
At any point, the cursor keys can be used to select the appropriate file. Clicking
OK or hitting Enter loads the file into Developer Studio.
Extra Projects
If there are external libraries your project requires that don’t exist in
the workspace, this dialog can be used to add those extra projects. Use the
Browse button to find the appropriate .dsp or .dsw file. Choose Add to add the
project to the Extra Projects list.
The Extra Projects dialog can also use system environment variables. To take
advantage of this, use the same syntax that Visual Studio requires:
$(MYLIB)PrjMyLib.dsp
Note: The Extra Projects settings are stored in a file called ExtraFiles.WU.
This file is stored in the same directory as the workspace.
Preferences
The Preferences dialog lets individual projects be toggled on and off in the
Workspace File Open display.
Note: The Extra Projects settings are stored in a file called ExcludeFiles.WU.
This file is stored in the same directory as the workspace.
Using Workspace File Open Header
This finds a corresponding header within any project directory. If your workspace
contained two headers of the same name, only the first header is returned. If
the header isn’t in the workspace, Workspace Utilities looks for it in the same
directory as the .cpp file.
When searching for "headers," the following extensions are considered:
.c, .cpp, .cxx, .h, .hpp, and .inl.
Using Workspace Find Tag
The Find Tag command uses the external utility, Exuberant
Ctags (written by Darren Hiebert), to parse through every file in the workspace,
finding all the identifiers (or tags). The tagsare then loaded into a dialog
similar to the "Find and Open File" dialog and incremental matching
is applied. As letters are typed in the edit field, files are incrementally
matched and displayed in the list box. The search is not case-sensitive and
only alpha-numeric characters are counted. Non alpha-numeric characters can
be typed, but they are ignored. (For example, if there is a file in a project
called !_ABC1_FW!.doc, it is only necessary to type ABC1FW.doc.)
All navigation rules are identical to the "Find and Open File" dialog,
with the exception of:
- The period key is not used as a file extension.
- The semicolon key is used as the identifier;parent separator. To see all
functions that start with the letter C in a class called Zoobie, you would
type: "c;zoobie". - The slash substring search may be used in the identifier and/or parent.
The first time the Find Identifier command runs, it has to execute CTags on
each file in the workspace. This process is a little slow, but it only needs
to be run when there are new identifiers in the workspace. Pressing F5 or clicking
Refresh will rebuild the .tags files.
Note: The tag information is stored in files ending in the extension .tags.
This file is stored in the same directory as the project it represents.
Using Setup Precompiled Headers
Overview
The WUFixMultiplePrecompiledHeaders command implements an add-in that allows
more than one precompiled header per project. After some careful investigation,
it was found that this was merely a Visual Studio GUI limitation, not a DSP
file limitation. Visual Studio’s Project Settings dialog allows the user to
select the precompiled header file to be used for certain source files. Microsoft,
for whatever reason, allowed the developer to type in different header files
across different source files in the same project, even though the compiler
would abort. The reason the compile fails makes perfect sense. If any
precompiled header is used within a project, Visual Studio automatically adds
a /Fp"projectName.pch" command line option for every source
file. This, of course, causes a compiler conflict since two header files can’t
share the same .pch file.
Each source file in the .dsp file can have additional compiler options attached.
If the developer specified a certain header file should be a precompiled header,
that compiler option shows up in the .dsp file:
SOURCE=.MySourceFile.cpp #ADD CPP /Yu"MyPrecompFile.h"
The lines above indicate that MySourceFile uses the precompiled header generated
through MyPrecompFile.h. Unfortunately, Visual Studio’s GUI doesn’t use the
name of the header file as the .pch file (as in MyPrecompFile.pch). Through
the .dsp file, this can be done by hand:
SOURCE=.MySourceFile.cpp #ADD CPP /Yu"MyPrecompFile.h" /Fp"MyPrecompFile.pch"
Usage
This add-in is in beta. Before using it, back up the appropriate .dsp
file first!
The following procedure describes basic precompiled header manipulation through
the Project Settings dialog.
- Open the Project Settings dialog.
- Click on the project name.
- Change to the C/C++ tab and pull down Category to Precompiled Headers.
- Open the project tree. Open Source Files.
- Select all files to use a particular precompiled header.
- Click Use precompiled header file and type in the name of the header to
be used. - Repeat steps 6 and 7 as necessary.
- Click OK.
When all precompiled headers are set up as desired, run the WUFixMultiplePrecompiledHeaders
command.
Thanks
This section is long overdue. I hope I didn’t forget anybody!
- Wise Solutions for their generous
donation of InstallMaster. - Greg Thoenen, Chris Nash, Eric Grundstrom, Brian Loss, and the rest of the
Engineering Animation, Inc. Salt Lake City and Ames Interactive Division employees
who let me use them as guinea pigs during this product’s development. - Chris Maunder and Tom Archer of CodeGuru for putting up with all of my emails
in order to get the Workspace Utilities posted in, what I believed was, the
right section. - Darryl Yust for numerous header flipper suggestions and mentioning the tab
order in the WUFileOpen dialog was incorrect. - Herbert Goisser for providing me with detailed error logs in an attempt
to fix the Visual Studio 97 support. - Ville Herva for the .cxx header flip suggestion and providing information
on why the tag support didn’t work with spaces in the project names (and a
fix, too!). - Lee Hillman provided a fix to the tag bug, too.
- Oz Solomonovich, whose Window Tabs users have accounted for a large part
of Workspace Utilities downloads. In addition, he provided information on
the NT non-administrator registration bug. - The rest of the kind individuals who have passed a word of thanks my way.
It is appreciated.
Concluding Remarks
I sincerely hope you enjoy using the Workspace Utilities add-in. I have enjoyed
writing it.
Thanks,
Joshua Jensen
History
Version 1.75
- Fixed the Visual Studio 97 support.
- Some source code cleanup.
- Added .cxx header flipping support.
- Added project/file scoping in the tags dialog.
- Fixed NT non-administrator registration.
Version 1.70
- Tab order in the File Open dialog fixed.
- Better identifies the workspace file location.
- The Extra Projects dialog now properly shows *.dsp and *.dsw files.
- New WUNextFile and WUPrevFile commands use the current file title (title.ext)
to iterate through the workspace finding and opening any file who’s title
matches. - Toolbar icons for everything.
- WUFixMultiplePrecompiledHeaders command implemented. Please see the documentation
below for exact usage. - WUHeaderFlip checks the directories specified in the Tools->Options->Directories->Include
and Source categories for a matching file, if all else fails. - Removes duplicate filenames (for sure this time… hopefully).
Version 1.60
- Now destroys the Visual Studio-generated type library in DllUnregisterServer.
- Added Workspace Compiler File Open.
- Made the tooltip help text work properly.
- Added Multiple Precompiled Headers. (Incomplete)
- Cleaned up the source code (big time).
- Header flipper will check the local directory if the workspace search fails.
- Identifier search now ignores non-alphanumeric symbols.
- Can read .dsw files.
- In the Extra Projects dialog, made the default button be Add.
- Resolves relative paths correctly.
- Resolves environment variables in any filename. DSP and DSW files
let you use absolute environment paths. Microsoft just doesn’t tell you about
it. - Removes duplicate filenames.
- Double selection bug in Workspace File dialog fixed.
- More speedups.
- Other stuff.
Version 1.55
- Cleaned up the source code.
- Renamed all Workspace Utils commands (they all start with WU now).
- Added Find Identifier At Cursor, Find Next Identifier, and Find Previous
Identifier.
Version 1.51
- Dramatic speed improvement in the Workspace Find Identifier add-in.
- Second public source code release.
Version 1.5
- Introduction of the Ctags Workspace Find Identifier add-in.
- Substring searches
Version 1.0 – 1.4
- Internal releases.
Known Bugs
- The Workspace Compiler File Open command has only been tested using Visual
Studio 6.0. It should work for Visual Studio 97, also. Please inform me if
it doesn’t. - ExtraFiles.WU is not detected as read-only. This will be fixed.