This commit is contained in:
parent
130c6e6aca
commit
111ff933be
@ -126,8 +126,8 @@ namespace Volian.Controls.Library
|
||||
// save portion of this code for an explanation.
|
||||
text = text.Replace(@"\~", @"\u160?");
|
||||
text = text.Replace("\r\n", @"\par ");
|
||||
if (text.IndexOf(@"\line") > -1)
|
||||
MessageBox.Show("Found rtf line");
|
||||
//if (text.IndexOf(@"\line") > -1)
|
||||
// MessageBox.Show("Found rtf line");
|
||||
text = text.Replace(@"\line", @"\par");
|
||||
|
||||
// add colors around links:
|
||||
|
@ -913,7 +913,6 @@ namespace Volian.Controls.Library
|
||||
return (((cft.dwMask & CharFormatMasks.CFM_SUPERSCRIPT) == CharFormatMasks.CFM_SUPERSCRIPT) &&
|
||||
((cft.dwEffects & CharFormatEffects.CFE_SUPERSCRIPT) == CharFormatEffects.CFE_SUPERSCRIPT));
|
||||
}
|
||||
|
||||
public static bool IsSubScript(RichTextBox richTextBox)
|
||||
{
|
||||
CharFormatTwo cft = GetCharFormat(richTextBox, RTBSelection.SCF_SELECTION);
|
||||
@ -925,12 +924,13 @@ namespace Volian.Controls.Library
|
||||
CharFormatTwo cft = GetCharFormat(richTextBox, selection); // RTBSelection.SCF_SELECTION);
|
||||
if (bSet)
|
||||
{
|
||||
cft.dwEffects |= CharFormatEffects.CFE_SUBSCRIPT;
|
||||
cft.dwMask |= CharFormatMasks.CFM_SUBSCRIPT;
|
||||
cft.dwEffects = CharFormatEffects.CFE_SUBSCRIPT;
|
||||
cft.dwMask = CharFormatMasks.CFM_SUBSCRIPT;
|
||||
}
|
||||
else
|
||||
{
|
||||
cft.dwEffects &= ~RTBAPI.CharFormatEffects.CFE_SUBSCRIPT;
|
||||
cft.dwEffects = CharFormatEffects.CFE_NONE;
|
||||
cft.dwMask = CharFormatMasks.CFM_SUBSCRIPT;
|
||||
}
|
||||
SetCharFormat(richTextBox, selection, cft);
|
||||
}
|
||||
@ -939,12 +939,13 @@ namespace Volian.Controls.Library
|
||||
CharFormatTwo cft = RTBAPI.GetCharFormat(richTextBox, selection); // RTBAPI.RTBSelection.SCF_SELECTION);
|
||||
if (bSet)
|
||||
{
|
||||
cft.dwEffects |= RTBAPI.CharFormatEffects.CFE_SUPERSCRIPT;
|
||||
cft.dwMask |= RTBAPI.CharFormatMasks.CFM_SUPERSCRIPT;
|
||||
cft.dwEffects = RTBAPI.CharFormatEffects.CFE_SUPERSCRIPT;
|
||||
cft.dwMask = RTBAPI.CharFormatMasks.CFM_SUPERSCRIPT;
|
||||
}
|
||||
else
|
||||
{
|
||||
cft.dwEffects &= ~RTBAPI.CharFormatEffects.CFE_SUPERSCRIPT;
|
||||
cft.dwEffects = RTBAPI.CharFormatEffects.CFE_NONE;
|
||||
cft.dwMask = RTBAPI.CharFormatMasks.CFM_SUPERSCRIPT;
|
||||
}
|
||||
SetCharFormat(richTextBox, selection, cft);
|
||||
}
|
||||
@ -959,12 +960,13 @@ namespace Volian.Controls.Library
|
||||
CharFormatTwo cft = GetCharFormat(richTextBox, selection);
|
||||
if (bSet)
|
||||
{
|
||||
cft.dwEffects |= CharFormatEffects.CFE_BOLD;
|
||||
cft.dwMask |= CharFormatMasks.CFM_BOLD;
|
||||
cft.dwEffects = CharFormatEffects.CFE_BOLD;
|
||||
cft.dwMask = CharFormatMasks.CFM_BOLD;
|
||||
}
|
||||
else
|
||||
{
|
||||
cft.dwEffects &= ~RTBAPI.CharFormatEffects.CFE_BOLD;
|
||||
cft.dwEffects = CharFormatEffects.CFE_NONE;
|
||||
cft.dwMask = CharFormatMasks.CFM_BOLD;
|
||||
}
|
||||
SetCharFormat(richTextBox, selection, cft);
|
||||
}
|
||||
@ -979,12 +981,13 @@ namespace Volian.Controls.Library
|
||||
CharFormatTwo cft = GetCharFormat(richTextBox, selection);
|
||||
if (bSet)
|
||||
{
|
||||
cft.dwEffects |= CharFormatEffects.CFE_UNDERLINE;
|
||||
cft.dwMask |= CharFormatMasks.CFM_UNDERLINE;
|
||||
cft.dwEffects = CharFormatEffects.CFE_UNDERLINE;
|
||||
cft.dwMask = CharFormatMasks.CFM_UNDERLINE;
|
||||
}
|
||||
else
|
||||
{
|
||||
cft.dwEffects &= ~RTBAPI.CharFormatEffects.CFE_UNDERLINE;
|
||||
cft.dwEffects = CharFormatEffects.CFE_NONE;
|
||||
cft.dwMask = CharFormatMasks.CFM_UNDERLINE;
|
||||
}
|
||||
SetCharFormat(richTextBox, selection, cft);
|
||||
}
|
||||
@ -999,60 +1002,61 @@ namespace Volian.Controls.Library
|
||||
CharFormatTwo cft = GetCharFormat(richTextBox, selection);
|
||||
if (bSet)
|
||||
{
|
||||
cft.dwEffects |= CharFormatEffects.CFE_ITALIC;
|
||||
cft.dwMask |= CharFormatMasks.CFM_ITALIC;
|
||||
cft.dwEffects = CharFormatEffects.CFE_ITALIC;
|
||||
cft.dwMask = CharFormatMasks.CFM_ITALIC;
|
||||
}
|
||||
else
|
||||
{
|
||||
cft.dwEffects &= ~RTBAPI.CharFormatEffects.CFE_ITALIC;
|
||||
cft.dwEffects = CharFormatEffects.CFE_NONE;
|
||||
cft.dwMask = CharFormatMasks.CFM_ITALIC;
|
||||
}
|
||||
SetCharFormat(richTextBox, selection, cft);
|
||||
}
|
||||
public static bool IsLink(RichTextBox richTextBox)
|
||||
{
|
||||
CharFormatTwo cft = GetCharFormat(richTextBox, RTBSelection.SCF_SELECTION);
|
||||
return ((cft.dwEffects & CharFormatEffects.CFE_PROTECTED) == CharFormatEffects.CFE_PROTECTED);
|
||||
}
|
||||
public static void ToggleLink(bool bSet, RichTextBox richTextBox, RTBSelection selection)
|
||||
{
|
||||
CharFormatTwo cft = GetCharFormat(richTextBox, selection);
|
||||
if (bSet)
|
||||
{
|
||||
cft.dwEffects |= CharFormatEffects.CFE_LINK;
|
||||
cft.dwMask |= CharFormatMasks.CFM_LINK;
|
||||
}
|
||||
else
|
||||
{
|
||||
cft.dwEffects &= ~RTBAPI.CharFormatEffects.CFE_LINK;
|
||||
}
|
||||
SetCharFormat(richTextBox, selection, cft);
|
||||
}
|
||||
public static void UnProtect(RichTextBox richTextBox) //, string type, string text, string link)
|
||||
{
|
||||
//richTextBox.DetectUrls = false;
|
||||
CharFormatTwo cft = GetCharFormat(richTextBox, RTBAPI.RTBSelection.SCF_SELECTION); ;
|
||||
//int position = richTextBox.SelectionStart = richTextBox.TextLength;
|
||||
//richTextBox.SelectionLength = 0;
|
||||
//richTextBox.SelectedRtf = @"{\rtf1\ansi " + text + @"\v #" + link + @"\v0}";
|
||||
//richTextBox.SelectedRtf = "{" + string.Format(@"\rtf1\ansi\protect\v {0}\v0 {1}\v #{2}", type, text, link) + "}";
|
||||
//richTextBox.Select(position, type.Length + text.Length + link.Length + 1);
|
||||
cft.dwMask = RTBAPI.CharFormatMasks.CFM_PROTECTED;
|
||||
cft.dwEffects = 0;
|
||||
// The lines below can be used to allow link text to be edited
|
||||
//charFormat.dwMask = RTBAPI.CharFormatMasks.CFM_LINK;
|
||||
//charFormat.dwEffects = RTBAPI.CharFormatEffects.CFE_LINK;
|
||||
SetCharFormat(richTextBox, RTBSelection.SCF_SELECTION, cft);
|
||||
//rtbRTF.SetSelectionLink(true);
|
||||
//richTextBox.SelectionStart = richTextBox.TextLength;
|
||||
//richTextBox.SelectionLength = 0;
|
||||
}
|
||||
public static void Protect(RichTextBox richTextBox) //, string type, string text, string link)
|
||||
{
|
||||
CharFormatTwo cft = GetCharFormat(richTextBox, RTBAPI.RTBSelection.SCF_SELECTION); ;
|
||||
cft.dwMask = CharFormatMasks.CFM_PROTECTED;
|
||||
cft.dwEffects = CharFormatEffects.CFE_PROTECTED;
|
||||
SetCharFormat(richTextBox, RTBSelection.SCF_SELECTION, cft);
|
||||
}
|
||||
//public static bool IsLink(RichTextBox richTextBox)
|
||||
//{
|
||||
// CharFormatTwo cft = GetCharFormat(richTextBox, RTBSelection.SCF_SELECTION);
|
||||
// return ((cft.dwEffects & CharFormatEffects.CFE_PROTECTED) == CharFormatEffects.CFE_PROTECTED);
|
||||
//}
|
||||
//public static void ToggleLink(bool bSet, RichTextBox richTextBox, RTBSelection selection)
|
||||
//{
|
||||
// CharFormatTwo cft = GetCharFormat(richTextBox, selection);
|
||||
// if (bSet)
|
||||
// {
|
||||
// cft.dwEffects |= CharFormatEffects.CFE_LINK;
|
||||
// cft.dwMask |= CharFormatMasks.CFM_LINK;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// cft.dwEffects &= ~RTBAPI.CharFormatEffects.CFE_LINK;
|
||||
// }
|
||||
// SetCharFormat(richTextBox, selection, cft);
|
||||
//}
|
||||
//public static void UnProtect(RichTextBox richTextBox) //, string type, string text, string link)
|
||||
//{
|
||||
// //richTextBox.DetectUrls = false;
|
||||
// CharFormatTwo cft = GetCharFormat(richTextBox, RTBAPI.RTBSelection.SCF_SELECTION); ;
|
||||
// //int position = richTextBox.SelectionStart = richTextBox.TextLength;
|
||||
// //richTextBox.SelectionLength = 0;
|
||||
// //richTextBox.SelectedRtf = @"{\rtf1\ansi " + text + @"\v #" + link + @"\v0}";
|
||||
// //richTextBox.SelectedRtf = "{" + string.Format(@"\rtf1\ansi\protect\v {0}\v0 {1}\v #{2}", type, text, link) + "}";
|
||||
// //richTextBox.Select(position, type.Length + text.Length + link.Length + 1);
|
||||
// cft.dwMask = RTBAPI.CharFormatMasks.CFM_PROTECTED;
|
||||
// cft.dwEffects = 0;
|
||||
// // The lines below can be used to allow link text to be edited
|
||||
// //charFormat.dwMask = RTBAPI.CharFormatMasks.CFM_LINK;
|
||||
// //charFormat.dwEffects = RTBAPI.CharFormatEffects.CFE_LINK;
|
||||
// SetCharFormat(richTextBox, RTBSelection.SCF_SELECTION, cft);
|
||||
// //rtbRTF.SetSelectionLink(true);
|
||||
// //richTextBox.SelectionStart = richTextBox.TextLength;
|
||||
// //richTextBox.SelectionLength = 0;
|
||||
//}
|
||||
//public static void Protect(RichTextBox richTextBox) //, string type, string text, string link)
|
||||
//{
|
||||
// CharFormatTwo cft = GetCharFormat(richTextBox, RTBAPI.RTBSelection.SCF_SELECTION); ;
|
||||
// cft.dwMask = CharFormatMasks.CFM_PROTECTED;
|
||||
// cft.dwEffects = CharFormatEffects.CFE_PROTECTED;
|
||||
// SetCharFormat(richTextBox, RTBSelection.SCF_SELECTION, cft);
|
||||
//}
|
||||
//public static void SetLink(RichTextBox richTextBox, string type, string text, string link)
|
||||
//{
|
||||
// richTextBox.DetectUrls = false;
|
||||
|
@ -166,7 +166,6 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
_InitializingRTB = true;
|
||||
_SelectedRtfSB.Remove(0, _SelectedRtfSB.Length);
|
||||
|
||||
DisplayText vlntxt = new DisplayText(_MyItemInfo, EpMode, VwMode, !edit, FieldToEdit);
|
||||
//if (_origDisplayText != null && vlntxt.StartText == _origDisplayText.StartText)
|
||||
//{
|
||||
@ -179,6 +178,7 @@ namespace Volian.Controls.Library
|
||||
// Use Times New Roman for Debugging
|
||||
//Font = new Font("Times New Roman", 14, FontStyle.Regular);
|
||||
Font = _origDisplayText.TextFont.WindowsFont;
|
||||
//Font = new Font("Times New Roman", _origDisplayText.TextFont.WindowsFont.Size, _origDisplayText.TextFont.WindowsFont.Style);
|
||||
#elif(RELEASE)
|
||||
Font = _origDisplayText.TextFont.WindowsFont; // font defined in plant's format
|
||||
#else //DEMO
|
||||
@ -191,7 +191,7 @@ namespace Volian.Controls.Library
|
||||
// was confusing the 'handle' of the rtf box.
|
||||
RTBAPI.SetLineSpacing(this, RTBAPI.ParaSpacing.PFS_EXACT);
|
||||
AddRtfText(vlntxt.StartText);
|
||||
AddRtfStyles();
|
||||
//AddRtfStyles();
|
||||
// set readonly based on initial modes, however, these may change if
|
||||
// user selected view mode.
|
||||
ReadOnly = !(EpMode == E_EditPrintMode.Edit && VwMode == E_ViewMode.Edit);
|
||||
@ -721,10 +721,10 @@ namespace Volian.Controls.Library
|
||||
if (SelectionLength > 0) DeleteCurrentSelection(null);
|
||||
int position = SelectionStart;
|
||||
SelectionLength = 0;
|
||||
Console.WriteLine(this.Rtf);
|
||||
//Console.WriteLine(this.Rtf);
|
||||
linkValue = linkValue.Replace("\\u8209?", "\\f1\\u8209?\\f0 ");
|
||||
SelectedRtf = @"{\rtf1\ansi"+FontTable+@"{\colortbl ;\red255\green0\blue0;}\v"+FontSize+@" <START]\v0\cf1 " + linkValue + @"\cf0\v " + linkUrl + @"\v0 \v [END>\v0 }";
|
||||
Console.WriteLine(this.Rtf);
|
||||
//Console.WriteLine(this.Rtf);
|
||||
this.SelectionLength = 0;
|
||||
this.SelectionStart = position;
|
||||
FindAllLinks();
|
||||
|
Loading…
x
Reference in New Issue
Block a user