// Copyright (c) 2007 Omer Rauchwerger (a.k.a rauchy) (omer@rauchy.net)
// All rights reserved.
//
// This file is part of Regionerate.
//
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License,
// or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
using System;
using System.Windows.Forms;
using Rauchy.Regionerate.Shared.Components;
namespace Rauchy.Regionerate.Presentation.Components
{
///
/// A lot of fuss has been going on in the blogosphere regarding the usage of regions, and many people seem to
/// be missing the point that Regionerate isn't neccesarily region oriented, and can be used as a code
/// arranger without any regions. The HolyWarPreventionSwitch will allow region haters to enjoy the full
/// benefits of Regionerate without any regions.
/// Choosing "AlwaysUseComments" or "SimpleOrder" will override all code layouts and ignore rendering options,
/// while "NoOverride" will keep things as is.
///
public partial class HolyWarPreventionSwitch : UserControl
{
private HolyWarPreventionMode _selection;
public HolyWarPreventionSwitch()
{
InitializeComponent();
}
public HolyWarPreventionMode Selection
{
get { return _selection; }
set
{
_selection = value;
switch (_selection)
{
case HolyWarPreventionMode.NoOverride:
NoOverride.Checked = true;
break;
case HolyWarPreventionMode.AlwaysUseComments:
AlwaysUseComments.Checked = true;
break;
case HolyWarPreventionMode.SimpleOrder:
SimpleOrder.Checked = true;
break;
default:
throw new ArgumentOutOfRangeException();
}
}
}
private void CheckBox_CheckedChanged(object sender, EventArgs e)
{
_selection = (HolyWarPreventionMode) ((RadioButton) sender).Tag;
}
}
}