2007-10-25

Refactoring and Gadget Hiding

Whilst adding a few bits to the documentation, I decided to look around for C++ styleguides to see if I’d missed anything obvious (the gadget developer section of the docs contains a Woopsi styleguide, y’see). I’d omitted to document loads of things, but I also realised that some of the style decisions I’d made weren’t particularly good.

Much refactoring later, enums and structs have more appropriate naming styles, as do enum items and class variables. I’ve also switched around the layout of the header files - public class methods now appear in the list first, followed by protected methods, followed by private methods. I read something about this when I first started playing with C++ about 5 years ago, and it made sense to me at the time. The thinking behind it was that developers are more likely to be interested in public methods than anything else, so they take precedence in the order.

Regarding developments that aren’t completely mind-numbingly tedious, gadgets can now be hidden/shown using (surprisingly) hide() and show() functions. Gadgets can also be set to hide themselves instead of closing and deleting themselves when the close() method is called.

Gadgets can be marked as non-draggable, so windows and screens can be locked in place. Lastly, the gadget deletion queue is now only processed by the VBL event handler instead of every event (which didn’t make much sense).

All of this is in the SVN code.