Be Sweet, a Set of Visual Source Code Browsers

Environment: VC6, VC7, Win32
Be Sweet Home page

What's New in Version 0.6

  • BeSweet supports now multiple workspaces and Visual Studio instances.
  • Initial support for Visual Studio .Net. This is still quite experimental and should be used with caution.
  • Completely reworked the Visual Studio Addin. It's now much simpler to get BeSweet running.
  • The integration between BeSweet and Visual Studio is now much tighter; in other words, the selected text in the Visual Studio editor will be used as search arguments when clicking on a addin button.
  • Improved the Tag-Browsers. The Up/Down arrow key works in the list boxes. If the Matches-List is focused, the typed characters will be used as search arguments (ESC/Delete to clear the filter, Backspace to erase the last typed character).
  • Fixed tons of bugs.

Introduction

If you ever worked with SniFF+, IBM's VisualAge, or its successor Eclipse/JDT, you get used to some features that are hard to miss if you have to change the IDE. VisualAge provides excellent visual class browsers and SniFF+ has the most advanced source code browsers I've seen yet. Although Visual Studio provides a visual class browser, it's absolutely unusable because it's only updated on a compiler run, doesn't show inheritance, and last but not least, shows all classes of the project in a single tree (uuhhm... very funny to search for a class within 300 other classes). Or you know there is class FooManager, or is it named FooMgr, and in which file does it reside? While VisualAge/Eclipse provides a very nice class browser that lets you search a class by its name with simple regular expressions, you are completely left on your memory with VS.

While some of the missing features can be "upgraded" by installing some third-party addins (such as VisualAssist or WorkspaceWhizz), none of them satisfied all my needs. So, after complaining and moaning around for almost a year, I decided to start my own little project, the "Be Sweet" project.

This leaves only one remaining point for the introduction... how come the name?
Well, when I initially started the project, it was named "Eclipse-Style Browsers." While, technically speaking, this would have been the correct name, it's quite long, isn't it? So, then I was thinking about Browser-Suite, which then turned into B-Suite, and that sounds like "Be Sweet" and indeed, it's sweet to have them.

Overview

Currently, there are five different kinds of browsers implemented:

All browsers have an auto-raise feature. They can be brought to the foreground by hovering the mouse over them (without any mouse click) and when the mouse leaves the dialog, it disappears into the background while Visual Studio is brought to the foreground instead. It takes some time to get used to that feature, but it's very handy once you are used to it. I sometimes catch myself holding the mouse over Microsoft Word, wondering why it doesn't come to the foreground.

It's IMPORTANT to note that you must specify a corner that is used as a measuring point to determine the window currently (partially) covering the browser. By default, this is the top-right corner but can be adjusted in the preferences. Therefore, you should place the browser at the left edge of your screen to make auto-raise work properly.

Oh yeah, all browsers are resizable, of course.

The Outline Browser

This is probably the most-used browser while working; well, at least in my case it is. It displays the content of the active Visual Studio editor. It's updated every time you switch to another file or if save your changes.

The mouse behavior is context sensitive. Clicking onto a class/struct will open an editor containing the declaration of the class (usually this will be a header file) and the declaration line is highlighted. If you left-click on a method or function, the editor containing the definition (implementation) will be opened at the appropriate position and if you right-click on that same method/function, the appropriate declaration will be opened. The middle button will pop up a little menu, allowing you to switch to the header, source, or displaying the hierarchy of the selected class/struct/union.

If the outline browser was brought to the foreground by its auto-raise feature, you can move the mouse back into Visual Studio (the outline browsers will then automatically disappear). The editor will automatically get the focus so you just can start typing without the need to activate/focus any window manually by any mouse click!

The Hierarchy Browser

This view shows the hierarchy of a type. The Type Hierarchy view consists of two panes: the Type Hierarchy tree pane and the Member list pane.

