private static void DrawFunctionDeclaration( CanvasDrawingSession session, float offset, IndentationType indentationType) { session.FillRoundedRectangle(IndentationIndicatorsLeftMargin, offset, IndentationIndicatorBlockSize, IndentationIndicatorBlockSize, 9999, 9999, FunctionBackgroundColor); session.DrawRoundedRectangle(IndentationIndicatorsLeftMargin, offset, IndentationIndicatorBlockSize, IndentationIndicatorBlockSize, 9999, 9999, OutlineColor); session.DrawText("f", IndentationIndicatorsLeftMargin + 4f, offset, TextColor, TextFormat); // Vertical guide if ((indentationType & IndentationType.FullSize) != 0) { session.DrawLine(IndentationIndicatorsMiddleMargin, offset + IndentationIndicatorBlockSize, IndentationIndicatorsMiddleMargin, offset + IndentationIndicatorsElementHeight, OutlineColor); } else { float middleOffset = offset + (IndentationIndicatorsElementHeight + IndentationIndicatorBlockSize) / 2f; session.DrawLine(IndentationIndicatorsMiddleMargin, offset + IndentationIndicatorBlockSize, IndentationIndicatorsMiddleMargin, middleOffset, OutlineColor); } // Horizontal marker if ((indentationType & IndentationType.IsClosing) != 0) { float horizontalOffset = IndentationIndicatorsMiddleMargin - 0.5f, middleOffset = offset + (IndentationIndicatorsElementHeight + IndentationIndicatorBlockSize) / 2f + 0.5f; session.DrawLine(horizontalOffset, middleOffset, IndentationIndicatorsRightMargin, middleOffset, OutlineColor); } }
private static void DrawLine( CanvasDrawingSession session, float offset, IndentationType indentationType) { // Vertical guide if ((indentationType & IndentationType.FullSize) != 0) { session.DrawLine(IndentationIndicatorsMiddleMargin, offset, IndentationIndicatorsMiddleMargin, offset + IndentationIndicatorsElementHeight, OutlineColor); } else { float middleOffset = offset + (IndentationIndicatorsElementHeight + IndentationIndicatorBlockSize) / 2f; session.DrawLine(IndentationIndicatorsMiddleMargin, offset, IndentationIndicatorsMiddleMargin, middleOffset, OutlineColor); } // Horizontal marker if ((indentationType & IndentationType.IsClosing) != 0) { float horizontalOffset = IndentationIndicatorsMiddleMargin - 0.5f, middleOffset = offset + (IndentationIndicatorsElementHeight + IndentationIndicatorBlockSize) / 2f + 0.5f; session.DrawLine(horizontalOffset, middleOffset, IndentationIndicatorsRightMargin, middleOffset, OutlineColor); } }
private static void DrawIndentationBlock( CanvasDrawingSession session, float offset, int depth, IndentationType indentationType, bool isWithinFunction) { Debug.Assert(offset >= 0); Debug.Assert(depth >= 1); // Indentation block if (isWithinFunction) { session.DrawRoundedRectangle(IndentationIndicatorsLeftMargin, offset, IndentationIndicatorBlockSize, IndentationIndicatorBlockSize, 2, 2, OutlineColor); } else { session.DrawRectangle(IndentationIndicatorsLeftMargin, offset, IndentationIndicatorBlockSize, IndentationIndicatorBlockSize, OutlineColor); } // Depth level counter string text = depth <= 9 ? depth.ToString() : "•"; session.DrawText(text, IndentationIndicatorsLeftMargin + 3, offset - 1, TextColor, TextFormat); // Vertical guide if ((indentationType & IndentationType.FullSize) != 0) { session.DrawLine(IndentationIndicatorsMiddleMargin, offset + IndentationIndicatorBlockSize, IndentationIndicatorsMiddleMargin, offset + IndentationIndicatorsElementHeight, OutlineColor); } else { float middleOffset = offset + (IndentationIndicatorsElementHeight + IndentationIndicatorBlockSize) / 2f; session.DrawLine(IndentationIndicatorsMiddleMargin, offset + IndentationIndicatorBlockSize, IndentationIndicatorsMiddleMargin, middleOffset, OutlineColor); } // Horizontal marker if ((indentationType & IndentationType.IsClosing) != 0) { float horizontalOffset = IndentationIndicatorsMiddleMargin - 0.5f, middleOffset = offset + (IndentationIndicatorsElementHeight + IndentationIndicatorBlockSize) / 2f + 0.5f; session.DrawLine(horizontalOffset, middleOffset, IndentationIndicatorsRightMargin, middleOffset, OutlineColor); } }