Fixed Flatten Layer and Merge Down actions for layer with layer styles
Also fixed a few of other bus. Now merging strategy is the following:
For Flatten Layer:
- If a layer doesn't have layer styles, its blending mode and channel flags are kept untouched while the flattening process.
- If a layer has a style applied, then all the composition options are reset and the layer is converted into Normal-mode layer.
For Merge Down:
- If the two layers has the same opacity, blend mode, channel flags and have no layer styles, then the resulting layer inherits all their blend options.
- If the condition above isn't true, then the two layers are blended into a new layer with default blending options (Normal, 100% opacity).
Implement "Merge Selected Layers" correctly.