diff --git a/PROMS/VEPROMS User Interface/frmVEPROMS.cs b/PROMS/VEPROMS User Interface/frmVEPROMS.cs
index f5a2d154..e46cafb1 100644
--- a/PROMS/VEPROMS User Interface/frmVEPROMS.cs
+++ b/PROMS/VEPROMS User Interface/frmVEPROMS.cs
@@ -153,6 +153,7 @@ namespace VEPROMS
tv.OpenItem += new vlnTreeViewItemInfoEvent(tv_OpenItem);
tv.DeleteItemInfo += new vlnTreeViewItemInfoDeleteEvent(tv_DeleteItemInfo);
tv.InsertItemInfo += new vlnTreeViewItemInfoInsertEvent(tv_InsertItemInfo);
+ tv.NodeInsert += new vlnTreeViewEvent(tv_NodeInsert);
tv.PasteItemInfo += new vlnTreeViewItemInfoPasteEvent(tv_PasteItemInfo);
tc.ItemPaste += new StepPanelItemPastedEvent(tc_ItemPasted);
_CommentTitleBckColor = epAnnotations.TitleStyle.BackColor1.Color;
@@ -168,6 +169,15 @@ namespace VEPROMS
this.Activated += new EventHandler(frmVEPROMS_Activated);
VlnSettings.StepTypeToolType = Settings.Default.StepTypeToolTip;
}
+ ///
+ /// Activate tmrTreeView so that the newly created Step recieves focus
+ ///
+ ///
+ ///
+ void tv_NodeInsert(object sender, vlnTreeEventArgs args)
+ {
+ tmrTreeView.Enabled = true;
+ }
void frmVEPROMS_Activated(object sender, EventArgs e)
{
// refresh anything that pertains to external files or programs:
@@ -194,9 +204,9 @@ namespace VEPROMS
}
bool tv_InsertItemInfo(object sender, vlnTreeItemInfoInsertEventArgs args)
{
- return tc.InsertStepItem(args.MyItemInfo, args.StepText, args.InsertType, args.FromType, args.Type);
+ // Don't select the newly created Step. This will be handled by tmrTreeView
+ return tc.InsertStepItem(args.MyItemInfo, args.StepText, args.InsertType, args.FromType, args.Type, false);
}
-
private bool tv_DeleteItemInfo(object sender, vlnTreeItemInfoEventArgs args)
{
return tc.DeleteStepItem(args.MyItemInfo);
@@ -345,7 +355,8 @@ namespace VEPROMS
DisplayTabItem tabItem = tc.GetProcDisplayTabItem(mySection);
if(tabItem != null)tabItem.MyStepTabPanel.MyStepPanel.Reset();
}
- SetupNodes((VETreeNode)args.Node);
+ // Don't select the newly created Step. This will be handled by tmrTreeView
+ //SetupNodes((VETreeNode)args.Node);
}
private void tv_NodeSelect(object sender, vlnTreeEventArgs args)
{
diff --git a/PROMS/VEPROMS.CSLA.Library/Generated/ContentInfo.cs b/PROMS/VEPROMS.CSLA.Library/Generated/ContentInfo.cs
index 35e3924a..5517185e 100644
--- a/PROMS/VEPROMS.CSLA.Library/Generated/ContentInfo.cs
+++ b/PROMS/VEPROMS.CSLA.Library/Generated/ContentInfo.cs
@@ -31,16 +31,7 @@ namespace VEPROMS.CSLA.Library
private void OnChange(ContentInfo contentInfo)
{
if (Changed != null)
- {
- //if (ContentItems[0].ItemID == 54)
- //Console.WriteLine("OnChange: ItemID = {0}, Unique = {1}", ContentItems[0].ItemID, ContentItems[0].MyItemInfoUnique);
- //Console.WriteLine("'Tab Bug','OnChange','{0}',{1},{2},{3},{4}", ContentItems[0].Path, ContentItems[0].ItemID, ContentItems[0].MyItemInfoUnique,
- //ContentID,MyContentInfoUnique);
Changed(this);
- }
- //else
- //Console.WriteLine("'Tab Bug','OnChange NoChange','{0}',{1},{2},{3},{4}", ContentItems[0].Path, ContentItems[0].ItemID, ContentItems[0].MyItemInfoUnique,
- //ContentID, MyContentInfoUnique);
}
private void OnChange()
{
@@ -553,7 +544,7 @@ namespace VEPROMS.CSLA.Library
// _MyZContent = null;// Reset related value
// }
_ContentZContentCount = -1;// Reset Count
- OnChange();// raise an event
+ OnChange(this);// raise an event only for this instance
}
public static void Refresh(FormatContent tmp)
{
@@ -598,7 +589,7 @@ namespace VEPROMS.CSLA.Library
// _MyZContent = null;// Reset related value
// }
_ContentZContentCount = -1;// Reset Count
- OnChange();// raise an event
+ OnChange(this);// raise an event only for this instance
}
public static ContentInfo Get(int contentID)
{
diff --git a/PROMS/Volian.Controls.Library/DisplayTabControl.cs b/PROMS/Volian.Controls.Library/DisplayTabControl.cs
index 1ef912ca..8c41c077 100644
--- a/PROMS/Volian.Controls.Library/DisplayTabControl.cs
+++ b/PROMS/Volian.Controls.Library/DisplayTabControl.cs
@@ -363,7 +363,7 @@ namespace Volian.Controls.Library
}
return false;
}
- public bool InsertStepItem(ItemInfo myItemInfo, string text, E_InsertType insertType, E_FromType fromType, int type)
+ public bool InsertStepItem(ItemInfo myItemInfo, string text, E_InsertType insertType, E_FromType fromType, int type,bool updateSelection)
{
CleanUpClosedItems();
ItemInfo proc = myItemInfo.MyProcedure; // Find procedure Item
@@ -378,10 +378,10 @@ namespace Volian.Controls.Library
switch (insertType)
{
case E_InsertType.Before:
- stpitm.AddSiblingBefore(text);
+ stpitm.AddSiblingBefore(text,updateSelection);
break;
case E_InsertType.After:
- stpitm.AddSiblingAfter(text);
+ stpitm.AddSiblingAfter(text,updateSelection);
break;
case E_InsertType.Child:
stpitm.AddChild(text, fromType, type);
diff --git a/PROMS/Volian.Controls.Library/StepItem.cs b/PROMS/Volian.Controls.Library/StepItem.cs
index c28e650f..39766ea2 100644
--- a/PROMS/Volian.Controls.Library/StepItem.cs
+++ b/PROMS/Volian.Controls.Library/StepItem.cs
@@ -1219,21 +1219,21 @@ namespace Volian.Controls.Library
///
public void AddSiblingAfter()
{
- AddSiblingAfter("");
+ AddSiblingAfter("",true);
}
- public void AddSiblingAfter(string text)
+ public void AddSiblingAfter(string text,bool updateStatus)
{
MyStepRTB.SaveText();
ItemInfo newItemInfo = MyItemInfo.InsertSiblingAfter(text);
- DoAddSiblingAfter(newItemInfo);
+ DoAddSiblingAfter(newItemInfo, updateStatus);
}
- public void AddSiblingAfter(int? type)
+ public void AddSiblingAfter(int? type, bool updateStatus)
{
MyStepRTB.SaveText();
ItemInfo newItemInfo = MyItemInfo.InsertSiblingAfter("","",type);
- DoAddSiblingAfter(newItemInfo);
+ DoAddSiblingAfter(newItemInfo,updateStatus);
}
- private void DoAddSiblingAfter(ItemInfo newItemInfo)
+ private void DoAddSiblingAfter(ItemInfo newItemInfo, bool updateStatus)
{
StepItem newStepItem = null;
switch (_MyChildRelation)
@@ -1251,14 +1251,15 @@ namespace Volian.Controls.Library
break;
}
//StepItem newStepItem = ActiveParent.AddChildAfter(newItemInfo, );
- _MyStepPanel.SelectedStepRTB = newStepItem.MyStepRTB;//Update Screen
+ if(updateStatus)
+ _MyStepPanel.SelectedStepRTB = newStepItem.MyStepRTB;//Update Screen
}
private static int _WatchThis = 1;
public void AddSiblingBefore()
{
- AddSiblingBefore("");
+ AddSiblingBefore("",true);
}
- public void AddSiblingBefore(string text)
+ public void AddSiblingBefore(string text, bool updateSelection)
{
// Save RTB text before creating a new item because the process of creating
// a new item will save a change to iteminfo excluding text changes. This
@@ -1283,7 +1284,8 @@ namespace Volian.Controls.Library
default: // Need debug
break;
}
- _MyStepPanel.SelectedStepRTB = newStepItem.MyStepRTB;//Update Screen
+ if(updateSelection)
+ _MyStepPanel.SelectedStepRTB = newStepItem.MyStepRTB;//Update Screen
}
public void AddChild(E_FromType fromType, int type)
{
diff --git a/PROMS/Volian.Controls.Library/StepPanel.cs b/PROMS/Volian.Controls.Library/StepPanel.cs
index 2ee7f5bc..549dd075 100644
--- a/PROMS/Volian.Controls.Library/StepPanel.cs
+++ b/PROMS/Volian.Controls.Library/StepPanel.cs
@@ -363,10 +363,35 @@ namespace Volian.Controls.Library
}
if (shouldDelete)
{
+ float oldTop = lastRTB.MyStepItem.Top;
StepItem newFocus = lastRTB.MyStepItem.DeleteItem();
+ float newTop = newFocus.Top;
lastRTB.MyStepItem.Dispose();
newFocus.SetAllTabs();
- newFocus.AdjustLocation();
+ // If the step being deleted appears above the step to recieve focus, find another step
+ // to use so that the steps are positioned properly (vertically)
+ if (oldTop < newTop)
+ {
+ if (newFocus.MyParentStepItem != null)
+ {
+ if (newFocus.Top > newFocus.MyParentStepItem.Top)
+ newFocus.MyParentStepItem.AdjustLocation();
+ else if (newFocus.MyParentStepItem.MyPreviousStepItem != null &&
+ newFocus.Top > newFocus.MyParentStepItem.MyPreviousStepItem.Top)
+ newFocus.MyParentStepItem.MyPreviousStepItem.AdjustLocation();
+ else if (newFocus.MyParentStepItem.MyParentStepItem != null &&
+ newFocus.Top > newFocus.MyParentStepItem.MyParentStepItem.Top)
+ newFocus.MyParentStepItem.MyParentStepItem.AdjustLocation();
+ else
+ newFocus.AdjustLocation();
+ }
+ else if (newFocus.MyPreviousStepItem != null)
+ newFocus.MyPreviousStepItem.AdjustLocation();
+ else
+ newFocus.AdjustLocation();
+ }
+ else
+ newFocus.AdjustLocation();
}
else
{
diff --git a/PROMS/Volian.Controls.Library/StepRTB.cs b/PROMS/Volian.Controls.Library/StepRTB.cs
index 855d8cd5..e991055f 100644
--- a/PROMS/Volian.Controls.Library/StepRTB.cs
+++ b/PROMS/Volian.Controls.Library/StepRTB.cs
@@ -714,17 +714,25 @@ namespace Volian.Controls.Library
}
#endregion
#region AddRtfTextAndStyles
+ private string _LastRtf = "";
private void AddRtfText(string txt)
{
+ //Console.WriteLine("ItemID:{0}", MyItemInfo.ItemID);
+ //if(MyItemInfo.ItemID==10256)
+ // Volian.Base.Library.vlnStackTrace.ShowStackLocal("ItemID:{0}", MyItemInfo.ItemID.ToString());
StringBuilder selectedRtfSB = new StringBuilder();
AddFontTable(selectedRtfSB);
_RtfPrefix = selectedRtfSB.ToString();
selectedRtfSB.Append(txt);
- string newRTF = selectedRtfSB.ToString() + "}";
- SelectAll();
- if (SelectedRtf != newRTF)
- SelectedRtf = newRTF;
- //SelectedRtf = selectedRtfSB.ToString() + "}";
+ string newRtf = selectedRtfSB.ToString() + "}";
+ if(newRtf != _LastRtf)
+ {
+ //Console.WriteLine("ItemID:{0}\r\nOld:'{1}'\r\nNew:'{2}'\r\n", MyItemInfo.ItemID, Rtf, newRtf);
+ this.ContentsResized -=new ContentsResizedEventHandler(StepRTB_ContentsResized);
+ Text = "";
+ this.ContentsResized += new ContentsResizedEventHandler(StepRTB_ContentsResized);
+ SelectedRtf = _LastRtf = newRtf;
+ }
FindAllLinks();
}
private void AddFontTable(StringBuilder selectedRtfSB)
diff --git a/PROMS/Volian.Controls.Library/StepTabRibbon.cs b/PROMS/Volian.Controls.Library/StepTabRibbon.cs
index a77672f5..e2f73f45 100644
--- a/PROMS/Volian.Controls.Library/StepTabRibbon.cs
+++ b/PROMS/Volian.Controls.Library/StepTabRibbon.cs
@@ -238,7 +238,7 @@ namespace Volian.Controls.Library
StepItem hlsStepItem = _MyStepItem;
while (!hlsStepItem.MyItemInfo.IsHigh)
hlsStepItem = hlsStepItem.ActiveParent;
- hlsStepItem.AddSiblingAfter((int ?)contenttype);
+ hlsStepItem.AddSiblingAfter((int ?)contenttype,true);
}
else
{
diff --git a/PROMS/Volian.Controls.Library/vlnTreeView.cs b/PROMS/Volian.Controls.Library/vlnTreeView.cs
index faa968e7..b6298d51 100644
--- a/PROMS/Volian.Controls.Library/vlnTreeView.cs
+++ b/PROMS/Volian.Controls.Library/vlnTreeView.cs
@@ -307,6 +307,14 @@ namespace Volian.Controls.Library
{
if (NodeNew != null) NodeNew(sender, args);
}
+ ///
+ /// Raised after a new step is added.
+ ///
+ public event vlnTreeViewEvent NodeInsert;
+ private void OnNodeInsert(object sender, vlnTreeEventArgs args)
+ {
+ if (NodeInsert != null) NodeInsert(sender, args);
+ }
public event vlnTreeViewEvent NodeSelectionChange;
private void OnNodeSelectionChange(object sender, vlnTreeEventArgs args)
{
@@ -969,6 +977,7 @@ namespace Volian.Controls.Library
SelectedNode = tn;
OnNodeNew(this, new vlnTreeEventArgs(SelectedNode));
Refresh();
+ OnNodeInsert(this, new vlnTreeEventArgs(SelectedNode));
}
}