This commit is contained in:
parent
06f23219cd
commit
56d5c40f8a
@ -1073,6 +1073,7 @@ namespace Volian.Controls.Library
|
|||||||
if (ans == DialogResult.Yes)
|
if (ans == DialogResult.Yes)
|
||||||
{
|
{
|
||||||
MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OpenItem(exTrans[0].MyContent.ContentItems[0]);
|
MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OpenItem(exTrans[0].MyContent.ContentItems[0]);
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
this.MyStepRTB.Focus();
|
this.MyStepRTB.Focus();
|
||||||
@ -1339,6 +1340,180 @@ namespace Volian.Controls.Library
|
|||||||
return child;
|
return child;
|
||||||
}
|
}
|
||||||
#endregion
|
#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
|
#region Event Handlers
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// If the background changes, change the background of the RichTextBox
|
/// If the background changes, change the background of the RichTextBox
|
||||||
|
@ -135,6 +135,12 @@ namespace Volian.Controls.Library
|
|||||||
{
|
{
|
||||||
WordSectionDeleted(sender, args);
|
WordSectionDeleted(sender, args);
|
||||||
}
|
}
|
||||||
|
// if item pasted, have event to flag in other UI panels
|
||||||
|
public event StepPanelItemPastedEvent ItemPasted;
|
||||||
|
internal void OnItemPasted(object sender, vlnTreeItemInfoPasteEventArgs args)
|
||||||
|
{
|
||||||
|
ItemPasted(sender, args);
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Link Events
|
#region Link Events
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -684,11 +690,11 @@ namespace Volian.Controls.Library
|
|||||||
{
|
{
|
||||||
// if on RNO, check display mode (1 column/2 column, etc) and how deep RNO is before going to
|
// if on RNO, check display mode (1 column/2 column, etc) and how deep RNO is before going to
|
||||||
// parents substeps.
|
// parents substeps.
|
||||||
if (ii.IsRNO && ii.MyParent.Steps != null && ii.RNOLevel >= ii.ColumnMode) return BottomPart(ii.MyParent.Steps[0].LastSibling);
|
if (ii.IsRNOPart && ii.MyParent.Steps != null && ii.RNOLevel >= ii.ColumnMode) return BottomPart(ii.MyParent.Steps[0].LastSibling);
|
||||||
|
|
||||||
// If on top note and parent has cautions - go to bottom caution
|
// If on top note and parent has cautions - go to bottom caution
|
||||||
if (ii.IsNoteStructure && ii.MyParent != null && ii.MyParent.Cautions != null) return BottomPart(ii.MyParent.Cautions[0].LastSibling);
|
if (ii.IsFirstNotePart && ii.MyParent != null && ii.MyParent.Cautions != null) return BottomPart(ii.MyParent.Cautions[0].LastSibling);
|
||||||
if (ii.IsCautionStructure || ii.IsNoteStructure)
|
if (ii.IsFirstCautionPart || ii.IsFirstNotePart)
|
||||||
{
|
{
|
||||||
if (ii.MyParent.MyPrevious != null) return BottomPart(ii.MyParent.MyPrevious);
|
if (ii.MyParent.MyPrevious != null) return BottomPart(ii.MyParent.MyPrevious);
|
||||||
return ii.MyParent.MyParent;
|
return ii.MyParent.MyParent;
|
||||||
@ -728,9 +734,9 @@ namespace Volian.Controls.Library
|
|||||||
// TODO: RHM - NextItems was not null when it should have been after delete of a note below a caution
|
// TODO: RHM - NextItems was not null when it should have been after delete of a note below a caution
|
||||||
if (ii.NextItems != null && ii.NextItemCount > 0) return TopPart(ii.NextItems[0]);
|
if (ii.NextItems != null && ii.NextItemCount > 0) return TopPart(ii.NextItems[0]);
|
||||||
// If on caution, if parent has note - go to note
|
// If on caution, if parent has note - go to note
|
||||||
if (ii.IsCautionStructureFirstSib && ii.MyParent.Notes != null) return ii.MyParent.Notes[0];
|
if (ii.IsCautionPart && ii.MyParent.Notes != null) return ii.MyParent.Notes[0];
|
||||||
// If on caution, if parent !has note or if on note go to parent
|
// If on caution, if parent !has note or if on note go to parent
|
||||||
if ((ii.IsCautionStructureFirstSib && ii.MyParent.Notes == null) || ii.IsNoteStructureFirstSib) return ii.MyParent;
|
if ((ii.IsCautionPart && ii.MyParent.Notes == null) || ii.IsNotePart) return ii.MyParent;
|
||||||
// Recursively call with parent until at procedure
|
// Recursively call with parent until at procedure
|
||||||
if (!ii.IsProcedure) return (ArrowDown(ii.MyParent, false, ii.MyParent.RNOLevel==ii.RNOLevel));
|
if (!ii.IsProcedure) return (ArrowDown(ii.MyParent, false, ii.MyParent.RNOLevel==ii.RNOLevel));
|
||||||
}
|
}
|
||||||
@ -1041,4 +1047,5 @@ namespace Volian.Controls.Library
|
|||||||
public delegate void StepPanelTabDisplayEvent(object sender, StepPanelTabDisplayEventArgs args);
|
public delegate void StepPanelTabDisplayEvent(object sender, StepPanelTabDisplayEventArgs args);
|
||||||
public delegate void StepPanelWordSectionCloseEvent(object sender, WordSectionEventArgs args);
|
public delegate void StepPanelWordSectionCloseEvent(object sender, WordSectionEventArgs args);
|
||||||
public delegate void StepPanelWordSectionDeletedEvent(object sender, WordSectionEventArgs args);
|
public delegate void StepPanelWordSectionDeletedEvent(object sender, WordSectionEventArgs args);
|
||||||
|
public delegate void StepPanelItemPastedEvent(object sender, vlnTreeItemInfoPasteEventArgs args);
|
||||||
}
|
}
|
||||||
|
@ -173,6 +173,12 @@ namespace Volian.Controls.Library
|
|||||||
if (MyStepItem == null || MyStepItem.MyStepPanel == null) return;
|
if (MyStepItem == null || MyStepItem.MyStepPanel == null) return;
|
||||||
BackColor = _MyItemInfo.ItemAnnotationCount == 0 ? MyStepItem.MyStepPanel.InactiveColor : Color.FromArgb(255, 255, 128);
|
BackColor = _MyItemInfo.ItemAnnotationCount == 0 ? MyStepItem.MyStepPanel.InactiveColor : Color.FromArgb(255, 255, 128);
|
||||||
}
|
}
|
||||||
|
public void HighlightBackColor()
|
||||||
|
{
|
||||||
|
// Don't try to highlight if this rtb is used on property pages.
|
||||||
|
if (MyStepItem == null || MyStepItem.MyStepPanel == null) return;
|
||||||
|
BackColor = Color.Gray;
|
||||||
|
}
|
||||||
private string _origRTF;
|
private string _origRTF;
|
||||||
public void RTBFillIn(bool edit)
|
public void RTBFillIn(bool edit)
|
||||||
{
|
{
|
||||||
@ -1590,6 +1596,18 @@ namespace Volian.Controls.Library
|
|||||||
// comment on _OverWrite
|
// comment on _OverWrite
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
break;
|
break;
|
||||||
|
case Keys.F5:
|
||||||
|
if (e.Shift)
|
||||||
|
{
|
||||||
|
e.Handled = true;
|
||||||
|
this.MyStepItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ShortCutContextMenu("StepPaste");
|
||||||
|
}
|
||||||
|
else if (!e.Control && !e.Alt)
|
||||||
|
{
|
||||||
|
e.Handled = true;
|
||||||
|
this.MyStepItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.DoCopyStep();
|
||||||
|
}
|
||||||
|
break;
|
||||||
case Keys.F6:
|
case Keys.F6:
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
SendKeys.Send("%H{ESC}");
|
SendKeys.Send("%H{ESC}");
|
||||||
|
@ -142,6 +142,7 @@ namespace Volian.Controls.Library
|
|||||||
_MyStepPanel.TabDisplay += new Volian.Controls.Library.StepPanelTabDisplayEvent(_MyStepPanel_TabDisplay);
|
_MyStepPanel.TabDisplay += new Volian.Controls.Library.StepPanelTabDisplayEvent(_MyStepPanel_TabDisplay);
|
||||||
_MyStepPanel.WordSectionClose += new StepPanelWordSectionCloseEvent(_MyStepPanel_WordSectionClose);
|
_MyStepPanel.WordSectionClose += new StepPanelWordSectionCloseEvent(_MyStepPanel_WordSectionClose);
|
||||||
_MyStepPanel.WordSectionDeleted += new StepPanelWordSectionDeletedEvent(_MyStepPanel_WordSectionDeleted);
|
_MyStepPanel.WordSectionDeleted += new StepPanelWordSectionDeletedEvent(_MyStepPanel_WordSectionDeleted);
|
||||||
|
_MyStepPanel.ItemPasted += new StepPanelItemPastedEvent(_MyStepPanel_ItemPasted);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -278,6 +279,10 @@ namespace Volian.Controls.Library
|
|||||||
{
|
{
|
||||||
_MyDisplayTabControl.OnWordSectionDeleted(sender, args);
|
_MyDisplayTabControl.OnWordSectionDeleted(sender, args);
|
||||||
}
|
}
|
||||||
|
void _MyStepPanel_ItemPasted(object sender, vlnTreeItemInfoPasteEventArgs args)
|
||||||
|
{
|
||||||
|
_MyDisplayTabControl.OnItemPaste(sender, args);
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -277,6 +277,7 @@ namespace Volian.Controls.Library
|
|||||||
btnCMRedo.Enabled = btnRedo.Enabled = setting;
|
btnCMRedo.Enabled = btnRedo.Enabled = setting;
|
||||||
btnCMPaste.Enabled = btnPaste.Enabled = setting;
|
btnCMPaste.Enabled = btnPaste.Enabled = setting;
|
||||||
btnCMCopy.Enabled = btnCopy.Enabled = setting;
|
btnCMCopy.Enabled = btnCopy.Enabled = setting;
|
||||||
|
btnPasteAfter.Enabled = btnPasteBefore.Enabled = btnStepPaste.Enabled = btnPasteReplace.Enabled = setting;
|
||||||
}
|
}
|
||||||
private void SetButtonMenuEnabledDisabledOnStepType(bool setting)
|
private void SetButtonMenuEnabledDisabledOnStepType(bool setting)
|
||||||
{
|
{
|
||||||
@ -328,6 +329,9 @@ namespace Volian.Controls.Library
|
|||||||
// all selected copy while in either Edit or View mode
|
// all selected copy while in either Edit or View mode
|
||||||
btnCMCopy.Enabled = btnCopy.Enabled = _MyStepRTB.SelectionLength > 0;
|
btnCMCopy.Enabled = btnCopy.Enabled = _MyStepRTB.SelectionLength > 0;
|
||||||
|
|
||||||
|
// paste step only available if a step was copied. Also, check for valid types:
|
||||||
|
SetPasteButtonEnabled();
|
||||||
|
|
||||||
// do all Transition and ReferencedObject menu items/buttons based on whether a 'link is selected' and the link type.
|
// do all Transition and ReferencedObject menu items/buttons based on whether a 'link is selected' and the link type.
|
||||||
btnCMGoTo.Enabled = btnGoTo.Enabled = _MyStepRTB.IsSelectionLinked(_MyStepRTB.SelectionStart, _MyStepRTB.SelectionLength); //(_MyStepRTB.MyLinkText != null);
|
btnCMGoTo.Enabled = btnGoTo.Enabled = _MyStepRTB.IsSelectionLinked(_MyStepRTB.SelectionStart, _MyStepRTB.SelectionLength); //(_MyStepRTB.MyLinkText != null);
|
||||||
if (btnCMGoTo.Enabled == true && _MyStepRTB.MyLinkText != null) // must have some link test, use it to set edit of transition or ro...
|
if (btnCMGoTo.Enabled == true && _MyStepRTB.MyLinkText != null) // must have some link test, use it to set edit of transition or ro...
|
||||||
@ -342,6 +346,37 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
// OLD: SetStepButtonAndMenuEnabling(docontextmenus);
|
// OLD: SetStepButtonAndMenuEnabling(docontextmenus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SetPasteButtonEnabled()
|
||||||
|
{
|
||||||
|
// if there is no 'copied' step, or if a procedure is copied, just turn all buttons off, this can only
|
||||||
|
// be done from the tree.
|
||||||
|
StepTabPanel tmp = Parent as StepTabPanel;
|
||||||
|
if (tmp.MyDisplayTabControl.MyCopyStep == null || tmp.MyDisplayTabControl.MyCopyStep.IsProcedurePart)
|
||||||
|
{
|
||||||
|
btnPasteReplace.Enabled = btnPasteBefore.Enabled = btnPasteAfter.Enabled = btnStepPaste.Enabled = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// If a section is copied, it can be pasted as a section (before/after/replace). If can also
|
||||||
|
// be pasted as a subsection if the format allows it.
|
||||||
|
if (tmp.MyDisplayTabControl.MyCopyStep.IsSectionPart)
|
||||||
|
{
|
||||||
|
btnPasteBefore.Enabled = btnPasteAfter.Enabled = btnPasteReplace.Enabled = MyItemInfo.IsSectionPart;
|
||||||
|
// when doing 'substep' part of paste, need to check if format allows subsection.
|
||||||
|
}
|
||||||
|
else if (tmp.MyDisplayTabControl.MyCopyStep.IsCautionPart || tmp.MyDisplayTabControl.MyCopyStep.IsNotePart)
|
||||||
|
// Part type of copied step must be same as Part type of destination, with exceptions of caution/note and step/rno
|
||||||
|
// can be pasted into each other.
|
||||||
|
// Part types are procedure - 1, section = 2, step = 6, caution = 3, note = 4, RNO (IsRNO), = 5 table/figure = 7.
|
||||||
|
btnPasteBefore.Enabled = btnPasteAfter.Enabled = btnPasteReplace.Enabled = (MyItemInfo.IsCautionPart || MyItemInfo.IsNotePart);
|
||||||
|
else if (tmp.MyDisplayTabControl.MyCopyStep.IsRNOPart || tmp.MyDisplayTabControl.MyCopyStep.IsStepPart)
|
||||||
|
btnPasteBefore.Enabled = btnPasteAfter.Enabled = btnPasteReplace.Enabled = (MyItemInfo.IsRNOPart || MyItemInfo.IsStepPart);
|
||||||
|
else
|
||||||
|
btnPasteBefore.Enabled = btnPasteAfter.Enabled = btnPasteReplace.Enabled = tmp.MyDisplayTabControl.MyCopyStep.IsTablePart == MyItemInfo.IsTablePart;
|
||||||
|
|
||||||
|
// Can't replace step with same step
|
||||||
|
if (tmp.MyDisplayTabControl.MyCopyStep.ItemID == MyItemInfo.ItemID) btnPasteReplace.Enabled = false;
|
||||||
|
}
|
||||||
private void SetStepButtonAndMenuEnabling(bool docontextmenus)
|
private void SetStepButtonAndMenuEnabling(bool docontextmenus)
|
||||||
{
|
{
|
||||||
if (MyStepItem == null) return;
|
if (MyStepItem == null) return;
|
||||||
@ -365,6 +400,7 @@ namespace Volian.Controls.Library
|
|||||||
btnEditMode.Checked = btnCMEditMode1.Checked = MyStepItem.MyStepPanel.PanelViewEditMode != E_ViewMode.View;
|
btnEditMode.Checked = btnCMEditMode1.Checked = MyStepItem.MyStepPanel.PanelViewEditMode != E_ViewMode.View;
|
||||||
// if on procedure, 'Delete' buttons should be disabled.
|
// if on procedure, 'Delete' buttons should be disabled.
|
||||||
btnDelelete.Enabled = btnDelStep.Enabled = ! MyItemInfo.IsProcedure;
|
btnDelelete.Enabled = btnDelStep.Enabled = ! MyItemInfo.IsProcedure;
|
||||||
|
btnCpyStp.Enabled = !MyItemInfo.IsProcedure;
|
||||||
// if on procedure or section, 'change type' & 'insert' buttons should be disabled.
|
// if on procedure or section, 'change type' & 'insert' buttons should be disabled.
|
||||||
if (MyItemInfo.IsProcedure || MyItemInfo.IsSection)
|
if (MyItemInfo.IsProcedure || MyItemInfo.IsSection)
|
||||||
{
|
{
|
||||||
@ -569,6 +605,7 @@ namespace Volian.Controls.Library
|
|||||||
{
|
{
|
||||||
Clipboard.Clear();
|
Clipboard.Clear();
|
||||||
DataObject myDO = new DataObject("Rich Text Format", _MyStepRTB.SelectedRtf);
|
DataObject myDO = new DataObject("Rich Text Format", _MyStepRTB.SelectedRtf);
|
||||||
|
myDO.SetText(_MyStepRTB.SelectedText);
|
||||||
Clipboard.SetDataObject(myDO);
|
Clipboard.SetDataObject(myDO);
|
||||||
_MyStepRTB.SelectedText = "";
|
_MyStepRTB.SelectedText = "";
|
||||||
}
|
}
|
||||||
@ -576,6 +613,7 @@ namespace Volian.Controls.Library
|
|||||||
{
|
{
|
||||||
Clipboard.Clear();
|
Clipboard.Clear();
|
||||||
DataObject myDO = new DataObject("Rich Text Format", _MyStepRTB.SelectedRtf);
|
DataObject myDO = new DataObject("Rich Text Format", _MyStepRTB.SelectedRtf);
|
||||||
|
myDO.SetText(_MyStepRTB.SelectedText);
|
||||||
Clipboard.SetDataObject(myDO);
|
Clipboard.SetDataObject(myDO);
|
||||||
}
|
}
|
||||||
private void btnBold_Click(object sender, EventArgs e)
|
private void btnBold_Click(object sender, EventArgs e)
|
||||||
@ -878,8 +916,11 @@ namespace Volian.Controls.Library
|
|||||||
bool displayMenu = false;
|
bool displayMenu = false;
|
||||||
E_AccStep? actable = 0;
|
E_AccStep? actable = 0;
|
||||||
StepData sd = MyItemInfo.FormatStepData;
|
StepData sd = MyItemInfo.FormatStepData;
|
||||||
actable = sd.StepEditData.AcTable;
|
if (sd != null) // will be null if section
|
||||||
if (actable == null) actable = 0;
|
{
|
||||||
|
actable = sd.StepEditData.AcTable;
|
||||||
|
if (actable == null) actable = 0;
|
||||||
|
}
|
||||||
//btnInsCaut.Enabled = (actable & E_AccStep.AddingCaution) > 0;
|
//btnInsCaut.Enabled = (actable & E_AccStep.AddingCaution) > 0;
|
||||||
switch (menuName)
|
switch (menuName)
|
||||||
{
|
{
|
||||||
@ -911,6 +952,10 @@ namespace Volian.Controls.Library
|
|||||||
displayMenu = (actable & E_AccStep.AddingTable) > 0;
|
displayMenu = (actable & E_AccStep.AddingTable) > 0;
|
||||||
_ContextMenuBar.SetContextMenuEx(_MyStepRTB, btnCMInsFigure);
|
_ContextMenuBar.SetContextMenuEx(_MyStepRTB, btnCMInsFigure);
|
||||||
break;
|
break;
|
||||||
|
case "StepPaste":
|
||||||
|
displayMenu = true;
|
||||||
|
_ContextMenuBar.SetContextMenuEx(_MyStepRTB, btnCMStepPaste);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (displayMenu)
|
if (displayMenu)
|
||||||
{
|
{
|
||||||
@ -960,8 +1005,8 @@ namespace Volian.Controls.Library
|
|||||||
{
|
{
|
||||||
deletedEmpty = true;
|
deletedEmpty = true;
|
||||||
deletedHLS = MyItemInfo.IsHigh;
|
deletedHLS = MyItemInfo.IsHigh;
|
||||||
deletedSubStep = MyItemInfo.IsSubStep;
|
deletedSubStep = MyItemInfo.IsStepPart;
|
||||||
deletedRNO = MyItemInfo.IsRNO;
|
deletedRNO = MyItemInfo.IsRNOPart;
|
||||||
deletedNote = MyItemInfo.IsNote;
|
deletedNote = MyItemInfo.IsNote;
|
||||||
deletedCaution = MyItemInfo.IsCaution;
|
deletedCaution = MyItemInfo.IsCaution;
|
||||||
|
|
||||||
@ -990,7 +1035,7 @@ namespace Volian.Controls.Library
|
|||||||
CreateNewRNO();
|
CreateNewRNO();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (MyItemInfo.IsRNO)
|
else if (MyItemInfo.IsRNOPart)
|
||||||
{
|
{
|
||||||
MyStepRTB.StepRTB_ArrowPressed(E_ArrowKeys.CtrlLeft);
|
MyStepRTB.StepRTB_ArrowPressed(E_ArrowKeys.CtrlLeft);
|
||||||
if (MyItemInfo.IsHigh)
|
if (MyItemInfo.IsHigh)
|
||||||
@ -1006,7 +1051,7 @@ namespace Volian.Controls.Library
|
|||||||
else
|
else
|
||||||
InsertSiblingBeforeOrAfter("after");
|
InsertSiblingBeforeOrAfter("after");
|
||||||
}
|
}
|
||||||
else if (MyItemInfo.IsInRNO && MyItemInfo.IsSubStep)
|
else if (MyItemInfo.IsInRNO && MyItemInfo.IsStepPart)
|
||||||
{
|
{
|
||||||
if (deletedEmpty)
|
if (deletedEmpty)
|
||||||
{
|
{
|
||||||
@ -1016,7 +1061,7 @@ namespace Volian.Controls.Library
|
|||||||
else
|
else
|
||||||
InsertSiblingBeforeOrAfter("after");
|
InsertSiblingBeforeOrAfter("after");
|
||||||
}
|
}
|
||||||
else if (MyItemInfo.IsSubStep)
|
else if (MyItemInfo.IsStepPart)
|
||||||
{
|
{
|
||||||
if (deletedSubStep)
|
if (deletedSubStep)
|
||||||
{
|
{
|
||||||
@ -1073,6 +1118,48 @@ namespace Volian.Controls.Library
|
|||||||
else
|
else
|
||||||
btnInsNote.RaiseClick();
|
btnInsNote.RaiseClick();
|
||||||
}
|
}
|
||||||
|
private void btnPasteAfter_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
StepTabPanel tmp = Parent as StepTabPanel;
|
||||||
|
MyStepItem.PasteSiblingAfter(tmp.MyDisplayTabControl.MyCopyStep.ItemID);
|
||||||
|
}
|
||||||
|
private void btnPasteBefore_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
StepTabPanel tmp = Parent as StepTabPanel;
|
||||||
|
MyStepItem.PasteSiblingBefore(tmp.MyDisplayTabControl.MyCopyStep.ItemID);
|
||||||
|
}
|
||||||
|
private void btnStepPaste_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
// just return
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnCpyStp_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
DoCopyStep();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DoCopyStep()
|
||||||
|
{
|
||||||
|
// highlight selected step(s) and prompt to see if selection is what user wants:
|
||||||
|
MyStepItem.HighlightBackColor();
|
||||||
|
DialogResult dr = MessageBox.Show("Step as Marked?", "Identify Step To Be Copied", MessageBoxButtons.YesNo);
|
||||||
|
if (dr == DialogResult.Yes)
|
||||||
|
{
|
||||||
|
StepTabPanel tmp = Parent as StepTabPanel;
|
||||||
|
tmp.MyDisplayTabControl.MyCopyStep = MyItemInfo;
|
||||||
|
btnStepPaste.Enabled = true;
|
||||||
|
SetPasteButtonEnabled();
|
||||||
|
}
|
||||||
|
MyStepItem.SetBackColor();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnPasteReplace_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
StepTabPanel tmp = Parent as StepTabPanel;
|
||||||
|
StepItem oldStepItem = MyStepItem;
|
||||||
|
MyStepItem = MyStepItem.PasteReplace(tmp.MyDisplayTabControl.MyCopyStep.ItemID);
|
||||||
|
if (MyStepItem.MyItemInfo.ItemID != oldStepItem.MyItemInfo.ItemID) oldStepItem.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum E_FieldToEdit { StepText, Text, Number };
|
public enum E_FieldToEdit { StepText, Text, Number };
|
||||||
|
BIN
PROMS/Volian.Controls.Library/StepTabRibbon.designer.cs
generated
BIN
PROMS/Volian.Controls.Library/StepTabRibbon.designer.cs
generated
Binary file not shown.
@ -117,6 +117,9 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
|
<metadata name="superTooltipRibbon.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>17, 17</value>
|
||||||
|
</metadata>
|
||||||
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||||
<data name="btnCut.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
<data name="btnCut.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
<value>
|
<value>
|
||||||
@ -130,9 +133,6 @@
|
|||||||
2CVVWYKhQwAAAABJRU5ErkJggg==
|
2CVVWYKhQwAAAABJRU5ErkJggg==
|
||||||
</value>
|
</value>
|
||||||
</data>
|
</data>
|
||||||
<metadata name="superTooltipRibbon.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
|
||||||
<value>17, 17</value>
|
|
||||||
</metadata>
|
|
||||||
<data name="btnInsRO.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
<data name="btnInsRO.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
<value>
|
<value>
|
||||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||||
@ -142,9 +142,6 @@
|
|||||||
hNwGBmaHAP5n4G8q6gFdoZLjBpE7j5KJdaRlAAAAAElFTkSuQmCC
|
hNwGBmaHAP5n4G8q6gFdoZLjBpE7j5KJdaRlAAAAAElFTkSuQmCC
|
||||||
</value>
|
</value>
|
||||||
</data>
|
</data>
|
||||||
<metadata name="superTooltipRibbon.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
|
||||||
<value>17, 17</value>
|
|
||||||
</metadata>
|
|
||||||
<data name="btnListUsers.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
<data name="btnListUsers.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
<value>
|
<value>
|
||||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||||
|
@ -71,7 +71,7 @@ namespace Volian.Controls.Library
|
|||||||
int typ = (int)myDisplayItem.MyItemInfo.MyContent.Type;
|
int typ = (int)myDisplayItem.MyItemInfo.MyContent.Type;
|
||||||
if (typ >= 20000)
|
if (typ >= 20000)
|
||||||
{
|
{
|
||||||
if (myDisplayItem.RNOLevel > 0 && myDisplayItem.MyItemInfo.IsRNO) return "";
|
if (myDisplayItem.RNOLevel > 0 && myDisplayItem.MyItemInfo.IsRNOPart) return "";
|
||||||
// Step 1: Get TabFormat from Format
|
// Step 1: Get TabFormat from Format
|
||||||
format = _TabFormats[typ % 10000];
|
format = _TabFormats[typ % 10000];
|
||||||
if (format == "<seq>")
|
if (format == "<seq>")
|
||||||
|
@ -20,6 +20,7 @@ namespace Volian.Controls.Library
|
|||||||
public delegate bool vlnTreeViewBoolEvent(object sender, vlnTreeEventArgs args);
|
public delegate bool vlnTreeViewBoolEvent(object sender, vlnTreeEventArgs args);
|
||||||
public delegate bool vlnTreeViewItemInfoDeleteEvent(object sender, vlnTreeItemInfoEventArgs args);
|
public delegate bool vlnTreeViewItemInfoDeleteEvent(object sender, vlnTreeItemInfoEventArgs args);
|
||||||
public delegate bool vlnTreeViewItemInfoInsertEvent(object sender, vlnTreeItemInfoInsertEventArgs args);
|
public delegate bool vlnTreeViewItemInfoInsertEvent(object sender, vlnTreeItemInfoInsertEventArgs args);
|
||||||
|
public delegate bool vlnTreeViewItemInfoPasteEvent(object sender, vlnTreeItemInfoPasteEventArgs args);
|
||||||
public delegate TreeNode vlnTreeViewTreeNodeEvent(object sender, vlnTreeEventArgs args);
|
public delegate TreeNode vlnTreeViewTreeNodeEvent(object sender, vlnTreeEventArgs args);
|
||||||
public delegate DialogResult vlnTreeViewPropertyEvent(object sender, vlnTreePropertyEventArgs args);
|
public delegate DialogResult vlnTreeViewPropertyEvent(object sender, vlnTreePropertyEventArgs args);
|
||||||
public delegate void vlnTreeViewSectionInfoEvent(object sender, vlnTreeSectionInfoEventArgs args);
|
public delegate void vlnTreeViewSectionInfoEvent(object sender, vlnTreeSectionInfoEventArgs args);
|
||||||
@ -144,6 +145,48 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
#region PasteEventArgs
|
||||||
|
public partial class vlnTreeItemInfoPasteEventArgs
|
||||||
|
{
|
||||||
|
#region Business Methods
|
||||||
|
private ItemInfo _MyItemInfo;
|
||||||
|
public ItemInfo MyItemInfo
|
||||||
|
{
|
||||||
|
get { return _MyItemInfo; }
|
||||||
|
set { _MyItemInfo = value; }
|
||||||
|
}
|
||||||
|
private int _CopyStartID;
|
||||||
|
public int CopyStartID
|
||||||
|
{
|
||||||
|
get { return _CopyStartID; }
|
||||||
|
set { _CopyStartID = value; }
|
||||||
|
}
|
||||||
|
private ItemInfo.EAddpingPart _PasteType;
|
||||||
|
public ItemInfo.EAddpingPart PasteType
|
||||||
|
{
|
||||||
|
get { return _PasteType; }
|
||||||
|
set { _PasteType = value; }
|
||||||
|
}
|
||||||
|
private int? _Type;
|
||||||
|
public int? Type
|
||||||
|
{
|
||||||
|
get { return _Type; }
|
||||||
|
set { _Type = value; }
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
#region Factory Methods
|
||||||
|
private vlnTreeItemInfoPasteEventArgs() { ;}
|
||||||
|
public vlnTreeItemInfoPasteEventArgs(ItemInfo myItemInfo, int copyStartId, ItemInfo.EAddpingPart pasteType, int? type)
|
||||||
|
{
|
||||||
|
_MyItemInfo = myItemInfo;
|
||||||
|
_CopyStartID = copyStartId;
|
||||||
|
_PasteType = pasteType;
|
||||||
|
_Type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
public partial class vlnTreePropertyEventArgs : EventArgs
|
public partial class vlnTreePropertyEventArgs : EventArgs
|
||||||
{
|
{
|
||||||
private string _Title;
|
private string _Title;
|
||||||
@ -232,6 +275,12 @@ namespace Volian.Controls.Library
|
|||||||
if (InsertItemInfo != null) return InsertItemInfo(sender, args);
|
if (InsertItemInfo != null) return InsertItemInfo(sender, args);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
public event vlnTreeViewItemInfoPasteEvent PasteItemInfo;
|
||||||
|
private bool OnPasteItemInfo(object sender, vlnTreeItemInfoPasteEventArgs args)
|
||||||
|
{
|
||||||
|
if (PasteItemInfo != null) return PasteItemInfo(sender, args);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
public event vlnTreeViewEvent NodeMove;
|
public event vlnTreeViewEvent NodeMove;
|
||||||
private void OnNodeMove(object sender, vlnTreeEventArgs args)
|
private void OnNodeMove(object sender, vlnTreeEventArgs args)
|
||||||
{
|
{
|
||||||
@ -300,7 +349,7 @@ namespace Volian.Controls.Library
|
|||||||
// that allow more than one type of operation associated with their selection.
|
// that allow more than one type of operation associated with their selection.
|
||||||
public enum MenuSelections : int
|
public enum MenuSelections : int
|
||||||
{
|
{
|
||||||
Folder = 1, FolderBefore = 2, FolderAfter = 3, DocVersion = 4, Procedure = 5, ProcedureBefore = 6, ProcedureAfter = 7, Section = 8, SectionBefore = 9, SectionAfter = 10, Step = 11, StepBefore = 12, StepAfter = 13
|
Folder = 1, FolderBefore = 2, FolderAfter = 3, DocVersion = 4, Procedure = 5, ProcedureBefore = 6, ProcedureAfter = 7, Section = 8, SectionBefore = 9, SectionAfter = 10, Step = 11, StepBefore = 12, StepAfter = 13, StepReplace = 14
|
||||||
}
|
}
|
||||||
void tv_MouseDown(object sender, MouseEventArgs e)
|
void tv_MouseDown(object sender, MouseEventArgs e)
|
||||||
{
|
{
|
||||||
@ -373,11 +422,9 @@ namespace Volian.Controls.Library
|
|||||||
cm.MenuItems.Add("Open", new EventHandler(mi_Click));
|
cm.MenuItems.Add("Open", new EventHandler(mi_Click));
|
||||||
#endregion
|
#endregion
|
||||||
#region Menu_CutCopy
|
#region Menu_CutCopy
|
||||||
// For initial release, no cut operations will be coded.
|
|
||||||
// For initial release, copy is not available for folders or docversions
|
// For initial release, copy is not available for folders or docversions
|
||||||
if (tn.VEObject as ItemInfo != null)
|
if (tn.VEObject as ItemInfo != null)
|
||||||
{
|
{
|
||||||
//cm.MenuItems.Add("Cut", new EventHandler(mi_Click));
|
|
||||||
cm.MenuItems.Add("Copy", new EventHandler(mi_Click));
|
cm.MenuItems.Add("Copy", new EventHandler(mi_Click));
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -445,7 +492,7 @@ namespace Volian.Controls.Library
|
|||||||
{
|
{
|
||||||
cm.MenuItems.Add("Paste Step Before", new EventHandler(mi_Click));
|
cm.MenuItems.Add("Paste Step Before", new EventHandler(mi_Click));
|
||||||
cm.MenuItems.Add("Replace Existing Step", new EventHandler(mi_Click));
|
cm.MenuItems.Add("Replace Existing Step", new EventHandler(mi_Click));
|
||||||
cm.MenuItems.Add("Paste Section Step", new EventHandler(mi_Click));
|
cm.MenuItems.Add("Paste Step After", new EventHandler(mi_Click));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -564,47 +611,50 @@ namespace Volian.Controls.Library
|
|||||||
DocVersionInfo dvi = tn.VEObject as DocVersionInfo;
|
DocVersionInfo dvi = tn.VEObject as DocVersionInfo;
|
||||||
if (dvi != null)
|
if (dvi != null)
|
||||||
{
|
{
|
||||||
// TODO: KBR Adjust database.
|
|
||||||
VETreeNode tnnew = new VETreeNode(iiClipboard);
|
|
||||||
SelectedNode.Nodes.Add(tnnew);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemInfo iiPaste = tn.VEObject as ItemInfo;
|
ItemInfo iiPaste = tn.VEObject as ItemInfo;
|
||||||
if (iiPaste == null) return;
|
if (iiPaste == null) return;
|
||||||
if (p.IndexOf("Before") > -1)
|
if (p.IndexOf("Before") > -1)
|
||||||
{
|
PasteBeforeOrAfter(MenuSelections.StepBefore, tn, iiClipboard.ItemID);
|
||||||
// TODO: KBR Adjust database.
|
else if (p.IndexOf("After") > -1)
|
||||||
VETreeNode tnnew = new VETreeNode(iiClipboard);
|
PasteBeforeOrAfter(MenuSelections.StepAfter, tn, iiClipboard.ItemID);
|
||||||
int indx = SelectedNode.Index;
|
else if (p.IndexOf("Replace") > -1)
|
||||||
SelectedNode.Parent.Nodes.Insert(indx, tnnew);
|
PasteReplace(tn, iiClipboard.ItemID);
|
||||||
return;
|
}
|
||||||
}
|
private void PasteBeforeOrAfter(MenuSelections newtype, VETreeNode tn, int copyStartID)
|
||||||
if (p.IndexOf("After") > -1)
|
{
|
||||||
{
|
// If paste-from step is open in the editor, use the OnPasteItemInfo to paste the step and add stepitems
|
||||||
// TODO: KBR Adjust database.
|
// to the step editor panel.
|
||||||
VETreeNode tnnew = new VETreeNode(iiClipboard);
|
ItemInfo ii = tn.VEObject as ItemInfo;
|
||||||
int indx = SelectedNode.Index;
|
ItemInfo.EAddpingPart pasteOpt = newtype == MenuSelections.StepBefore ? ItemInfo.EAddpingPart.Before : ItemInfo.EAddpingPart.After;
|
||||||
SelectedNode.Parent.Nodes.Insert(indx+1, tnnew);
|
// If parent step is open in step editor, the 'OnPasteItemInfo' event will cause
|
||||||
return;
|
// the item to be pasted in the step editor and the tree.
|
||||||
}
|
if (OnPasteItemInfo(this, new vlnTreeItemInfoPasteEventArgs(ii, copyStartID, pasteOpt, ii.MyContent.Type))==null)
|
||||||
if (p.IndexOf("Replace") > -1)
|
{
|
||||||
{
|
//return;
|
||||||
// TODO: KBR Adjust database.
|
// The parent step was not open in the step editor, just paste step (in data) and add treenode.
|
||||||
VETreeNode tnnew = new VETreeNode(iiClipboard);
|
ItemInfo newItemInfo = null;
|
||||||
int indx = SelectedNode.Index;
|
if (newtype == MenuSelections.StepBefore)
|
||||||
TreeNode tmptn = SelectedNode;
|
newItemInfo = ii.PasteSiblingBefore(copyStartID);
|
||||||
SelectedNode = SelectedNode.Parent.Nodes[indx];
|
else
|
||||||
SelectedNode.Remove();
|
newItemInfo = ii.PasteSiblingAfter(copyStartID);
|
||||||
SelectedNode.Parent.Nodes.Insert(indx, tnnew);
|
}
|
||||||
return;
|
SelectedNode = (VETreeNode)((newtype == MenuSelections.StepAfter) ? tn.NextNode : tn.PrevNode);
|
||||||
}
|
}
|
||||||
// if it got to here, just add as a child.
|
private void PasteReplace(VETreeNode tn, int copyStartID)
|
||||||
// TODO: KBR Adjust database.
|
{
|
||||||
VETreeNode tnnewc = new VETreeNode(iiClipboard);
|
VETreeNode prevtn = (VETreeNode) tn.PrevNode;
|
||||||
SelectedNode.Nodes.Add(tnnewc);
|
VETreeNode partn = (VETreeNode) tn.Parent;
|
||||||
|
ItemInfo ii = tn.VEObject as ItemInfo;
|
||||||
|
if (OnPasteItemInfo(this, new vlnTreeItemInfoPasteEventArgs(ii, copyStartID, ItemInfo.EAddpingPart.Replace, ii.MyContent.Type))==null)
|
||||||
|
{
|
||||||
|
//return;
|
||||||
|
ItemInfo replItemInfo = Item.PasteReplace(ii, copyStartID);
|
||||||
|
}
|
||||||
|
SelectedNode = (VETreeNode)((prevtn != null) ? prevtn.NextNode : partn.FirstNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void tv_NodeCopy()
|
private void tv_NodeCopy()
|
||||||
{
|
{
|
||||||
if (SelectedNode==null)return;
|
if (SelectedNode==null)return;
|
||||||
@ -616,7 +666,12 @@ namespace Volian.Controls.Library
|
|||||||
PromsClipboard iClip;
|
PromsClipboard iClip;
|
||||||
iClip.itemId = ii.ItemID;
|
iClip.itemId = ii.ItemID;
|
||||||
iClip.cType = (int)PromsClipboardType.Copy;
|
iClip.cType = (int)PromsClipboardType.Copy;
|
||||||
Clipboard.SetData("PromsClipboard", iClip);
|
DataObject myDO = new DataObject();
|
||||||
|
myDO.SetText(ii.DisplayNumber);
|
||||||
|
myDO.SetData("PromsClipboard", iClip);
|
||||||
|
Clipboard.SetDataObject(myDO);
|
||||||
|
//Clipboard.SetData("PromsClipboard", iClip);
|
||||||
|
//Clipboard.SetData(DataFormats.Text, ii.DisplayNumber);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
Loading…
x
Reference in New Issue
Block a user