Handle Range Transitions for Invalid Transitions
Add a prefix to transitions converted to text which were invalid Add counters for invalid transitions converted to text. Added a method to convert invalid transitions to text Cleanup debug Changed the panel so that it only requires a default section if the default is not set and it is required Fix invalid transitions when a step is activated. Don't fail when you open a step with an invalid transition. Display Transition Refresh Statistics
This commit is contained in:
@@ -162,7 +162,8 @@ 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,
|
||||
@@ -214,6 +215,7 @@ 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)
|
||||
{
|
||||
@@ -223,6 +225,10 @@ 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.
|
||||
@@ -248,6 +254,7 @@ 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)
|
||||
{
|
||||
@@ -474,9 +481,12 @@ 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)
|
||||
{
|
||||
@@ -595,6 +605,8 @@ 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) ||
|
||||
@@ -800,11 +812,15 @@ 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;
|
||||
groupPanelTranFmt.Style.BackColor = (_CurTrans == null && _TranFmtIndx == 0) ? Color.Yellow : Color.Orange;
|
||||
// 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;
|
||||
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
|
||||
@@ -883,8 +899,12 @@ 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:
|
||||
@@ -959,7 +979,8 @@ 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);
|
||||
//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
|
||||
return -1;
|
||||
}
|
||||
private void cbTranProcs_SelectedIndexChanged(object sender, EventArgs e)
|
||||
@@ -1032,8 +1053,19 @@ namespace Volian.Controls.Library
|
||||
// || ( selii != null && _CurTrans.ToID != selii.ItemID);
|
||||
bool hasChanged = SettingsChanged;
|
||||
bool isenh = MyRTB != null && MyRTB.MyItemInfo != null && MyRTB.MyItemInfo.IsEnhancedStep;
|
||||
btnTranSave.Enabled = !isenh && hasChanged && UserInfo.CanEdit(MyUserInfo, Mydvi); //Can Insert Transitons
|
||||
// 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
|
||||
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)
|
||||
//{
|
||||
|
Reference in New Issue
Block a user