This commit is contained in:
2010-03-25 11:28:09 +00:00
parent 06f23219cd
commit 56d5c40f8a
9 changed files with 402 additions and 58 deletions

View File

@@ -1073,6 +1073,7 @@ namespace Volian.Controls.Library
if (ans == DialogResult.Yes)
{
MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OpenItem(exTrans[0].MyContent.ContentItems[0]);
}
else
this.MyStepRTB.Focus();
@@ -1339,6 +1340,180 @@ namespace Volian.Controls.Library
return child;
}
#endregion
#region CopyPaste
public void PasteSiblingBefore(int copyStartID)
{
ItemInfo newItemInfo = MyItemInfo.PasteSiblingBefore(copyStartID);
StepItem newStepItem = null;
switch (_MyChildRelation)
{
case ChildRelation.After:
newStepItem = ActiveParent.AddChildAfter(newItemInfo, this);
break;
case ChildRelation.Before:
newStepItem = ActiveParent.AddChildBefore(newItemInfo, this);
break;
case ChildRelation.RNO:
newStepItem = ActiveParent.AddChildRNO(newItemInfo, this);
break;
default: // Need debug
break;
}
_MyStepPanel.SelectedStepRTB = newStepItem.MyStepRTB;//Update Screen
_MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OnItemPaste(this, new vlnTreeItemInfoPasteEventArgs(newItemInfo, copyStartID, ItemInfo.EAddpingPart.Before, newItemInfo.MyContent.Type));
}
public void PasteSiblingAfter(int copyStartID)
{
ItemInfo newItemInfo = MyItemInfo.PasteSiblingAfter(copyStartID);
StepItem newStepItem = null;
switch (_MyChildRelation)
{
case ChildRelation.After:
newStepItem = ActiveParent.AddChildAfter(newItemInfo, MyNextStepItem);
break;
case ChildRelation.Before:
newStepItem = ActiveParent.AddChildBefore(newItemInfo, MyNextStepItem);
break;
case ChildRelation.RNO:
newStepItem = ActiveParent.AddChildRNO(newItemInfo, MyNextStepItem);
break;
default: // Need debug
break;
}
_MyStepPanel.SelectedStepRTB = newStepItem.MyStepRTB;//Update Screen
_MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OnItemPaste(this, new vlnTreeItemInfoPasteEventArgs(newItemInfo, copyStartID, ItemInfo.EAddpingPart.After, newItemInfo.MyContent.Type));
}
public StepItem PasteReplace(int copyStartID)
{
MyStepPanel.SelectedStepRTB = null; // Unselect the item to be deleted
ChildRelation childRelation = _MyChildRelation;
StepItem newFocus = null;
StepItem nextStepItem = MyNextStepItem;
StepItem prevStepItem = MyPreviousStepItem;
StepItem parentStepItem = ActiveParent;
int TopMostYBefore = TopMostStepItem.Top;
int? TopMostParentY = (MyParentStepItem == null ? null : (int?)(MyParentStepItem.TopMostStepItem.Top));
int? ParentY = (MyParentStepItem == null ? null : (int?)(MyParentStepItem.Top));
ItemInfo newItemInfo = null;
try
{
newItemInfo = Item.PasteReplace(MyItemInfo, copyStartID);
}
catch (System.Data.SqlClient.SqlException ex)
{
HandleSqlExceptionOnDelete(ex);
return this;
}
// Remove the StepItem that was the replaced item.
RemoveFromParentsChildList();
if (MyNextStepItem != null)
{
if (MyPreviousStepItem != null)
{
MyNextStepItem.MyPreviousStepItem = MyPreviousStepItem;
MyPreviousStepItem = null;
}
else
{
MyNextStepItem.MyParentStepItem = MyParentStepItem;
MyParentStepItem = null;
MyNextStepItem.MyPreviousStepItem = null;
}
MyNextStepItem = null;
}
else if (MyPreviousStepItem != null)
{
MyPreviousStepItem.MyNextStepItem = null;
newFocus = MyPreviousStepItem;
MyPreviousStepItem = null;
}
else
{
newFocus = MyParentStepItem;
MyParentStepItem = null;
}
// add copied item to ui where the replaced item was.
StepItem newStepItem = null;
switch (childRelation)
{
case ChildRelation.After:
newStepItem = parentStepItem.AddChildAfter(newItemInfo, nextStepItem);
break;
case ChildRelation.Before:
newStepItem = parentStepItem.AddChildBefore(newItemInfo, nextStepItem);
break;
case ChildRelation.RNO:
newStepItem = parentStepItem.AddChildRNO(newItemInfo, nextStepItem);
break;
default: // Need debug
break;
}
_MyStepPanel.SelectedStepRTB = newStepItem.MyStepRTB;//Update Screen
_MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OnItemPaste(this, new vlnTreeItemInfoPasteEventArgs(newItemInfo, copyStartID, ItemInfo.EAddpingPart.Replace, newItemInfo.MyContent.Type));
return newStepItem;
}
public void HighlightBackColor()
{
// Highlight all of the rtb's within this stepitem:
if (MyAfterStepItems != null)
{
foreach (StepItem sia in MyAfterStepItems)
{
sia.MyStepRTB.HighlightBackColor();
sia.HighlightBackColor();
}
}
if (MyBeforeStepItems != null)
{
foreach (StepItem sib in MyBeforeStepItems)
{
sib.MyStepRTB.HighlightBackColor();
sib.HighlightBackColor();
}
}
if (MyRNOStepItems != null)
{
foreach (StepItem sir in MyRNOStepItems)
{
sir.MyStepRTB.HighlightBackColor();
sir.HighlightBackColor();
}
}
}
public void SetBackColor()
{
// Set (removing highlighting) all of the rtb's within this stepitem:
if (MyAfterStepItems != null)
{
foreach (StepItem sia in MyAfterStepItems)
{
sia.MyStepRTB.SetBackColor();
sia.SetBackColor();
}
}
if (MyBeforeStepItems != null)
{
foreach (StepItem sib in MyBeforeStepItems)
{
sib.MyStepRTB.SetBackColor();
sib.SetBackColor();
}
}
if (MyRNOStepItems != null)
{
foreach (StepItem sir in MyRNOStepItems)
{
sir.MyStepRTB.SetBackColor();
sir.SetBackColor();
}
}
}
#endregion
#region Event Handlers
/// <summary>
/// If the background changes, change the background of the RichTextBox