31 October 2006

User Interface Guidelines

Another stop on the way to a fuller look at the Vista User Interface Guidelines. This will be the last one I promise...


For designing any user interface in Windows XP (and generally Windows) you need to know Design Specifications and Guidelines - Visual Design. This specifies how you are supposed to lay out your user interface and how allthe elements should fit together. I use this to hand code my resources for MFC user interfaces, when it is all consistent you will be surprised how much better and more professional it looks. One thing I can't remember if it is covered is make sure your tab order is correct as when working with resources it is possible to get it wrong.


The Windows Vista User Experience Guidelines have been available for a while. By available I mean exist as a placeholder that someone will eventually be forced to write.

The most substantive part of the Vista UI Guidelines is the Top Rules for the Windows Vista User Experience which are extremely shallow and a bit of a red herring for good UI design. It even asks for things that the applications provided with Windows Vista are unable to follow.

All of the Vista guideline are so shallow that even the most obvious things like what will be the user interface differences between Basic and other Vista versions are not covered. For those of you that haven't heard the standard home version of Vista will be supplied with the "Aero Basic" theme that does not have the bells and whistles. It makes no mention of how to lay out controls consistently and intuitively. Also it says use Vista style icons and so on, unfortunately the icon guidelines hve not been published yet.


Trust Apple to show you how it is done. They have comrehensive developer documentation on how to supply a well integrated consistent interface for OS X. They can be read here.

The human interface guidelines are available here. This covers all you need to know for a professional looking OS X application. The documents keep evolving and get better like with the recent icon addition.


The Gnome desktop has a well know human interface guidelines. It is really quite in-depth and puts Microsoft to shame.


The popular Linux desktop environment also has a set of user interface guidelines.

You can read a previous post about icon guidelines for various platforms here.

Windows Vista GUI - Gotta start thinking about it

Windows Vista is just around the corner. As a developer you worry about what a new OS version is going to do to the program you work on, most incremental cases are pretty trivial, XP introduced a virtually undocumented theming API (and it still pretty much is), SP2 opened up a whole can of pain, Vista has even bigger problems on the horizon.

But this post isn't about those migration problems, I'll be covering them as I tear my hair out at work, much like my migrations to Visual Studio 2005.

From this GUI developer's point of view I'll cover my thought process:
  • "Does my UI work under this upgraded platform?"
    Ignoring the platform issues, does the user interface work on the new platform. This means does it render without causing corruption and does it crash? It's a simple case of running the executable.
  • "Does it look good?"
    Now the user interface is usable, does it look integrated with the rest of the system? This means checking custom draw items work and match the system theme. Once you've made sure you have made no glaring errors the program is probably usable on the new platform.
  • "Does it look consistent with other programs on that platform?"
    Now this is where the realy hard work start. Some platforms actually provide user interface (HCI) guidelines that are worth the virtual paper they are written on like the Apple ones, some are not like Vista. My next post will cover this point in greater detail.
  • "Has the migration made our user's lives better or easier?"
    Has the shiny new look cheered our user's lives up? Has it made the user's lives easier, say for instance the new common controls provide even more functionality as standard?
  • "What can be added incrementally?"
    Are there new features available to the developers that can be added in an incremental fashion, either phasing out old items or introducing new paradigms. This will also be the implementation of features seen as extras by the HCI guidelines.
  • "Can you separate yourself from the crowd?"
    This is the lowest priority item. Are there things you can do that look good, but also serve to separate you from the rest of the crowd (but please keep them within the HCI guidelines, PLEASE!)
Well, I will end this random ramble though my thought processes, but I am expending valuable brain power on this knowing I have to sort this out in the near future. Since Vista is going to manufacturers very soon it all seems tangible now.

28 October 2006

GUI Toolkits - qooxdoo

No, I haven't lost all typing skills, it is really called qooxdoo.

qooxdoo (see also Wikipedia) is an AJAX targetted Javascript user interface toolkit. It is surprisingly fully featured and shows how far along web-based toolkits have come. Well, when I say surprising, I mean shocking.

The toolkit is LGPL licensed and has a large set of widgets available. I think the best way to describe it is to send you to the demo page here and I would recommend you look at this example in particular. There is no point in looking at the screenshots as playing round with the demos demonstrates its depth of features and how polished they are.

The advantages of this kit for web development include the abstraction away of web browser specifics and automatic browser detection. It has things that are normally only seen in fully fledged desktop environments like drag-n-drop support. Like I said earlier though I think the demos speak for themselves.

GUI Toolkits - Evaluation

I reckon I am probably in the minority here, but I am less concerned about the code format of GUI toolkits. I am more concerned about what it is capable of and what it looks and feels like. After all it is more than possible to write an abstraction layer on top of it to hide some of the less nice features, and adapting to different styles is a learning process.

Whilst screenshots can be misleading or more often understating the abilities of a toolkit, a well-defined example application is more than enough to decide whether to evaluate further. With online type user interfaces it is much easier, whereas you need an executable to try things out for most others.

It's surprising how few go down this route as it is such a good way to show how good an application is on your platform. I thought I would put together a list of some you can check out now.
  • JUCE - The JUCE demos are downloadable here.
  • wxPython - There is the wxPython demo available here. Unfortunately you do need Python installed as well to run it.
  • wxWidgets/wxAUI - There is a demo of how wxAUI works here.
  • WTL - There are lots of precompiled examples on CodeProject here.
  • Ultimate++ - Download the package as TheIDE is written in Ultimate++.
  • Adobe Source Libraries (ASL) - They have their Adam and Eve engine available for download here. Thanks to dtinkham, and I'll leave it in his own words: Mac is available also. Unzip, and you will have an app called begin.exe. Start it. It runs 1 example using their .adam and .eve files. To try out other UI examples, drag a pair of .adam and .eve files from the examples directory onto the main app window (the wide-short window), and it loads up a new window from the .adam and .eve form file specs. I had played with this a little but the drag and drop changing of the UI completely escaped me(!)
  • qooxdoo - The Javascript based toolkit has lots of examples that you can check out through your browser here.
I've probably missed a stack of them, but I'll try to find some more. If you know some more leave a comment and I'll add it to the list.

26 October 2006

Porting to Visual Studio 2005

I've covered a variety of the areas for porting to Visual Studio 2005 in some previous posts, as it is not as simple as it should be. It seems that although it is relatively easy to get it compiled there is a lot of performance and stability work to be undertaken.

The posts are:There is also one area that needs looking at as you may notice you are not getting the Windows XP look and feel. This is a pain because the way manifests work has changed. You need to go to your stdafx.h file or the main .cpp file and add the following:

#if _MSC_VER >= 1400
#ifdef _UNICODE
#if defined _M_IX86
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_IA64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_X64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
#endif //_UNICODE
#endif //_MSC_VER >= 1400
Just copy and paste this, the formatting will be correct.

24 October 2006

GUI Toolkits - More VCF

I've already covered the Visual Component Framework (VCF), but I feel like talking about it a bit more.

Before starting make sure you check out the list of features from the VCF documentation, as I won't repeat them all here (after all it is what hyperlinking is invented for).

