Problem with Undo when using COLOR field in a description resource
-
I've encountered an odd problem when a plugin has a COLOR field in a description and Undo (Ctrl-Z) is hit after changing the colour.
The attached archive contains a small ObjectData plugin called 'Diamond' to demonstrate this (Windows only, debug build). If you install it then invoke it from the Extensions menu, you see it generates a simple polygon object. There are three parameters - height, width and colour.
To reproduce the problem, change either the height or width parameter to anything. Then, click the 'Color' coloured rectangle and in the colour dialog box change the colour to anything. The object colour changes as expected. Close the dialog, then hit Ctrl-Z to undo the colour change. The colour changes back, but also undoes the previous parameter change to width or height. In fact, if you didn't change anything other than the colour, then hit undo, the object is deleted. It's almost as if the effect is to undo two levels on the undo stack rather than one.
At first I thought this must be the code I used to change the colour (it's just a call to BaseObject::SetColorProperties()) but not so. Because, if instead of clicking the coloured rectangle you expand the COLOR field to show the colour sliders, you can change the colour using the sliders and undo works normally You can also modify the source so the object colour is not changed at all and the problem still occurs.
Unless I'm missing something really obvious this looks like a possible bug in the colour picker dialog implementation. (N.B. the full plugin source code is included in the archive.)
Steve
-
This post is deleted! -
Apologies - the file upload to my original post doesn't seem to have worked. I tried a different link but that was deleted for some reason. Here's another attempt. You can download the file from my site using this link.
Hopefully that has worked!
Steve