189 lines
5.1 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevComponents;
using DevComponents.DotNetBar.Rendering;
using DevComponents.DotNetBar;
using VEPROMS.Properties;
using Volian.Base.Library;
using DescriptiveEnum;
namespace VEPROMS
{
public partial class frmSysOptions : DevComponents.DotNetBar.Office2007Form
{
bool _initializing;
public frmSysOptions()
{
_initializing = true;
InitializeComponent();
CurrentSettings();
cbPropGrid.Visible = VlnSettings.DebugMode;
btnGeneral.PerformClick();
_initializing = false;
}
/// <summary>
/// Check the proper buttons with respect to the current settings
/// </summary>
private void CurrentSettings()
{
switch (Settings.Default.PropPageStyle)
{
case 1: cbButtonIntrFace.Checked = true;
break;
case 2: cbTabbedIntrFace.Checked = true;
break;
case 3: cbPropGrid.Checked = true;
break;
}
switch (Settings.Default.SystemColor)
{
case (int)eOffice2007ColorScheme.Black:
cbRibonBlack.Checked = true;
break;
case (int)eOffice2007ColorScheme.Blue:
cbRibonBlue.Checked = true;
break;
case (int)eOffice2007ColorScheme.Silver:
cbRibonSilver.Checked = true;
break;
}
colorPickerButton1.SelectedColor = Settings.Default.TransitionRangeColor;
cbAnnotationPopup.Checked = Settings.Default.AutoPopUpAnnotations;
cbStepTypeToolTip.Checked = Settings.Default.StepTypeToolTip;
cbTVExpand.Checked = Settings.Default.SaveTreeviewExpanded;
cbPasteNoReturns.Checked = Settings.Default.PasteNoReturns;
cbPastePlainText.Checked = Settings.Default.PastePlainText;
}
private void cbPastePlainText_CheckedChanged(object sender, EventArgs e)
{
if (!_initializing)
{
Settings.Default.PastePlainText = cbPastePlainText.Checked;
}
}
private void cbPasteNoReturns_CheckedChanged(object sender, EventArgs e)
{
if (!_initializing)
{
Settings.Default.PasteNoReturns = cbPasteNoReturns.Checked;
}
}
private void cbRibonBlue_CheckedChanged(object sender, EventArgs e)
{
if (!_initializing)
{
RibbonPredefinedColorSchemes.ChangeOffice2007ColorTable(eOffice2007ColorScheme.Blue);
Settings.Default.SystemColor = (int)eOffice2007ColorScheme.Blue;
}
}
private void cbRibonSilver_CheckedChanged(object sender, EventArgs e)
{
if (!_initializing)
{
RibbonPredefinedColorSchemes.ChangeOffice2007ColorTable(eOffice2007ColorScheme.Silver);
Settings.Default.SystemColor = (int)eOffice2007ColorScheme.Silver;
}
}
private void cbRibonBlack_CheckedChanged(object sender, EventArgs e)
{
if (!_initializing)
{
RibbonPredefinedColorSchemes.ChangeOffice2007ColorTable(eOffice2007ColorScheme.Black);
Settings.Default.SystemColor = (int)eOffice2007ColorScheme.Black;
}
}
private void btnOK_Click(object sender, EventArgs e)
{
// Save Default settings for User
// Property Page style
if (cbButtonIntrFace.Checked)
Settings.Default.PropPageStyle = 1;
else if (cbTabbedIntrFace.Checked)
Settings.Default.PropPageStyle = 2;
else if (cbPropGrid.Checked)
Settings.Default.PropPageStyle = 3;
Settings.Default.Save();
this.DialogResult = DialogResult.OK;
this.Close();
}
private void btnIntrFaceStngs_Click(object sender, EventArgs e)
{
ClearAllCheckedButtons();
tcSysOpts.SelectedTab = tiIntrFaceStngs;
btnIntrFaceStngs.Checked = true;
}
private void btnStartMsg_Click(object sender, EventArgs e)
{
ClearAllCheckedButtons();
tcSysOpts.SelectedTab = tiStUpMsg;
btnStartMsg.Checked = true;
}
private void btnGeneral_Click(object sender, EventArgs e)
{
ClearAllCheckedButtons();
tcSysOpts.SelectedTab = tiGeneral;
btnGeneral.Checked = true;
}
private void ClearAllCheckedButtons()
{
btnGeneral.Checked = false;
btnStartMsg.Checked = false;
btnIntrFaceStngs.Checked = false;
}
private void btnReset_Click(object sender, EventArgs e)
{
Settings.Default.Reset();// .Reload();
CurrentSettings();
// show the resetted color scheme
RibbonPredefinedColorSchemes.ChangeOffice2007ColorTable((eOffice2007ColorScheme)Settings.Default.SystemColor);
}
private void colorPickerButton1_SelectedColorChanged(object sender, EventArgs e)
{
if (!_initializing)
{
Settings.Default.TransitionRangeColor = colorPickerButton1.SelectedColor;
}
}
private void cbAnnotationPopup_CheckedChanged(object sender, EventArgs e)
{
Settings.Default.AutoPopUpAnnotations = cbAnnotationPopup.Checked;
}
private void frmSysOptions_Load(object sender, EventArgs e)
{
ClearAllCheckedButtons();
tcSysOpts.SelectedTab = tiIntrFaceStngs;
btnIntrFaceStngs.Checked = true;
}
private void cbStepTypeToolTip_CheckedChanged(object sender, EventArgs e)
{
Settings.Default.StepTypeToolTip = cbStepTypeToolTip.Checked;
VlnSettings.StepTypeToolType = cbStepTypeToolTip.Checked;
}
private void cbTVExpand_CheckedChanged(object sender, EventArgs e)
{
Settings.Default.SaveTreeviewExpanded = cbTVExpand.Checked;
}
}
}