Added automatic layout adaptation following window orientation. Gray-out editor if code is incorrect.