There are three core libraries in the VCF:
  • FoundationKit - The base library for the VCF providing the lower level building blocks for the other libraries. It provides the RTTI system, string support, threading, and much more.
  • GraphicsKit - It's the library that provides the graphic rendering and graphics formats. It has some great functionality from libAGG (The Anti-Grain Geometry Tookit) which I have mentioined in some previous posts.
  • ApplicationKit - The GUI functionality itself. Obviously this is the largest component and covers the widgets, events, focus, and more. It's almost so big there must be a thought to break it down further into smaller functional components.
There are more libraries (kits) that contribute functionality including HTML, OpenGL, the upcoming Regex, and a few more.

One compaint I hear is that the libraries are too large (in file size) which I have never understood as an argument for or against a toolkit (unless we are talking MASSIVE). It is rare that a toolkit has a small amount of dependencies, plus with the VCF you don't need everything if you are into that (but it is obviously more work to do).

I have found writing code in VCF is surprisingly concise and easy to understand. If you have come from an MFC or wxWidgets background, the event system will need some understanding. I was trying out writing something to simulate docking with a small amount of success, although I haven't done as much coding for it as I probably should have. It wasn't more than a little experiment to try out something in the VCF.

I probably should list the major features that it lacks, which are docking windows (and toolbars), fully implemented cross-platform support, scripting language bindings (Edit: There is a basic Javascript engine that has not made it into the release yet), and the finished documentation.

The cross platform aspect remains incomplete for Linux and Mac although the Linux version has pushed on in the recent past. Actually I find it a bit disappointing that it does not have a large community built up around it like some other toolkits. The foundations seem so solid that the system is begging to be extended more.

Make sure you read the documentation here which is excellent although not comprehensive, and not completely finished. Also check out the VCF articles on the CodeProject (do a search for VCF).

As you can tell I am quite positive about this toolkit, it is almost too understated for its own good. I can imagine developing something quite complex in it and being able to extend it for more complex things.

Firefox v2.0

Google Analytics is addictive, and gives a wealth of useful information, like 75% of the readers here use Firefox. Firefox 2.0 comes the same week as Microsoft Internet Explorer 7.0 has arrived. So there are two installation experiences to tell.

IE7 starts installation by unpacking the installation to a temporary directory, and then begins some enforced Windows Updates. Then it begins an unusually long installation (I am still not sure why), overall taking 10-15 minutes. Then it needs you to reboot.

I was going to wait for automatic updates to pick up Firefox 2.0, but I decided to upgrade now. The installation was a case of blink and you'll miss it. No reboot. A minor startup delay of about ten seconds due to checking the plug-ins for updates, and I was away. The new UI takes a bit of getting used to visually, but I think I will end up preferring it, and it pretty much all works the same. The tab shading is a bit unnecessary especially since the rest of the UI isn't as shaded. Check out a comprehensive review here.

Firefox 2

23 October 2006

Code::Blocks - Free Open-Source IDE

Code::Blocks is a free open-source IDE written in wxWidgets, making good use of wxAUI and wxFlatNoteBook.

If you decide to give it a go make sure you use the Nightly Builds, you'll need 7-zip to decompress the files as well. The nightly builds are well beyond the last "release" called RC2. I've found the nightly builds stable and mature. There are lots of plug-ins and project templates.

One of the major plug-ins that has recently gone through a major rewrite is the wxSmith plug-in which is a visual GUI designer for the IDE. If this turns out to be good or even just average it would give Code::Blocks a major advantage for adoption.

Code::Blocks is able to be the IDE for a variety of compiler back-ends. I completely forgot to mention it is cross-platform. It seems to scale up pretty well to larger projects, and can even convert your Visual Studio solutions.

