private void RenderMargin(int RowIndex)
{
GDISurface bbuff = GFX.BackBuffer;
if (Control.ShowGutterMargin)
{
bbuff.FillRect(GFX.GutterMarginBrush, 0, 0, Control.View.GutterMarginWidth, Control.View.RowHeight);
bbuff.FillRect(GFX.GutterMarginBorderBrush, Control.View.GutterMarginWidth - 1, 0, 1, Control.View.RowHeight);
if (RowIndex <= Control.Document.Count - 1)
{
Row r = Control.Document[RowIndex];
if (Control.View.RowHeight >= Control._SyntaxBox.GutterIcons.ImageSize.Height)
{
if (r.Bookmarked)
Control._SyntaxBox.GutterIcons.Draw(Graphics.FromHdc(bbuff.hDC), 0, 0, 1);
if (r.Breakpoint)
Control._SyntaxBox.GutterIcons.Draw(Graphics.FromHdc(bbuff.hDC), 0, 0, 0);
}
else
{
int w = Control.View.RowHeight;
if (r.Bookmarked)
Control._SyntaxBox.GutterIcons.Draw(Graphics.FromHdc(bbuff.hDC), 0, 0, w, w, 1);
if (r.Breakpoint)
Control._SyntaxBox.GutterIcons.Draw(Graphics.FromHdc(bbuff.hDC), 0, 0, w, w, 0);
}
if (r.Images != null)
{
foreach (int i in r.Images)
{
if (Control.View.RowHeight >= Control._SyntaxBox.GutterIcons.ImageSize.Height)
{
Control._SyntaxBox.GutterIcons.Draw(Graphics.FromHdc(bbuff.hDC), 0, 0, i);
}
else
{
int w = Control.View.RowHeight;
Control._SyntaxBox.GutterIcons.Draw(Graphics.FromHdc(bbuff.hDC), 0, 0, w, w, i);
}
}
}
}
}
if (Control.ShowLineNumbers)
{
bbuff.FillRect(GFX.LineNumberMarginBrush, Control.View.GutterMarginWidth, 0, Control.View.LineNumberMarginWidth + 1, Control.View.RowHeight);
//bbuff.FillRect (GFX.LineNumberMarginBrush ,Control.View.GutterMarginWidth+Control.View.LineNumberMarginWidth,0,1,Control.View.RowHeight);
for (int j = 0; j < Control.View.RowHeight; j += 2)
{
bbuff.FillRect(GFX.LineNumberMarginBorderBrush, Control.View.GutterMarginWidth + Control.View.LineNumberMarginWidth, j, 1, 1);
}
}
if (!Control.ShowLineNumbers || !Control.ShowGutterMargin)
bbuff.FillRect(GFX.BackgroundBrush, Control.View.TotalMarginWidth, 0, Control.View.TextMargin - Control.View.TotalMarginWidth - 3, Control.View.RowHeight);
else
bbuff.FillRect(GFX.BackgroundBrush, Control.View.TotalMarginWidth + 1, 0, Control.View.TextMargin - Control.View.TotalMarginWidth - 4, Control.View.RowHeight);
if (Control.ShowLineNumbers)
{
bbuff.Font = GFX.FontNormal;
bbuff.FontTransparent = true;
bbuff.TextForeColor = Control.LineNumberForeColor;
if (RowIndex <= Control.Document.Count - 1)
{
int nw = MeasureString((RowIndex + 1).ToString(CultureInfo.InvariantCulture)).Width;
bbuff.DrawTabbedString((RowIndex + 1).ToString(CultureInfo.InvariantCulture), Control.View.GutterMarginWidth + Control.View.LineNumberMarginWidth - nw - 1, 1, 0, Control.PixelTabSize);
}
}
}