Page Num Transition (for grids)

This commit is contained in:
Kathy Ruffing 2014-01-22 12:06:56 +00:00
parent cfb0981a22
commit 4e445bbe20
9 changed files with 245 additions and 26 deletions

View File

@ -138,8 +138,8 @@ namespace VEPROMS.CSLA.Library
if (mg != null && mg.Groups.Count > 1) if (mg != null && mg.Groups.Count > 1)
{ {
System.Text.RegularExpressions.Group g = mg.Groups[3]; System.Text.RegularExpressions.Group g = mg.Groups[3];
//if (g.ToString() != transText) if (g.ToString() != transText)
// MyGrid.Data = MyGrid.Data.Substring(0, g.Index) + transText + MyGrid.Data.Substring(g.Index + g.Length); MyGrid.SetData(MyGrid.Data.Substring(0, g.Index) + transText + MyGrid.Data.Substring(g.Index + g.Length));
} }
} }
} }

View File

@ -434,6 +434,26 @@ namespace VEPROMS.CSLA.Library
foreach (ItemInfo ii in pi.MyItems) foreach (ItemInfo ii in pi.MyItems)
SetParentSectionAndDocVersion(ii, itemInfo, (itemInfo as SectionInfo) ?? sectionInfo, procInfo, docVersionInfo); SetParentSectionAndDocVersion(ii, itemInfo, (itemInfo as SectionInfo) ?? sectionInfo, procInfo, docVersionInfo);
} }
internal static void SetParentSectionAndDocVersionPageNum(ItemInfo itemInfo, IVEDrillDownReadOnly itemParent, SectionInfo sectionInfo, ProcedureInfo procInfo, DocVersionInfo docVersionInfo, TransitionLookup tranLookup)
{
if (itemInfo.MyContent.ContentPartCount > 0)
{
foreach (PartInfo pi in itemInfo.MyContent.ContentParts)
{
foreach (ItemInfo ii in pi.MyItems)
{
SetParentSectionAndDocVersionPageNum(ii, itemInfo, (itemInfo as SectionInfo) ?? sectionInfo, procInfo, docVersionInfo, tranLookup);
}
}
}
if (itemInfo.MyContent.ContentTransitionCount > 0)
{
foreach (TransitionInfo traninfo in itemInfo.MyContent.ContentTransitions)
{
itemInfo.MyContent.FixTransitionText(traninfo, tranLookup);
}
}
}
//internal static long ticksROUsage; //internal static long ticksROUsage;
//internal static long ticksItems; //internal static long ticksItems;
//internal static long ticksTrans; //internal static long ticksTrans;
@ -528,6 +548,18 @@ namespace VEPROMS.CSLA.Library
} }
set { _PrintLevel = value; } set { _PrintLevel = value; }
} }
// The following property tracks the page number that this item is on if the resolved
// transition text has a Page Number associated with it. Formats that have this either
// have the UseTransitionModfier flag or have '{Page Num}' in respective transition formats.
// If the format requires page numbers in transitions text, two passes are run through the
// data for printing. The first determines page numbers, the seconds resolves the transition
// text.
private int _PageNumber = 0;
public int PageNumber
{
get { return _PageNumber; }
set { _PageNumber = value; }
}
private float _MSWordPageCount = 0; private float _MSWordPageCount = 0;
public float MSWordPageCount public float MSWordPageCount
{ {
@ -1194,7 +1226,7 @@ namespace VEPROMS.CSLA.Library
if (ActiveSection != null) if (ActiveSection != null)
{ {
SectionInfo si = null; SectionInfo si = null;
if (IsSection) si = (SectionInfo) this; if (IsSection) si = this as SectionInfo;
else si = ActiveSection as SectionInfo; else si = ActiveSection as SectionInfo;
if(si == null) if(si == null)
si = SectionInfo.Get(ActiveSection.ItemID); //ActiveSection as SectionInfo; si = SectionInfo.Get(ActiveSection.ItemID); //ActiveSection as SectionInfo;
@ -4583,6 +4615,12 @@ namespace VEPROMS.CSLA.Library
{ {
return (Procedure) (_Editable = Procedure.Get(ItemID)); return (Procedure) (_Editable = Procedure.Get(ItemID));
} }
public static void RefreshPageNumTransitions(ProcedureInfo tmp)
{
TransitionLookup tranLookup = new TransitionLookup(0, tmp.ItemID, tmp.MyLookup);
tranLookup.NewLookupNeeded += new TransitionLookupEvent(GetNewLookup);
SetParentSectionAndDocVersionPageNum(tmp, tmp.MyDocVersion, null, tmp, tmp.MyDocVersion, tranLookup);
}
//jcb add 20120501 item and children by unit //jcb add 20120501 item and children by unit
public static ProcedureInfo GetItemAndChildrenByUnit(int? itemID, int? parentID, int? unitID) public static ProcedureInfo GetItemAndChildrenByUnit(int? itemID, int? parentID, int? unitID)
{ {

View File

@ -31,16 +31,50 @@ namespace VEPROMS.CSLA.Library
return MyContent.ContentItems[0].Path; return MyContent.ContentItems[0].Path;
} }
} }
public string ResolvePathTo(FormatInfo fi, ItemInfo itminfo, int tranType, ItemInfo toitem, ItemInfo rangeitem) [NonSerialized]
private TransitionConfig _TransitionConfig;
public TransitionConfig TransitionConfig
{
get
{
if (_TransitionConfig == null)
{
_TransitionConfig = new TransitionConfig(this);
}
return _TransitionConfig;
}
}
public bool HasPageNum
{
get
{
return TransitionConfig.Transition_Formatted.ToUpper() == "TRUE";
}
}
public string ResolvePathTo(FormatInfo fi, ItemInfo itminfo, int tranType, ItemInfo toitem, ItemInfo rangeitem, bool hasPageNum)
{ {
try try
{ {
return TransitionText.GetResolvedText(fi, itminfo, tranType, toitem, rangeitem); return TransitionText.GetResolvedText(fi, itminfo, tranType, toitem, rangeitem, HasPageNum);
} }
catch (Exception ex) catch (Exception ex)
{ {
if (tranType == 2 && ex.Message == "Cannot find Next Item") if (tranType == 2 && ex.Message == "Cannot find Next Item")
return TransitionText.GetResolvedText(fi, itminfo, tranType, toitem, toitem); return TransitionText.GetResolvedText(fi, itminfo, tranType, toitem, toitem, HasPageNum);
_MyLog.Error("Error Processing Transition Text", ex);
return "(Resolved Transition Text)";
}
}
public string ResolvePathTo(FormatInfo fi, ItemInfo itminfo, int tranType, ItemInfo toitem, ItemInfo rangeitem)
{
try
{
return TransitionText.GetResolvedText(fi, itminfo, tranType, toitem, rangeitem, HasPageNum);
}
catch (Exception ex)
{
if (tranType == 2 && ex.Message == "Cannot find Next Item")
return TransitionText.GetResolvedText(fi, itminfo, tranType, toitem, toitem, HasPageNum);
_MyLog.Error("Error Processing Transition Text", ex); _MyLog.Error("Error Processing Transition Text", ex);
return "(Resolved Transition Text)"; return "(Resolved Transition Text)";
} }
@ -61,13 +95,22 @@ namespace VEPROMS.CSLA.Library
MyContent.RefreshContentItems(); MyContent.RefreshContentItems();
ItemInfo item = MyContent.ContentItems[0]; ItemInfo item = MyContent.ContentItems[0];
ItemInfo myItemToID = MyItemToID; ItemInfo myItemToID = MyItemToID;
if (tranLookup.ContainsKey(item.ItemID)) item = tranLookup[item.ItemID];
bool hasPageNum = false;
if (item.ActiveFormat.PlantFormat.FormatData.TransData.UseTransitionModifier)
{
TransitionConfig tc = new TransitionConfig(Config);
if (tc != null && tc.Transition_Formatted.ToUpper() == "TRUE") hasPageNum = true;
}
if (tranLookup.ContainsKey(ToID)) if (tranLookup.ContainsKey(ToID))
{
myItemToID = tranLookup[ToID]; myItemToID = tranLookup[ToID];
}
else else
{ {
//different proc //different proc
//_MyLog.WarnFormat("Transition May Not Be Correct at Location From {0} To {1}", item.SearchPath, myItemToID.SearchPath); //_MyLog.WarnFormat("Transition May Not Be Correct at Location From {0} To {1}", item.SearchPath, myItemToID.SearchPath);
if(!tranLookup.MyLookups.ContainsKey(myItemToID.MyProcedure.ItemID)) if (!tranLookup.MyLookups.ContainsKey(myItemToID.MyProcedure.ItemID))
tranLookup.AddProcLookup(myItemToID.MyProcedure.ItemID, ProcedureInfo.GetNewLookup(tranLookup, new TransitionLookupEventArgs(myItemToID.MyProcedure.ItemID, tranLookup.ApplicabilityUnit, MyItemToID.MyDocVersion, tranLookup)).MyLookup); tranLookup.AddProcLookup(myItemToID.MyProcedure.ItemID, ProcedureInfo.GetNewLookup(tranLookup, new TransitionLookupEventArgs(myItemToID.MyProcedure.ItemID, tranLookup.ApplicabilityUnit, MyItemToID.MyDocVersion, tranLookup)).MyLookup);
if (tranLookup.ContainsKey(ToID)) if (tranLookup.ContainsKey(ToID))
myItemToID = tranLookup[ToID]; myItemToID = tranLookup[ToID];
@ -94,7 +137,7 @@ namespace VEPROMS.CSLA.Library
//Console.WriteLine("MyItemToID = {0}", MyItemToID); //Console.WriteLine("MyItemToID = {0}", MyItemToID);
//Console.WriteLine("MyItemRangeID = {0}", MyItemRangeID); //Console.WriteLine("MyItemRangeID = {0}", MyItemRangeID);
} }
return ResolvePathTo(item.ActiveFormat, item, TranType, myItemToID, myItemRangeID); return ResolvePathTo(item.ActiveFormat, item, TranType, myItemToID, myItemRangeID, hasPageNum);
} }
} }
#region AffectedTransitons #region AffectedTransitons
@ -457,18 +500,46 @@ namespace VEPROMS.CSLA.Library
_AppendMethods.Add("{?.Sect Num}", AddOptionalTranGetSectionNum); _AppendMethods.Add("{?.Sect Num}", AddOptionalTranGetSectionNum);
_AppendMethods.Add("{Sect Num}", AddTranGetSectionNumber); _AppendMethods.Add("{Sect Num}", AddTranGetSectionNumber);
_AppendMethods.Add("{Sect Number}", AddTranGetSectionNumber); // WCN2, tran type 6 _AppendMethods.Add("{Sect Number}", AddTranGetSectionNumber); // WCN2, tran type 6
_AppendMethods.Add("{Page Num}", AddPageNumber);
} }
public static string GetResolvedText(ItemInfo fromInfo, int tranType, ItemInfo toItem, ItemInfo rangeItem) public static string GetResolvedText(ItemInfo fromInfo, int tranType, ItemInfo toItem, ItemInfo rangeItem, bool hasPageNum)
{ {
return GetResolvedText(fromInfo.ActiveFormat, fromInfo, tranType, toItem, rangeItem); return GetResolvedText(fromInfo.ActiveFormat, fromInfo, tranType, toItem, rangeItem, hasPageNum);
} }
public static string GetResolvedText(FormatInfo formatInfo, ItemInfo fromInfo, int tranType, ItemInfo toItem, ItemInfo rangeItem) public static string GetResolvedText(FormatInfo formatInfo, ItemInfo fromInfo, int tranType, ItemInfo toItem, ItemInfo rangeItem, bool pagenum)
{ {
if (!pagenum)
{
TransitionInfo ct = fromInfo.MyContent.ContentTransitionCount > 0 ? fromInfo.MyContent.ContentTransitions[0] : null;
int trIU = -1;
string cfg = string.Empty;
if (ct != null)
{
trIU = fromInfo.MyContent.ContentTransitions[0].MyTransitionInfoUnique;
cfg = fromInfo.MyContent.ContentTransitions[0].Config;
}
else
{
string pattern = string.Format(@".*\\v <START\](\\[^v \\]+)*\\v0(\\[^v \\]+)* ([^#]*?)(\\[^v'? \\]+)*\\v(\\[^v \\]+)* #Link:Transition[^:]*?:[0-9]+ <CTID=-[0-9]+>( [0-9]*){{1,2}}\[END>");
Match m = Regex.Match(fromInfo.MyContent.Text, pattern);
if (m.Groups.Count > 1 && m.Groups[1].Value.Contains("(Page ~)"))
pagenum = true;
}
}
if (toItem == null || rangeItem == null || toItem.IsDeleted || rangeItem.IsDeleted) if (toItem == null || rangeItem == null || toItem.IsDeleted || rangeItem.IsDeleted)
return "Invalid Transition Destination"; return "Invalid Transition Destination";
TransitionBuilder tb = SetupTransitionBuilder(formatInfo, fromInfo, tranType, toItem, TransitionBuilder tb = SetupTransitionBuilder(formatInfo, fromInfo, tranType, toItem,
toItem.ItemID==rangeItem.ItemID && !toItem.IsHigh?toItem.LastSibling:rangeItem); toItem.ItemID==rangeItem.ItemID && !toItem.IsHigh?toItem.LastSibling:rangeItem);
if (pagenum && (tranType==1||tranType==2||tranType==4))
{
// if range transition, the page number token needs to go after the first step, else it's at the end:
if (tranType == 2 && tb._TransFormat.Contains("{First Step"))
{
tb._TransFormat = tb._TransFormat.Insert(tb._TransFormat.IndexOf("{First Step}")+12, " {Page Num}");
}
else
tb._TransFormat = tb._TransFormat + " {Page Num}";
}
if(_AppendMethods==null) if(_AppendMethods==null)
SetupMethods(); SetupMethods();
string retval = BuildString(tb); string retval = BuildString(tb);
@ -732,7 +803,35 @@ namespace VEPROMS.CSLA.Library
sret = sret.Trim(" .)".ToCharArray()); sret = sret.Trim(" .)".ToCharArray());
return sret; return sret;
} }
private static bool AddPageNumber(TransitionBuilder tb)
{
if (tb._ToItem.PageNumber != 0 && tb._FromItem.PageNumber != 0)
{
int pgoffset = tb._ToItem.PageNumber - tb._FromItem.PageNumber;
switch (pgoffset)
{
case 1:
tb.Append(" (Next Page)");
Console.WriteLine("Next Page: {0}", tb._FromItem.ShortPath);
break;
case -1:
tb.Append(" (Previous Page)");
Console.WriteLine("Prev Page: {0}", tb._FromItem.ShortPath);
break;
case 0:
break;
default:
tb.Append(string.Format(" (Page {0})", tb._ToItem.PageNumber + 1));
Console.WriteLine("Page: {0}, {1}", tb._FromItem.ShortPath, tb._ToItem.PageNumber);
break;
}
}
else
{
tb.Append(" (Page ~)");
}
return true;
}
private static bool AddStepNumber(TransitionBuilder tb) private static bool AddStepNumber(TransitionBuilder tb)
{ {
// If we're on a step put out the step number. // If we're on a step put out the step number.

View File

@ -17,6 +17,7 @@ using System.Configuration;
using System.IO; using System.IO;
using System.ComponentModel; using System.ComponentModel;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text.RegularExpressions;
using Csla.Validation; using Csla.Validation;
namespace VEPROMS.CSLA.Library namespace VEPROMS.CSLA.Library
{ {
@ -589,6 +590,12 @@ namespace VEPROMS.CSLA.Library
// if we're not dirty then don't update the database // if we're not dirty then don't update the database
if (!this.IsDirty) return; if (!this.IsDirty) return;
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"]; SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
string pattern = string.Format(@"<START\]\\v0([^#]*)\\v #Link:Transition(|Range):[0-9]* <CTID={0}>( [0-9]*){{1,2}}\[END>", _TransitionID);
Match m = Regex.Match(myContent.Text, pattern);
if (m.Groups.Count > 1 && m.Groups[1].Value.Contains("(Page ~)"))
_Config = "<Config><Transition Formatted=\"True\" /></Config>";
else
_Config = string.Empty;
_LastChanged = Transition.Add(cn, ref _TransitionID, myContent, _MyItemToID, _MyItemRangeID, _IsRange, _TranType, _Config, _DTS, _UserID); _LastChanged = Transition.Add(cn, ref _TransitionID, myContent, _MyItemToID, _MyItemRangeID, _IsRange, _TranType, _Config, _DTS, _UserID);
MarkOld(); MarkOld();
} }

View File

@ -30,6 +30,7 @@ namespace Volian.Controls.Library
{ {
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DisplayTransition)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DisplayTransition));
this.groupPanelBtns = new DevComponents.DotNetBar.Controls.GroupPanel(); this.groupPanelBtns = new DevComponents.DotNetBar.Controls.GroupPanel();
this.cbPageNum = new DevComponents.DotNetBar.Controls.CheckBoxX();
this.btnTranCancel = new DevComponents.DotNetBar.ButtonX(); this.btnTranCancel = new DevComponents.DotNetBar.ButtonX();
this.btnTranSave = new DevComponents.DotNetBar.ButtonX(); this.btnTranSave = new DevComponents.DotNetBar.ButtonX();
this.groupPanelTranFmt = new DevComponents.DotNetBar.Controls.GroupPanel(); this.groupPanelTranFmt = new DevComponents.DotNetBar.Controls.GroupPanel();
@ -61,13 +62,14 @@ namespace Volian.Controls.Library
// //
this.groupPanelBtns.CanvasColor = System.Drawing.SystemColors.Control; this.groupPanelBtns.CanvasColor = System.Drawing.SystemColors.Control;
this.groupPanelBtns.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; this.groupPanelBtns.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007;
this.groupPanelBtns.Controls.Add(this.cbPageNum);
this.groupPanelBtns.Controls.Add(this.btnTranCancel); this.groupPanelBtns.Controls.Add(this.btnTranCancel);
this.groupPanelBtns.Controls.Add(this.btnTranSave); this.groupPanelBtns.Controls.Add(this.btnTranSave);
this.groupPanelBtns.Dock = System.Windows.Forms.DockStyle.Top; this.groupPanelBtns.Dock = System.Windows.Forms.DockStyle.Top;
this.groupPanelBtns.Location = new System.Drawing.Point(0, 0); this.groupPanelBtns.Location = new System.Drawing.Point(0, 0);
this.groupPanelBtns.Margin = new System.Windows.Forms.Padding(4); this.groupPanelBtns.Margin = new System.Windows.Forms.Padding(4);
this.groupPanelBtns.Name = "groupPanelBtns"; this.groupPanelBtns.Name = "groupPanelBtns";
this.groupPanelBtns.Size = new System.Drawing.Size(501, 44); this.groupPanelBtns.Size = new System.Drawing.Size(501, 71);
// //
// //
// //
@ -98,6 +100,21 @@ namespace Volian.Controls.Library
this.groupPanelBtns.StyleMouseOver.CornerType = DevComponents.DotNetBar.eCornerType.Square; this.groupPanelBtns.StyleMouseOver.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.groupPanelBtns.TabIndex = 25; this.groupPanelBtns.TabIndex = 25;
// //
// cbPageNum
//
this.cbPageNum.BackColor = System.Drawing.Color.Transparent;
//
//
//
this.cbPageNum.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.cbPageNum.Location = new System.Drawing.Point(0, 43);
this.cbPageNum.Name = "cbPageNum";
this.cbPageNum.Size = new System.Drawing.Size(168, 18);
this.cbPageNum.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.cbPageNum.TabIndex = 26;
this.cbPageNum.Text = "Include Page Number";
this.cbPageNum.CheckedChanged += new System.EventHandler(this.cbPageNum_CheckedChanged);
//
// btnTranCancel // btnTranCancel
// //
this.btnTranCancel.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; this.btnTranCancel.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
@ -136,10 +153,10 @@ namespace Volian.Controls.Library
this.groupPanelTranFmt.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; this.groupPanelTranFmt.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007;
this.groupPanelTranFmt.Controls.Add(this.listBoxTranFmt); this.groupPanelTranFmt.Controls.Add(this.listBoxTranFmt);
this.groupPanelTranFmt.Dock = System.Windows.Forms.DockStyle.Top; this.groupPanelTranFmt.Dock = System.Windows.Forms.DockStyle.Top;
this.groupPanelTranFmt.Location = new System.Drawing.Point(0, 44); this.groupPanelTranFmt.Location = new System.Drawing.Point(0, 71);
this.groupPanelTranFmt.Margin = new System.Windows.Forms.Padding(4); this.groupPanelTranFmt.Margin = new System.Windows.Forms.Padding(4);
this.groupPanelTranFmt.Name = "groupPanelTranFmt"; this.groupPanelTranFmt.Name = "groupPanelTranFmt";
this.groupPanelTranFmt.Size = new System.Drawing.Size(501, 182); this.groupPanelTranFmt.Size = new System.Drawing.Size(501, 174);
// //
// //
// //
@ -192,7 +209,7 @@ namespace Volian.Controls.Library
this.groupPanelTransitionSets.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; this.groupPanelTransitionSets.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007;
this.groupPanelTransitionSets.Controls.Add(this.vlnTreeComboSets); this.groupPanelTransitionSets.Controls.Add(this.vlnTreeComboSets);
this.groupPanelTransitionSets.Dock = System.Windows.Forms.DockStyle.Top; this.groupPanelTransitionSets.Dock = System.Windows.Forms.DockStyle.Top;
this.groupPanelTransitionSets.Location = new System.Drawing.Point(0, 226); this.groupPanelTransitionSets.Location = new System.Drawing.Point(0, 245);
this.groupPanelTransitionSets.Margin = new System.Windows.Forms.Padding(4); this.groupPanelTransitionSets.Margin = new System.Windows.Forms.Padding(4);
this.groupPanelTransitionSets.Name = "groupPanelTransitionSets"; this.groupPanelTransitionSets.Name = "groupPanelTransitionSets";
this.groupPanelTransitionSets.Size = new System.Drawing.Size(501, 59); this.groupPanelTransitionSets.Size = new System.Drawing.Size(501, 59);
@ -245,7 +262,7 @@ namespace Volian.Controls.Library
this.groupPanelTransitionProcs.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; this.groupPanelTransitionProcs.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007;
this.groupPanelTransitionProcs.Controls.Add(this.cbTranProcs); this.groupPanelTransitionProcs.Controls.Add(this.cbTranProcs);
this.groupPanelTransitionProcs.Dock = System.Windows.Forms.DockStyle.Top; this.groupPanelTransitionProcs.Dock = System.Windows.Forms.DockStyle.Top;
this.groupPanelTransitionProcs.Location = new System.Drawing.Point(0, 285); this.groupPanelTransitionProcs.Location = new System.Drawing.Point(0, 304);
this.groupPanelTransitionProcs.Margin = new System.Windows.Forms.Padding(4); this.groupPanelTransitionProcs.Margin = new System.Windows.Forms.Padding(4);
this.groupPanelTransitionProcs.Name = "groupPanelTransitionProcs"; this.groupPanelTransitionProcs.Name = "groupPanelTransitionProcs";
this.groupPanelTransitionProcs.Size = new System.Drawing.Size(501, 57); this.groupPanelTransitionProcs.Size = new System.Drawing.Size(501, 57);
@ -298,7 +315,7 @@ namespace Volian.Controls.Library
this.groupPanelTransitionSect.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; this.groupPanelTransitionSect.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007;
this.groupPanelTransitionSect.Controls.Add(this.cbTranSects); this.groupPanelTransitionSect.Controls.Add(this.cbTranSects);
this.groupPanelTransitionSect.Dock = System.Windows.Forms.DockStyle.Top; this.groupPanelTransitionSect.Dock = System.Windows.Forms.DockStyle.Top;
this.groupPanelTransitionSect.Location = new System.Drawing.Point(0, 342); this.groupPanelTransitionSect.Location = new System.Drawing.Point(0, 361);
this.groupPanelTransitionSect.Margin = new System.Windows.Forms.Padding(4); this.groupPanelTransitionSect.Margin = new System.Windows.Forms.Padding(4);
this.groupPanelTransitionSect.Name = "groupPanelTransitionSect"; this.groupPanelTransitionSect.Name = "groupPanelTransitionSect";
this.groupPanelTransitionSect.Size = new System.Drawing.Size(501, 60); this.groupPanelTransitionSect.Size = new System.Drawing.Size(501, 60);
@ -353,10 +370,10 @@ namespace Volian.Controls.Library
this.groupPanelTranstionSteps.Controls.Add(this.tvTran); this.groupPanelTranstionSteps.Controls.Add(this.tvTran);
this.groupPanelTranstionSteps.Controls.Add(this.pnlTranStepBtns); this.groupPanelTranstionSteps.Controls.Add(this.pnlTranStepBtns);
this.groupPanelTranstionSteps.Dock = System.Windows.Forms.DockStyle.Fill; this.groupPanelTranstionSteps.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupPanelTranstionSteps.Location = new System.Drawing.Point(0, 402); this.groupPanelTranstionSteps.Location = new System.Drawing.Point(0, 421);
this.groupPanelTranstionSteps.Margin = new System.Windows.Forms.Padding(4); this.groupPanelTranstionSteps.Margin = new System.Windows.Forms.Padding(4);
this.groupPanelTranstionSteps.Name = "groupPanelTranstionSteps"; this.groupPanelTranstionSteps.Name = "groupPanelTranstionSteps";
this.groupPanelTranstionSteps.Size = new System.Drawing.Size(501, 430); this.groupPanelTranstionSteps.Size = new System.Drawing.Size(501, 411);
// //
// //
// //
@ -395,7 +412,7 @@ namespace Volian.Controls.Library
this.tvTran.Location = new System.Drawing.Point(0, 57); this.tvTran.Location = new System.Drawing.Point(0, 57);
this.tvTran.Margin = new System.Windows.Forms.Padding(4); this.tvTran.Margin = new System.Windows.Forms.Padding(4);
this.tvTran.Name = "tvTran"; this.tvTran.Name = "tvTran";
this.tvTran.Size = new System.Drawing.Size(495, 350); this.tvTran.Size = new System.Drawing.Size(495, 331);
this.superToolTipDispTran.SetSuperTooltip(this.tvTran, new DevComponents.DotNetBar.SuperTooltipInfo("", "", resources.GetString("tvTran.SuperTooltip"), null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); this.superToolTipDispTran.SetSuperTooltip(this.tvTran, new DevComponents.DotNetBar.SuperTooltipInfo("", "", resources.GetString("tvTran.SuperTooltip"), null, null, DevComponents.DotNetBar.eTooltipColor.Gray));
this.tvTran.TabIndex = 31; this.tvTran.TabIndex = 31;
this.tvTran.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.tvTran_AfterSelect); this.tvTran.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.tvTran_AfterSelect);
@ -522,5 +539,6 @@ namespace Volian.Controls.Library
private vlnTreeView3 tvTran; private vlnTreeView3 tvTran;
private DevComponents.DotNetBar.SuperTooltip superToolTipDispTran; private DevComponents.DotNetBar.SuperTooltip superToolTipDispTran;
private DevComponents.DotNetBar.Controls.CheckBoxX cbIncStepNum; private DevComponents.DotNetBar.Controls.CheckBoxX cbIncStepNum;
private DevComponents.DotNetBar.Controls.CheckBoxX cbPageNum;
} }
} }

