C2026-043-Tech-Debt_v1 - Stash 1
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Drawing;
|
||||
using System.Runtime.InteropServices;
|
||||
@@ -450,11 +448,6 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
#endregion
|
||||
#region Structures
|
||||
//struct CharRange
|
||||
//{
|
||||
// public int cpMin;
|
||||
// public int cpMax;
|
||||
//}
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 4, CharSet = CharSet.Auto)]
|
||||
public struct CharFormat2
|
||||
{
|
||||
@@ -874,25 +867,6 @@ namespace Volian.Controls.Library
|
||||
pft.dySpaceBefore = spaceBefore * 1440 / dpi;
|
||||
SetParaFormat(richTextBox, pft);
|
||||
}
|
||||
//developed for equation editor interface work, but ended up not needing it. Kept it in
|
||||
// case it is needed in the future.
|
||||
//public static void SetSpaceAfter(RichTextBox richTextBox, int spaceAfter)
|
||||
//{
|
||||
// ParaFormatTwo pft = GetParaFormat(richTextBox);
|
||||
// pft.dwMask = 0;
|
||||
// pft.dwMask |= ParaFormatMasks.PFM_SPACEAFTER;
|
||||
// // get the monitor's resolution in DPI and use it to set the linespacing value for
|
||||
// // the richtextbox. Note that without this, the Arial Unicode font made the appearance of
|
||||
// // almost double linespacing. Using PFS_Exact makes it appear as regular single spacing.
|
||||
// Graphics g = richTextBox.CreateGraphics();
|
||||
// int dpi = Convert.ToInt32((g.DpiX + g.DpiY) / 2);
|
||||
// g.Dispose();
|
||||
// // dyLineSpacing is Spacing between lines. the PFS_EXACT sets line spacing as the spacing from one
|
||||
// //line to the next, in twips - thus the 1440.
|
||||
|
||||
// pft.dySpaceAfter = spaceAfter * 1440 / dpi;
|
||||
// SetParaFormat(richTextBox, pft);
|
||||
//}
|
||||
public static void SetLineSpacing(RichTextBox richTextBox, ParaSpacing type)
|
||||
{
|
||||
ParaFormatTwo pft = GetParaFormat(richTextBox);
|
||||
@@ -955,22 +929,18 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
SetCharFormat(richTextBox, RTBSelection.SCF_SELECTION, cft);
|
||||
}
|
||||
public static bool IsSuperScript(RichTextBox richTextBox)
|
||||
{
|
||||
return (richTextBox.SelectionCharOffset>0);
|
||||
}
|
||||
public static bool IsSubScript(RichTextBox richTextBox)
|
||||
{
|
||||
return (richTextBox.SelectionCharOffset < 0);
|
||||
}
|
||||
public static void ToggleSubscript(bool bSet, RichTextBox richTextBox, RTBSelection selection)
|
||||
public static bool IsSuperScript(RichTextBox richTextBox) => (richTextBox.SelectionCharOffset > 0);
|
||||
public static bool IsSubScript(RichTextBox richTextBox) => (richTextBox.SelectionCharOffset < 0);
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "Keeping RTBSelection")]
|
||||
public static void ToggleSubscript(bool bSet, RichTextBox richTextBox, RTBSelection selection)
|
||||
{
|
||||
if (bSet)
|
||||
richTextBox.SelectionCharOffset = -2;
|
||||
else
|
||||
richTextBox.SelectionCharOffset = 0;
|
||||
}
|
||||
public static void ToggleSuperscript(bool bSet, RichTextBox richTextBox, RTBSelection selection)
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "Keeping RTBSelection")]
|
||||
public static void ToggleSuperscript(bool bSet, RichTextBox richTextBox, RTBSelection selection)
|
||||
{
|
||||
if (bSet)
|
||||
richTextBox.SelectionCharOffset = 2;
|
||||
@@ -1040,70 +1010,6 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
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 void SetLink(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_LINK | RTBAPI.CharFormatMasks.CFM_PROTECTED;
|
||||
// cft.dwEffects = RTBAPI.CharFormatEffects.CFE_LINK | RTBAPI.CharFormatEffects.CFE_PROTECTED;
|
||||
// // 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;
|
||||
//}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user