Fixed separator location logic, added Template logic for Prairie Island Alarms

Added ChildIndent for use with Callaway Backgounds
This commit is contained in:
John Jenko 2013-12-06 19:51:59 +00:00
parent 7f396c2285
commit a2f1fb0640
3 changed files with 91 additions and 2 deletions

View File

@ -2707,7 +2707,24 @@ namespace VEPROMS.CSLA.Library
_MyHeader.Text = FormatStepData.Sep;
_MyHeader.CleanText = StripRtfFormatting(_MyHeader.Text);
_MyHeader.Justify = ContentAlignment.MiddleCenter;
// per 16-bit format speadsheet, Location can have the following values:
// 0 - Left
// 1 - Right
// 2 or greater - Center
int sepLoc = ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.Separator.Location?? 2; //default to Center
switch (sepLoc)
{
case 0:
_MyHeader.Justify = ContentAlignment.MiddleLeft;
break;
case 1:
_MyHeader.Justify = ContentAlignment.MiddleRight;
break;
default:
_MyHeader.Justify = ContentAlignment.MiddleCenter;
break;
}
//_MyHeader.Justify = ContentAlignment.MiddleCenter;
}
#region Non Converted Plants tab TODO
// Position offset
@ -3209,6 +3226,13 @@ namespace VEPROMS.CSLA.Library
if (IsStep && FormatStepData.MyFormat.PlantFormat.FormatData.TopTemplateTypes.ContainsKey((int)MyContent.Type - 20001)) return true;
return false;
}
public int GetSmartTemplateTopLevelIndxOfThisType(int oftype)
{
FormatData formatData = FormatStepData.MyFormat.PlantFormat.FormatData;
if (formatData.TopTemplateTypes == null || formatData.TopTemplateTypes.Count == 0) return -1;
if (formatData.TopTemplateTypes.ContainsKey(oftype - 20001)) return formatData.TopTemplateTypes[oftype - 20001];
return -1;
}
public int GetSmartTemplateTopLevelIndx()
{
FormatData formatData = FormatStepData.MyFormat.PlantFormat.FormatData;

View File

@ -298,6 +298,60 @@ namespace VEPROMS.CSLA.Library
((ItemInfo)ActiveParent).MyContent.RefreshContentParts();
return tmp;
}
private ItemInfo InsertSmartTemplateSubStep(string text, string number, ItemInfo tmp, EAddpingPart adPart, int type)
{
int newItemID = 0;
int topType = GetSmartTemplateTopLevelIndxOfThisType(type);
if (topType == -1) return null;
int tpIndx = GetSmartTemplateIndex(topType, type);
if (tpIndx != -1)
{
ItemInfo siblingSmart = null;
ItemInfo firstSmart = null;
int level = FormatStepData.MyFormat.PlantFormat.FormatData.Templates[tpIndx].level;
string tmptext = FormatStepData.MyFormat.PlantFormat.FormatData.NewTemplateFormat ? text : FormatStepData.MyFormat.PlantFormat.FormatData.Templates[tpIndx].text;
int prevlevel = level;
while (level > 0)
{
if (firstSmart == null)
{
firstSmart = NewItemInfoFetch(ItemID, adPart, number, tmptext, type, null, null, null, DateTime.Now, Volian.Base.Library.VlnSettings.UserID);
siblingSmart = firstSmart;
newItemID = firstSmart.ItemID;
}
else
{
E_FromType fromType = E_FromType.Step;
EAddpingPart addPart = EAddpingPart.Child; // level > previous, add a child.
if (level == prevlevel) addPart = EAddpingPart.After;
if (level < prevlevel)
{
if (FormatStepData.MyFormat.PlantFormat.FormatData.Templates[tpIndx].type == 39)
{
fromType = E_FromType.RNO;
addPart = EAddpingPart.Child;
}
else
{
addPart = EAddpingPart.After;
}
newItemID = siblingSmart.ItemID;
}
tmptext = /*FormatStepData.MyFormat.PlantFormat.FormatData.NewTemplateFormat ? " ": */FormatStepData.MyFormat.PlantFormat.FormatData.Templates[tpIndx].text;
tmp = NewItemInfoFetch(newItemID, addPart, null, tmptext, FormatStepData.MyFormat.PlantFormat.FormatData.Templates[tpIndx].type + 20001, (int?)fromType, null, null, DateTime.Now, Volian.Base.Library.VlnSettings.UserID);
newItemID = tmp.ItemID;
if (level < prevlevel) siblingSmart = tmp;
}
tpIndx++;
prevlevel = level;
level = tpIndx < FormatStepData.MyFormat.PlantFormat.FormatData.Templates.Count ?
FormatStepData.MyFormat.PlantFormat.FormatData.Templates[tpIndx].level : -1;
}
tmp = firstSmart;
}
return tmp;
}
private ItemInfo InsertSmartTemplateSteps(string text, string number, ItemInfo tmp, EAddpingPart adPart, int type)
{
@ -575,7 +629,10 @@ namespace VEPROMS.CSLA.Library
}
public ItemInfo InsertChild(E_FromType fromType, int type, string text, string number)
{
ItemInfo tmp = NewItemInfoFetch(ItemID, EAddpingPart.Child, number, text, type, (int?)fromType, null, null, DateTime.Now, Volian.Base.Library.VlnSettings.UserID);
ItemInfo tmp = null;
tmp = InsertSmartTemplateSubStep(text, number, tmp, EAddpingPart.After, type);
if (tmp == null)
tmp = NewItemInfoFetch(ItemID, EAddpingPart.Child, number, text, type, (int?)fromType, null, null, DateTime.Now, Volian.Base.Library.VlnSettings.UserID);
// if next exists, it is updated in SQL so we have to manually force the iteminfo updates
// Refresh ItemInfo to update PreviousID field
if (tmp.NextItem != null) using (Item item = tmp.NextItem.Get()) ItemInfo.Refresh(item);

View File

@ -4075,6 +4075,14 @@ namespace VEPROMS.CSLA.Library
return LazyLoad(ref _AdjHighLevelTab, "@AdjHighLevelTab");
}
}
private LazyLoad<float?> _ChildIndent;
public float? ChildIndent
{
get
{
return LazyLoad(ref _ChildIndent, "@ChildIndent");
}
}
private LazyLoad<bool> _LeftJustifyBorderless;
public bool LeftJustifyBorderless
{