View File

@ -50,7 +50,7 @@ namespace Volian.Controls.Library
// use the following if user selects 'cancel' button // use the following if user selects 'cancel' button
private ItemInfo _SavCurItemFrom; private ItemInfo _SavCurItemFrom;
private int _SavTranFmtIndx; private int _SavTranFmtIndx;
private bool _ModExistingPageNum = false;
private bool _DoingRange = false; // flags if in 'range' transition mode private bool _DoingRange = false; // flags if in 'range' transition mode
private VETreeNode _RangeNode1; private VETreeNode _RangeNode1;
private VETreeNode _RangeNode2; private VETreeNode _RangeNode2;
@ -580,6 +580,24 @@ namespace Volian.Controls.Library
} }
else else
cbIncStepNum.Visible = false; cbIncStepNum.Visible = false;
// if this format has the transition flag for UseTransitionModifier, i.e. page numbers included in transition text,
// then make visible the checkbox & set based on data.
// and transition type has to be (tranType==1||tranType==2||tranType==4))
cbPageNum.Visible = _CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.UseTransitionModifier &&
(_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[indx].Type == 1 ||
_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[indx].Type == 2 ||
_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[indx].Type == 4);
if (cbPageNum.Visible)
{
cbPageNum.Checked = false;
if (CurTrans != null)
{
TransitionConfig tc = new TransitionConfig(CurTrans.Config);
cbPageNum.Checked = _ModExistingPageNum = tc != null && tc.Transition_Formatted.ToUpper() == "TRUE";
}
}
} }
#endregion #endregion
#region Events #region Events
@ -866,7 +884,15 @@ namespace Volian.Controls.Library
btnTranSave.Enabled = allowSave; btnTranSave.Enabled = allowSave;
if (CurTrans != null) if (CurTrans != null)
{ {
if (CurTrans.ToID == selii.ItemID) btnTranCancel.Enabled = btnTranSave.Enabled = false; if (CurTrans.ToID == selii.ItemID)
{
// if the checkbox for including a page number (UseTransitionModifier flag is true)
// then need to check if this has been changed, and allow a save/cancel if so.
if (cbPageNum.Visible && _ModExistingPageNum != cbPageNum.Checked)
btnTranCancel.Enabled = btnTranSave.Enabled = true;
else
btnTranCancel.Enabled = btnTranSave.Enabled = false;
}
else else
{ {
btnTranCancel.Enabled = true; btnTranCancel.Enabled = true;
@ -1010,7 +1036,8 @@ namespace Volian.Controls.Library
MessageBox.Show(sb.ToString()); MessageBox.Show(sb.ToString());
return; return;
} }
trantxt = TransitionText.GetResolvedText(MyRTB.MyItemInfo, listBoxTranFmt.SelectedIndex,toItem,rangeItem ?? toItem); bool doTranmod = this.cbPageNum.Checked;
trantxt = TransitionText.GetResolvedText(MyRTB.MyItemInfo, listBoxTranFmt.SelectedIndex, toItem, rangeItem ?? toItem, doTranmod);
int ss = MyRTB.SelectionStart;// Remember where the link is being added int ss = MyRTB.SelectionStart;// Remember where the link is being added
int sl = MyRTB.SelectionLength; int sl = MyRTB.SelectionLength;
MyRTB.OnReturnToEditor(this, new EventArgs()); MyRTB.OnReturnToEditor(this, new EventArgs());
@ -1126,6 +1153,11 @@ namespace Volian.Controls.Library
{ {
tvTran.Enabled=cbIncStepNum.Checked; tvTran.Enabled=cbIncStepNum.Checked;
} }
private void cbPageNum_CheckedChanged(object sender, EventArgs e)
{
if (_ModExistingPageNum != cbPageNum.Checked)
btnTranCancel.Enabled = btnTranSave.Enabled = true;
}
} }
public class TransItem public class TransItem
{ {

View File

@ -481,6 +481,7 @@ namespace Volian.Controls.Library
if (!MyFlexGrid.IsDirty && !IsSaving) return; if (!MyFlexGrid.IsDirty && !IsSaving) return;
List<int> RtfRoUsageList = new List<int>(); List<int> RtfRoUsageList = new List<int>();
List<int> RtfTransList = new List<int>(); List<int> RtfTransList = new List<int>();
List<int> RtfTransPageNumList = new List<int>();
int r = 0; int r = 0;
int c = 0; int c = 0;
@ -524,6 +525,7 @@ namespace Volian.Controls.Library
{ {
int tid = int.Parse(myMatch.Groups[2].Value); int tid = int.Parse(myMatch.Groups[2].Value);
RtfTransList.Add(tid); RtfTransList.Add(tid);
if (m.Groups[3].Value.Contains("(Page ~)")) RtfTransPageNumList.Add(tid);
} }
} }
} }
@ -567,7 +569,17 @@ namespace Volian.Controls.Library
{ {
List<int> delTrans = new List<int>(); List<int> delTrans = new List<int>();
foreach (TransitionInfo ti in MyItemInfo.MyContent.ContentTransitions) foreach (TransitionInfo ti in MyItemInfo.MyContent.ContentTransitions)
{
if (!RtfTransList.Contains(ti.TransitionID)) delTrans.Add(ti.TransitionID); if (!RtfTransList.Contains(ti.TransitionID)) delTrans.Add(ti.TransitionID);
else if (RtfTransPageNumList.Contains(ti.TransitionID))
{
using (Transition t = ti.Get())
{
t.Config = "<Config><Transition Formatted=\"True\" /></Config>";
t.Save();
}
}
}
foreach (int dt in delTrans) Transition.Delete(dt); foreach (int dt in delTrans) Transition.Delete(dt);
} }

