void PaintCurrentBytesSign(Graphics g)
{
if(_keyInterpreter != null && Focused && _bytePos != -1 && Enabled)
{
if(_keyInterpreter.GetType() == typeof(KeyInterpreter))
{
if(_selectionLength == 0)
{
Point gp = GetGridBytePoint(_bytePos - _startByte);
PointF pf = GetByteStringPointF(gp);
Size s = new Size((int)_charSize.Width, (int)_charSize.Height);
Rectangle r = new Rectangle((int)pf.X, (int)pf.Y, s.Width, s.Height);
if(r.IntersectsWith(_recStringView))
{
r.Intersect(_recStringView);
PaintCurrentByteSign(g, r);
}
}
else
{
int lineWidth = (int)(_recStringView.Width-_charSize.Width);
Point startSelGridPoint = GetGridBytePoint(_bytePos-_startByte);
PointF startSelPointF = GetByteStringPointF(startSelGridPoint);
Point endSelGridPoint = GetGridBytePoint(_bytePos-_startByte+_selectionLength-1);
PointF endSelPointF = GetByteStringPointF(endSelGridPoint);
int multiLine = endSelGridPoint.Y - startSelGridPoint.Y;
if(multiLine == 0)
{
Rectangle singleLine = new Rectangle(
(int)startSelPointF.X,
(int)startSelPointF.Y,
(int)(endSelPointF.X-startSelPointF.X+_charSize.Width),
(int)_charSize.Height);
if(singleLine.IntersectsWith(_recStringView))
{
singleLine.Intersect(_recStringView);
PaintCurrentByteSign(g, singleLine);
}
}
else
{
Rectangle firstLine = new Rectangle(
(int)startSelPointF.X,
(int)startSelPointF.Y,
(int)(_recStringView.X+lineWidth-startSelPointF.X+_charSize.Width),
(int)_charSize.Height);
if(firstLine.IntersectsWith(_recStringView))
{
firstLine.Intersect(_recStringView);
PaintCurrentByteSign(g, firstLine);
}
if(multiLine > 1)
{
Rectangle betweenLines = new Rectangle(
_recStringView.X,
(int)(startSelPointF.Y+_charSize.Height),
(int)(_recStringView.Width),
(int)(_charSize.Height*(multiLine-1)));
if(betweenLines.IntersectsWith(_recStringView))
{
betweenLines.Intersect(_recStringView);
PaintCurrentByteSign(g, betweenLines);
}
}
Rectangle lastLine = new Rectangle(
_recStringView.X,
(int)endSelPointF.Y,
(int)(endSelPointF.X-_recStringView.X+_charSize.Width),
(int)_charSize.Height);
if(lastLine.IntersectsWith(_recStringView))
{
lastLine.Intersect(_recStringView);
PaintCurrentByteSign(g, lastLine);
}
}
}
}
else
{
if(_selectionLength == 0)
{
Point gp = GetGridBytePoint(_bytePos - _startByte);
PointF pf = GetBytePointF(gp);
Size s = new Size((int)_charSize.Width * 2, (int)_charSize.Height);
Rectangle r = new Rectangle((int)pf.X, (int)pf.Y, s.Width, s.Height);
PaintCurrentByteSign(g, r);
}
else
{
int lineWidth = (int)(_recHex.Width-_charSize.Width*5);
Point startSelGridPoint = GetGridBytePoint(_bytePos-_startByte);
PointF startSelPointF = GetBytePointF(startSelGridPoint);
Point endSelGridPoint = GetGridBytePoint(_bytePos-_startByte+_selectionLength-1);
PointF endSelPointF = GetBytePointF(endSelGridPoint);
int multiLine = endSelGridPoint.Y - startSelGridPoint.Y;
if(multiLine == 0)
{
Rectangle singleLine = new Rectangle(
(int)startSelPointF.X,
(int)startSelPointF.Y,
(int)(endSelPointF.X-startSelPointF.X+_charSize.Width*2),
(int)_charSize.Height);
if(singleLine.IntersectsWith(_recHex))
{
singleLine.Intersect(_recHex);
PaintCurrentByteSign(g, singleLine);
}
}
else
{
Rectangle firstLine = new Rectangle(
(int)startSelPointF.X,
(int)startSelPointF.Y,
(int)(_recHex.X+lineWidth-startSelPointF.X+_charSize.Width*2),
(int)_charSize.Height);
if(firstLine.IntersectsWith(_recHex))
{
firstLine.Intersect(_recHex);
PaintCurrentByteSign(g, firstLine);
}
if(multiLine > 1)
{
Rectangle betweenLines = new Rectangle(
_recHex.X,
(int)(startSelPointF.Y+_charSize.Height),
(int)(lineWidth+_charSize.Width*2),
(int)(_charSize.Height*(multiLine-1)));
if(betweenLines.IntersectsWith(_recHex))
{
betweenLines.Intersect(_recHex);
PaintCurrentByteSign(g, betweenLines);
}
}
Rectangle lastLine = new Rectangle(
_recHex.X,
(int)endSelPointF.Y,
(int)(endSelPointF.X-_recHex.X+_charSize.Width*2),
(int)_charSize.Height);
if(lastLine.IntersectsWith(_recHex))
{
lastLine.Intersect(_recHex);
PaintCurrentByteSign(g, lastLine);
}
}
}
}
}
}