Better fix for image save state tracking

This mechanism will allow for more flexibility if we implement "jump to
undo position" behavior in something like an Undo History tool.
Skip export color depth check for PDI files
Many improvements to import/export color depth handling

PD has a sophisticated system for automatically determining exported
file color depth, based on the current image contents and the color
depths supported by a given format.  The switch to Layers support
introduced a lot of problems to this system, as the various color depth
functions weren't intended to operate on a multilayer image.

I have now reworked all color depth checks to operate on copies of the
composited image.  Similarly, those composited image copies are created
as infrequently as possible (for performance reasons).

Among other things, this commit fixess issues where images that could be
written as 24bpp were instead being wastefully written as 32bpp with a
blank alpha channel.