Revert to previous version

This commit is contained in:
Rich
2018-01-19 19:21:42 +00:00
parent 05f04b75ef
commit b1fa1603b2
8 changed files with 49 additions and 167 deletions

View File

@@ -162,8 +162,7 @@ namespace Volian.Controls.Library
_OrigGroupPanelProcs = groupPanelTransitionProcs.Style.BackColor;
_OrigGroupPanelSects = groupPanelTransitionSect.Style.BackColor;
_OrigGroupPanelSteps = groupPanelTranstionSteps.Style.BackColor;
// B2018-002 - Invalid Transitions - Get default section - side effect sets HasDefault
if (_CurItemFrom != null) FindSectionStart(_CurItemFrom.MyProcedure);
ListBoxTranFmtFillIn();
// if new, use _CurItemFrom to setup the initial selections in the controls,
@@ -215,7 +214,6 @@ namespace Volian.Controls.Library
E_TransUI etm = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[_TranFmtIndx].TransUI;
if ((etm & E_TransUI.SectDefault) == E_TransUI.SectDefault)
{
NeedsDefault = true; // B2018-002 - Invalid Transitions - if (SectDefault set in TransFormat set NeedsDefault to true
secStartId = FindSectionStart(_CurrentProcedure);
if (secStartId > -1)
{
@@ -225,10 +223,6 @@ namespace Volian.Controls.Library
else
btnTranSave.Enabled = false; // if there is an invalid section start - don't allow save.
}
else
{
NeedsDefault = false;// B2018-002 - Invalid Transitions - if (SectDefault not set in TransFormat set NeedsDefault to false
}
cbTranSectsFillIn(secitm, secitm == null ? -1 : secStartId, true);
// Fill step items, passing in the active step to the selected item, or the first
// step if the selection was not at the step level.
@@ -254,7 +248,6 @@ namespace Volian.Controls.Library
tvTran.Nodes.Clear();
}
SetControlsEnabling();
SaveCancelEnabling();// B2018-002 - Invalid Transitions - Set button enabled or disabled
}
private void tvInitHiliteRange() //bool rangeSameLevel, ItemInfo stpitm, ItemInfo rngitm, int uplevel)
{
@@ -481,12 +474,9 @@ namespace Volian.Controls.Library
listBoxTranFmt.Items.Add(new TransItem(ttl[i].TransMenu.Replace("?.",""),ttl[i].TransFormat.Replace("?.","")));
//listBoxTranFmt.Items.Add(ttl[i].TransFormat.Replace("?.",""));
listBoxTranFmt.SelectedIndex = _TranFmtIndx;
groupPanelTranFmt.Style.BackColor = (_CurTrans == null && _TranFmtIndx==0) ? Color.Yellow : Color.Orange;
E_TransUI etm = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[_TranFmtIndx].TransUI;
_DoingRange = (etm & E_TransUI.StepLast) == E_TransUI.StepLast;
// B2018-002 - Invalid Transitions - Determine if a default section is required for this format
NeedsDefault = ((etm & E_TransUI.SectDefault) == E_TransUI.SectDefault);
// B2018-002 - Invalid Transitions - Set backcolor to red if it doesn't have a default section and it Needs a Default Section
groupPanelTranFmt.Style.BackColor = !HasDefault && NeedsDefault ? Color.Red : Color.Orange;
}
private void tvTranFillIn(ItemInfo startitm)
{
@@ -605,8 +595,6 @@ namespace Volian.Controls.Library
}
// Do section combo, in 16-bit system it was types 0, 3, 4, 5
// B2018-002 - Invalid Transitions - Determine if a default section is required for this format
NeedsDefault = (etm & E_TransUI.SectDefault) == E_TransUI.SectDefault;
if (cbTranSects.Items.Count > 0 &&
( (((etm & E_TransUI.SectDefault) == E_TransUI.SectDefault &&
_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.DoSectionTransitions) ||
@@ -812,15 +800,11 @@ namespace Volian.Controls.Library
IList chldrn = _CurrentProcedure.GetChildren();
int secIdForCbSect = secitm == null ? sectstartid : secitm.ItemID;
// if this transition format requires the default section, use it:
if ((etmnew & E_TransUI.SectDefault) == E_TransUI.SectDefault)
secIdForCbSect = sectstartid;
if ((etmnew & E_TransUI.SectDefault) == E_TransUI.SectDefault) secIdForCbSect = sectstartid;
if (chldrn != null && chldrn.Count > 0) cbTranSectsFillIn((ItemInfo)chldrn[0], secIdForCbSect, true); //sectstartid);
}
// B2018-002 - Invalid Transitions - Determine if Default Section is required
NeedsDefault = ((etmnew & E_TransUI.SectDefault) == E_TransUI.SectDefault);
_TranFmtIndx = listBoxTranFmt.SelectedIndex;
// B2018-002 - Invalid Transitions - Set the backcolor to red if it doesn't have a default section and it needs one
groupPanelTranFmt.Style.BackColor = !HasDefault && NeedsDefault ? Color.Red : Color.Orange;
groupPanelTranFmt.Style.BackColor = (_CurTrans == null && _TranFmtIndx == 0) ? Color.Yellow : Color.Orange;
E_TransUI etm = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[_TranFmtIndx].TransUI;
_DoingRange = (etm & E_TransUI.StepLast) == E_TransUI.StepLast;
// get section selected and if it's a step section, fill in the treeview of steps
@@ -899,12 +883,8 @@ namespace Volian.Controls.Library
SaveCancelEnabling();
}
}
// B2018-002 - Invalid Transitions - Declare Default Section variables
private bool NeedsDefault;
private bool HasDefault;
private int FindSectionStart(ItemInfo prcitm)
{
HasDefault = true;// B2018-002 - Invalid Transitions - Initialize Has Default to true
// Steps to get the section start. continue down list until finding a valid id. If none is found
// put up a message dialog - and if returns a result of -1, caller should disable the 'ok' button
// so that a transition cannot be entered until the default section is defined:
@@ -979,8 +959,7 @@ namespace Volian.Controls.Library
}
}
// 5) Display messagebox to tell user to specify which section should be used as the 'default section'.
//MessageBox.Show("No default step section was found. Set the appropriate Step Section as the default by using the Section Property Page, Format Tab.", "Transition using Default Step Section in Format", MessageBoxButtons.OK,MessageBoxIcon.Error);
HasDefault = false;// B2018-002 - Invalid Transitions - Set Has default to false
MessageBox.Show("No default step section was found. Set the appropriate Step Section as the default by using the Section Property Page, Format Tab.", "Transition using Default Step Section in Format", MessageBoxButtons.OK,MessageBoxIcon.Error);
return -1;
}
private void cbTranProcs_SelectedIndexChanged(object sender, EventArgs e)
@@ -1053,19 +1032,8 @@ namespace Volian.Controls.Library
// || ( selii != null && _CurTrans.ToID != selii.ItemID);
bool hasChanged = SettingsChanged;
bool isenh = MyRTB != null && MyRTB.MyItemInfo != null && MyRTB.MyItemInfo.IsEnhancedStep;
// B2018-002 - Invalid Transitions - Set button enabled if it has a default section or it doesn't need a default
btnTranSave.Enabled = (HasDefault || !NeedsDefault) && !isenh && hasChanged && UserInfo.CanEdit(MyUserInfo, Mydvi); //Can Insert Transitons
btnTranSave.Enabled = !isenh && hasChanged && UserInfo.CanEdit(MyUserInfo, Mydvi); //Can Insert Transitons
btnTranCancel.Enabled = _CurTrans != null && hasChanged;
groupPanelTranFmt.Text = !HasDefault && NeedsDefault ? "Requires Default" : "Select Format";
// B2018-002 - Invalid Transitions - Set tool tip based upon HasDefault and NeedsDefault
if (!HasDefault || NeedsDefault)
this.superToolTipDispTran.SetSuperTooltip(this.listBoxTranFmt,
new DevComponents.DotNetBar.SuperTooltipInfo("Requires Default", "",
"The selected Transition Format requires a Default Section.\r\n" +
"This can be set on the format tab of the section property window.", null, null, DevComponents.DotNetBar.eTooltipColor.Yellow));
else
this.superToolTipDispTran.SetSuperTooltip(this.listBoxTranFmt, new DevComponents.DotNetBar.SuperTooltipInfo("", "", "This is where transition types are selected. This also defines how the transitio" +
"n will look in the text.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray));
//btnTranSave.Enabled = allowSave;
//if (CurTrans != null && selii != null)
//{

View File

@@ -445,8 +445,7 @@ namespace Volian.Controls.Library
EditItem lastEI = _SelectedEditItem;
if (value != null) value.SetActive(); // Set the active color
if (lastEI == value) return; // Same - No Change
// B2018-002 - Invalid Transitions - If the current step contains an invalid transition convert it to text
if(value != null) ItemInfo.ConvertInvalidTransitionsToText(value.MyItemInfo);
if (lastEI != null && lastEI.BeingDisposed == false)
{
bool shouldDelete = !lastEI.BeingRemoved && lastEI.Empty && (lastEI.MyItemInfo.MyContent.ContentEntryCount <= 0);

View File

@@ -281,12 +281,6 @@ namespace Volian.Controls.Library
{
if (args.MyLinkText.LinkInfoText.IndexOf("Transition") > -1)
{
// B2018-002 - Invalid Transitions - Don't fail on invalid transition
if(args.MyLinkText.MyTransitionInfo == null)
{
MessageBox.Show("This transition is invalid\r\n\r\nDelete it and replace it with \r\na valid transition", "Invalid Transition", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return; // Not a valid transition
}
ItemInfo item = args.MyLinkText.MyTranToItemInfo;
if (item == null || item.MyDocVersion == null || (item.PreviousID == null && item.ItemPartCount == 0 && item.ItemDocVersionCount == 0))
{

View File

@@ -3312,10 +3312,10 @@ namespace Volian.Controls.Library
private void btnTranRefresh_Click(object sender, System.EventArgs e)
{
this.Cursor = Cursors.WaitCursor;
ProcedureInfo.ResetTranCounters();
ProcedureInfo.RefreshTransitions(MyItemInfo.MyProcedure as ProcedureInfo);
this.Cursor = Cursors.Default;
// B2018-002 - Invalid Transitions - Display Transition Refresh Statistics
MessageBox.Show(this, string.Format("Checked {0} transitions, modified {1} transitions, converted to text {2} transitions", ProcedureInfo.TranCheckCount, ProcedureInfo.TranFixCount, ProcedureInfo.TranConvertCount), "Results of Refresh Transitions", MessageBoxButtons.OK, MessageBoxIcon.Information);
MessageBox.Show(this, string.Format("Checked {0} transitions, fixed {1} transitions", ProcedureInfo.TranCheckCount, ProcedureInfo.TranFixCount), "Results of Refresh Transitions", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void btnRefObjRefresh_Click(object sender, System.EventArgs e)
{