The view can be adjusted to show the type in its full context (in other words, subclasses and superclasses). If the type has multiple superclasses, only the longest "super-path" will be displayed. It can be set to show the super types only (be aware that the the hierarchy tree is displayed upside down) and, last but not least, the view can be restricted to show sub-types only.

The member list pane displays the members of the currently selected type in the type hierarchy tree pane. It can be adjusted to show its "own" members only or to show inherited methods and fields also.

The Tag Browsers

What shall I say about them? Well, they are quite handy if you are looking for something, but can't remember the full name or its location. For example, was that type named TextHandler or TextManager or TextMgr? All tag browsers provide an incremental search and support simple regular expressions (sorry, the "?" doesn't work yet).

Type Browser


Method/Function Browser


Workspace Browser

The Visual Studio AddIn

The addin is one of the two main parts of the system and implements the role of the BeSweet client. It's registered to several Visual Studio events and triggers the appropriate action on the server; in other words, it loads the workspace if you open a new workspace or triggers a reparse of a source file if that file has been modified.

Selected text in the Visual Studio editor will be validated and used as search arguments when opening a browser via the addin buttons.

For your convenience, hot keys can be bound via Tools->Customize->Keyboard->Add-In. All commands start with "ESB"; for example, ESBShowTypeBrowser would bring the type browser to the foreground.

Architecture

When I started the project, I had to decide to either fully integrate the browsers inside Visual Studio or to build an external application. After reading a couple of articles about how to integrate custom apps into VS on www.codeguru.com, I decided to build an external client/server application based on the following reasons. First, I wanted to concentrate my effort on the fun part and after reading those articles, integrating an app into VS didn't sound like fun. Second, which is IMO the much more important reason, if the external app crashes, it won't crash VS as well!

As mentioned above, the system is designed with a client/server architecture, where the client is implemented as a Visual Studio addin and interacts with the server via COM. The server's architecture is a very traditional MVC pattern. Not all of the blocks above are currently implemented—there are no QT-Renderers.

Implementation

Although there isn't/wasn't any need for multi platform support, I tried to avoid too many platform-specific dependencies. STL is used wherever possible, MFC is strictly used in the renderers only, and the COM interface implementation is completely encapsulated in its own module. That said, the effort to port it to another platform shouldn't be too big.

Installation

The best way to work with BeSweet is when Visual Studio is NOT in full-screen mode and you place all browsers at the edges of your screen (see also the screen-shot in the source zip).

Installation is very easy. Just follow these steps:

  1. Unzip the package into a folder of your choice.
  2. Register/Load the Visual Studio Addin via Tools->Customize->Macros and Add-Ins
  3. Customize the key binding. I personally use Alt-T to pop up the Type Browser, Alt-O for the Outline Browser, and so forth.
  4. Start ESBServer.exe.
  5. Open a workspace in Visual Studio.

It might be neccessary to reboot your computer if you have already installed an older version of BeSweet. If nothing works, do the following:

  1. Uninstall the addin from Visual Studio.
  2. Unregister the DLL with regsvr32.
  3. Reboot your PC.
  4. Start ESBServer.exe.
  5. Open Visual Studio and reinstall the addin.
  6. Press the first addin button and ensure that BeSweet is enabled (only for VC6).
  7. Open a workspace in Visual Studio.
  8. Right-click on the BeSweet-SystemTray icon and maximize --> your workspace should be listened here.

How to Build BeSweet

It's not possible to build BeSweet with the default STL shipped with VC++ 6.0. The reason is that the VC STL is based on a pre-existing standard (I think before 1998) and is therefore missing some (important) features. To build the project, any recent STL implementation should work. I personally use STLPort 4.5.3, which is based on the original SGI implementation and can be freely downloaded here.

