This commit is contained in:
Kathy Ruffing 2010-09-23 18:45:44 +00:00
parent f4a561c1b3
commit 6604321362
4 changed files with 65 additions and 25 deletions

View File

@ -713,7 +713,7 @@ namespace Volian.Controls.Library
if (MyRTB.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta)
outstr = outstr.Replace("^", @"\f1\u916?\f0");
outstr = ROFSTLookup.ConvertFortranFormatToScienctificNotation(outstr);
outstr = outstr.Replace("\r\n", @"\par ");
return outstr;
}

View File

@ -62,6 +62,10 @@ namespace Volian.Controls.Library
private StepItem _MyPreviousStepItem = null;
private StepItem _MyNextStepItem = null;
private bool _ChildrenLoaded = false;
public bool HasChildren
{
get {return _MyBeforeStepItems != null || _MyRNOStepItems != null || _MyAfterStepItems != null;}
}
private List<StepItem> _MyBeforeStepItems;
public List<StepItem> MyBeforeStepItems
@ -864,7 +868,6 @@ namespace Volian.Controls.Library
_Loading = false;
//// TIMING: DisplayItem.TimeIt("CSLARTB Controls Add");
}
private void SetExpandAndExpander(ItemInfo itemInfo)
{
// Don't allow substeps to expand
@ -884,7 +887,6 @@ namespace Volian.Controls.Library
break;
}
}
private void SetupHeader(ItemInfo itemInfo)
{
lblTab.Top = 3 + ((itemInfo.HasHeader) ? 23 : 0);
@ -1005,12 +1007,33 @@ namespace Volian.Controls.Library
//Console.Write("{0}: TopMostY={1}, TopMostParentY={2}, ParentY = {3}",title, TopMostY, TopMostParentY, ParentY);
Console.Write("{0}{1},{2},{3}", title, TopMostY, TopMostParentY.ToString() ?? "null", ParentY.ToString() ?? "null");
}
private bool _BeingRemoved = false;
public bool BeingRemoved
{
get { return _BeingRemoved; }
set { _BeingRemoved = value; }
}
public void RemoveItem()
{
BeingRemoved = true;
MyStepPanel.SelectedStepRTB = null; // Unselect the item to be deleted
StepItem newFocus = null;
//ShowTops("\r\n");
int TopMostYBefore = TopMostStepItem.Top;
StepItem newFocus = DeleteItem();
if (newFocus == null) return;
newFocus.MyStepRTB.Focus();
Dispose();
newFocus.SetAllTabs();
int TopMostYAfter = newFocus.TopMostStepItem.Top;
if (TopMostYAfter > TopMostYBefore)
newFocus.TopMostStepItem.Top = TopMostYBefore;
newFocus.AdjustLocation();
//newFocus.ShowTops("");
}
public StepItem DeleteItem()
{
StepItem newFocus = null;
int? TopMostParentY = (MyParentStepItem == null ? null : (int?)(MyParentStepItem.TopMostStepItem.Top));
int? ParentY = (MyParentStepItem == null ? null : (int?)(MyParentStepItem.Top));
try
@ -1020,7 +1043,7 @@ namespace Volian.Controls.Library
catch (System.Data.SqlClient.SqlException ex)
{
HandleSqlExceptionOnDelete(ex);
return;
return null;
}
// Remove StepItems
RemoveFromParentsChildList();
@ -1056,15 +1079,7 @@ namespace Volian.Controls.Library
MyParentStepItem = null;
//Console.Write(",\"Parent\",");
}
newFocus.MyStepRTB.Focus();
Dispose();
newFocus.SetAllTabs();
int TopMostYAfter = newFocus.TopMostStepItem.Top;
if (TopMostYAfter > TopMostYBefore)
newFocus.TopMostStepItem.Top = TopMostYBefore;
newFocus.AdjustLocation();
//newFocus.ShowTops("");
return;
return newFocus;
}
private void HandleSqlExceptionOnDelete(System.Data.SqlClient.SqlException ex)

View File

@ -343,13 +343,39 @@ namespace Volian.Controls.Library
{
//_SelectedStepRTB.BackColor = InactiveColor;
_SelectedStepRTB.SetBackColor();
_SelectedStepRTB.SaveText(); // Save any changes to the text
_SelectedStepRTB.SaveConfig(); // This may be redundant
//int selst = _SelectedStepRTB.SelectionStart;
_SelectedStepRTB.RTBFillIn(false);
//_SelectedStepRTB.SetSelection(selst, 0);
//_SelectedStepRTB.SelectionStart=selst;
_SelectedStepRTB.ViewRTB = true;
bool shouldDelete = !_SelectedStepRTB.MyStepItem.BeingRemoved && _SelectedStepRTB.Text.Length == 0;
if (shouldDelete)
{
if (_SelectedStepRTB.MyStepItem.HasChildren)
{
if (value != null && value.MyItemInfo.HasAncestor(_SelectedStepRTB.MyItemInfo))
{
shouldDelete = false;
}
else
{
DialogResult result = MessageBox.Show("This step does not have text but has substeps. Do you want to delete it and its substeps?", "Verify Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (result == DialogResult.No) shouldDelete = false;
}
}
}
if (shouldDelete)
{
StepItem newFocus = _SelectedStepRTB.MyStepItem.DeleteItem();
_SelectedStepRTB.MyStepItem.Dispose();
newFocus.SetAllTabs();
newFocus.AdjustLocation();
}
else
{
_SelectedStepRTB.SaveText(); // Save any changes to the text
_SelectedStepRTB.SaveConfig(); // This may be redundant
//int selst = _SelectedStepRTB.SelectionStart;
_SelectedStepRTB.RTBFillIn(false);
//_SelectedStepRTB.SetSelection(selst, 0);
//_SelectedStepRTB.SelectionStart=selst;
_SelectedStepRTB.ViewRTB = true;
}
}
_SelectedStepRTB = value;
if (value != null)

View File

@ -447,8 +447,8 @@ namespace Volian.Controls.Library
btnInsFig.Enabled = (actable & E_AccStep.AddingTable) > 0;
btnInsTable.Enabled = (actable & E_AccStep.AddingTable) > 0;
btnInsSubstep.Enabled = (actable & E_AccStep.AddingSub) > 0;
btnInsBefore.Enabled = btnInsBefH.Enabled = (actable & E_AccStep.AddingPrev) > 0;
btnInsAfter.Enabled = btnInsAftH.Enabled = (actable & E_AccStep.AddingNext) > 0;
btnInsBefore.Enabled = btnInsBefH.Enabled = !MyItemInfo.IsRNOPart && (actable & E_AccStep.AddingPrev) > 0;
btnInsAfter.Enabled = btnInsAftH.Enabled = !MyItemInfo.IsRNOPart && (actable & E_AccStep.AddingNext) > 0;
btnInsHLS.SubItems.Clear();
btnInsCaut.SubItems.Clear();
@ -510,7 +510,7 @@ namespace Volian.Controls.Library
{
ItemInfo ichld = MyItemInfo.Steps[0];
btn.Click += new System.EventHandler(btnInsStep_Click);
Volian.Base.Library.vlnStackTrace.ShowStackLocal("btn", 2, 10);
//Volian.Base.Library.vlnStackTrace.ShowStackLocal("btn", 2, 10);
btn.Tag = string.Format("{0} {1}", fromtype, ichld.MyContent.Type - 20000);
return;
}
@ -1040,7 +1040,6 @@ namespace Volian.Controls.Library
break;
}
}
public void ProcessEnterKey()
{
bool deletedEmpty = false;