Use the TreeView timer to select the newly created step when a step is added from the TreeView. This assures that it will get focus.
Changed OnChange to be called for a specific instance Don't select newly created Step if it was created from the TreeView Adjust the locations of steps properly if a caution or note is deleted Reduce repeated setup of the RTF data in a step Add an event that fires after the Step is added from the TreeView so that the newly created step can get focus
This commit is contained in:
parent
d01b27c80d
commit
5b70652cb4
@ -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;
|
||||
}
|
||||
/// <summary>
|
||||
/// Activate tmrTreeView so that the newly created Step recieves focus
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="args"></param>
|
||||
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)
|
||||
{
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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);
|
||||
|
@ -1219,21 +1219,21 @@ namespace Volian.Controls.Library
|
||||
/// </summary>
|
||||
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)
|
||||
{
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -307,6 +307,14 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
if (NodeNew != null) NodeNew(sender, args);
|
||||
}
|
||||
/// <summary>
|
||||
/// Raised after a new step is added.
|
||||
/// </summary>
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user