Changed CheckOffs
Made DisplayText more generic Added comments - Added parameter to DisplayText - Removed specific OutlineTable
This commit is contained in:
@@ -121,14 +121,14 @@ namespace Volian.Controls.Library
|
|||||||
cbCAS.Checked = sc.Step_CAS;
|
cbCAS.Checked = sc.Step_CAS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(fmtdata.ProcData.CheckOffData.CheckOffList == null) && !(fmtdata.ProcData.CheckOffData.CheckOffList.Count == 0))
|
//if (!(fmtdata.ProcData.CheckOffData.CheckOffList == null) && !(fmtdata.ProcData.CheckOffData.CheckOffList.Count == 0))
|
||||||
{
|
//{
|
||||||
foreach (CheckOff co in fmtdata.ProcData.CheckOffData.CheckOffList)
|
// foreach (CheckOff co in fmtdata.ProcData.CheckOffData.CheckOffList)
|
||||||
{
|
// {
|
||||||
cmbCheckoff.Items.Add(co.RightCheckOffPrompt);
|
// cmbCheckoff.Items.Add(co.RightCheckOffPrompt);
|
||||||
}
|
// }
|
||||||
if (sc.Step_CheckOffIndex != -1) cmbCheckoff.SelectedIndex = sc.Step_CheckOffIndex;
|
// if (sc.Step_CheckOffIndex != -1) cmbCheckoff.SelectedIndex = sc.Step_CheckOffIndex;
|
||||||
}
|
//}
|
||||||
|
|
||||||
// change bar setting depends on whether step has changed (dts) as compared to date/time off the
|
// change bar setting depends on whether step has changed (dts) as compared to date/time off the
|
||||||
// procedure that it's in.
|
// procedure that it's in.
|
||||||
|
@@ -109,22 +109,63 @@ namespace Volian.Controls.Library
|
|||||||
/// bool noEdit - flags whether to edit or not (used to set data in
|
/// bool noEdit - flags whether to edit or not (used to set data in
|
||||||
/// rtb as resolved replacewords for non-active rtb.
|
/// rtb as resolved replacewords for non-active rtb.
|
||||||
/// E_FieldToEdit fieldToEdit - identifies the field to edit (number or text)
|
/// E_FieldToEdit fieldToEdit - identifies the field to edit (number or text)
|
||||||
|
/// bool colorLinks - whether to add color to links
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DisplayText(ItemInfo itemInfo, E_EditPrintMode epMode, E_ViewMode vwMode, bool noEdit,E_FieldToEdit fieldToEdit)
|
public DisplayText(ItemInfo itemInfo, E_EditPrintMode epMode, E_ViewMode vwMode, bool noEdit,E_FieldToEdit fieldToEdit, bool colorLinks)
|
||||||
{
|
{
|
||||||
_FieldToEdit = fieldToEdit;
|
_FieldToEdit = fieldToEdit;
|
||||||
_MyItemInfo = itemInfo;
|
_MyItemInfo = itemInfo;
|
||||||
OriginalText = InfoText;
|
OriginalText = InfoText;
|
||||||
TextFont = itemInfo.GetItemFont();//GetItemFont();
|
TextFont = itemInfo.GetItemFont();//GetItemFont();
|
||||||
string text = InfoText;
|
string text = InfoText;
|
||||||
|
_MyFormat = itemInfo.ActiveFormat;
|
||||||
|
|
||||||
|
bool tableShouldBeOutlined = (epMode == E_EditPrintMode.Print || vwMode == E_ViewMode.View || noEdit) &&
|
||||||
|
(_FieldToEdit == E_FieldToEdit.StepText || _FieldToEdit == E_FieldToEdit.Text) &&
|
||||||
|
(!itemInfo.IsSection && !itemInfo.IsProcedure) && (itemInfo.IsTable || itemInfo.IsFigure);
|
||||||
|
bool wordsShouldBeReplaced = epMode == E_EditPrintMode.Print || vwMode == E_ViewMode.View || noEdit;
|
||||||
|
bool numbersShouldBeFormated = (!_MyFormat.PlantFormat.FormatData.SectData.StepSectionData.FortranFormatNumbers && (epMode == E_EditPrintMode.Print || vwMode == E_ViewMode.View || noEdit));
|
||||||
|
int typ = ((int)itemInfo.MyContent.Type) % 10000;
|
||||||
|
bool tableHasBorder = tableShouldBeOutlined ? itemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[typ].Type.IndexOf(@"Borderless") < 0 : false;
|
||||||
|
|
||||||
|
text = CreateRtf(colorLinks, text, tableShouldBeOutlined, wordsShouldBeReplaced, numbersShouldBeFormated, tableHasBorder);
|
||||||
|
StartText = text;
|
||||||
|
}
|
||||||
|
public DisplayText(string text, VE_Font vFont, bool colorLinks)
|
||||||
|
{
|
||||||
|
TextFont = vFont;
|
||||||
|
StartText = CreateRtf(colorLinks, text, false, false, false, false);
|
||||||
|
}
|
||||||
|
private string CreateRtf(bool colorLinks, string text, bool tableShouldBeOutlined, bool wordsShouldBeReplaced, bool numbersShouldBeFormated, bool tableHasBorder)
|
||||||
|
{
|
||||||
|
// add colors around links:
|
||||||
|
if (colorLinks)
|
||||||
|
{
|
||||||
|
text = Regex.Replace(text, @"(<START\].*?\\v0) ", @"$1\cf1 ");
|
||||||
|
//text = Regex.Replace(text, @"<START]\b0\v0 ", @"<START]\b0\v0\cf1 ");
|
||||||
|
int indxcf = text.IndexOf("cf1");
|
||||||
|
while (indxcf != -1)
|
||||||
|
{
|
||||||
|
int indxend = text.IndexOf(@"\v", indxcf);
|
||||||
|
text = text.Insert(indxend, @"\cf0");
|
||||||
|
indxcf = text.IndexOf(@"cf1", indxend);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// determine whether the table/figure should be outlined:
|
||||||
|
if (tableShouldBeOutlined)
|
||||||
|
{
|
||||||
|
OutlineRTFTable myTable = new OutlineRTFTable(text, tableHasBorder);
|
||||||
|
myTable.OutlineTable();
|
||||||
|
text = myTable.Lines.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
// if in print mode, view mode, or non-active richtextbox do replace words. Only if in
|
// if in print mode, view mode, or non-active richtextbox do replace words. Only if in
|
||||||
// actual edit mode are replace words left as is.
|
// actual edit mode are replace words left as is.
|
||||||
_MyFormat = itemInfo.ActiveFormat;
|
|
||||||
if (epMode == E_EditPrintMode.Print || vwMode == E_ViewMode.View || noEdit) text = DoReplaceWords(text);
|
if (wordsShouldBeReplaced) text = DoReplaceWords(text);
|
||||||
|
|
||||||
// adjust formatting of exponents
|
// adjust formatting of exponents
|
||||||
if (!_MyFormat.PlantFormat.FormatData.SectData.StepSectionData.FortranFormatNumbers && (epMode == E_EditPrintMode.Print || vwMode == E_ViewMode.View || noEdit)) text = DoFortranFormat(text);
|
if (numbersShouldBeFormated) text = DoFortranFormat(text);
|
||||||
|
|
||||||
// as a precaution, convert any \~ to \u160?. This is for Hard spaces. see the commentary in the
|
// as a precaution, convert any \~ to \u160?. This is for Hard spaces. see the commentary in the
|
||||||
// save portion of this code for an explanation.
|
// save portion of this code for an explanation.
|
||||||
@@ -134,17 +175,6 @@ namespace Volian.Controls.Library
|
|||||||
// MessageBox.Show("Found rtf line");
|
// MessageBox.Show("Found rtf line");
|
||||||
text = text.Replace(@"\line", @"\par");
|
text = text.Replace(@"\line", @"\par");
|
||||||
|
|
||||||
// add colors around links:
|
|
||||||
text = Regex.Replace(text, @"(<START\].*?\\v0) ", @"$1\cf1 ");
|
|
||||||
//text = Regex.Replace(text, @"<START]\b0\v0 ", @"<START]\b0\v0\cf1 ");
|
|
||||||
int indxcf = text.IndexOf("cf1");
|
|
||||||
while (indxcf != -1)
|
|
||||||
{
|
|
||||||
int indxend = text.IndexOf(@"\v", indxcf);
|
|
||||||
text = text.Insert(indxend, @"\cf0 ");
|
|
||||||
indxcf = text.IndexOf(@"cf1", indxend);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Now put symbol (for fixed fonts) or unicode font (proportional) around symbols
|
// Now put symbol (for fixed fonts) or unicode font (proportional) around symbols
|
||||||
// These fonts are VESymbFix & Arial Unicode MS respectively, and the font table
|
// These fonts are VESymbFix & Arial Unicode MS respectively, and the font table
|
||||||
// is actually defined in the StepRTB code.
|
// is actually defined in the StepRTB code.
|
||||||
@@ -155,19 +185,19 @@ namespace Volian.Controls.Library
|
|||||||
if (text[indxsym + 2] != 'l')
|
if (text[indxsym + 2] != 'l')
|
||||||
{
|
{
|
||||||
text = text.Insert(indxsym, @"\f1 ");
|
text = text.Insert(indxsym, @"\f1 ");
|
||||||
int indxendsym = text.IndexOfAny(@"\ ?".ToCharArray(),indxsym+5);
|
int indxendsym = text.IndexOfAny(@"\ ?".ToCharArray(), indxsym + 5);
|
||||||
if (indxendsym == -1) // must be end of line:
|
if (indxendsym == -1) // must be end of line:
|
||||||
text = text.Insert(text.Length-1,@"\f0 ");
|
text = text.Insert(text.Length - 1, @"\f0 ");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (text[indxendsym]=='?') indxendsym++;
|
if (text[indxendsym] == '?') indxendsym++;
|
||||||
text = text.Insert(indxendsym, @"\f0 "); // TODO: do I need a space??
|
text = text.Insert(indxendsym, @"\f0 "); // TODO: do I need a space??
|
||||||
}
|
}
|
||||||
incrindx = 5;
|
incrindx = 5;
|
||||||
}
|
}
|
||||||
indxsym = text.IndexOf(@"\u",indxsym + incrindx);
|
indxsym = text.IndexOf(@"\u", indxsym + incrindx);
|
||||||
}
|
}
|
||||||
StartText = text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
private string DoFortranFormat(string text)
|
private string DoFortranFormat(string text)
|
||||||
@@ -195,7 +225,7 @@ namespace Volian.Controls.Library
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
FormatInfo formatInfo = _MyItemInfo.ActiveFormat;
|
//FormatInfo formatInfo = _MyItemInfo.ActiveFormat;
|
||||||
using (_MyItem = _MyItemInfo.Get())
|
using (_MyItem = _MyItemInfo.Get())
|
||||||
{
|
{
|
||||||
// check for different text, i.e. text from this itm doesn't match
|
// check for different text, i.e. text from this itm doesn't match
|
||||||
@@ -973,13 +1003,6 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region ReplaceWords
|
#region ReplaceWords
|
||||||
private ReplaceStr _rs;
|
|
||||||
//private string ReplaceIt(Match m)
|
|
||||||
//{
|
|
||||||
// string s = m.ToString();
|
|
||||||
// string t = s.Replace(_rs.ReplaceWord, _rs.ReplaceWith);
|
|
||||||
// return m.ToString().Replace(_rs.ReplaceWord, _rs.ReplaceWith);
|
|
||||||
//}
|
|
||||||
private string DoReplaceWords(string Text)
|
private string DoReplaceWords(string Text)
|
||||||
{
|
{
|
||||||
ReplaceStrList rsl = _MyFormat.PlantFormat.FormatData.SectData.ReplaceStrList;
|
ReplaceStrList rsl = _MyFormat.PlantFormat.FormatData.SectData.ReplaceStrList;
|
||||||
@@ -1032,7 +1055,7 @@ namespace Volian.Controls.Library
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// If there are Regex Control Characters '\[]()' prefix them with backslash
|
// If there are Regex Control Characters '\[]()' prefix them with backslash
|
||||||
string replaceWord = Regex.Replace(rs.ReplaceWord, @"\\[[\]()]", @"\$0");
|
string replaceWord = Regex.Replace(rs.ReplaceWord, @"[[\]\\()]", @"\$0");
|
||||||
string pat = @"(?<=\W|^)" + replaceWord + @"(?=\W|$)";
|
string pat = @"(?<=\W|^)" + replaceWord + @"(?=\W|$)";
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@@ -195,7 +195,7 @@ namespace Volian.Controls.Library
|
|||||||
switch (_MyChildRelation)
|
switch (_MyChildRelation)
|
||||||
{
|
{
|
||||||
case ChildRelation.None: // Same as after
|
case ChildRelation.None: // Same as after
|
||||||
case ChildRelation.After:
|
case ChildRelation.After: // Procedures, sections, substeps, and tables/figures
|
||||||
// The size depends upon the parent type
|
// The size depends upon the parent type
|
||||||
int iType = (int)_MyParentStepItem._Type;
|
int iType = (int)_MyParentStepItem._Type;
|
||||||
|
|
||||||
@@ -267,7 +267,7 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
// Same size as the Parent
|
// Same size as the Parent
|
||||||
break;
|
break;
|
||||||
case ChildRelation.Before:
|
case ChildRelation.Before: // Cautions and Notes
|
||||||
//if(_WatchThis > 0 && MyID > 2111)
|
//if(_WatchThis > 0 && MyID > 2111)
|
||||||
// Console.WriteLine("Setting MyParent: \r\n\tParent {0},{1} \r\n\tTopMostItem {2},{3} \r\n\tNext {4}, {5}", _MyParentStepItem.MyID, _MyParentStepItem
|
// Console.WriteLine("Setting MyParent: \r\n\tParent {0},{1} \r\n\tTopMostItem {2},{3} \r\n\tNext {4}, {5}", _MyParentStepItem.MyID, _MyParentStepItem
|
||||||
// ,_MyParentStepItem.TopMostStepItem.MyID,_MyParentStepItem.TopMostStepItem
|
// ,_MyParentStepItem.TopMostStepItem.MyID,_MyParentStepItem.TopMostStepItem
|
||||||
@@ -1849,7 +1849,8 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
foreach (string line in lines)
|
foreach (string line in lines)
|
||||||
{
|
{
|
||||||
string line2 = (addBorder ? "--" : "") + Regex.Replace(line, @"\\.*? ", ""); // Remove RTF Commands - Really should not be any
|
//string line2 = (addBorder ? "--" : "") + Regex.Replace(line, @"\\.*? ", ""); // Remove RTF Commands - Really should not be any
|
||||||
|
string line2 = Regex.Replace(line, @"\\.*? ", ""); // Remove RTF Commands - Really should not be any
|
||||||
//line2 = line2.Replace(@"\u8209?", "-");
|
//line2 = line2.Replace(@"\u8209?", "-");
|
||||||
//line2 = line2.Replace("<START]", "");
|
//line2 = line2.Replace("<START]", "");
|
||||||
//line2 = Regex.Replace(line2, @"#Link:.*?\[END>","");
|
//line2 = Regex.Replace(line2, @"#Link:.*?\[END>","");
|
||||||
|
@@ -68,7 +68,6 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Properties and Variables
|
#region Properties and Variables
|
||||||
|
|
||||||
private static FontFamily _MyFontFamily = null;
|
private static FontFamily _MyFontFamily = null;
|
||||||
public static FontFamily MyFontFamily
|
public static FontFamily MyFontFamily
|
||||||
{
|
{
|
||||||
@@ -196,7 +195,7 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
_InitializingRTB = true;
|
_InitializingRTB = true;
|
||||||
_SelectedRtfSB.Remove(0, _SelectedRtfSB.Length);
|
_SelectedRtfSB.Remove(0, _SelectedRtfSB.Length);
|
||||||
DisplayText vlntxt = new DisplayText(_MyItemInfo, EpMode, VwMode, !edit, FieldToEdit);
|
DisplayText vlntxt = new DisplayText(_MyItemInfo, EpMode, VwMode, !edit, FieldToEdit, true);
|
||||||
//if (_origDisplayText != null && vlntxt.StartText == _origDisplayText.StartText)
|
//if (_origDisplayText != null && vlntxt.StartText == _origDisplayText.StartText)
|
||||||
//{
|
//{
|
||||||
// ReadOnly = !(EpMode == E_EditPrintMode.Edit && VwMode == E_ViewMode.Edit);
|
// ReadOnly = !(EpMode == E_EditPrintMode.Edit && VwMode == E_ViewMode.Edit);
|
||||||
@@ -243,9 +242,14 @@ namespace Volian.Controls.Library
|
|||||||
RemoveEventHandlers();
|
RemoveEventHandlers();
|
||||||
if ((!_MyItemInfo.IsSection && !_MyItemInfo.IsProcedure) && (_MyItemInfo.IsTable || _MyItemInfo.IsFigure))
|
if ((!_MyItemInfo.IsSection && !_MyItemInfo.IsProcedure) && (_MyItemInfo.IsTable || _MyItemInfo.IsFigure))
|
||||||
{
|
{
|
||||||
int typ = ((int)_MyItemInfo.MyContent.Type) % 10000;
|
int newwidth = (int)_MyStepItem.TableWidth(Font, Text, true);
|
||||||
OutlineTable(_MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[typ].Type.IndexOf(@"Borderless")<0);
|
if (_MyStepItem.ItemWidth != newwidth)
|
||||||
FindAllLinks();
|
{
|
||||||
|
_MyStepItem.ItemWidth = newwidth;
|
||||||
|
}
|
||||||
|
// int typ = ((int)_MyItemInfo.MyContent.Type) % 10000;
|
||||||
|
// OutlineTable(_MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[typ].Type.IndexOf(@"Borderless")<0);
|
||||||
|
// FindAllLinks();
|
||||||
}
|
}
|
||||||
SelectAll();
|
SelectAll();
|
||||||
if (SelectionHangingIndent !=0) SelectionHangingIndent = 0;
|
if (SelectionHangingIndent !=0) SelectionHangingIndent = 0;
|
||||||
@@ -425,7 +429,6 @@ namespace Volian.Controls.Library
|
|||||||
Console.WriteLine("{0} - {1}", ex.GetType().Name, ex.Message);
|
Console.WriteLine("{0} - {1}", ex.GetType().Name, ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetUpStepRTB()
|
private void SetUpStepRTB()
|
||||||
{
|
{
|
||||||
C1SpellChecker2.SetActiveSpellChecking(this, true);
|
C1SpellChecker2.SetActiveSpellChecking(this, true);
|
||||||
@@ -472,7 +475,7 @@ namespace Volian.Controls.Library
|
|||||||
_MouseDown = false;
|
_MouseDown = false;
|
||||||
//Console.WriteLine("^^^^^^^^^^ StepRTB Mouse Up id= {0}", MyItemInfo.ItemID);
|
//Console.WriteLine("^^^^^^^^^^ StepRTB Mouse Up id= {0}", MyItemInfo.ItemID);
|
||||||
|
|
||||||
if (this.Focused) // Only HandleSelectionChange if this control has focus.
|
if(this.Focused) // Only HandleSelectionChange if this control has focus.
|
||||||
{
|
{
|
||||||
HandleSelectionChange();
|
HandleSelectionChange();
|
||||||
// save our context menu to add to the spell checker's context menu
|
// save our context menu to add to the spell checker's context menu
|
||||||
|
Reference in New Issue
Block a user