Retro-Code

I was looking for older code through some older projects and I ended up looking at the code of RoundAbout, a Delphi project I headed with a German (Roland), an American (Marcos) and plenty of other contributors. I thought, I might just as well make this an opportunity to breathe new life into this specific category: There is some exciting and funny code in the project and I wouldn’t do the project good by not showing the effort to collectively create something good out of nothing.

But first: In the early 2000s I ended up looking for an e-mail client for Windows. For years I had been using Eudora, but, I got a bit tired of looking at the ads that Qualcomm pushed upon users. I initially looked at Phoenix Mail, an e-mailer initially programmed by Michael Haller which in turn was passed on to American Delphi developers. Via that mailing-list I discovered Roland’s excellent modernized branch and, as any good open-source branch, I ended up branching his version into RoundAbout because we couldn’t agree on many issues: I believed in going more in-depth (technically speaking) while Roland was more or less adopting a wait-and-see, conservative approach. Both approaches had their successes, and both our branches had attracted a variety of Delphi luminaries and dignitaries (I’m looking at you Duntemann), including offers of help from the original Phoenix Mail branch. In 2004, RoundAbout was left for what it was and like many open-source projects, it died a silent dead. However, without doubt, its code continues to live on in the original branch(es) or is probably floating around on the Internets. I wouldn’t recommend people to try the e-mailer nowadays: it works fine but might look odd on Windows XP and higher.

This brings me to the first piece of code I’d like to point at, which is the ability of adding or dynamically creating toolbars and toolbar buttons: It was heavily pushed by Marcos and it required so many code changes, that I ended up taking the challenge, provided that:

It is possible to create new toolbars and buttons: however, the maximum of toolbars should be 255, the maximum of total buttons (application wide) are 65,5xxx (the number that fits in a word).

I mean, 65 thousand and some buttons should be enough for everybody, right?

The main code of code clearing up existing entries (toolbars/toolbar buttons) was encapsulated in a inline procedure called:

 8594   procedure UseThatGrenadeLauncher;
8595 var l : integer;
8596 p : TPopUpMenu;
8597 begin
8598 for l := FooBar.ControlCount - 1 downto 0 do
8599 begin
8600 // FireInTheHole!
8601 if FooBar.Controls[l] is TToolBarButton97 then
8602 begin
8603 // Make sure that eventual attached menus are freed.
8604 p := TToolBarButton97(FooBar.Controls[l]).DropDownMenu;
8605 if Assigned(p) then
8606 begin
8607 p.Free;
8608 TToolBarButton97(FooBar.Controls[l]).DropDownMenu := nil;
8609 end;
8610 end;
8611 Foobar.Controls[l].Free;
8612 end;
8613 end;

Obviously, I was heavily into QuakeWorld then and when I was programming this, it was most likely late at night. It worked out, and surprisingly, the first code wasn't too buggy either.