Page Num Transition (for grids)
This commit is contained in:
parent
cfb0981a22
commit
4e445bbe20
@ -138,8 +138,8 @@ namespace VEPROMS.CSLA.Library
|
||||
if (mg != null && mg.Groups.Count > 1)
|
||||
{
|
||||
System.Text.RegularExpressions.Group g = mg.Groups[3];
|
||||
//if (g.ToString() != transText)
|
||||
// MyGrid.Data = MyGrid.Data.Substring(0, g.Index) + transText + MyGrid.Data.Substring(g.Index + g.Length);
|
||||
if (g.ToString() != transText)
|
||||
MyGrid.SetData(MyGrid.Data.Substring(0, g.Index) + transText + MyGrid.Data.Substring(g.Index + g.Length));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -434,6 +434,26 @@ namespace VEPROMS.CSLA.Library
|
||||
foreach (ItemInfo ii in pi.MyItems)
|
||||
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 ticksItems;
|
||||
//internal static long ticksTrans;
|
||||
@ -528,6 +548,18 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
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;
|
||||
public float MSWordPageCount
|
||||
{
|
||||
@ -1194,7 +1226,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (ActiveSection != null)
|
||||
{
|
||||
SectionInfo si = null;
|
||||
if (IsSection) si = (SectionInfo) this;
|
||||
if (IsSection) si = this as SectionInfo;
|
||||
else si = ActiveSection as SectionInfo;
|
||||
if(si == null)
|
||||
si = SectionInfo.Get(ActiveSection.ItemID); //ActiveSection as SectionInfo;
|
||||
@ -4583,6 +4615,12 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
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
|
||||
public static ProcedureInfo GetItemAndChildrenByUnit(int? itemID, int? parentID, int? unitID)
|
||||
{
|
||||
|
@ -31,16 +31,50 @@ namespace VEPROMS.CSLA.Library
|
||||
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
|
||||
{
|
||||
return TransitionText.GetResolvedText(fi, itminfo, tranType, toitem, rangeitem);
|
||||
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);
|
||||
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);
|
||||
return "(Resolved Transition Text)";
|
||||
}
|
||||
@ -61,13 +95,22 @@ namespace VEPROMS.CSLA.Library
|
||||
MyContent.RefreshContentItems();
|
||||
ItemInfo item = MyContent.ContentItems[0];
|
||||
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))
|
||||
{
|
||||
myItemToID = tranLookup[ToID];
|
||||
}
|
||||
else
|
||||
{
|
||||
//different proc
|
||||
//_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);
|
||||
if (tranLookup.ContainsKey(ToID))
|
||||
myItemToID = tranLookup[ToID];
|
||||
@ -94,7 +137,7 @@ namespace VEPROMS.CSLA.Library
|
||||
//Console.WriteLine("MyItemToID = {0}", MyItemToID);
|
||||
//Console.WriteLine("MyItemRangeID = {0}", MyItemRangeID);
|
||||
}
|
||||
return ResolvePathTo(item.ActiveFormat, item, TranType, myItemToID, myItemRangeID);
|
||||
return ResolvePathTo(item.ActiveFormat, item, TranType, myItemToID, myItemRangeID, hasPageNum);
|
||||
}
|
||||
}
|
||||
#region AffectedTransitons
|
||||
@ -457,18 +500,46 @@ namespace VEPROMS.CSLA.Library
|
||||
_AppendMethods.Add("{?.Sect Num}", AddOptionalTranGetSectionNum);
|
||||
_AppendMethods.Add("{Sect Num}", AddTranGetSectionNumber);
|
||||
_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)
|
||||
return "Invalid Transition Destination";
|
||||
TransitionBuilder tb = SetupTransitionBuilder(formatInfo, fromInfo, tranType, toItem,
|
||||
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)
|
||||
SetupMethods();
|
||||
string retval = BuildString(tb);
|
||||
@ -732,7 +803,35 @@ namespace VEPROMS.CSLA.Library
|
||||
sret = sret.Trim(" .)".ToCharArray());
|
||||
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)
|
||||
{
|
||||
// If we're on a step put out the step number.
|
||||
|
@ -17,6 +17,7 @@ using System.Configuration;
|
||||
using System.IO;
|
||||
using System.ComponentModel;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.RegularExpressions;
|
||||
using Csla.Validation;
|
||||
namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
@ -589,6 +590,12 @@ namespace VEPROMS.CSLA.Library
|
||||
// if we're not dirty then don't update the database
|
||||
if (!this.IsDirty) return;
|
||||
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);
|
||||
MarkOld();
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DisplayTransition));
|
||||
this.groupPanelBtns = new DevComponents.DotNetBar.Controls.GroupPanel();
|
||||
this.cbPageNum = new DevComponents.DotNetBar.Controls.CheckBoxX();
|
||||
this.btnTranCancel = new DevComponents.DotNetBar.ButtonX();
|
||||
this.btnTranSave = new DevComponents.DotNetBar.ButtonX();
|
||||
this.groupPanelTranFmt = new DevComponents.DotNetBar.Controls.GroupPanel();
|
||||
@ -61,13 +62,14 @@ namespace Volian.Controls.Library
|
||||
//
|
||||
this.groupPanelBtns.CanvasColor = System.Drawing.SystemColors.Control;
|
||||
this.groupPanelBtns.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007;
|
||||
this.groupPanelBtns.Controls.Add(this.cbPageNum);
|
||||
this.groupPanelBtns.Controls.Add(this.btnTranCancel);
|
||||
this.groupPanelBtns.Controls.Add(this.btnTranSave);
|
||||
this.groupPanelBtns.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.groupPanelBtns.Location = new System.Drawing.Point(0, 0);
|
||||
this.groupPanelBtns.Margin = new System.Windows.Forms.Padding(4);
|
||||
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.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
|
||||
//
|
||||
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.Controls.Add(this.listBoxTranFmt);
|
||||
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.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.Controls.Add(this.vlnTreeComboSets);
|
||||
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.Name = "groupPanelTransitionSets";
|
||||
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.Controls.Add(this.cbTranProcs);
|
||||
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.Name = "groupPanelTransitionProcs";
|
||||
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.Controls.Add(this.cbTranSects);
|
||||
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.Name = "groupPanelTransitionSect";
|
||||
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.pnlTranStepBtns);
|
||||
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.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.Margin = new System.Windows.Forms.Padding(4);
|
||||
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.tvTran.TabIndex = 31;
|
||||
this.tvTran.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.tvTran_AfterSelect);
|
||||
@ -522,5 +539,6 @@ namespace Volian.Controls.Library
|
||||
private vlnTreeView3 tvTran;
|
||||
private DevComponents.DotNetBar.SuperTooltip superToolTipDispTran;
|
||||
private DevComponents.DotNetBar.Controls.CheckBoxX cbIncStepNum;
|
||||
private DevComponents.DotNetBar.Controls.CheckBoxX cbPageNum;
|
||||
}
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ namespace Volian.Controls.Library
|
||||
// use the following if user selects 'cancel' button
|
||||
private ItemInfo _SavCurItemFrom;
|
||||
private int _SavTranFmtIndx;
|
||||
|
||||
private bool _ModExistingPageNum = false;
|
||||
private bool _DoingRange = false; // flags if in 'range' transition mode
|
||||
private VETreeNode _RangeNode1;
|
||||
private VETreeNode _RangeNode2;
|
||||
@ -580,6 +580,24 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
else
|
||||
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
|
||||
#region Events
|
||||
@ -866,7 +884,15 @@ namespace Volian.Controls.Library
|
||||
btnTranSave.Enabled = allowSave;
|
||||
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
|
||||
{
|
||||
btnTranCancel.Enabled = true;
|
||||
@ -1010,7 +1036,8 @@ namespace Volian.Controls.Library
|
||||
MessageBox.Show(sb.ToString());
|
||||
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 sl = MyRTB.SelectionLength;
|
||||
MyRTB.OnReturnToEditor(this, new EventArgs());
|
||||
@ -1126,6 +1153,11 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
tvTran.Enabled=cbIncStepNum.Checked;
|
||||
}
|
||||
private void cbPageNum_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (_ModExistingPageNum != cbPageNum.Checked)
|
||||
btnTranCancel.Enabled = btnTranSave.Enabled = true;
|
||||
}
|
||||
}
|
||||
public class TransItem
|
||||
{
|
||||
|
@ -481,6 +481,7 @@ namespace Volian.Controls.Library
|
||||
if (!MyFlexGrid.IsDirty && !IsSaving) return;
|
||||
List<int> RtfRoUsageList = new List<int>();
|
||||
List<int> RtfTransList = new List<int>();
|
||||
List<int> RtfTransPageNumList = new List<int>();
|
||||
|
||||
int r = 0;
|
||||
int c = 0;
|
||||
@ -524,6 +525,7 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
int tid = int.Parse(myMatch.Groups[2].Value);
|
||||
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>();
|
||||
foreach (TransitionInfo ti in MyItemInfo.MyContent.ContentTransitions)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -172,7 +172,19 @@ namespace Volian.Print.Library
|
||||
public string Print(string pdfFolder)
|
||||
{
|
||||
if (_MyItem is ProcedureInfo)
|
||||
return Print(_MyItem as ProcedureInfo, pdfFolder);
|
||||
{
|
||||
if (!_MyItem.ActiveFormat.PlantFormat.FormatData.TransData.UseTransitionModifier)
|
||||
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 "";
|
||||
}
|
||||
private string BuildMSWordPDF(SectionInfo section)
|
||||
|
@ -299,6 +299,7 @@ namespace Volian.Print.Library
|
||||
|
||||
public float ParagraphToPdf(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin)
|
||||
{
|
||||
if (MyItemInfo.PageNumber == 0) MyItemInfo.PageNumber = MyPageHelper.CurrentPageNumber;
|
||||
if (Processed) return yPageStart;
|
||||
//float localYPageStart = yPageStart;
|
||||
Processed = true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user