Changed the code that was presenting a message that the step had been deleted when the step had not been deleted.

Allow a transition to be modified.  The current code does not allow an existing transition to be modified unless you change the Step Number of the destintation.
Add a hardspace bewteen multiple returns.  This assures that blank lines will be printed.
This commit is contained in:
Rich 2015-10-20 21:12:33 +00:00
parent abe3e723ea
commit e668a71b43
3 changed files with 81 additions and 36 deletions

View File

@ -197,11 +197,23 @@ namespace Volian.Controls.Library
ContentAuditInfo cai = lbChanges.SelectedItem as ContentAuditInfo; ContentAuditInfo cai = lbChanges.SelectedItem as ContentAuditInfo;
if (cai != null) if (cai != null)
{ {
if (cai.DeleteStatus > 0 || (cai.DeleteStatus == 0 && cai.ActionWhen.Year == DateTime.MinValue.Year)) // The following line was incorrectly showing a message stating that the item was deleted when it was noot.
//if (cai.DeleteStatus > 0 || (cai.DeleteStatus == 0 && cai.ActionWhen.Year == DateTime.MinValue.Year))
if (cai.DeleteStatus > 0)
MessageBox.Show("This item has been deleted.", "Deleted Item", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); MessageBox.Show("This item has been deleted.", "Deleted Item", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
else else
{
try
{
OnHistorySelectionChanged(new DisplayHistoryEventArgs(cai.ItemID)); OnHistorySelectionChanged(new DisplayHistoryEventArgs(cai.ItemID));
} }
// If the selected item is deleted display a message rather than crashing
catch (Exception ex)
{
MessageBox.Show("This item has been deleted.", "Deleted Item", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
}
else else
{ {
AnnotationAuditInfo aai = lbChanges.SelectedItem as AnnotationAuditInfo; AnnotationAuditInfo aai = lbChanges.SelectedItem as AnnotationAuditInfo;

View File

@ -45,6 +45,36 @@ namespace Volian.Controls.Library
_SavCurItemFrom = _CurItemFrom; _SavCurItemFrom = _CurItemFrom;
_SavTranFmtIndx = _TranFmtIndx; _SavTranFmtIndx = _TranFmtIndx;
TransitionFillIn(); TransitionFillIn();
SaveSettings();
}
}
private int _II_Format;
private bool _II_PageNumber;
private bool _II_IncStepNumber;
private int _II_Procedure;
private int _II_Section;
private int _II_ItemID;
private void SaveSettings()
{
_II_Format=listBoxTranFmt.SelectedIndex;
_II_PageNumber=cbPageNum.Checked;
_II_IncStepNumber=cbIncStepNum.Checked;
_II_Procedure=cbTranProcs.SelectedIndex;
_II_Section=cbTranSects.SelectedIndex;
_II_ItemID=(tvTran.SelectedNode.Tag as ItemInfo).ItemID;
}
private bool SettingsChanged
{
get
{
if (_CurTrans == null) return true;
if (_II_Format != listBoxTranFmt.SelectedIndex) return true;
if (_II_PageNumber != cbPageNum.Checked) return true;
if (_II_IncStepNumber != cbIncStepNum.Checked) return true;
if (_II_Procedure != cbTranProcs.SelectedIndex) return true;
if (_II_Section != cbTranSects.SelectedIndex) return true;
if (_II_ItemID != (tvTran.SelectedNode.Tag as ItemInfo).ItemID) return true;
return false;
} }
} }
// use the following if user selects 'cancel' button // use the following if user selects 'cancel' button
@ -787,6 +817,7 @@ namespace Volian.Controls.Library
// tree was the selected node which was throwing off the logic for defining the _RangeNode1 // tree was the selected node which was throwing off the logic for defining the _RangeNode1
// and _RangeNode2 // and _RangeNode2
if (_DoingRange) tvTran.SelectedNode = null; if (_DoingRange) tvTran.SelectedNode = null;
SaveCancelEnabling();
} }
//private void btnUp1_Click(object sender, EventArgs e) //private void btnUp1_Click(object sender, EventArgs e)
//{ //{
@ -819,8 +850,7 @@ namespace Volian.Controls.Library
tvTran.Enabled = false; tvTran.Enabled = false;
// Set Save & Cancel enabling, depending on whether section can be an endpoint. // Set Save & Cancel enabling, depending on whether section can be an endpoint.
E_TransUI etm = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[_TranFmtIndx].TransUI; E_TransUI etm = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[_TranFmtIndx].TransUI;
bool noStepNeeded = (etm & E_TransUI.StepAllowNone) == E_TransUI.StepAllowNone; SaveCancelEnabling();
SaveCancelEnabling(noStepNeeded, secitm);
} }
else else
{ {
@ -838,6 +868,7 @@ namespace Volian.Controls.Library
if (_RangeNode1 != null || _RangeNode2 != null) _RangeNode1 = _RangeNode2 = null; if (_RangeNode1 != null || _RangeNode2 != null) _RangeNode1 = _RangeNode2 = null;
} }
_InitializingTrans = false; _InitializingTrans = false;
SaveCancelEnabling();
} }
} }
private int FindSectionStart(ItemInfo prcitm) private int FindSectionStart(ItemInfo prcitm)
@ -919,6 +950,7 @@ namespace Volian.Controls.Library
IList chldrn = prcitm.GetChildren(); IList chldrn = prcitm.GetChildren();
cbTranSectsFillIn((ItemInfo)chldrn[0], sectstartid, true); cbTranSectsFillIn((ItemInfo)chldrn[0], sectstartid, true);
btnTranSave.Enabled = true; btnTranSave.Enabled = true;
SaveCancelEnabling();
} }
private void tvTran_AfterSelect(object sender, TreeViewEventArgs e) private void tvTran_AfterSelect(object sender, TreeViewEventArgs e)
{ {
@ -931,23 +963,14 @@ namespace Volian.Controls.Library
} }
// check if node is a true end-point, i.e. not a 'part' node. If part node, don't // check if node is a true end-point, i.e. not a 'part' node. If part node, don't
// allow selection. // allow selection.
bool allowSave = false;
VETreeNode vt = tvTran.SelectedNode as VETreeNode; VETreeNode vt = tvTran.SelectedNode as VETreeNode;
ItemInfo selii = vt.VEObject as ItemInfo; ItemInfo selii = vt.VEObject as ItemInfo;
if (vt != null) if (selii == null)
{
if (selii != null) allowSave = true;
}
if (!_DoingRange)
{
SaveCancelEnabling(allowSave, selii);
return;
}
if (!allowSave)
{ {
MessageBox.Show("Must select a valid step, not a grouping part such as 'RNO', 'Steps', etc"); MessageBox.Show("Must select a valid step, not a grouping part such as 'RNO', 'Steps', etc");
return; return;
} }
SaveCancelEnabling();
if (_DoingRange) if (_DoingRange)
{ {
if (_RangeNode1 == null || (_RangeNode1 != null && _RangeNode2 != null)) if (_RangeNode1 == null || (_RangeNode1 != null && _RangeNode2 != null))
@ -972,27 +995,32 @@ namespace Volian.Controls.Library
} }
} }
} }
private void SaveCancelEnabling(bool allowSave, ItemInfo selii) private void SaveCancelEnabling()
{ {
btnTranSave.Enabled = allowSave; //bool hasChanged = _CurItemFrom != _SavCurItemFrom || _TranFmtIndx != _SavTranFmtIndx
if (CurTrans != null) // || ( selii != null && _CurTrans.ToID != selii.ItemID);
{ bool hasChanged = SettingsChanged;
if (CurTrans.ToID == selii.ItemID) btnTranSave.Enabled = hasChanged;
{ btnTranCancel.Enabled = _CurTrans != null && hasChanged;
// if the checkbox for including a page number (UseTransitionModifier flag is true) //btnTranSave.Enabled = allowSave;
// then need to check if this has been changed, and allow a save/cancel if so. //if (CurTrans != null && selii != null)
if (cbPageNum.Visible && _ModExistingPageNum != cbPageNum.Checked) //{
btnTranCancel.Enabled = btnTranSave.Enabled = true; // if (CurTrans.ToID == selii.ItemID)
else // {
btnTranCancel.Enabled = btnTranSave.Enabled = false; // // if the checkbox for including a page number (UseTransitionModifier flag is true)
} // // then need to check if this has been changed, and allow a save/cancel if so.
else // if (cbPageNum.Visible && _ModExistingPageNum != cbPageNum.Checked)
{ // btnTranCancel.Enabled = btnTranSave.Enabled = true;
btnTranCancel.Enabled = true; // else
btnTranSave.Enabled = allowSave; // btnTranCancel.Enabled = btnTranSave.Enabled = false;
} // }
} // else
else btnTranSave.Enabled = allowSave; // {
// btnTranCancel.Enabled = true;
// btnTranSave.Enabled = allowSave;
// }
//}
//else btnTranCancel.Enabled = btnTranSave.Enabled = allowSave;
} }
private void btnTranCancel_Click(object sender, EventArgs e) private void btnTranCancel_Click(object sender, EventArgs e)
{ {
@ -1255,6 +1283,7 @@ namespace Volian.Controls.Library
private void cbIncStepNum_CheckedChanged(object sender, EventArgs e) private void cbIncStepNum_CheckedChanged(object sender, EventArgs e)
{ {
tvTran.Enabled=cbIncStepNum.Checked; tvTran.Enabled=cbIncStepNum.Checked;
if (!_InitializingTrans) SaveCancelEnabling();
} }
private void cbPageNum_CheckedChanged(object sender, EventArgs e) private void cbPageNum_CheckedChanged(object sender, EventArgs e)
{ {

View File

@ -114,6 +114,10 @@ namespace Volian.Print.Library
{ {
int profileDepth = ProfileTimer.Push(">>>> VlnPrintObject.IParagraph"); int profileDepth = ProfileTimer.Push(">>>> VlnPrintObject.IParagraph");
string myRtf = Rtf; string myRtf = Rtf;
// Add a printable character (hard space) between multiple newlines
// this asssures that the blank line will be printed
if (myRtf.Contains(@"\line \line "))
myRtf= myRtf.Replace(@"\line \line ", @"\line \u160? \line ");
_IParagraph = RtfToParagraph(myRtf, HasIndent); _IParagraph = RtfToParagraph(myRtf, HasIndent);
ProfileTimer.Pop(profileDepth); ProfileTimer.Pop(profileDepth);
} }