View File

@ -172,7 +172,19 @@ namespace Volian.Print.Library
public string Print(string pdfFolder) public string Print(string pdfFolder)
{ {
if (_MyItem is ProcedureInfo) if (_MyItem is ProcedureInfo)
{
if (!_MyItem.ActiveFormat.PlantFormat.FormatData.TransData.UseTransitionModifier)
return Print(_MyItem as ProcedureInfo, pdfFolder); return Print(_MyItem as ProcedureInfo, pdfFolder);
else
{
// if the plant uses transition modifiers and/or page num in transition format,
// need to do two passes. First pass, sets the pagenumbers for each item,
// 2nd pass fills in the page numbers in transitions.
Print(_MyItem as ProcedureInfo, pdfFolder);
ProcedureInfo.RefreshPageNumTransitions(_MyItem as ProcedureInfo);
return Print(_MyItem as ProcedureInfo, pdfFolder);
}
}
return ""; return "";
} }
private string BuildMSWordPDF(SectionInfo section) private string BuildMSWordPDF(SectionInfo section)

View File

@ -299,6 +299,7 @@ namespace Volian.Print.Library
public float ParagraphToPdf(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin) public float ParagraphToPdf(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin)
{ {
if (MyItemInfo.PageNumber == 0) MyItemInfo.PageNumber = MyPageHelper.CurrentPageNumber;
if (Processed) return yPageStart; if (Processed) return yPageStart;
//float localYPageStart = yPageStart; //float localYPageStart = yPageStart;
Processed = true; Processed = true;