|
using System.Collections.Generic;
using System.Drawing;
using System.Text;
namespace ErkerTech.DeltaScope.View.Models
{
public class MoveStruct
{
public int LeftMove;
public int RightMove;
public MoveStruct ()
{
LeftMove = -1;
RightMove = -1;
}
public MoveStruct(int tnLeft, int tnRight)
{
LeftMove = tnLeft * -1;
RightMove = tnRight * -1;
}
}
public class LineInfo
{
public string Line;
public int Top;
public int Height;
public LineInfo(string tsLine)
{
Line = tsLine;
Top = 0;
Height = 0;
}
public LineInfo(string tsLine, int tnTop, int tnHeight)
{
Line = tsLine;
Top = tnTop;
Height = tnHeight;
}
}
public class SideStructure
{
public string Text;
public LineInfo [] ALines;
public Rectangle Rect;
public SideStructure(string tsText)
{
Text = tsText;
Rect = Rectangle.Empty;
ALines = ParseText(tsText);
}
public SideStructure ( IList<string> tsTextList )
{
Rect = Rectangle.Empty;
var sb = new StringBuilder();
for (var i = 0; i < tsTextList.Count; i++)
sb.AppendLine(tsTextList[i]);
Text = sb.ToString();
ALines = ParseText(Text);
}
public void MoveRectTop(int tnTopDelta)
{
Rect = new Rectangle(Rect.Left, Rect.Top + tnTopDelta, Rect.Width, Rect.Height);
foreach (var loLine in ALines)
loLine.Top += tnTopDelta;
}
private static LineInfo[] ParseText(string tsText)
{
var loList = new List<LineInfo>();
foreach (var lsLine in tsText.Split('\n'))
loList.Add(new LineInfo(lsLine));
return loList.ToArray();
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.