Rewrite Image -> Canvas Size to support layers

Arguably the easiest function to rewrite, as no pixel data has to be
modified - just the virtual bounding box around the layer collection.
Fix severe Flatten Image bug

Typed ID when I meant Index, ugh.
Rewrite Image -> Indexed color to support layers

I wanted to tackle this operation next because it requires a flat image,
which is kind of a unique challenge.  Fortunately, finding a
Layers-friendly solution wasn't too difficult.

Basically, the dialog now warns the user that it will flatten the image
before proceeding (but the image can still be previewed to get an idea
of how it would look at 8bpp).  Previews work similar to the JPEG export
dialog, by requesting a non-standard preview source - in this case, the
composited image.

I also cleaned up the code a bit, thanks to more familiarity with
FreeImage these days, and added a progress bar so the user has some idea
of how long the function may take.
Improve comments
Get selection/effect interaction working again

PD is awesome because it manages all layer boundaries automatically,
rather than forcing them to the size of the image like other photo
editors *cough* Paint.NET *cough*, or making the user manually enlarge
layers when they do something that lies outside layer boundaries *cough*
GIMP *cough*.  This makes PD both user-friendly and very light on RAM.

Unfortunately, it also creates some ugly programming situations.  This
commit tackles one such area.  Selections can exist anywhere on an
image, including completely outside the active layer's boundaries, which
causes a conundrum when the user tries to apply an action to the
selected area.

I've now solved the problem for final adjustment and effect actions, but
previews remain to be done.  They are even messier on account of the
dynamic scroll/zoom considerations.
Get effect previews + selections working again

With this commit, all items in the Adjustment and Effects menus should
be working 100% correctly.  If something is not working, please report
it as a bug.
Improve comments