This commit is contained in:
2009-11-20 12:34:14 +00:00
parent 579a1502d6
commit 655ec1ab94
2 changed files with 78 additions and 23 deletions

View File

@@ -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;