Add calibration support.

No gui yet.
Make calibration dialog working.

Calibration values are made persistent as well.