"Merge visible layers" now implemented

More nuances to this than I expected, as you can have cases where the
number of visible (and by extension, hidden layers) extends from 0 to
numOfLayers, in any conceivable pattern.

This function required new helper functions for counting visible/hidden
layers, and those allowed me to knock out more "menu state synching"
issues, e.g. only allow "Merge Visible Layers" if there is more than one
layer visible.
"Delete hidden layers" now implemented

Also, a number of fixes and edge-cases added to the menu enable/disable
system.
"Raise layer to top" and "Lower layer to bottom" now implemented