This commit is contained in:
parent
579a1502d6
commit
655ec1ab94
@ -291,11 +291,7 @@ namespace Volian.Controls.Library
|
||||
public bool DeleteStepItem(ItemInfo myItemInfo)
|
||||
{
|
||||
CleanUpClosedItems();
|
||||
return DeleteStepTabItem(myItemInfo);
|
||||
}
|
||||
|
||||
private bool DeleteStepTabItem(ItemInfo myItemInfo)
|
||||
{
|
||||
|
||||
//removeitem!
|
||||
ItemInfo proc = myItemInfo.MyProcedure; // Find procedure Item
|
||||
string key = "Item - " + proc.ItemID.ToString();
|
||||
@ -303,8 +299,10 @@ namespace Volian.Controls.Library
|
||||
if (_MyDisplayTabItems.ContainsKey(key)) // If procedure page open use it
|
||||
{
|
||||
DisplayTabItem pg = _MyDisplayTabItems[key];
|
||||
// if deleting a procedure, close the tab.
|
||||
if (proc.ItemID == myItemInfo.ItemID)
|
||||
{
|
||||
// do we need to close open doc tabs associated with this proc.
|
||||
CloseTabItem(pg);
|
||||
return false;
|
||||
}
|
||||
@ -317,6 +315,37 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public bool InsertStepItem(ItemInfo myItemInfo, string text, E_InsertType insertType, E_FromType fromType, int type)
|
||||
{
|
||||
CleanUpClosedItems();
|
||||
ItemInfo proc = myItemInfo.MyProcedure; // Find procedure Item
|
||||
string key = "Item - " + proc.ItemID.ToString();
|
||||
|
||||
if (_MyDisplayTabItems.ContainsKey(key)) // If procedure page open use it
|
||||
{
|
||||
DisplayTabItem pg = _MyDisplayTabItems[key];
|
||||
if (pg.MyStepTabPanel.MyStepPanel._LookupStepItems.ContainsKey(myItemInfo.ItemID))
|
||||
{
|
||||
StepItem stpitm = pg.MyStepTabPanel.MyStepPanel._LookupStepItems[myItemInfo.ItemID];
|
||||
switch (insertType)
|
||||
{
|
||||
case E_InsertType.Before:
|
||||
stpitm.AddSiblingBefore(text);
|
||||
break;
|
||||
case E_InsertType.After:
|
||||
stpitm.AddSiblingAfter(text);
|
||||
break;
|
||||
case E_InsertType.Child:
|
||||
stpitm.AddChild(text, fromType, type);
|
||||
break;
|
||||
default:
|
||||
return false; ;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
private void CleanUpClosedItems()
|
||||
{
|
||||
while (_RemovedDisplayTabItems.Count > 0) // Clean-up any items that have been closed.
|
||||
|
@ -132,6 +132,7 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
// Update the text to reflect the content change
|
||||
MyStepRTB.MyItemInfo=MyStepRTB.MyItemInfo; // Reset Text
|
||||
SetExpandAndExpander(MyItemInfo);
|
||||
// TODO: Need code to update tabs ? not sure what this is - maybe for
|
||||
// transitions?
|
||||
}
|
||||
@ -804,21 +805,7 @@ namespace Volian.Controls.Library
|
||||
if (itemInfo != null)
|
||||
{
|
||||
Name = string.Format("Item-{0}", itemInfo.ItemID);
|
||||
// Don't allow substeps to expand
|
||||
switch (_Type / 10000)
|
||||
{
|
||||
case 1: // Section can expand
|
||||
CanExpand = true;
|
||||
// If a word document set the expander to attachment
|
||||
_MyvlnExpander.Attachment = (itemInfo.MyContent.ContentPartCount == 0);
|
||||
break;
|
||||
case 2: // High level steps with children can expand
|
||||
CanExpand = itemInfo.IsHigh && itemInfo.HasChildren; // TemporaryFormat.IsHigh(item); ;
|
||||
break;
|
||||
default://Procedures cannot expand, because they automatically expand
|
||||
CanExpand = false;
|
||||
break;
|
||||
}
|
||||
SetExpandAndExpander(itemInfo);
|
||||
if (expand && (itemInfo.MyContent.ContentPartCount != 0)) // If it should expand and it can expand
|
||||
Expand(true);
|
||||
else
|
||||
@ -843,6 +830,26 @@ namespace Volian.Controls.Library
|
||||
//// TIMING: DisplayItem.TimeIt("CSLARTB Controls Add");
|
||||
}
|
||||
|
||||
private void SetExpandAndExpander(ItemInfo itemInfo)
|
||||
{
|
||||
// Don't allow substeps to expand
|
||||
switch (_Type / 10000)
|
||||
{
|
||||
case 1: // Section can expand
|
||||
CanExpand = true;
|
||||
// If a word document set the expander to attachment
|
||||
_MyvlnExpander.Attachment = !(itemInfo.IsStepSection);
|
||||
//OLD: _MyvlnExpander.Attachment = (itemInfo.MyContent.ContentPartCount == 0);
|
||||
break;
|
||||
case 2: // High level steps with children can expand
|
||||
CanExpand = itemInfo.IsHigh && itemInfo.HasChildren; // TemporaryFormat.IsHigh(item); ;
|
||||
break;
|
||||
default://Procedures cannot expand, because they automatically expand
|
||||
CanExpand = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void SetupHeader(ItemInfo itemInfo)
|
||||
{
|
||||
lblTab.Top = 3 + ((itemInfo.HasHeader) ? 23 : 0);
|
||||
@ -1169,7 +1176,11 @@ namespace Volian.Controls.Library
|
||||
/// </summary>
|
||||
public void AddSiblingAfter()
|
||||
{
|
||||
ItemInfo newItemInfo = MyItemInfo.InsertSiblingAfter("");
|
||||
AddSiblingAfter("");
|
||||
}
|
||||
public void AddSiblingAfter(string text)
|
||||
{
|
||||
ItemInfo newItemInfo = MyItemInfo.InsertSiblingAfter(text);
|
||||
DoAddSiblingAfter(newItemInfo);
|
||||
}
|
||||
public void AddSiblingAfter(int? type)
|
||||
@ -1200,7 +1211,18 @@ namespace Volian.Controls.Library
|
||||
private static int _WatchThis = 1;
|
||||
public void AddSiblingBefore()
|
||||
{
|
||||
ItemInfo newItemInfo = MyItemInfo.InsertSiblingBefore("");
|
||||
AddSiblingBefore("");
|
||||
}
|
||||
public void AddSiblingBefore(string text)
|
||||
{
|
||||
// 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
|
||||
// shouldn't be necessary for adding sibling after because the current step
|
||||
// doesn't get saved during the insert after because of the MyPrevious field
|
||||
// is only set on an insert before, which is what saves the item without
|
||||
// any updates from the richtextbox text.
|
||||
_MyStepRTB.SaveText();
|
||||
ItemInfo newItemInfo = MyItemInfo.InsertSiblingBefore(text);
|
||||
StepItem newStepItem=null;
|
||||
switch (_MyChildRelation)
|
||||
{
|
||||
@ -1219,12 +1241,16 @@ namespace Volian.Controls.Library
|
||||
_MyStepPanel.SelectedStepRTB = newStepItem.MyStepRTB;//Update Screen
|
||||
}
|
||||
public void AddChild(E_FromType fromType, int type)
|
||||
{
|
||||
AddChild("",fromType, type);
|
||||
}
|
||||
public void AddChild(string text, E_FromType fromType, int type)
|
||||
{
|
||||
if (_MyItemInfo.IsHigh || _MyItemInfo.IsSection)
|
||||
this.CanExpand = true;
|
||||
this.Expanded = true;
|
||||
_WatchThis = 1;
|
||||
ItemInfo newItemInfo = MyItemInfo.InsertChild(fromType,type,"");
|
||||
ItemInfo newItemInfo = MyItemInfo.InsertChild(fromType, type, text);
|
||||
// TODO: We need to determine where this will go in the stack of children
|
||||
StepItem nextItem = MyStepPanel.FindItem(newItemInfo.NextItem);
|
||||
StepItem newStepItem;
|
||||
|
Loading…
x
Reference in New Issue
Block a user