Fix T38860: Video preview in VSE shows a distorted and jagged appearance at scale 1:1

Issue was cauzed by the set zoom ratio optator which didn't really set pixel zoom to 1:1.
RNA: clamp colors min to 0.0

any colors which need to be negative can explicitly pass in a range.
Fix T39537: Multi button editing is unreliable
Fix T39546: blender crash on open recent file, when tracking is still in progress
Fix T39378: Revert, Recover Last Session and Load Factory Settings have no prompt.

Now they do, to make it harder to accidentally press them and lose work.

Reviewed By: brecht, carter2422

Differential Revision: https://developer.blender.org/D440
Image and clip editor: change zoom step to end up at powers of two.

When you press zoom 3 times you will now get 2:1, 4:1, 8:1, etc. Fixes T36916.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D409
Make matcaps suck less

This commit does various changes for matcaps:

One is taking advantage of drawing with pbvh (which would only happen
with dyntopo previously) and drawing with partial redraw during
sculpting.

The second one is support for masks. To make this work in the special
case of multires, which uses flat shading, I use the only available flat
shaded builtins in OpenGL 2.0 which are color and secondary color.

Abusing colors in that way is also essential for flat shading to work if
we are to use pbvh draw in multires, since it is the color that is being
interpolated flatly, not the normal (which can only interpolated
smoothly). The pbvh drawing code for multires used last triangle
element's normal to compute the shading which would only produce smooth
results. This could change if we did the shading in the vertex shader
for flat shaded primitives, but this is more complex and makes it harder
to have one shader to rule the mole.

Also increased the brightness of the default diffuse color for
sculpting. This should be useful since artists like to tweak the
lighting settings and it will give them the full dynamic range of the
lights, but also it helps with correct brightness of sculpted matcaps.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D435
Revert 7955cb78d it causes GPU_pbvh_buffers_diffuse_changed to always
return false, causing update of all pbvh nodes all the time.
Fix T39550: polygons.active has bad default
Sculpt: the thread controls where unintentianlly greyed out along with capabilities.has_gravity condition
Fix some redrawing and possibly other issues in dyntopo:

When node face gets deleted, added or exchanged, the nodes should update
their draw buffers, normals and bounding boxes. This was not being done
before so there were graphical glitches apparent, especially in collapse
mode.
Fix bpy.so linking on Mac OS X

D345 from Aleksandr Derbenev
Fix for building with MSVC2008
Dyntopo: Delete OpenGL buffers of nodes that do not have any more
triangles.

It is possible to end up with such nodes using brushes in aggressive
collapse mode. Those nodes should normally be cleaned up, since they can
never be actually reused (adding more geometry to a node requires the
node having some geometry to begin with) but until we support dynamic
nodes, better delete those to avoid binding graphics driver resources.

If such zero elements buffers were used, GL error out of memory would be
reported.
Code cleanup: use uint64_t for BLI_rand
Fix for BLI_rng_shuffle_array noted by mont29
Code cleanup: avoid redundant lookups for subwindows
UI: support for dragging popups title area
Fix T39545: "Track selected markers", does not stop at end of video

Issue was cauzed by some weird clamping of current frame. Not sure
why it was here at the first point -- it's from the day0 of movie
clip datablock.
Fix T39547: Toggling render passes on active scene does not update
render layer nodes in a pinned tree from different scene.

The way these updates work is a nasty legacy hack:
https://developer.blender.org/diffusion/B/browse/master/source/blender/nodes/composite/node_composite_tree.c$277

This function is called //very frequently// by the get_from_context
method. However, this does not get called for pinned node trees, so
when showing a different scene's compositing nodes in the editor they
may not get updated correctly.

Now moved this update call out of get_from_context so it happens in any
case. Will be called no more frequently than before (on every redraw).
Eventually the depsgraph should handle this more precisely, it's just a
simple ID dependency anyway ...