It also provides scripting through Squirrel/SqPlus (which I've mentioned I like in a previous post).

I must confess I am not currently using it, but I am using the Visual C++ Express Edition. The only excuse I have is that I have Visual C++ set up perfectly for what I want to do. If you are curious go and check it out, you won't be disappointed.

wxWidgets - some recent improvements

As wxWidgets development gathers speed more new features are appearing. These look like add-ins that will become part of the core toolkit.

First up there is wxAUI (wxWidgets Advanced User Interface) which provides a really nice and simple docking toolkit. It has great looking hint boxes for docking and the ability to use transparency for drag effects. It also has a notebook style tabbed interface built into it, and provides toolbar docking which is really top notch. This is now part of the main 2.7 development distribution.

is a tabbed "notebook" interface much like what you see in Visual Studio (or indeed Code::Blocks which uses it). It has lots of professional looking rendering and custom drawn styles.

wxFlatMenu has just been released on the wxWidgets forums. This provides custom drawn menus much like what you see in Windows XP applications like Office and Visual Studio (both 2003/2005 and 2007 look).

wxFlatNoteBook and wxFlatMenu have not been put into the main trunk, but there are plans afoot to integrate both into the wxAUI interface. With this collection of very decent extensions it opens up wxWidgets to more possibilities.

22 October 2006

GUI Toolkits - Ultimate++

This is a fairly new toolkit on the scene, but that doesn't make it particularly lacking. I have been scouring the Internet for unbiased reviews of most toolkits before downloading them and it is seriously hard to find them.

Ultimate++ is more than just a GUI toolkit (in fact I could probably say that about every single one I have looked at), it has an IDE, a build system, a visual designer, code-completion, code documentation, and its own standard library. As a compiler back-end it can use Mingw, Visual Studio Toolkit 2003, and Visual C++ 2005 Express.

It seems that you are unable to use your IDE of choice as Ultimate++ is more of a platform than simply a library. TheIDE does allow you to simplify starting up development in Ultimate++ since you don't have to worry too much about environmental setup and they don't have to support multiple IDEs. TheIDE is OK as a development environment, it lacks a plug-in framework that I could find but it does have a macro language. This means integration of external development tools seems difficult which I find useful.

The basis of Ultimate++ is the NTL which is a replacement for STL due to their perceived deficiencies for the project. I honestly can't say if it is a giant leap forward or reinventing the wheel, I've heard these arguments in the past that turn out to be null and void.

But on to the most interesting part - the actual GUI Toolkit. It has a fairly modest collection of widgets, not as deep as more mature toolkits. I have noticed it is possible to get a fair amount of flicker from the projects when resizing and a simple solution didn't immediately present itself.

The user interface is not actually built on the common controls of the operating system, but is custom drawn, and as such in previous versions did not match the widgets of the underlying system in all cases. This has improved massively recently (gone away completely I believe) thanks to a new Chameleon theming engine that uses the operating system UI theming engine (uxtheme on Windows).

What I feel about Ultimate++ is that it is a decent new stab at something a little different to the other UI libraries by making it more of a platform. I don't think it is ready if you are evaluating it for use in a big application.

For me when I read "Rapid development is achieved by the smart and aggressive use of C++ rather than through fancy code generators" I thought it was interesting, but I always take this kind of stuff with a pinch of salt. The code although shorter in a manner of speaking I don't think is any more readable, and doesn't really show any reduction in programmer thought or time (if you are comparing to more modern toolkits).

The activity of the community seems fairly large, so they may be able to add functionality faster than other toolkits. You can check out a fairly in-depth getting started tutorial on the CodeProject.

Hello to everyone reading


If you are reading this and have any comments or suggestions, just post a comment - all you need is a Google account. The comments already posted have lead me down some paths I might not have thought about.

Thanks for reading,


Updated Visual Studio 2005 Express and TortoiseSVN Integration

See the update here.

I've made an update to the TortoiseSVN integration for Visual Studio 2005. This is from a comment by Dean about adding a solution to the repository. This has been added to the menu, toolbar, and context menu for solutions.

Unfortunately this update has only been tested on Visual C++ 2005 Express for the moment as this is all I have to hand, but I am pretty sure these settings should also work for Visual Studio full versions (see the link at the end of this post). I'll update the Visual Studio 2005 Pro versions at some point during the week, or discover I don't need to and only maintain one file (which would mean not going grey as fast).

You can read the original article here and see some screenshots as well.

You can download the .vssettings for Visual Studio here.

20 October 2006

Digital Music - Songbird

Today I discovered a great little program called Songbird which is an open-source rival to iTunes. In some of my previous posts I've been going on about the web GUI, allowing the browser to be come the front end. Although this looks like a really good project it probably doesn't go the whole hog as it is a web-browser in itself.

It uses the Mozilla libraries as a foundation to build a web-browser with integrated music/media functionality, or maybe it is media program with an integrated web-browser? The advantages of using the Mozilla framework is that it is cross-platform and it is a proven technology. It is also designed around the Firefox design of a core product with extensions to add functionality. To that end there are plug-ins for iTunes libraries and syncing iPods. One of the driving forces behind it is the guy behind the original WinAmp.

All of the artwork produced for the site is excellent quality and highly amusing(!) which wins points with me. Maybe I'm just shallow. I'll be watching this project though as it is really an interesting integration of a heavyweight application and the web. Click the image below to check it out.

Get Songbird

19 October 2006

It has all gone a bit GUI

One of the holy grails in development is a universal GUI library, much like the quest for the one equation that explains life, the universe, and everything. Unfortunately as it currently stands such a library is further away than ever before.

A project that wanted to succeed is the BoostGUI library. Unfortunately it has never got out of the research stage, let alone the planning stage. It was envisioned to be the Boost Library addition to make GUI development at least have one standard. The research page (click on the BoostGUI link) though provides great avenues for people wanting to know more about GUI development, some of the conversations on mailing lists that the wiki links to are excellent and thought-provoking.

I don't know how all of this will work in ten years time. It was certainly an admirable aim, but with technologies like XUL getting more traction and getting more mature, the answer may come from a completely different direction to what all of these toolkits are aiming to do. They'll provide a simple cross-platform framework that will get added to over time and eventually have the richness of user interface abilities required by heavier applications. Certainly I don't think these types of libraries can be designed from scratch to be everything, and they have to grow, whereas most GUI toolkits have gaping holes in "to be implemented" areas, whereas the simpler domains mean you can easily get 100% coverage and then add more.

I can't believe this, over the past few weeks I have been talking myself out of heavyweight GUI toolkits... Scary stuff. Don't get me wrong these toolkits are still my primary interest for any GUI development, but I wonder what the future could hold as web development has really started to spped up. We all need not only to think of this new multi-core future but also the web-based platform future.

18 October 2006

GUI Toolkits - JUCE

On my trawl through GUI toolkits and my general web browsing I have encountered the name Juce from time to time. It's not just a GUI toolkit, it aims to be as comprehensive as possible.

What stopped me from taking a closer look in the past is that it is a non-native UI, but hey, nothing ventured...

It provides excellent support to essentially a vector graphics based user interface. It seems really solid and smooth. The library itself was developed for the audio sequencer application Tracktion, and looking more closely at this you can see where the library's real power lies. Providing you don't want a platform standard GUI toolkit UI you are away, like if you wanted a midi sequencing apllication to look like a keyboard not a standard windows dialog based application. I'm sure it must be possible to apply a Windows XP/Vista theme with enough effort.

Juce is also on the Wikipedia which covers the main points from the website. I recommend downloading the example application the Juce website as it is interesting seeing how it behaves. I do find it all a little blurry, but I think that is the theme supplied not the toolkit itself.

GUI Toolkits - More than you can shake a stick at

It seems to me there are loads of GUI toolkits out there but virtually none reach maturity, unless pressed by a commercial interest/funding or somehow they manage to reach critical mass with respect to their community activity.

Successes certainly have been:
  • Qt - thanks mainly to being used by KDE to bring it right into the developer consciousness. It also helps the design is really quite good.
  • wxWidgets - now the community is getting seriously large and active. The comprehensive nature of this library and its maturity helps to draw people in.
  • Whatever Microsoft technology they are pushing today - WinForms? Avalon? Sheer commercial brute force will get people dumping whatever they were told to use last time in droves and get them to implement it in Microsoft's Golden Child Of The Moment.
  • GTK+ is being used in Gnome. It is certainly well-developed and well-used.
In fact it is quite scary how few commercial GUI toolkits there are out there. You are normally given a low-level set of APIs from the desktop environment and if you are lucky you get a higher-level API (which will definitely not be cross-platform designed).

Anyway, to the point of the post... You can check out piles and piles of GUI toolkits here.

14 October 2006

More Vista - Desktop Window Manager

I must admit, although I am not very interested in running Microsoft Windows Vista as my own operating system at home, I am interested in understanding the UI technologies that are going to be available in it. It's certainly necessary to understand it for work.

A more interesting application of these new UI features are how the cross-platform toolkits going to incorporate them (and indeed whether some of it is so useless that it shouldn't be incorporated). I don't think that the toolkits will struggle to keep up since each time operating system UIs try to diverge they always end up converging. I do think that the way these toolkits expand will show which ones are the best designed (you know, the extra functionalty being less kludgey).

There is nother decent blog article about DWM here.

13 October 2006

Scripting Languages

At work I use a proprietary scripting language written using a version of Lex and Yacc (the neat Windows implementation from Bumblebee Software called Parser Generator 2). Unfortunately it is not as well documented as I would like (although it is in a much beter state with some recent work), and also difficult to maintain. It has been fun messing around with Lex and Yacc, but Parser Generator 2 hasn't been updated since 2003 so I had to spend some time getting it ready for Visual Studio 2005 (I don't know what will happen for 64 bit...)

Admittedly this is not an ideal situation, but when this macro language was first dropped in there was not quite the thriving community of different scripting languages available. I find the whole scripting language thing intensely interesting, so I thought I'd ruminate on a few.


Python is well-known, mature and well respected programming language. It was designed as a programming language not a scripting language so it has a really solid foundation, as it is always harder to retrofit complexity rather than preparing for it at the start. It has been used in the web domain extensively as well as embedding and a programming language in its own right.

It is really extensible with a well defined C API, and also this API allows you to embed an interpreter within your program. There are arguments that you should extend and not embed Python as a language, but this is a moot point as the design of your program will normally dictate the course you take.

Extending the language with your own C++ functionality is almost trivial thanks to projects like Boost Python and SWIG. There are also many other tools for extending and embedding. I am definitely a big fan of Boost Python after success playing with it and understanding how it all fits together (and I don't forget I promised to go into more detail on setting it up and designing your program around it).

Python extensions also include the absolutely brilliant wxPython which exposes the wxWindows library. The thing about wxPython is that it is widely regarded as a better API than the actual macro based wxWidgets C++ API.


This was designed as a scripting language. It is lightweight and fast. The language has grown to accomodate the features people wanted or needed, and the community around it is massive and thriving. It is normally the option people go for when they consider Python too "heavyweight", and as such is popular with game developers (for instance the MMORPG Worlds Of Warcraft).

This language also has an excellently designed way of binding C++ to the language called LuaBind. This is born from the same roots as the Boost Python design, there are plans afoot for the Boost Langbinding project (which would also encompass binding to other languages like Ruby).

There are also many other tools and more available from the community, make sure you take a look at the wiki.


I must admit I have been keeping an eye on this project. It was born from someone's frustrations with Lua and they created their own language. It's a young language, but it is surprisingly robust and mature for its age. The active maintenance also means that it is always working for the latest compilers.

Since it is so new it does lack the size of community, but it does have some nice tools. Squirrel has a C++ language binding tool like LuaBind and Boost Python called SqPlus which is never normally far behind the release of Squirrel. I recommend going to have a look at the Squirrel Wiki for a lot more information.

Well, that is three languages so far. Others include AngelScript, GameMonkey, XHed, EO scripting language, Guile, Javascript, Ruby, Pawn, io, and no doubt I am missing some others. (I've deliberately missed off the CLI based ones.)

Windows Vista - Aero Basic UI Explanation

There is an interesting explanation as to why the Aero Basic Interface looks the way it does when compared to the Aero accelerated theme. You can read about it here.

It's quite an interesting little article since it shows Microsoft banging their heads up against the same limitations as GUI developers have been.

GUI Toolkits - wxWidgets - new version released

A new development version of wxWidgets has been released. This is in a lead up to version 2.8, which will be the latest stable version.

The new version of wxPack has not been released yet, but the new version will probably be out soon and no doubt feature wxFormBuilder v3 (the new version of a GUI builder).

If you like GUI building in wxWidgets then the 2.7 development codeline actually seems pretty stable from my tests. If you are currently using 2.6 you are missing out on integrated wxAUI (advanced docking and UI kit) and quite a few other improvements.

12 October 2006

AJAX - The Hot New Thang

I can't be the only one. AJAX has taken off, so I took a closer look at it and realised I have essentially been doing AJAX for years. I referred to it as XML and Javascript to render a web page (not using XSLT).

Maybe I've completely missed the point, but the only difference between what AJAX is now (in simplistic terms) and what I did a while back was the way the XML was being retrieved. Admittedly my Javascript was way simpler than these new flashy whizz-bang sites, but the same data/view separation was there. I am pretty sure it was referred to as DHTML (although I think that also encompassed VBScript).

I must admit these Javascript platforms are really impressive, especially as the browser support gets better, like with WYSIWYG editors embedded in webpages which is what I am typing this with. I just realised this post seemed a bit negative, but I think it's all FANTASTIC! (Fast Show fans will know what I am on about)

GUI Toolkits - Visual Component Framework (VCF)

Out of all the GUI toolkits I have been looking at, the Visual Component Framework (VCF) has impressed me most. It was easy to compile in Visual C++ Express 2005, but most importantly the resizing is silky smooth (an odd thing to say is important, but it really impressed me). Most importantly the webpage has a link to Zod 2008, you know who to vote for!

The VCF is an almost cross-platform GUI toolkit, in that the Mac and Linux implementations are not complete yet. It is based on modern C++ and uses a signals/slots type event system. What made this so easy to evaluate was that I could load the solution into Visual C++ Express 2005 and kick off a build. And with my Core 2 Duo upgrade I made recently, it whizzed through the compilation of over 100 projects. I was using the Subversion trunk so a couple of the newer examples didn't compile, not a problem.

It was a bit of a leap for me to try it out as it was well out of the "similar to MFC" comfort zone, but getting some code up and running was trivial. There are so many examples that it can be difficult deciding which example provides the best template for a solution to your design. There is an online book describing lots of the VCF which although it is not finished is pretty informative, plus the source code documentation is likewise pretty good.

I found this a well-designed package as well, as it was not just simply a monolithic library, it was split into components. This also makes it much easier to implement cross-platform versions of it as there is a porting guide on the forums. There are some well written extensions as well with the graphics kit using the splendid Anti-Grain Geometry Library (libAGG), networking, and so on.

I started posting some questions on the forums because from the website and forums it looked a pretty quiet project, but I think it is just a case of appearances being deceiving. The main developer Jim Crafton (ddiego) drives it on with loads and loads of development.

The Windows version of the VCF is definitely mature enough to develop with, and looking at it I am surprised it does not have a more thriving community as it seems to have all the right ingredients. Some of these things are probably down to luck not judgement I suppose.

11 October 2006

A Great Collection Of Libraries

A while back I found a really great website for game development libraries. What I found was that these libraries are useful for development full-stop. So go check it out at the Free Game Development Libraries website.

If you are interested in programming you will find some libraries you knew about and some that you never knew existed. Also along with breaking the libraries down by functionality it also specifies the licence type.

Web Browsers Of The Future

I realised the other day how many Google products I was using...
  • Analytics
  • Blogger
  • Browser Sync
  • Calendar
  • Google
  • Mail
  • Notebook
  • Page Creator
  • Personalized Homepage
Also I use the search and now the code search.

And now I have just signed up for:
  • Spreadsheets
  • Writely
It's great all these things are free and freely provided, but now I think I am getting too reliant on it all... Admittedly I only use some of the things I am signed up to, and signed up to other things just to try them out.

But I wasn't going to discuss my addiction to trying things out. Something occurred to me when I was looking at the new Google Office, browsers are providing all this functionality, but we are still using an ancient paradigm.

Microsoft are releasing Internet Explorer 7.0 very soon, and it is attempting to catch up with Firefox by adding features like tabbed browsing, but it is just playing catch-up to an idea that was born before all of the AJAX applications started leaping out of the woodwork.

As these AJAX applications become more prevalent the web browser starts to become a hindrance. Do you use multiple tabs or do you use multiple windows, and how do you arrange and manage those windows (especially since they all have the same taskbar icon)? Are the bookmark user interfaces moving with the times? The web browser needs a rethink for these new uses as it is still designed more for viewing static data (and now that is only part of its repetoire, a specialisation of its more generalised use).

Most web browsers have their rendering engine a different layer, so that is easy to break out. Do these applications become a separate window? Do we get a new kind of application launcher? I've never really put much thought into it as until recently I never saw the web as a platform.

Certainly I am finding the current browser technology very limiting as tabbed browsing, multiple windows, bookmarks are not allowing me to use all of these new applications to their maximum potential. Just having GMail and Blogger open in web browsers is harder than it should be to manage as I have to do a double take on the task bar or think before switching tabs.

Maybe the web browser needs a rethink, or maybe my ideas aren't so outlandish... The main web browser application is some sort of navigator/task bar and the pages are shown in their own easily recognisable windows, perhaps even without borders as they currently exist. I suppose some of these ideas are being integrated into these new "sidebars" in operating systems, but do they go far enough and take the new AJAX applications into account?

10 October 2006

GUI Toolkits - wxWidgets

wxWidgets is the 800lb gorilla in the open source GUI toolkit arena. It goes well beyond being simply about the GUI and spreads into all areas of application development, from networking to database to threading to strings.

It isn't such a large leap from MFC to wxWidgets. They are born from the design of macros and simple classes, and this is not as large a problem as sometimes it is made out to be, some people find it easier, some find it harder.

By far the easiest way to get up and running is to use wxPack if you are using Visual Studio, or give Code::Blocks a try.

The sheer breadth and depth of the project is amazing, and it keeps spreading further with more and more contributions. What I have noticed over the past year is that it has really started to take off with millions of additions like wxAUI (docking toolkit), wxFlatNoteBook (a tab control window container like Visual Studio has), wxPDFDocument, wxSQLite3, and in the past few days wxSkin (a potential skinning package). The website is also much better with a wiki, a forum, and this week a blog. Google Summer of Code seems to have been a success for wxWidgets as well.

I certainly have had some success with it writing a test program embedding an Ogre rendering context into a docking user interface to try out wxAUI. It looked impressive although didn't accomplish much...

Before making this post too long I will go into more depth in wxWidgets another time.

09 October 2006

GUI Toolkits - Win32GUI Generics

Win32GUI Generics Homepage

When I found this project I thought I had found the holy grail. An advanced use of C++ for user interface purposes. I looked past the screenshots on the website which seemed odd, but downloaded it anyway. The last release of the project and any active development was nearly a year ago.

It certainly pressed all the right buttons for me. It was a wrapper for the Win32 API with aspirations to be cross-platform. I encountered my first set of problems when I tried to get it to compile, you shouldn't use the solution files for Visual Studio. There is a "build library" utility that works with Visual C++ 8.0. I got a few examples up and running with minor project file tweaks like include directories, and found that custom draw buttons were not XP themed so I hacked in a small theming API.

All seems okay so far. The biggest problem I found was the resizing, it caused massive amounts of flicker. Having solved a lot of similar problems in MFC I tried to get it to flicker less with no success. Then attempting lots of other examples I found they simply crashed or would not compile. Most disappointing was I could not have a look at the new "Surfaces" version of the library.

The compiled size of the library is massive with large amounts of global static data. I found building a bit pot-luck. I had to configure the Boost Jam files to not use iterator debugging or safe iterators.

The thing is I really like this library and it seems really powerful, but simultaneously lacks a little robustness. There is a lot of work to be done on this library to make it ready for the primetime which is really unfortunate. John Torjo definitely deserves a pint of beer for fantastic and thought provoking work.

There is a great little article about it here.

GUI Toolkits Again - a bit of MFC

At work, I only use MFC and the antiquated design features in Visual Studio for working on resources. These interfaces still feel like they haven't moved on for a lifetime (and are in fact pretty much unchanged from Visual Studio 6.0).

The most annoying part about working with the resources is I have to resort to handcoding most of the time. It is especially necessary in order to follow the Official Guidelines for User Interface Developers and Designers (self-inflicted myself, but you need some level of consistency). Also the IDE design features have an uncanny knack for orphaned #defines and controls.

MFC doesn't really feel like an API as most of the stuff I want to do I end up having to subclass and write lots of specific code. There are subclasses for just about every type of control, and in that a lot of it is direct access to the Win32 API.

I must admit that I don't have an intense hatred for MFC like a lot of developers. It seems to serve its purpose well, and there are so many extensions and large applications built on it. I don't think Microsoft envisioned being unable to kill it off because it is used by too many applications. It will still be developed and have some new "managed" features which strikes me as odd... MFC is a thin wrapper around the Win32 API, but .NET is a wrapper around the Win32 API, so there would be a double level of indirection for these new features.

A lot of people would love to migrate away from MFC, but they are too integrally tied into their applications. The cause of that is normally the initial codebase grew from a small code-generated wizard application. I know I would love to do move away from MFC, but it is first necessary to find a new GUI toolkit that is capable of doing every feature you have probably handcoded in extensions to MFC, or if you have to write the extensions yourself it is no more difficult to do than the first time you wrote it.

That is part of the reason to really look in depth at GUI toolkits. It is really necessary to find one that will allow the most active development by the virtue of being easy to pick up. Also, the grass is not always greener on the other side.

07 October 2006

Open Source GUI toolkits

One of the things I really want to check out over the next few weeks are open-source GUI toolkits. There are quite a few to choose from and I tend to jump from camp-to-camp on a weekly basis as to which one I find the most interesting.

Since I am using Visual C++ 2005 Express, the ones I try out fully will be tested and compiled (if indeed a successful compilation is possible) on that platform.

The initial ones I have already had a good go at over the past few weeks are wxWidgets, Visual Component Framework (VCF), and Win32GUI Generics. Some others I have been reading about are Smartwin++, Ultimate++, FLTK, and FOX.

Also I want to write up a bit more of a comprehensive howto on Boost Python, as I quite enjoyed playing around with that.

06 October 2006

Core 2 Duo

In as long as I can remember I have not been impressed with the incremental steps in hardware. The last time I went "Ooooooh!" was when I bought a Voodoo card for 3D graphics (it wasn't even integrated into graphics cards at the time) for a Pention 200MMX. The smoothness and difference in response was amazing. I suppose the incremental steps all add up and the comparison with a few years ago is noticable, but nothing really blew my socks off.

That was until we got a top of the range two processor (each with two cores) Core 2 Duo (Xeon). Bloody hell, I have never seen such a leap in speed ever! Operations that took days before now take hours, and even when it is a single process (we work on a full multithreading program) it has a massive performance gain in the order of 50%, and there are three cores still left idle!

I've always bought Athlon processors for my home PC builds mainly because they were cost-effective and powerful. But I have broken with tradition and picked myself up a Core 2 Duo 6400 processor and a new motherboard (which has both AGP and PCI-Ex slots) from my Athlon XP 3200+. For general websurfing I don't notice any difference until I try to compile something. I am currently compiling a 114 project solution in Visual Studio in the background whilst I am typing this and it is hammering through and took about five to ten minutes to do(!)

All I can say is if you do development the Core 2 Duo processors really make a difference.

Boost Python

A few posts ago I wrote up how to compile the Boost Library and also Boost::Python with Visual C++ 2005 Express.

Boost::Python is a fantastic tool for binding your C++ functionality to the Python scripting language. You just need to write some extra small templates to expose classes, functions and so on.

One of the things that bothered me about Boost Python is the need to use bjam to build the resulting .pyd file. It complicates it all quite a lot, especially if you have not been using bjam.exe to compile your project anyway...

What I discovered with a little bit of experimentation is that the PYD file is just a DLL renamed(!) And that seems to be it. So if you compile your program into a DLL (with all the additional Boost::Python code) then you either change the extension or change the project settings for the output filename.

Tools for TortoiseSVN

In order to make my TortoiseSVN as useful as possible, I use some external tools to maximise productivity. It took a while to find the right set up but I am happy with it now.

For merging with a three-way diff when there are conflicks I found KDiff3, which seems to not be considered as sexy or well-known as most other tools. But it does the job admirably with plenty of powerful features. Certainly it does not look fully Windows-native, but that should not put you off if you want to use this powerful tool, and after all it is very rare that Subversion wants me to do a three-way diff.

For standard diffs I use WinMerge. Simply it is the best Windows based diff and merge tool I have ever used. It is powerful and intuitive, but is unfortunately limited to two-way diffs. If it did do the three-way diffs I would not be using KDiff3.

For viewing patch files (unified diffs) I use Notepad2 which has nice highlighting, but it very rare that I will have a need to look at these patch files.

After installing TortoiseSVN, install KDiff3 as it sets up your TortoiseSVN environment for you. Then install WinMerge and choose "WinMergeU.exe" as the diff viewer. Then install Notepad2 and set it up as the unified diff viewer. Doing it in this order means that you can let KDiff3's installation set up the bindings, and then configure the other ones by had as KDiff3's commandline isn't overly simple for TortoiseSVN.

More Vista Native API

Michael Dunn has posted anotehr Vista native API tutorial about monitoring the system's power. It is obviously not as whizz-bang as the first tutorial, but this is excellent stuff as I hope it means C/C++ developers are going to have a real go at messing around with the native API.

There is an excellent and massive post from Kenny Kerr available from this link. Make sure you check that out as well.

I've now installed the Windows SDK (I think they call the Win32 API the Windows API now, but there is no definitive answer as Microsoft want to encourage people to use other technologies).

05 October 2006

Burning a DVD ISO on Windows XP

I started by downloading the Windows SDK, which had a file extension .img. After a bit of Googling I found out you can just change the extension to .iso.

Now it was time to burn it. I found out that the ISO Burning Powertoy doesn't work for DVDs. The software with the DVD drive was so hatefully bad that it was unusable.

So I searched out the burning engine from DVDDecrypter which has been split off by the developer after all the raids and legal ranglings. Now it is called ImgBurn and it was a case of choosing the ISO then hitting the big button to burn. Oh, did I mention it was freeware as well? Top notch stuff.

Icons Icons Icons

In my last company I redesigned every icon in the system from a 16 colour pallette into full 32-bit alpha-blended glory. I also wrote the support functions for cool looking disabled and hover (hot) looks.

In total I think that was 250-300 icons. Probably more. I didn't follow any guidelines apart from my own consistency of design. To be honest the Microsoft Guidelines were very difficult to follow if you wanted to produce a substantial number of toolbar and tree view icons.

There are a few guidelines out there now:

The reason I am writing this today is that Apple have recently added a style guide for their icons, and it is part of their Apple Human Interface Guidelines which is essentially an online book and is very in-depth.

I find it interesting that OS makers can chastise the applications for not being consistent and so on, but without providing developers with the information and tools to go and do it, they surely can't be surprised... Hell, you can't even edit 32-bit icons in Visual Studio or even through an add-on.

04 October 2006

Visual Studio 2005 - Lets Break Everything!

Since I've been using Visual Studio.NET 2005 I have discovered a myriad of undocumented (or documented in such a way as to seem inoccuous) breaks in the compilation of most code.

Standard C - the CRT

I should start with the simplest and probably most common breaks that would effect you if you use C or C++ with the Visual C++ 8.0 (VC8) compiler. If you have used swprintf or any of its relations you will find your code no longer compiles, or it does and gives an odd warning. This is extremely dangerous as to make it more conforming they have added an extra parameter for the buffer size. All well and good, but you find most of the code you download of the Internet no longer compiles. Simply adding #define _CRT_NONSTDC_NO_DEPRECATE 1
won't make a difference. You need to add:

Make sure this all gets added as the first thing in the stdafx.h or in the pre-processor definitions in the project settings.

The _CRT_NONSTDC_NO_DEPRECATE will deal with the instances of other C runtime library code that has also changed. This is because Microsoft have replaced all of the functions that you will get all the warnings about with "secure" functions. This means that the function names are appended with _s.

Floating Point Operations

There are three options now:
  • fp:fast - The fastest implementation.
  • fp:precise - slower but more "precise".
  • fp:strict - the strictest implementation.
You have to make a choice - faster or more precise. I still haven't discovered how imprecise fp:fast is yet.

C++ Standard Template Library

You'll probably find that any code you use will fall over in some obscure and not so obscure instances, as well as being much slower. And that goes double for Debug builds.

So you need to add these to the top of your stdafx.h or your pre-processor definitions (or to your command line). To get up and running use:
#define _SECURE_SCL 0

How to define these values.

The options to add these things:
  1. Add to your stdafx.h as plain preprocessor definitions. This option seems to be the most hit-and-miss.
  2. Add to your pre-processor definitions in your project settings. This is done with semi-colon separated values, eg, _SECURE_SCL=0
  3. Add it to your commandline. Do this in the project settings commandline tab. Add /D_SECURE_SL=0 for instance, you simply add /D then the preprocessor symbol without a space with an optional assignment.
In some instances one option may not work but one of the three will.

Windows Vista and its API

After lots of uncertainty with Windows Vista as a developer (it's sad, I worry about such things), I breathed a huge sigh of relief today. Windows Vista has generated such things as WPF and Aero and other things that mean very little to me as a developer. Simply, I want to know how to access all the good stuff.

This had me worried as they seem to want to make non-managed code a ghetto, but this is mainly from reading allt he public information and marketing. It seems that the Win32 is still the basis of everything, although the name Win32 is ultimately misleading. To cut to the chase, .NET sits on top of Win32, even in Vista, and you still have access to it.

There is a great little article on the CodeProject that shows that you can write in what are now called the "Native APIs". Hit the link and have a quick read.

I find this exciting as a developer as this means that I can write my own wrappers for stuff and extend those wrappers I have written previously.

Now I'm in the middle of downloading the new Windows SDK for Vista and I am going to have a closer look at the native APIs in order to work out what it can do.

03 October 2006

Boost Library And Visual Studio 2005

This will set you up with a top notch development environment for C++ in Windows. Also this will tell you how to get the Boost::Python libraries to work with as well (which can never be a bad thing).
  1. Download Visual C++ 2005 Express from here.
  2. Then go and install the Platform SDK. I recommend installing it into C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK as then the environment variables are already set up for you in VC8.
  3. Go and download Python where the latest version is 2.5. Install Python 2.5 to the default installation directory of c:\Python25.
  4. Now it is time to download Boost and make sure you download the source and a precompiled bjam build tool.
  5. Extract Boost to a temporary directory on your hard drive, and copy the bjam.exe into the Boost directory.
  6. Open a command prompt in the Boost root directory(where you copied bjam.exe to).
  7. Run the batch file for registering Visual Studio commandline variables : C:\Program Files\Microsoft Visual Studio 8\Common7\Tools\vsvars32.bat
  8. Run the following command line to compile and install Boost in "c:\Boost" with no checked iterators:bjam "-sTOOLS=vc-8_0" "-sPYTHON_VERSION=2.5" "-sPYTHON_ROOT=c:\Python25" "-sBUILD=debug release <define>_CRT_NONSTDC_NO_DEPRECATE <define>_CRT_SECURE_NO_DEPRECATE <define>_SECURE_SCL=0 <define>_SCL_SECURE_NO_DEPRECATE <define>_HAS_ITERATOR_DEBUGGING=0" install
  9. What I tend to do then is copy Boost to where my development libraries go, and then add those directories to the lib and include directories in Visual C++.
Now you are ready to go for Boost-ified C++ development and you will have the Boost Python libraries as well for binding your code to a scripting language. Next install TortoiseSVN and install the settings outlined in one of my previous posts for the toolbars, and then you should be ready to check some code out and develop like a demon.

What to do next?

I think my next task should be explaining how to get Boost working with Visual C++ 2005 Express. Then in theory with the Subversion user interface you should have a very powerful and free development environment for C++.

TortoiseSVN + VS.NET 2005 = Good Stuff

See the update here.

As promised it is time to integrate TortoiseSVN into Visual Studio 2005. The easiest way I have found to do this is to post the vsettings files from Visual Studio once the environment is set up.

Here are the zipped settings files:
This link is for Visual Studio.NET 2005.
This link is for Visual C++ 2005 Express.

You need to go to Tools->Import and Export Settings and load the files from wizard dialog that pops up. There are differences between the free Visual C++ Express and Visual Studio settings files, so please make sure you use the correct one. It would also be an idea to say yes when the wizard asks you to back up your current settings.

There is one thing the settings get wrong on the build toolbar which is the size of some controls, so once the settings have loaded make sure you resize the items on the build toolbar by right-clicking and choosing Customise.... Then you can select the items and make them smaller.

The settings have some of my own personal changes as well as the Subversion changes I am afraid, but you can choose which bits to load in on the settings wizard dialog. There are some assumptions made also, the PlatformSDK is assumed to be in the default environment location under c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK. Also it assumes that TortoiseSVN is installed in the default directory. The settings files are just XML so you could alter those directories by hand before loading it in.

Once you have loaded these settings you will have:
  • A Subversion Menu.
  • A consolidated help menu so the same number of menus is still there at the top.
  • A Subversion toolbar.
  • All Subversion options in menus and toolbars have icons associated with them that will look familiar to users of TortoiseSVN.
  • The context menu for Solutions has relevant Subversion options.
  • As do individual files context menus - Diff, Log, Blame.
  • Since Subversion has its own menu they are no longer present in the External Tools.
  • Made the build bar actually have build options on it.
  • Trimmed down the main file toolbar.
  • All of the moving around of items means you get all the toolbars across the top of the screen in one row.
  • Added quickwatch to the debug menu as it annoys me they removed it after Visual Studio 6.0.
Menu screenshot:

Toolbar screenshot:

Solution context menu:

File context menu:

Well, if anyone has any improvements let me know...

Subversion : TortoiseSVN Integration into Visual Studio.NET 2005 Again

Today I discovered the "Import and Export Settings" feature in Visual Studio.NET 2005. This means no more losing settings or having to mess around getting the environment set up again after a rogue installer blitzes all of the settings I had worked so hard to set up.

What this means is that later today I will post up a link to a file which will customise Visual Studio.NET 2003 for embedding TortoiseSVN. You'll have icons, toolbars, new menus, and additions to the context menus. You'll end up with some of my other settings like removing all Visual SourceSafe source control commands, and other things I find annoying. But you will easily use this as a base setting and add your own bits and pieces to it.

Garry Bodsworth

Edit: See my next post for links to the settings files and screenshots of teh integration.

02 October 2006

Wireless Routers and the Linksys WRT54G

My dad gave me a Linksys Wireless router (WRT54G) and it looks ug-leeee, so I never used it and bought a more stylish looking one which turned out not to work properly to the point I got so annoyed I threw it away.

So I dug out the WRT54G and plugged it in. It worked flawlessly until today when my two router network decided to eat itself. Eventually after much resetting I got it all up and running again, but I discovered that with heavy network traffic like P2P (and probably my surfing habits) it can crash due to keeping a record of everything for five days.

A quick websearch lead me to the Wikipedia Article on the Linksys WRT54G and reading that I realised exactly what I had. The company had opened up the firmware and there were a variety of open source versions available. I then read this FAQ for utorrent where it describes what firmware it recommends and how to avoid overloading the router. Never being afraid of destroying hardware I installed HyperWRT Thibor on the router (there is a decent Wikipedia page for HyperWRT as well). Once it rebooted I saw how many extra features are in there now. Needless to say I am buying only Linksys routers from now on...

Subversion : TortoiseSVN Integration into Visual Studio

See the update here.

This is the easy method of integrating TortoiseSVN into Visual Studio.NET 2003 and 2005 (and probably Visual Studio 6.0). I'll take it in stages first and show you how to add these useful things to your "External Tools" menu.

TortoiseSVN is kind enough to provide a decent command-line interface for bringing up the dialogs. This gives us the ability to add External Tools that will operate on the currently open project in Visual Studio.

Here is a script (vbs) that will append the External Tools to the end of your list:
' Create the Subversion External Tools for Visual Studio

' Set the Visual Studio Version Number so we access the correct
' part of the registry for External Tools.
' Visual Studio.NET = "7.0"
' Visual Studio.NET 2003 = "7.1"
' Visual Studio.NET 2005 = "8.0"
Dim strVisualStudioVersionNumber
strVisualStudioVersionNumber = "8.0"

Dim strTortoiseSVNBin
strTortoiseSVNBin = "c:\\program files\\TortoiseSVN\\bin\\"

' Create the scripting shell object
Dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")

' Function to install an external tool
function WriteExternalTool( strVersionNumber, _
iToolNumber, _
strTitle, _
strCommandLine, _
strArgs, _
strWorkingDir, _
strSource, _
' NOTES (from Google Groups):
' ToolTitle:
' stores the name of your tool
' ToolCmd:
' stores the path to your tool
' ToolArg:
' stores the command line arguments for your tool.
' Set this to a blank string if your tool takes no arguments.
' ToolDir:
' stores the initial directory from which your tool
' should be run. Set this to a blank string if you don't care where your tool
' is run from.
' ToolOpt:
' stores the settings for the checkboxes at the
' bottom of the external tools dialog. The easiest way to determine what
' value you should set, is to create your tool once manually with the
' checkboxes set the way you like, and then exit visual studio. Then look up
' the value that's written to this regkey. The value that this registry
' entries got set to is the value your installer should set.

Dim strTitleKey, strCommandLineKey, strArgsKey, strWorkingDirKey, strSourceKey, strOptionsKey
' Construct the keys we will be adding to as strings. These depend on the number of the tool.
strTitleKey = "HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\" & _
strVersionNumber & "\External Tools\ToolTitle" & iToolNumber
strCommandLineKey = "HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\" & _
strVersionNumber & "\External Tools\ToolCmd" & iToolNumber
strArgsKey = "HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\" & _
strVersionNumber & "\External Tools\ToolArg" & iToolNumber
strWorkingDirKey = "HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\" & _
strVersionNumber & "\External Tools\ToolDir" & iToolNumber
strSourceKey = "HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\" & _
strVersionNumber & "\External Tools\ToolSourceKey" & iToolNumber
strOptionsKey = "HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\" & _
strVersionNumber & "\External Tools\ToolOpt" & iToolNumber

' Write out the contents of an external tool
WshShell.RegWrite strTitleKey, strTitle
WshShell.RegWrite strCommandLineKey, strCommandLine
WshShell.RegWrite strArgsKey, strArgs
WshShell.RegWrite strWorkingDirKey, strWorkingDir
WshShell.RegWrite strSourceKey, strSource
WshShell.RegWrite strOptionskey, strOptions, "REG_DWORD"

' Update the count of external tools for the benefit of Visual Studio
WshShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\" & _
strVersionNumber & _
"\External Tools\ToolNumKeys", _
iToolNumber + 1, _

WriteExternalTool = (iToolNumber + 1)
end function

' Get the number of current external tools as this will tell us where to start the numbering
Dim iNumTools
iNumTools = WshShell.RegRead( "HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\" & _
strVisualStudioVersionNumber & _
"\External Tools\ToolNumKeys")

' Install Subversion Tools

' The order is:
' SVN Commit
' SVN Update
' SVN History
' SVN Diff
' SVN Blame
' SVN Revert
' SVN Modifications
' SVN Repository
' SVN Project History
' SVN Settings

iNumTools = WriteExternalTool( strVisualStudioVersionNumber, _
iNumTools, _
"SVN Commit", _
strTortoiseSVNBin & "tortoiseproc.exe", _
"/command:commit /path:""$(SolutionDir)"" /notempfile", _
"$(SolutionDir)", _
"", _

iNumTools = WriteExternalTool( strVisualStudioVersionNumber, _
iNumTools, _
"SVN Update", _
strTortoiseSVNBin & "tortoiseproc.exe", _
"/command:update /path:""$(SolutionDir)"" /notempfile", _
"$(SolutionDir)", _
"", _

iNumTools = WriteExternalTool( strVisualStudioVersionNumber, _
iNumTools, _
"SVN History", _
strTortoiseSVNBin & "tortoiseproc.exe", _
"/command:log /path:""$(ItemPath)"" /notempfile", _
"$(ItemDir)", _
"", _

iNumTools = WriteExternalTool( strVisualStudioVersionNumber, _
iNumTools, _
"SVN Diff", _
strTortoiseSVNBin & "tortoiseproc.exe", _
"/command:diff /path:""$(ItemPath)"" /notempfile", _
"$(ItemDir)", _
"", _

iNumTools = WriteExternalTool( strVisualStudioVersionNumber, _
iNumTools, _
"SVN Blame", _
strTortoiseSVNBin & "tortoiseproc.exe", _
"/command:blame /path:""$(ItemPath)"" /notempfile", _
"$(ItemDir)", _
"", _

iNumTools = WriteExternalTool( strVisualStudioVersionNumber, _
iNumTools, _
"SVN Revert", _
strTortoiseSVNBin & "tortoiseproc.exe", _
"/command:revert /path:""$(SolutionDir)"" /notempfile", _
"$(SolutionDir)", _
"", _

iNumTools = WriteExternalTool( strVisualStudioVersionNumber, _
iNumTools, _
"SVN Modifications", _
strTortoiseSVNBin & "tortoiseproc.exe", _
"/command:repostatus /path:""$(SolutionDir)"" /notempfile", _
"$(SolutionDir)", _
"", _

iNumTools = WriteExternalTool( strVisualStudioVersionNumber, _
iNumTools, _
"SVN Repository", _
strTortoiseSVNBin & "tortoiseproc.exe", _
"/command:repobrowser /path:""$(SolutionDir)"" /notempfile", _
"$(SolutionDir)", _
"", _

iNumTools = WriteExternalTool( strVisualStudioVersionNumber, _
iNumTools, _
"SVN Project History", _
strTortoiseSVNBin & "tortoiseproc.exe", _
"/command:log /path:""$(SolutionDir)"" /notempfile", _
"$(SolutionDir)", _
"", _

iNumTools = WriteExternalTool( strVisualStudioVersionNumber, _
iNumTools, _
"SVN Settings", _
strTortoiseSVNBin & "tortoiseproc.exe", _
"/command:settings /path:""$(SolutionDir)"" /notempfile", _
"$(SolutionDir)", _
"", _

' Reset the scripting shell object
set WshShell = nothing

Download the script from this link

You can set your Visual Studio version by setting the strVisualStudioVersionNumber variable according to the comment.

If your TortoiseSVN is not in the default installation location change the strTortoiseSVNBin variable (making sure you use \\ as separators).

I am not a vbs expert but I tried to make this script as reusable as possible, especially with respect to writing the external tools to the registry. This should work with any external tools you may want to add via this script. There are probably some TortoiseSVN features that should be added as well, but I have got by on what is in that script so far.

For the next part I will describe how to make a toolbar to access the new External Tools.

01 October 2006

Subversion and TortoiseSVN - A programmers best friend

Before you work in industry it is unlikely you ever use any source control. At Essex Uni we were forced to use RCS (on the command-line) once and it all seemed pretty trivial and pointless. Most of the time when you go into industry you end up having to use Visual SourceSafe, sure it does a job, but for the most part it is completely useless and scales terribly.

Earlier this year I migrated the company I work at (NC Graphics) from Visual SourceSafe to Subversion. I prepared a lot for this doing tons of research to make this transition as seamless as humanly possible, but as these things normally happen time was a serious factor. Bizarrely it was done ahead of schedule and the benefits were pretty much instantaneous. Sometimes in IT we beat deadlines(!)

The Migration

I spent ages reading everything I could find via Google about migrating anything to Subversion. This was necessary as there was very little covering Visual SourceSafe specifically. In the end I had to choose the only tool even remotely capable of doing the conversion called vss2svn and even then there were some compromises that had to be made. I used the orginal "legacy" script from their development repository. It essentially gets every file you have currently in your source tree and then search each of their histories backwards in time. This does mean you lose renames and files that have been removed. The good thing though is that it converts the check-ins into Subversion style atomic commits by grouping them all together by time and user.

There is a new version of vss2svn (new website) but it was nowhere near being ready when I was doing this work. This version actually reconstructs almost everything by reverse-engineering the Visual SourceSafe file format. If you have archived portions or restored portions I found that it didn't work. It seems to have come a long way since I last looked, but I don't think it would have converted our large database with all of its quirks.

Back to the original script though... To get it to run fast what I did was archive out the areas of SourceSafe we needed and then imported them into a brand new clean instance. This cut the running time for the script from the test run of 14 days down to less than 2 days.

Using Subversion For Development

Obviously you have the basic command-line tools for using Subversion but there is a lot more out there as well. Internally we use TortoiseSVN and that is about it. Most people are looking at loads of other options, but once you use TortoiseSVN you don't need anything else, it only takes about a day, maybe two to realise this. Without hyperbole I can say TortoiseSVN ranks right up there as one of the greatest gifts to developers ever made.

To make it even more useful though I did a little work to integrate it into Visual Studio.NET (2003 and 2005). It is actually really simple to do because TortoiseSVN provides us with a commandline interface that can display the dialogs. In the next couple of days I will give complete instructions how to set this up and even describe how to set it all up on a toolbar like I currently have it. I'll also cover all the clients I checked out in the course of the migration.

First Post

I suppose at the moment I just need an outlet for all these computer-type things going round in my head. I mainly specialise in C++ and was once known (and probably still known) as a GUI specialist. I've done all kinds of random things like setting up a company-wide bug database and migrating a Visual SourceSafe (VSS) "database" to a Subversion repository.

I tend to read loads of programming stuff in my spare time and I think should put my money where my mouth is and provide some source code on the Internet that may be of use to someone. On numerous occasions in my programming career I have encountered bits and pieces that even Google couldn't rescue me from, and I know for a fact MSDN help is a chocolate teapot. I like it when the building blocks are out there and it gives you just enough to build your own solution.

So in the future if you are interested, you can look forward to ramblings on C++, Open Source libraries that I encounter, MFC, Win32, user interface design, Open Source programs that make life easier, STL library, Boost library, template metaprogramming, code design, Python, and more.

Thanks for listening, now it is time to get some real content...

Garry Bodsworth