This commit is contained in:
2010-09-21 18:36:49 +00:00
parent 6634758e73
commit 22831cc08d
7 changed files with 144 additions and 132 deletions

View File

@@ -720,7 +720,9 @@ namespace Volian.Controls.Library
_SelectedRtfSB.Append(@"{\f1\fnil\fcharset0 VESymbFix;}}{\colortbl ;\red255\green0\blue0;}");
_SelectedRtfSB.Append("\r\n");
// use styles to construct rtf commands to insert into next line (where \b, etc is)
_SelectedRtfSB.Append(@"\viewkind4\uc1\pard\sl-240\slmult0" + sbbeg.ToString() + @"\fs" + Convert.ToInt32(this.Font.SizeInPoints * 2).ToString() + @" "); // \f0\fs" + this.Font.SizeInPoints * 2 + @" " + myDisplayTextElement.Text + @"}";
//_SelectedRtfSB.Append(@"\viewkind4\uc1\pard\sl-240\slmult0" + sbbeg.ToString() + @"\fs" + Convert.ToInt32(this.Font.SizeInPoints * 2).ToString() + @" "); // \f0\fs" + this.Font.SizeInPoints * 2 + @" " + myDisplayTextElement.Text + @"}";
_SelectedRtfSB.Append(@"\viewkind4\uc1\sb240\slmult0\pard" + sbbeg.ToString() + @"\fs" + Convert.ToInt32(this.Font.SizeInPoints * 2).ToString() + @" "); // \f0\fs" + this.Font.SizeInPoints * 2 + @" " + myDisplayTextElement.Text + @"}";
}
private bool FontIsFixed()
@@ -2344,77 +2346,6 @@ namespace Volian.Controls.Library
@"\u9508", // HEX@"\u2524",// Right Tee - 16-bit char: '\xB4'
@"\u9532", // HEX@"\u253c" // + Plus - 16-bit char: '\xC5'
};
public static string Repeat(string str, int count)
{
StringBuilder lStr = new StringBuilder();
for (int i = 0; i < count; i++)
lStr.Append(str);
return lStr.ToString();
}
public void OutlineTable(bool withBorder)
{
if (_MyStepItem != null) // Set the width based upon the contents
{
int newwidth = (int)_MyStepItem.TableWidth(Font, Text, true);
if (_MyStepItem.ItemWidth != newwidth)
{
_MyStepItem.ItemWidth = newwidth;
}
}
// Determine the number of characters per line
int w = MaxCharacterWidth();
//Console.WriteLine("'Row','last','Start','w2','w','w3','offset1','offset2'");
string horzLine = Repeat(withBorder ? @"\u9472?" : " ", w);
// Determine the number of lines
int l = Lines.Length;
int lastoffset = 0;
for (int row = 0; row < Lines.Length; row++)
{
//string strb4 = Lines[row];
//int spaces = w - line.Length;
int offset1 = GetFirstCharIndexFromLine(row);
if (lastoffset != offset1)
{
//Console.WriteLine("OFFSET MISMATCH {0},{1}", lastoffset, offset1);
offset1 = lastoffset;
}
Select(offset1, 0);
string cleanLine = RemoveLinkComments(Lines[row]);
int w2 = Lines[row].Length;
int w3 = cleanLine.Length;
int offset2 = SelectionStart + w2 + (w - w3) + 1;
lastoffset = offset2 + 2;
int selStart = SelectionStart;
SelectedRtf = RtfPrefix + (withBorder ? @"\u9474?" : " ") + "}";
Select(SelectionStart + w2, 0);
if (w3 < w)
{
SelectedText = "".PadRight(w - w3);
Select(offset2, 0);
}
SelectedRtf = RtfPrefix + (withBorder ? @"\u9474?" : " ") + "}";
//string strafter = Lines[row];
//Console.WriteLine("'{0}'\r\n'{1}'\r\n'{2}'", strb4, strafter,cleanLine);
//Console.WriteLine("{0},{1},{2},{3},{4},{5},{6},{7}", row, selStart, SelectionStart, w2, w, w3, offset1, offset2);
}
// Add the top line
//if (_MyStepItem != null)
//{
// Console.WriteLine("Char[0]={0:X}", (int)(Text[0]));
// _MyStepItem.ItemWidth = (int)_MyStepItem.TableWidth(Font, Text.Replace('\u2502','-'), false);
//}
//Console.WriteLine("After Edges\n{0}\n{1}", Rtf, Text);
Select(0, 0);
SelectedRtf = RtfPrefix + (withBorder ? @"\u9484?" : " ") + horzLine + (withBorder ? @"\u9488?\par " : @" \par ") + "}";
// Add the bottom line
Select(TextLength, 0);
ContentsResized += new ContentsResizedEventHandler(StepRTB_ContentsResized);
SelectedRtf = RtfPrefix + (withBorder ? @"\par\u9492?" : @"\par ") + horzLine + (withBorder ? @"\u9496?" : @" ") + "}";
ContentsResized -= new ContentsResizedEventHandler(StepRTB_ContentsResized);
//Console.WriteLine("After Top and Bottom\n{0}\n{1}", Rtf, Text);
ReplaceLinesInTable(withBorder);
}
private int MaxCharacterWidth()
{
// loop through lines and get the width in characters