public void DrawRectangleWithRuler (Cairo.Context cr, double x, Cairo.Rectangle area, Cairo.Color color, bool drawDefaultBackground)
{
bool isDefaultColor = color.R == defaultBgColor.R && color.G == defaultBgColor.G && color.B == defaultBgColor.B;
if (isDefaultColor && !drawDefaultBackground)
return;
cr.SetSourceColor (color);
var left = (int)(area.X);
var width = (int)area.Width + 1;
if (textEditor.GetTextEditorData ().ShowRuler) {
var right = left + width;
var divider = (int) (System.Math.Max (left, System.Math.Min (x + TextStartPosition + rulerX, right)));
if (divider < right) {
var beforeDividerWidth = divider - left;
if (beforeDividerWidth > 0) {
cr.Rectangle (left, area.Y, beforeDividerWidth, area.Height);
cr.Fill ();
}
cr.Rectangle (divider, area.Y, right - divider, area.Height);
cr.SetSourceColor (color);
cr.Fill ();
if (beforeDividerWidth > 0) {
cr.DrawLine (
ColorStyle.Ruler.Color,
divider + 0.5, area.Y,
divider + 0.5, area.Y + area.Height);
}
return;
}
}
cr.Rectangle (left, area.Y, System.Math.Ceiling (area.Width), area.Height);
cr.Fill ();
}