コード例 #1
0
ファイル: Scope.cs プロジェクト: mctr909/CircuitSim
        void _drawSettingsWheel(CustomGraphics g)
        {
            const int outR   = 6 * 18 / 16;
            const int inR    = 4 * 18 / 16;
            const int inR45  = 3 * 18 / 16;
            const int outR45 = 4 * 18 / 16;

            if (mShowSettingsWheel)
            {
                if (CursorInSettingsWheel)
                {
                    g.LineColor = Color.Cyan;
                }
                else
                {
                    g.LineColor = Color.DarkGray;
                }
                g.SetTransform(new Matrix(1, 0, 0, 1, BoundingBox.X + 12, BoundingBox.Y + BoundingBox.Height - 16));
                g.DrawCircle(new Point(), inR);
                g.DrawLine(-outR, 0, -inR, 0);
                g.DrawLine(outR, 0, inR, 0);
                g.DrawLine(0, -outR, 0, -inR);
                g.DrawLine(0, outR, 0, inR);
                g.DrawLine(-outR45, -outR45, -inR45, -inR45);
                g.DrawLine(outR45, -outR45, inR45, -inR45);
                g.DrawLine(-outR45, outR45, -inR45, inR45);
                g.DrawLine(outR45, outR45, inR45, inR45);
                g.ClearTransform();
            }
        }
コード例 #2
0
ファイル: Scope.cs プロジェクト: mctr909/CircuitSim
        public void Draw(CustomGraphics g)
        {
            if (mPlots.Count == 0)
            {
                return;
            }

            /* reset if timestep changed */
            if (mScopeTimeStep != ControlPanel.TimeStep)
            {
                mScopeTimeStep = ControlPanel.TimeStep;
                ResetGraph();
            }

            _drawSettingsWheel(g);

            g.LineColor = Color.Red;

            g.SetTransform(new Matrix(1, 0, 0, 1, BoundingBox.X, BoundingBox.Y));

            if (ShowFFT)
            {
                _drawFFTVerticalGridLines(g);
                _drawFFT(g);
            }

            if (mMaxScale)
            {
                mScale = 1e-4;
            }
            mReduceRange       = false;
            mSomethingSelected = false;  /* is one of our plots selected? */

            for (int si = 0; si != mVisiblePlots.Count; si++)
            {
                var plot = mVisiblePlots[si];
                _calcPlotScale(plot);
                if (CirSim.Sim.ScopeSelected == -1 && plot.Elm != null && plot.Elm.IsMouseElm)
                {
                    mSomethingSelected = true;
                }
                mReduceRange = true;
            }

            _checkForSelection();
            if (SelectedPlot >= 0)
            {
                mSomethingSelected = true;
            }

            mDrawGridLines = true;
            if ((ShowMax || ShowMin) && mVisiblePlots.Count > 0)
            {
                _calcMaxAndMin();
            }

            if (ShowV)
            {
                /* draw volts on top (last), then current underneath, then everything else */
                for (int i = 0; i != mVisiblePlots.Count; i++)
                {
                    if (i != SelectedPlot)
                    {
                        _drawPlot(g, mVisiblePlots[i], false);
                    }
                }
                /* draw selection on top.  only works if selection chosen from scope */
                if (SelectedPlot >= 0 && SelectedPlot < mVisiblePlots.Count)
                {
                    _drawPlot(g, mVisiblePlots[SelectedPlot], true);
                }
            }

            if (mVisiblePlots.Count > 0)
            {
                _drawInfoTexts(g);
            }

            g.ClearTransform();
            _drawCrosshairs(g);

            g.SetTransform(new Matrix(
                               CirSim.Sim.Transform[0], CirSim.Sim.Transform[1],
                               CirSim.Sim.Transform[2], CirSim.Sim.Transform[3],
                               CirSim.Sim.Transform[4], CirSim.Sim.Transform[5]
                               ));

            if (5 < mPlots[0].Pointer && !LockScale)
            {
                if (1e-4 < mScale && mReduceRange)
                {
                    mScale /= 2;
                }
            }
        }