Ejemplo n.º 1
0
        private Node CreateGraphNode(Block b)
        {
            var nl        = "\n    ";
            var model     = GenerateTextModel(b);
            var stack     = new StyleStack(uiPreferences);
            var layout    = TextViewLayout.AllLines(model, g, defaultFont, stack);
            var blockNode = new CfgBlockNode {
                Block         = b,
                TextModel     = GenerateTextModel(b),
                Layout        = layout,
                UiPreferences = uiPreferences,
            };
            var node = graph.AddNode(b.Name);

            node.Attr.LabelMargin = 5;
            node.UserData         = blockNode;
            if (useTextEngine)
            {
                node.Attr.Shape           = Shape.DrawFromGeometry;
                node.DrawNodeDelegate     = blockNode.DrawNode;
                node.NodeBoundaryDelegate = blockNode.GetNodeBoundary;
            }
            else
            {
                node.Label.FontName = "Lucida Console";
                node.Label.FontSize = 10f;
                node.LabelText      =
                    b.Name + nl +
                    string.Join(nl, b.Statements.Select(s => s.Instruction));
            }
            return(node);
        }
Ejemplo n.º 2
0
 private Node CreateGraphNode(Block b)
 {
     var nl = "\n    ";
     var model = GenerateTextModel(b);
     var stack = new StyleStack(uiPreferences);
     var layout = TextViewLayout.AllLines(model, g, defaultFont, stack);
     var blockNode = new CfgBlockNode {
         Block = b,
         TextModel = GenerateTextModel(b),
          Layout = layout,
          UiPreferences = uiPreferences,
     };
     var node = graph.AddNode(b.Name);
     node.Attr.LabelMargin = 5;
     node.UserData = blockNode;
     if (useTextEngine)
     {
         node.Attr.Shape = Shape.DrawFromGeometry;
         node.DrawNodeDelegate = blockNode.DrawNode;
         node.NodeBoundaryDelegate = blockNode.GetNodeBoundary;
     }
     else
     {
         node.Label.FontName = "Lucida Console";
         node.Label.FontSize = 10f;
         node.LabelText =
             b.Name + nl +
             string.Join(nl, b.Statements.Select(s => s.Instruction));
     }
     return node;
 }