C2026-021_B2026-048 Expand Functionality of Viewing Mode
This commit is contained in:
@@ -492,15 +492,32 @@ namespace Volian.Controls.Library
|
||||
OnAdjustTableWidth(this, new StepRTBTableWidthEventArgs(true));
|
||||
//Volian.Base.Library.HWndCounter.GetWindowHandlesForCurrentProcess(this.Handle, "RefreshDisplay 2");
|
||||
_InitializingRTB = true;
|
||||
DisplayText vlntxt = new DisplayText(MyItemInfo, E_EditPrintMode.Edit, VwMode, !ActiveMode, FieldToEdit, true,null, null,false);
|
||||
//Volian.Base.Library.HWndCounter.GetWindowHandlesForCurrentProcess(this.Handle, "RefreshDisplay 3");
|
||||
//if (_origDisplayText != null && vlntxt.StartText == _origDisplayText.StartText)
|
||||
//{
|
||||
// ReadOnly = !(EpMode == E_EditPrintMode.Edit && VwMode == E_ViewMode.Edit);
|
||||
// if (!ReadOnly && !edit) ReadOnly = true;
|
||||
// return;
|
||||
//}
|
||||
OrigDisplayText = vlntxt;
|
||||
|
||||
//C2026-021 Expand Functionality of Viewing Mode
|
||||
StepPanel pnl = (Parent as RTBItem)?.MyStepPanel;
|
||||
if (pnl?.ApplDisplayMode > 0)
|
||||
{
|
||||
MyItemInfo.MyDocVersion.DocVersionConfig.SelectedSlave = pnl.ApplDisplayMode;
|
||||
}
|
||||
else
|
||||
{
|
||||
MyItemInfo.MyDocVersion.DocVersionConfig.SelectedSlave = 0;
|
||||
}
|
||||
|
||||
DisplayText vlntxt = new DisplayText(MyItemInfo, E_EditPrintMode.Edit, VwMode, !ActiveMode, FieldToEdit, true,null, null,false);
|
||||
if (pnl?.ApplDisplayMode > 0 && MyItemInfo.MyContent.ContentRoUsageCount > 0)
|
||||
{
|
||||
vlntxt.StartText = RefreshROsWithUnitStartText(vlntxt.StartText, pnl.ApplDisplayMode);
|
||||
}
|
||||
|
||||
//Volian.Base.Library.HWndCounter.GetWindowHandlesForCurrentProcess(this.Handle, "RefreshDisplay 3");
|
||||
//if (_origDisplayText != null && vlntxt.StartText == _origDisplayText.StartText)
|
||||
//{
|
||||
// ReadOnly = !(EpMode == E_EditPrintMode.Edit && VwMode == E_ViewMode.Edit);
|
||||
// if (!ReadOnly && !edit) ReadOnly = true;
|
||||
// return;
|
||||
//}
|
||||
OrigDisplayText = vlntxt;
|
||||
//Volian.Base.Library.HWndCounter.GetWindowHandlesForCurrentProcess(this.Handle, "RefreshDisplay 4");
|
||||
|
||||
// RHM 20101201 - Don't reset the text. Calculate the text and compare it with the existing text in AddRTFText
|
||||
@@ -656,7 +673,48 @@ namespace Volian.Controls.Library
|
||||
Application.DoEvents();
|
||||
}
|
||||
|
||||
private bool IsDerived(StepConfig sc)
|
||||
//C2026-021 Expand Functionality of Viewing Mode
|
||||
//regex for finding Referenced object links
|
||||
private static Regex regRefObj = new Regex(@"\#Link\:ReferencedObject:([0-9]*) ([0-9a-zA-Z]*) ([0-9]*)", RegexOptions.Singleline);
|
||||
|
||||
//Replace the Default RO text with Unit Specific RO text
|
||||
private string RefreshROsWithUnitStartText(string startText, int unitID)
|
||||
{
|
||||
ROFSTLookup lookup = MyItemInfo.MyDocVersion.DocVersionAssociations[0].MyROFst.GetROFSTLookup(MyItemInfo.MyDocVersion);
|
||||
|
||||
MatchCollection mc = regRefObj.Matches(startText);
|
||||
|
||||
if (mc.Count == 0)
|
||||
return startText;
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
int lastindex = 0;
|
||||
|
||||
foreach (Match match in mc)
|
||||
{
|
||||
//get where ther default text for the RO starts
|
||||
int indx = startText.LastIndexOf(@"\v <START]\v0", match.Index) + 13;
|
||||
|
||||
//get the RO, value will be the unit related value
|
||||
ROFSTLookup.rochild roc = lookup.GetRoChild(ROFSTLookup.FormatRoidKey(match.Groups[2].Value, true));
|
||||
|
||||
// append before tags up through the <START]\v0
|
||||
//note if multiple tags this will also append the end up the previous tags
|
||||
sb.Append(startText.Substring(lastindex, indx - lastindex));
|
||||
|
||||
//append the unit specific RO value (replacing where the default RO value was)
|
||||
sb.Append($@"\cf1 {roc.value}\cf0\v");
|
||||
|
||||
lastindex = match.Index;
|
||||
}
|
||||
|
||||
//append referenced object tag & text after tag
|
||||
sb.Append(startText.Substring(lastindex));
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
private bool IsDerived(StepConfig sc)
|
||||
{
|
||||
foreach (EnhancedDocument ed in sc.MyEnhancedDocuments)
|
||||
if (ed.Type == 0) //New Design
|
||||
|
||||
Reference in New Issue
Block a user