Ejemplo n.º 1
0
 public IBlockView ViewFromBlock(IBlock block)
 {
     if (blockViews.ContainsKey(block))
         return blockViews[block];
     if (block is BlockStack)
     {
         IBlockView ret = ViewFromBlockStack((BlockStack)block);;
         blockViews[block] = ret;
         return ret;
     }
     if (block is VarAccessBlock || block is VarDefBlock)
     {
         IBlockView ret = new VariableView((IVarBlock)block, varb_parts, textMetrics, textFont);
         blockViews[block] = ret;
         return ret;
     }
     if (block is TextBlock)
     {
         IBlockView ret = new TextView((TextBlock) block, ib_parts, textMetrics, textFont);
         blockViews[block] = ret;
         return ret;
     }
     if (block is InvokationBlock)
     {
         InvokationBlock b = (InvokationBlock)block;
         BlockAttributes attr = blockSpace.AttributeOf(b);
         IBlockView r = ViewFromInvokationBlock(b, attr);
         blockViews[block] = r;
         return r;
     }
     if (block is ProcDefBlock)
     {
         ProcDefBlock b = (ProcDefBlock) block;
         BlockAttributes attr = blockSpace.AttributeOf(b);
         IBlockView r = ViewFromProcDefBlock(b);
         blockViews[block] = r;
         return r;
     }
     throw new ArgumentException();
 }