Пример #1
0
 public override void Draw(CustomGraphics g)
 {
     drawPosts();
     draw2Leads();
     g.LineColor = NeedsHighlight ? CustomGraphics.SelectColor : CustomGraphics.GrayColor;
     g.DrawPolygon(gatePoly);
     g.DrawPolygon(symbolPoly);
     mCurCount = updateDotCount(mCurrent, mCurCount);
     drawDots(mLead2, mPoint2, mCurCount);
 }
Пример #2
0
        public override void Draw(CustomGraphics g)
        {
            g.LineColor = NeedsHighlight ? CustomGraphics.SelectColor : CustomGraphics.GrayColor;
            g.DrawPolygon(mRectPoints);

            /* draw stubs */
            for (int i = 0; i != 4; i++)
            {
                var a = posts[i];
                var b = mStubs[i];
                drawLead(a, b);
                mCurCounts[i] = updateDotCount(-GetCurrentIntoNode(i), mCurCounts[i]);
                drawDots(a, b, mCurCounts[i]);
            }

            mDiode.Draw(g);
            mTransistor.Draw(g);

            drawPosts();

            /* draw little arrows */
            var c = NeedsHighlight ? CustomGraphics.SelectColor : CustomGraphics.GrayColor;

            g.FillPolygon(c, mArrow1);
            g.FillPolygon(c, mArrow2);
            g.LineColor = c;
            int sx = mStubs[0].X + 2;
            int sy = (mStubs[0].Y + mStubs[1].Y) / 2;

            for (int i = 0; i != 2; i++)
            {
                int y = sy + i * 10 - 5;
                g.DrawLine(sx + 10, y, sx + 15, y);
            }
        }
Пример #3
0
 public void drawChip(CustomGraphics g)
 {
     for (int i = 0; i != PostCount; i++)
     {
         var p = pins[i];
         var a = p.post;
         var b = p.stub;
         drawLead(a, b);
         p.curcount = updateDotCount(p.current, p.curcount);
         drawDots(b, a, p.curcount);
         if (p.bubble)
         {
             g.LineColor = Color.White;
             g.DrawCircle(p.bubblePos, 1);
             g.LineColor = CustomGraphics.GrayColor;
             g.DrawCircle(p.bubblePos, 3);
         }
         g.LineColor = p.selected ? CustomGraphics.SelectColor : CustomGraphics.GrayColor;
         int fsz  = 12 * csize;
         var font = CustomGraphics.FontText;
         while (true)
         {
             int sw = (int)g.GetTextSize(p.text, font).Width;
             /* scale font down if it's too big */
             if (sw > 12 * csize)
             {
                 fsz--;
                 font = new Font(CustomGraphics.FontText.Name, fsz);
                 continue;
             }
             g.DrawCenteredText(p.text, p.textloc.X, p.textloc.Y, font);
             if (p.lineOver)
             {
                 int ya = p.textloc.Y;
                 g.DrawLine(p.textloc.X - sw / 2, ya, p.textloc.X + sw / 2, ya);
             }
             break;
         }
     }
     g.LineColor = NeedsHighlight ? CustomGraphics.SelectColor : CustomGraphics.GrayColor;
     g.DrawPolygon(rectPoints);
     if (clockPoints != null)
     {
         g.DrawPolygon(clockPoints);
     }
     drawPosts();
 }
Пример #4
0
 public override void Draw(CustomGraphics g)
 {
     drawPosts();
     draw2Leads();
     g.LineColor = NeedsHighlight ? CustomGraphics.SelectColor : CustomGraphics.GrayColor;
     if (GateElm.useAnsiGates())
     {
         g.DrawPolygon(mGatePolyAnsi);
     }
     else
     {
         g.DrawPolygon(mGatePolyEuro);
         drawCenteredLText("1", mCenter, true);
     }
     g.DrawCircle(mPcircle, 3);
     mCurCount = updateDotCount(mCurrent, mCurCount);
     drawDots(mLead2, mPoint2, mCurCount);
 }
Пример #5
0
 public override void Draw(CustomGraphics g)
 {
     for (int i = 0; i != mInputCount; i++)
     {
         drawLead(mInPosts[i], mInGates[i]);
     }
     drawLead(mLead2, mPoint2);
     g.LineColor = NeedsHighlight ? CustomGraphics.SelectColor : CustomGraphics.GrayColor;
     if (useAnsiGates())
     {
         g.DrawPolygon(mGatePolyAnsi);
     }
     else
     {
         g.DrawPolygon(mGatePolyEuro);
         var center = new Point();
         interpPoint(ref center, 0.5);
         drawCenteredLText(getGateText(), center, true);
     }
     if (hasSchmittInputs())
     {
         g.LineColor = CustomGraphics.WhiteColor;
         g.DrawPolygon(mSchmittPoly);
     }
     if (mLinePoints != null && useAnsiGates())
     {
         for (int i = 0; i != mLinePoints.Length - 1; i++)
         {
             drawLead(mLinePoints[i], mLinePoints[i + 1]);
         }
     }
     if (isInverting())
     {
         g.DrawCircle(mCirclePos, CIRCLE_SIZE);
     }
     mCurCount = updateDotCount(mCurrent, mCurCount);
     drawDots(mLead2, mPoint2, mCurCount);
     drawPosts();
 }
Пример #6
0
        public override void Draw(CustomGraphics g)
        {
            int hs = 16;

            setBbox(mPoint1, mPoint2, hs);

            draw2Leads();

            g.LineColor = NeedsHighlight ? CustomGraphics.SelectColor : CustomGraphics.GrayColor;
            g.DrawPolygon(gatePoly);
            drawLead(point3, lead3);
            mCurCount = updateDotCount(mCurrent, mCurCount);
            drawDots(mLead2, mPoint2, mCurCount);
            drawPosts();
        }
Пример #7
0
        public override void Draw(CustomGraphics g)
        {
            setBbox(mPoint1, mPoint2, mOpHeight * 2);

            drawLead(mIn1p[0], mIn1p[1]);
            drawLead(mIn2p[0], mIn2p[1]);
            drawLead(mLead2, mPoint2);

            g.LineColor = NeedsHighlight ? CustomGraphics.SelectColor : CustomGraphics.GrayColor;
            g.DrawPolygon(mTriangle);

            drawCenteredLText("-", mTextp[0], true);
            drawCenteredLText("+", mTextp[1], true);
            mCurCount = updateDotCount(mCurrent, mCurCount);
            drawDots(mPoint2, mLead2, mCurCount);
            drawPosts();
        }