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) if (MyRTB.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta)
outstr = outstr.Replace("^", @"\f1\u916?\f0"); outstr = outstr.Replace("^", @"\f1\u916?\f0");
outstr = ROFSTLookup.ConvertFortranFormatToScienctificNotation(outstr); outstr = ROFSTLookup.ConvertFortranFormatToScienctificNotation(outstr);
outstr = outstr.Replace("\r\n", @"\par ");
return outstr; return outstr;
} }

View File

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

View File

@ -343,13 +343,39 @@ namespace Volian.Controls.Library
{ {
//_SelectedStepRTB.BackColor = InactiveColor; //_SelectedStepRTB.BackColor = InactiveColor;
_SelectedStepRTB.SetBackColor(); _SelectedStepRTB.SetBackColor();
_SelectedStepRTB.SaveText(); // Save any changes to the text bool shouldDelete = !_SelectedStepRTB.MyStepItem.BeingRemoved && _SelectedStepRTB.Text.Length == 0;
_SelectedStepRTB.SaveConfig(); // This may be redundant if (shouldDelete)
//int selst = _SelectedStepRTB.SelectionStart; {
_SelectedStepRTB.RTBFillIn(false); if (_SelectedStepRTB.MyStepItem.HasChildren)
//_SelectedStepRTB.SetSelection(selst, 0); {
//_SelectedStepRTB.SelectionStart=selst; if (value != null && value.MyItemInfo.HasAncestor(_SelectedStepRTB.MyItemInfo))
_SelectedStepRTB.ViewRTB = true; {
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; _SelectedStepRTB = value;
if (value != null) if (value != null)

View File

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