Credits and Thanks to

  • Darren Hiebert for his ctags parser... the enabling part of this project!
  • Davide Calabro for his excellent flat-style bitmap button class, CButtonST
  • Richard Hazlewood for his formidable multi selection tree control, CMultiTree
  • Andy Brown for providing his easy CDynamicDialog class
  • Chris Maunder and his CSystemTray class
  • Special thanks goes to Ulf Niewoehner, Tsvetan Tsvetanov, and Xiaoming Zhao for their help in testing BeSweet and suggestions for improvements

Downloads

Be Sweet Home page

Download binary - 1436 Kb
Download source - 825 Kb


Comments

  • FAQ

    Posted by Legacy on 06/20/2003 12:00am

    Originally posted by: Marco Welti

    1) I forgot to mention that one must manually start the  server
    
    program (ESBServer.exe) to get BeSweet working. I personally
    have short-cut to the exe in the windows auto-start folder.
    Just make sure the running-folder ("start-in:") is set to the install folder.

    2) The ESBDSAddinSimulator is linked against a wrong dll. download a
    simulator which is linked against stl port from
    the link below.

    http://prdownloads.sourceforge.net/esbrowsers/ESBAddInSimulator.zip?download


    3)it seems that the hierarchy browser has some problems.

    there are a few reason why it might not show up:

    a) if the class or one of it's parent classes has multiple parents a message box is
    displayed which might be hidden behind your visual studio and prevents the h-browser
    from beeing shown!

    b) the screen posisiotn in the .ini file fits my 1280x1024 and might be outside of your
    screen resolution. try to set it to something like 20:20

    c) it looks like if the hierarchy browser won't show up anymore by pressing the
    visual studio addin if it has been closed manualy. Either don't close it or use the
    middle mouse menu of the outline browser to raise it again.

    4) the .dps parser contains a bug which prevents file haveing the follwowing entry
    SOURCE=MyFile.cpp

    from bbeing loaded. (an indication is when the ctags window (the dos-window apearing when
    loading the workspace) contains as lot of lines. As a workaround you may manualy change
    the line (in the .dsp file) to

    SOURCE=.\MyFile.cpp

    or wait until June, 30th for the new version ;)

    apology for this inconvenience

    marco

    Reply
  • great work! but still need to be improved

    Posted by Legacy on 06/19/2003 12:00am

    Originally posted by: xfile

    agree with last question. Hierarchy doesn't work. Anytime I press the button, nothing happen.

    Reply
  • Show Hierarchy not working

    Posted by Legacy on 06/18/2003 12:00am

    Originally posted by: Coy

    All features work except Show Hierarchy. I have a class method selected, and all source and header files are in the same directory. Any idea what I am doing wrong?

    Reply
  • Does not work at all

    Posted by Legacy on 06/17/2003 12:00am

    Originally posted by: Cosmin

    Even if I enable it, there is no button working, no dialog opened, nothing.

    I am using VC++6, SP5 on W2k, SP2

    Cosmin

    Reply
  • Getting error

    Posted by Legacy on 06/16/2003 12:00am

    Originally posted by: John Rossini


    When I drop my .dsp file into the ESBAddInSimulator window, I get the error "could not open workspace", and when I click on a file I get the error "OnShowFileOutline(): failure"


    can you tell me what I'm doing wrong?

    thanks,
    John.

    Reply
  • Great Work!

    Posted by Legacy on 06/13/2003 12:00am

    Originally posted by: Armin Ostrowski

    That's the reason to use an IDE instead of an simple editor!

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Protecting business operations means shifting the priorities around availability from disaster recovery to business continuity. Enterprises are shifting their focus from recovery from a disaster to preventing the disaster in the first place. With this change in mindset, disaster recovery is no longer the first line of defense; the organizations with a smarter business continuity practice are less impacted when disasters strike. This SmartSelect will provide insight to help guide your enterprise toward better …

  • IBM Worklight is a mobile application development platform that lets you extend your business to mobile devices. It is designed to provide an open, comprehensive platform to build, run and manage HTML5, hybrid and native mobile apps.

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds