debugged and fixed many issues in the property pages

This commit is contained in:
2010-06-04 19:23:22 +00:00
parent 19a58f7409
commit d0c1b9d2b2
11 changed files with 1795 additions and 1074 deletions

View File

@@ -18,6 +18,11 @@ namespace VEPROMS
{
public partial class frmFolderProperties : DevComponents.DotNetBar.Office2007Form
{
private bool _Initializing = false;
private FolderConfig _FolderConfig;
private bool _IsVepromsNode = false;
private bool _IsDefaultSettingNode = false;
private string _DefaultFormatName = null;
private string _DefaultChgBarType = null;
private string _DefaultChgBarLoc = null;
@@ -31,8 +36,6 @@ namespace VEPROMS
private string _DefaultWatermark = null;
private bool _DefaultDisableDuplex = false;
private string _DefaultFormatColumns = null;
private bool _Initializing = false;
private FolderConfig _FolderConfig;
//private string _ROcolor;
//private string _TransColor;
//private string _EditBckgndColor;
@@ -41,12 +44,21 @@ namespace VEPROMS
public frmFolderProperties(FolderConfig folderConfig)
{
_FolderConfig = folderConfig;
_IsVepromsNode = !folderConfig.HasParent; // top tree node does not have a parent
if (!_IsVepromsNode)
_IsDefaultSettingNode = _FolderConfig.MyFolder.MyParent.MyParent == null;
_Initializing = true;
InitializeComponent();
btnGeneral.PerformClick(); // always start with General tab or button
_Initializing = false;
// Build window caption
this.Text = string.Format("{0} Properties",folderConfig.Name);
if (_IsDefaultSettingNode)
{
// Change these labels for the first node after the VE-PROMS node.
ppLblDefSettingsInfo.Text = "* Default VE-PROMS settings are shown in italics";
ppCbShwDefSettings.Text = "Show Default VE-PROMS Settings";
}
}
/// <summary>
@@ -136,7 +148,11 @@ namespace VEPROMS
// Get the saved settings for this user
//
// This setting tells us if we should display the default values on this property page
ppCbShwDefSettings.Checked = (Settings.Default["ShowDefaultFolderProp"] != null)? Settings.Default.ShowDefaultFolderProp : false;
//ppCbShwDefSettings.Checked = (Settings.Default["ShowDefaultFolderProp"] != null)? Settings.Default.ShowDefaultFolderProp : false;
if (_IsVepromsNode || Settings.Default["ShowDefaultFolderProp"] == null)
ppCbShwDefSettings.Checked = false;
else
ppCbShwDefSettings.Checked = Settings.Default.ShowDefaultFolderProp;
// Get the User's property page style "PropPageStyle" (this is a system wide user setting)
// 1 - Button Dialog (default)
@@ -154,7 +170,7 @@ namespace VEPROMS
// Setup as to which "tabs" to display on the property page
// - the first (top) tree node shows different "tabs" than the
// other folder type of tree nodes
if (!_FolderConfig.HasParent)
if (_IsVepromsNode) //(!_FolderConfig.HasParent)
{
// if we are at the top node of the tree, remove the Folder Property page tabs
// that do not pertain to this level (top of tree)
@@ -175,9 +191,9 @@ namespace VEPROMS
// Also, for the referenced object tab, the top node (veproms system level) should
// allow setting of the default graphics file extension. No other folder level allows this.
ppCmbxGrphFileExt.Visible = true;
ppLblGrphFileExtDefault.Visible = true;
ppLblGrphFileExtDefault.Visible = false; // true;
lblGrphFileExt.Visible = true;
ppBtnDefaultGrphFileExt.Visible = true;
ppBtnDefaultGrphFileExt.Visible = false; // true;
}
else
{
@@ -326,6 +342,7 @@ namespace VEPROMS
if (_DefaultROGraficFileExtension.Equals(_FolderConfig.Graphics_defaultext))
_FolderConfig.Graphics_defaultext = _DefaultROGraficFileExtension;// this will force a database update (write)
ppCmbxGrphFileExt.SelectedIndex = -1; //reset to the default Graphic File Extension setting
//tcpRefObjs.Focus();
}
/// <summary>
@@ -381,7 +398,7 @@ namespace VEPROMS
/// <param name="e">EventArgs</param>
private void ppCmbxPagination_SelectedValueChanged(object sender, EventArgs e)
{
if (!_Initializing)
if (!_Initializing || !_IsDefaultSettingNode)
{
FolderConfig.PrintPagination pgtn = (FolderConfig.PrintPagination)Enum.Parse(typeof(FolderConfig.PrintPagination), _DefaultPagination);
ProcessCmbxSelectionEnumChanged(ppCmbxPagination, pgtn, ppBtnDefPagination, ppLblPaginationDefault);
@@ -397,12 +414,14 @@ namespace VEPROMS
/// <param name="e"></param>
private void ppBtnDefPagination_Click(object sender, EventArgs e)
{
Console.WriteLine("ppBtnDefPagination_Click");
// Get the parent setting
FolderConfig.PrintPagination pgtn = (FolderConfig.PrintPagination)Enum.Parse(typeof(FolderConfig.PrintPagination), _DefaultPagination);
// Compare parent setting with current setting
if (pgtn != _FolderConfig.Print_Pagination)
_FolderConfig.Print_Pagination = pgtn; // this will force a database update (write)
ppCmbxPagination.SelectedIndex = -1; //reset to the default Pagination setting
//tcpOutputSettings.Focus();
}
/// <summary>
@@ -434,6 +453,7 @@ namespace VEPROMS
if (wtr != _FolderConfig.Print_Watermark)
_FolderConfig.Print_Watermark = wtr; // this will force a database update (write)
ppCmbxWatermark.SelectedIndex = -1; //reset to the default Watermark setting
//tcpOutputSettings.Focus();
}
/// <summary>
@@ -445,6 +465,7 @@ namespace VEPROMS
{
if (!_Initializing)
{
_FolderConfig.Print_DisableDuplex = ppChbxDisAutoDuplex.Checked;
ppBtnDeftDisAutoDuplx.Visible = (!_FolderConfig.Name.Equals("VEPROMS")) && (_DefaultDisableDuplex != ppChbxDisAutoDuplex.Checked);
ppLblAutoDuplexDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDeftDisAutoDuplx.Visible;
}
@@ -485,13 +506,14 @@ namespace VEPROMS
/// <param name="e">EventArgs</param>
private void ppCmbxFormat_SelectedValueChanged(object sender, EventArgs e)
{
//if (!_Initializing)
if (!_Initializing)
ProcessCmbxSelectedValueChange(ppCmbxFormat, _DefaultFormatName, ppBtnDefaultFmt, ppLblFormatDefault);
}
private void ppBtnDefaultFmt_Click(object sender, EventArgs e)
{
ppCmbxFormat.SelectedIndex = -1; //reset to the default Format setting
//tcpFmtSettings.Focus();
}
/// <summary>
@@ -500,13 +522,18 @@ namespace VEPROMS
/// </summary>
private void setEnabledUserSpecifiedChgBarCombos(FolderConfig.PrintChangeBar pcb)
{
ppGpbxUserSpecCB.Enabled =
ppCmbxChgBarPos.Enabled =
ppCmbxChgBarTxtType.Enabled =
ppBtnDefaultCbPos.Enabled =
ppBtnDefCbTxtTyp.Enabled = (ppCmbxChangeBarType.SelectedValue != null &&
ppCmbxChangeBarType.SelectedValue.Equals(FolderConfig.PrintChangeBar.WithUserSpecified)) ||
(ppCmbxChangeBarType.SelectedValue == null && pcb.Equals(FolderConfig.PrintChangeBar.WithUserSpecified));
//ppGpbxUserSpecCB.Enabled =
//ppCmbxChgBarPos.Enabled =
//ppCmbxChgBarTxtType.Enabled =
//ppBtnDefaultCbPos.Enabled =
//ppBtnDefCbTxtTyp.Enabled = (ppCmbxChangeBarType.SelectedValue != null &&
//ppCmbxChangeBarType.SelectedValue.Equals(FolderConfig.PrintChangeBar.WithUserSpecified)) ||
//(ppCmbxChangeBarType.SelectedValue == null && pcb.Equals(FolderConfig.PrintChangeBar.WithUserSpecified));
ppGpbxUserSpecCB.Enabled = (ppCmbxChangeBarType.SelectedValue != null &&
ppCmbxChangeBarType.SelectedValue.Equals(FolderConfig.PrintChangeBar.WithUserSpecified)) ||
(ppCmbxChangeBarType.SelectedValue == null && pcb.Equals(FolderConfig.PrintChangeBar.WithUserSpecified));
}
/// <summary>
@@ -533,13 +560,16 @@ namespace VEPROMS
/// <param name="e"></param>
private void ppBtnDefaultChgBar_Click(object sender, EventArgs e)
{
// Get the parent setting
FolderConfig.PrintChangeBar pcb = (FolderConfig.PrintChangeBar)Enum.Parse(typeof(FolderConfig.PrintChangeBar), _DefaultChgBarType);
// Compare parent setting with current setting
if (pcb!= _FolderConfig.Print_ChangeBar)
_FolderConfig.Print_ChangeBar = pcb; // this will force a database update (write)
ppCmbxChangeBarType.SelectedIndex = -1; //reset combo box to the default Change Bar setting
}
// Get the parent setting
FolderConfig.PrintChangeBar pcb = (FolderConfig.PrintChangeBar)Enum.Parse(typeof(FolderConfig.PrintChangeBar), _DefaultChgBarType);
// Compare parent setting with current setting
_Initializing = true;
if (pcb != _FolderConfig.Print_ChangeBar)
_FolderConfig.Print_ChangeBar = pcb; // this will force a database update (write)
ppCmbxChangeBarType.SelectedIndex = -1; //reset combo box to the default Change Bar setting
_Initializing = false;
//tcpFmtSettings.Focus();
}
/// <summary>
/// Selection in Change Bar Position combo box changed.
@@ -562,7 +592,7 @@ namespace VEPROMS
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ppCmbxChgBarPos_Click(object sender, EventArgs e)
private void ppBtnDefaultCbPos_Click(object sender, EventArgs e)
{
// Get the parent setting
FolderConfig.PrintChangeBarLoc cbl = (FolderConfig.PrintChangeBarLoc)Enum.Parse(typeof(FolderConfig.PrintChangeBarLoc), _DefaultChgBarLoc);
@@ -570,6 +600,7 @@ namespace VEPROMS
if (cbl != _FolderConfig.Print_ChangeBarLoc)
_FolderConfig.Print_ChangeBarLoc = cbl; // this will force a database update (write)
ppCmbxChgBarPos.SelectedIndex = -1; //reset to the default Change Bar Position setting
//tcpFmtSettings.Focus();
}
/// <summary>
@@ -584,6 +615,7 @@ namespace VEPROMS
FolderConfig.PrintChangeBarText cbt = (FolderConfig.PrintChangeBarText)Enum.Parse(typeof(FolderConfig.PrintChangeBarText), _DefaultChgBarText);
ProcessCmbxSelectionEnumChanged(ppCmbxChgBarTxtType, cbt, ppBtnDefCbTxtTyp, ppLblChgBarTxtTypeDefault);
setEnabledUserSpecifiedChgBarText();
//tcpFmtSettings.Focus();
}
}
@@ -602,6 +634,7 @@ namespace VEPROMS
if (cbt != _FolderConfig.Print_ChangeBarText)
_FolderConfig.Print_ChangeBarText = cbt; // this will force a database update (write)
ppCmbxChgBarTxtType.SelectedIndex = -1; //reset to the default Change Bar Text Type setting
//tcpFmtSettings.Focus();
}
/// <summary>
@@ -610,12 +643,19 @@ namespace VEPROMS
/// </summary>
private void setEnabledUserSpecifiedChgBarText()
{
ppGpbxUserSpecTxt.Enabled =
ppTxbxChangeBarUserMsgOne.Enabled =
ppTxbxChgBarUserMsgTwo.Enabled =
ppBtnDefCbTxt1.Enabled =
ppBtnDefCbTxt2.Enabled = (ppCmbxChgBarTxtType.SelectedValue != null &&
ppCmbxChgBarTxtType.SelectedValue.Equals(FolderConfig.PrintChangeBarText.UserDef));
//ppGpbxUserSpecTxt.Enabled =
//ppTxbxChangeBarUserMsgOne.Enabled =
//ppTxbxChgBarUserMsgTwo.Enabled =
//ppBtnDefCbTxt1.Enabled =
//ppBtnDefCbTxt2.Enabled = (ppCmbxChgBarTxtType.SelectedValue != null &&
//ppCmbxChgBarTxtType.SelectedValue.Equals(FolderConfig.PrintChangeBarText.UserDef));
// This string is used to check against our default setting to see if User Defined Changebar Text is active
string decUserDef = DocVersionConfig.PrintChangeBarText.UserDef.ToString();
ppGpbxUserSpecTxt.Enabled = (ppCmbxChgBarTxtType.SelectedValue != null &&
ppCmbxChgBarTxtType.SelectedValue.Equals(FolderConfig.PrintChangeBarText.UserDef)) ||
(ppCmbxChgBarTxtType.SelectedIndex == -1 && _DefaultChgBarText.Equals(decUserDef));
}
/// <summary>
@@ -625,8 +665,10 @@ namespace VEPROMS
/// <param name="e">EventArgs</param>
private void ppTxbxChangeBarUserMsgOne_TextChanged(object sender, EventArgs e)
{
if (!_Initializing)
ppBtnDefCbTxt1.Visible = (!_FolderConfig.Name.Equals("VEPROMS")) && (ppTxbxChangeBarUserMsgOne.Text != null);
//ppBtnDefCbTxt1.Visible = (!_FolderConfig.Name.Equals("VEPROMS")) &&
// ((ppTxbxChangeBarUserMsgOne.Text != null) && !ppTxbxChangeBarUserMsgOne.Text.Equals(_DefaultChgBarUsrMsg1));
ppBtnDefCbTxt1.Visible = ((ppTxbxChangeBarUserMsgOne.Text != null) && !ppTxbxChangeBarUserMsgOne.Text.Equals(_DefaultChgBarUsrMsg1));
ppLblChgBarUserMsgOneDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefCbTxt1.Visible;
}
/// <summary>
@@ -636,8 +678,10 @@ namespace VEPROMS
/// <param name="e">EventArgs</param>
private void ppTxbxChangeBarUserMsgTwo_TextChanged(object sender, EventArgs e)
{
if (!_Initializing)
ppBtnDefCbTxt2.Visible = (!_FolderConfig.Name.Equals("VEPROMS")) && (ppTxbxChgBarUserMsgTwo.Text != null);
//ppBtnDefCbTxt2.Visible = (!_FolderConfig.Name.Equals("VEPROMS")) &&
// ((ppTxbxChgBarUserMsgTwo.Text != null) && !ppTxbxChgBarUserMsgTwo.Text.Equals(_DefaultChgBarUsrMsg2));
ppBtnDefCbTxt2.Visible = ((ppTxbxChgBarUserMsgTwo.Text != null) && !ppTxbxChgBarUserMsgTwo.Text.Equals(_DefaultChgBarUsrMsg2));
ppLblChgBarUserMsgTwoDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefCbTxt2.Visible;
}
#endregion
@@ -839,6 +883,7 @@ namespace VEPROMS
if (fcl != _FolderConfig.Format_Columns)
_FolderConfig.Format_Columns = fcl; // this will force a database update (write)
ppCmbxStpEditorCols.SelectedIndex = -1; //reset to the default Step Editor Columns setting
//tcpEdSettings.Focus();
}
#endregion
@@ -902,8 +947,9 @@ namespace VEPROMS
{
if (defaultText != null && !(defaultText.Equals("")))
{
lbl.Text = string.Format("({0})", defaultText);
cmbo.WatermarkText = string.Format("{0}", defaultText);
string deftext = string.Format("{0}", defaultText);
lbl.Text = deftext;
cmbo.WatermarkText = deftext;
}
}
@@ -912,13 +958,14 @@ namespace VEPROMS
/// </summary>
private void defaultSettingsVisiblity()
{
ppLblChgBarUserMsgOneDefault.Visible =
ppLblChgBarUserMsgTwoDefault.Visible =
ppLblDefSettingsInfo.Visible = ppCbShwDefSettings.Checked;
ppLblChgBarUserMsgOneDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefCbTxt1.Visible;
ppLblChgBarUserMsgTwoDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefCbTxt2.Visible;
ppLblAutoDuplexDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDeftDisAutoDuplx.Visible;
ppLblStpEditorColsDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefEdCols.Visible;
ppLblGrphFileExtDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefaultGrphFileExt.Visible;
ppLblGrphFileExtDefault.Visible = (ppCbShwDefSettings.Checked || _IsVepromsNode) && ppBtnDefaultGrphFileExt.Visible;
ppLblWatermarkDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefWatermark.Visible;
ppLblPaginationDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefPagination.Visible;
ppLblChgBarTxtTypeDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefCbTxtTyp.Visible;
@@ -942,7 +989,7 @@ namespace VEPROMS
button.PerformClick();
}
button.Visible = (cmbx.SelectedValue != null);//(!_FolderConfig.Name.Equals("VEPROMS")) && (cmbx.SelectedValue != null);
deflabel.Visible = ppCbShwDefSettings.Checked && button.Visible;
deflabel.Visible = (ppCbShwDefSettings.Checked || _IsVepromsNode) && button.Visible;
}
/// <summary>
@@ -954,13 +1001,18 @@ namespace VEPROMS
/// <param name="deflabel">label containing the default</param>
private void ProcessCmbxSelectionEnumChanged(ComboBoxEx cmbx, object enumval, ButtonX button, Label deflabel)
{
if ((cmbx.SelectedIndex != -1) &&
if ((cmbx.SelectedIndex != -1) &&
cmbx.SelectedValue.Equals(enumval))
{
_Initializing = true;
button.Visible = true;
button.Focus();
button.PerformClick();
cmbx.SelectedIndex = -1; // This will hide the Default button
_Initializing = false;
}
button.Visible = ((!_FolderConfig.Name.Equals("VEPROMS")) && (cmbx.SelectedValue != null));
//button.Visible = ((!_FolderConfig.Name.Equals("VEPROMS")) && (cmbx.SelectedValue != null));
button.Visible = (!_IsVepromsNode && (cmbx.SelectedValue != null)&&(cmbx.SelectedIndex >= 0));
deflabel.Visible = ppCbShwDefSettings.Checked && button.Visible;
}
@@ -972,9 +1024,7 @@ namespace VEPROMS
private void ProcessButtonClick(TabItem tab, ButtonX button)
{
ClearAllCheckedButtons();
_Initializing = true;
tcFolder.SelectedTab = tab;
_Initializing = false;
button.Checked = true;
}
@@ -1004,11 +1054,48 @@ namespace VEPROMS
private void tabpage_Enter(object sender, EventArgs e)
{
// Show or hide the labels containing the default values
if (!_Initializing)
//if (!_Initializing)
defaultSettingsVisiblity();
}
}
#endregion
private void ppBtnDefCbTxt1_Click(object sender, EventArgs e)
{
// Compare default setting with current setting
// Reset with the default and hide the default button and label
if (_DefaultChgBarUsrMsg1 != _FolderConfig.Print_UserCBMess1)
{
//_Initializing = true;
_FolderConfig.Print_UserCBMess1 = _DefaultChgBarUsrMsg1; // this will force a database update (write)
ppLblChgBarUserMsgOneDefault.Visible = false;
ppBtnDefCbTxt1.Visible = false;
//tcpFmtSettings.Focus();
//_Initializing = false;
}
}
private void ppBtnDefCbTxt2_Click(object sender, EventArgs e)
{
// Compare default setting with current setting
// Reset with the default and hide the default button and label
if (_DefaultChgBarUsrMsg2 != _FolderConfig.Print_UserCBMess2)
{
_FolderConfig.Print_UserCBMess2 = _DefaultChgBarUsrMsg2; // this will force a database update (write)
ppLblChgBarUserMsgTwoDefault.Visible = false;
ppBtnDefCbTxt2.Visible = false;
//tcpFmtSettings.Focus();
}
}
private void ppBtnDeftDisAutoDuplx_Click(object sender, EventArgs e)
{
ppChbxDisAutoDuplex.Checked = _DefaultDisableDuplex;
_FolderConfig.Print_DisableDuplex = ppChbxDisAutoDuplex.Checked;
ppBtnDeftDisAutoDuplx.Visible = false;
ppLblAutoDuplexDefault.Visible = false;
//tcpOutputSettings.Focus();
}
}