This morning I reviewed the code that I created for gnocl::drawingArea runtime addition of widget options. I’m quite pleased with the result. The changes made this morning included the creation of a new function to handle the changes to the drawingAreaOptions array. This function, simply called doOptionAdd contains the barest level of changes to implement new functionality. Putting the allocation in a separate function does have its advantages of course. The location of the original code was nested within a switch sequence and the implementation of these new options itself relies upon a switch statement. Needless to say that with all these switches , Idxs and curly braces code errors were popping up all of the time. The current solution is lean and more easily maintained/expanded.
The todo list attached to today’s work includes the following proposals. The addition of the following sub-commands:
remove -remove the option from the options array (incl. script)
available -return a list of currently configured options
suspend -remove option from the event mask only
resume -add the option to the event mask
So far the implemented options have been signals, ie -onMotion etc., so the next logical step is looking at setting properties.
Oh, and finally, I update the NEWS file. Since beginning this blog it had become neglected somewhat!