Palettes:

Avoid having an invalid active index if user deletes a color.

Also attempt to set active color on clicking (Not working yet but fix
coming soon)
Palettes

* Remove some duplication in deletion code
* Fix crash when restoring file from last saved state.
Palette active color:

Use indicator color derived from color luminance for better contrast.
Fix T41708, active palette indicator not refreshing when clicking

Issue, after a lot of blood sweat and tears, was found in
ui_but_update_from_old_block, where we restore a button to its old
values when possible. The problem here is that a1 and a2 are not really
meant to store temporary variables, because they tend to get overriden
and palette selection is one of those temporary states.

Instead, we now store the position of each button in the palette in a2
and pointer to the palette in the customdata pointer of each button and
use that to test if it's active. The positions won't change when
clicking so we are guaranteed that the old button won't override the new
one with garbage.

It's still hacky but it is better than testing button types when copying
old values.
One last tweak to palette deletion code. It would correct active color
only when deleting the last color.
Fix crashes with timers.

Incorrectly accessing the menu pointer, set it to NULL before doing the
tests.

We don't restore the menu pointer because it is invalid by the time the operator ends.
Merge branch 'master' into multiview
Correct flag -> bool use
Cleanup
Builtin Stereo Camera: replace hack cameras to a real matrix approach

Note: Cycles is not working with this yet
Cycles multiview rendering

Saving out it's not working yet.