Example #1
0
        public override void Render(CodeRender.IRenderer renderer)
        {
            if (mMatchingResult.Count == 0)
            {
                return;
            }

            float startX = (Coder.CursorCol - Coder.CodeRenderer.RenderStartCol + 1) *
                           Coder.Renderer.CharWidth + Coder.CodeRenderer.RenderOffsetX;
            float startY = (Coder.CursorRow - Coder.CodeRenderer.RenderStartRow + 1) *
                           Coder.Renderer.CharHeight + Coder.CodeRenderer.RenderOffsetY;
            int height = (int)Coder.Renderer.CharHeight + 4;
            int width  = (int)Coder.Renderer.CharWidth * 20;

            renderer.DrawRect(new URect(
                                  (int)startX,
                                  (int)startY,
                                  width,
                                  height * 10),
                              UColor.White,
                              true);
            renderer.DrawRect(new URect(
                                  (int)startX,
                                  (int)startY + mSelectIndex * height,
                                  width,
                                  height),
                              UColor.Orange,
                              true);

            for (int i = 0; i < mMatchingResult.Count; i++)
            {
                renderer.DrawText(startX, startY + i * height + 2, mMatchingResult[i], UColor.Black);
            }
        }
Example #2
0
 public override void Render(CodeRender.IRenderer renderer)
 {
     foreach (IPlugin plugin in mPlugins)
     {
         plugin.Render(renderer);
     }
 }
Example #3
0
        public override void Render(CodeRender.IRenderer renderer)
        {
            if (!mVisible)
            {
                return;
            }

            int width = (int)((Coder.CodeManager.GetCodeCount().ToString().Length + 1) * renderer.CharWidth);
            //float renderX = 0;
            float renderY = 0;

            Coder.SetRenderOffset(new UPoint(width, 0));

            renderer.DrawRect(new URect(0, 0, width, renderer.RenderHeight), UColor.Black, true);

            for (int i = 0; i < Coder.CodeRenderer.RenderRow; i++)
            {
                renderer.DrawText(0, renderY, (i + Coder.CodeRenderer.RenderStartRow).ToString(), UColor.Purple);
                renderY += renderer.CharHeight;
            }
        }
Example #4
0
 public abstract void Render(CodeRender.IRenderer renderer);
Example #5
0
        public override void Render(CodeRender.IRenderer renderer)
        {
            int startRow = Start.Row;
            int endRow   = End.Row;

            int startCol = Start.Col;
            int endCol   = End.Col;

            float WordWidth  = Coder.Renderer.CharWidth;
            float WordHeight = Coder.Renderer.CharHeight;

            UColor color = UColor.Orange;

            if (Start == End)
            {
                return;
            }

            if (Start == URank.None || End == URank.None)
            {
                return;
            }

            if (endRow < Coder.CodeRenderer.RenderStartRow ||
                startRow > Coder.CodeRenderer.RenderStartRow + Coder.CodeRenderer.RenderRow)
            {
                return;
            }

            // 第一种情况,选中的区域在同一行
            if (startRow == endRow)
            {
                renderer.DrawRect(new URect(
                                      (int)((startCol - Coder.CodeRenderer.RenderStartCol) * WordWidth + Coder.CodeRenderer.RenderOffsetX + WordWidth / 2 - 1),
                                      (int)((startRow - Coder.CodeRenderer.RenderStartRow) * WordHeight + Coder.CodeRenderer.RenderOffsetY),
                                      (int)((endCol - startCol) * WordWidth),
                                      (int)WordHeight),
                                  color,
                                  true);
                return;
            }
            else
            {
                // 第一行
                renderer.DrawRect(new URect(
                                      (int)((startCol - Coder.CodeRenderer.RenderStartCol) * WordWidth + Coder.CodeRenderer.RenderOffsetX + WordWidth / 2 - 1),
                                      (int)((startRow - Coder.CodeRenderer.RenderStartRow) * WordHeight + Coder.CodeRenderer.RenderOffsetY),
                                      (int)((Coder.CodeManager.GetCodeLength(startRow) - startCol) * WordWidth),
                                      (int)WordHeight),
                                  color,
                                  true);

                // 最后一行
                renderer.DrawRect(new URect(
                                      (int)(Coder.CodeRenderer.RenderOffsetX + WordWidth / 2 - 1),
                                      (int)((endRow - Coder.CodeRenderer.RenderStartRow) * WordHeight + Coder.CodeRenderer.RenderOffsetY),
                                      (int)(endCol * WordWidth),
                                      (int)WordHeight),
                                  color,
                                  true);

                for (int i = startRow + 1; i < endRow; i++)
                {
                    if (i > Coder.CodeRenderer.RenderStartRow + Coder.CodeRenderer.RenderRow)
                    {
                        break;
                    }

                    renderer.DrawRect(new URect(
                                          (int)(Coder.CodeRenderer.RenderOffsetX + WordWidth / 2 - 1),
                                          (int)((i - Coder.CodeRenderer.RenderStartRow) * WordHeight + Coder.CodeRenderer.RenderOffsetY),
                                          (int)(Coder.CodeManager.GetCodeLength(i) * WordWidth),
                                          (int)WordHeight),
                                      color,
                                      true);
                }
            }
        }