Added ability to specify background color

Reviewed-by: Thorbjørn Lindeijer
Automapping: Removed setting the layer index

Setting the layerindex was needed once the AutomapperWrapper
used to replace layers for undo/redo functionality.
As of 1defe854c01a04f9daa60bd7adb47d8cffffb7ce
the AutomapperWrapper only patches the layerdata, so no
replacement of layers takes place, which keeps the current
index set correctly.
Added initial terrain painting tool.
Added support for line drawing.
Distant terrain transitions working now.

Also:
- Updated desert example with terrain painting data.
Added Terrain palette.
Fixed the run away terrain generation when encountering unknown tiles, added support for tile randomness factor.
Added vertex painting mode
Merge branch 'TurkeyMan/master'

Conflicts:
	src/tiled/mainwindow.cpp
Added terrain information to isometric example
Added climits include for INT_MAX

Fixes compilation error on Ubuntu Lucid.
Fixed crash when opening a map without tilesets

In particular this crash would always happen when creating a new map.
The crash was caused by TerrainBrush::mapDocumentChanged, which did not
handle the case where the new map did not have any tilesets correctly.
Fixed handling of tileset renaming by terrains dock

By adding missing slot implementation.

Also removed an unused variable.
Tweaked default dockwidget configuration

* Tabify the Terrains dock with the Tilesets dock
* Show the Layers and Tilesets docks in front by default
* Shortened "Terrain Types" to "Terrains"
* Fixed the objectName of the terrain dock, which caused it to share
  settings with the tileset dock
Fixed crash on closing a map

This is a crash introduced with
1afabff912bd959e866f084e9c65d89a9cbcf8db. We can't always call
TerrainBrush::updateBrush since it expects the current layer to be a
tile layer, which is not the case when the map is being closed (and the
brush set back to a null map).

Reviewed-by: Manu Evans
Automapping: remove beforehand check if rules are used.

D. Knuth: Premature optimisation is the root of all evil.
And he is right again.

The checks if rules are used have been done before all Automapping takes
place, but a rule can alter the situation for the following rules
drastically, so either we try to correct the checks if rules are applied
or just drop these checks.

The intention of the checking before was to speed up Automapping by only
executing the needed rules, but as the checks would take more and more
code for just being correct, it might be better to remove the speedup
things completely and have a smaller code base.

Thanks to Giancarlo Todone for spotting the bug.
Automapping: Handle non existing input layers in working map.

If there is an input layer required by the rule map, which does not
exist in the working map, the rules will not get applied, as the rules
are not met.

Before there was no check if input layers existed, so you could crash
tiled.

Thanks to Giancarlo Todone for spotting the bug.

Fixes #219
Automapping: Correct comments in sewers rules file.

Also two rules have been added, which use layers as input, which
have been generated by the rules before.
Share the line drawing code between StampBrush and TerrainBrush

I've introduced a new module called 'geometry' which now contains
rasterization of ellipse and line, as well as the 'coherent regions'
function which existed in the 'utils' module.
Merge pull request #220 from stefanbeller/multipleLayerRules

Automapping: 2 bugfixes and an updated sewers example.