Adaptive shape control of wavefront-preserving X-ray mirrors with active cooling and heating