Example #1
0
        public override void Rewind(uint idx)
        {
            m_idx = idx;

            switch (idx)
            {
            case 0:                                     // Text
                m_text.StartPoint(m_Bounds.Left + m_BorderSize, m_Bounds.Bottom + m_BorderSize + m_text.AscenderHeight);
                m_text.SetFontSize(m_CapsHeight);
                m_text_poly.Width(m_Thickness);
                m_text_poly.LineJoin(MathStroke.ELineJoin.round_join);
                m_text_poly.LineCap(MathStroke.ELineCap.round_cap);
                m_text_poly.Rewind(0);
                break;
            }
        }
Example #2
0
        public override void Rewind(uint idx)
        {
            m_idx = idx;

            switch (idx)
            {
            default:

            case 0:                                     // Background
                m_vertex = 0;
                m_vx[0]  = m_Bounds.Left - m_border_extra;
                m_vy[0]  = m_Bounds.Bottom - m_border_extra;
                m_vx[1]  = m_Bounds.Right + m_border_extra;
                m_vy[1]  = m_Bounds.Bottom - m_border_extra;
                m_vx[2]  = m_Bounds.Right + m_border_extra;
                m_vy[2]  = m_Bounds.Top + m_border_extra;
                m_vx[3]  = m_Bounds.Left - m_border_extra;
                m_vy[3]  = m_Bounds.Top + m_border_extra;
                break;

            case 1:                                     // Triangle
                m_vertex = 0;
                if (m_descending)
                {
                    m_vx[0] = m_Bounds.Left;
                    m_vy[0] = m_Bounds.Bottom;
                    m_vx[1] = m_Bounds.Right;
                    m_vy[1] = m_Bounds.Bottom;
                    m_vx[2] = m_Bounds.Left;
                    m_vy[2] = m_Bounds.Top;
                    m_vx[3] = m_Bounds.Left;
                    m_vy[3] = m_Bounds.Bottom;
                }
                else
                {
                    m_vx[0] = m_Bounds.Left;
                    m_vy[0] = m_Bounds.Bottom;
                    m_vx[1] = m_Bounds.Right;
                    m_vy[1] = m_Bounds.Bottom;
                    m_vx[2] = m_Bounds.Right;
                    m_vy[2] = m_Bounds.Top;
                    m_vx[3] = m_Bounds.Left;
                    m_vy[3] = m_Bounds.Bottom;
                }
                break;

            case 2:
                m_text.Text = m_label;
                if (m_label.Length > 0)
                {
                    string buf;
                    buf         = string.Format(m_label, Value());
                    m_text.Text = buf;
                }
                m_text.StartPoint(m_Bounds.Left, m_Bounds.Bottom);
                m_text.SetFontSize((m_Bounds.Top - m_Bounds.Bottom) * 1.2);
                m_text_poly.Width(m_text_thickness);
                m_text_poly.LineJoin(MathStroke.ELineJoin.round_join);
                m_text_poly.LineCap(MathStroke.ELineCap.round_cap);
                m_text_poly.Rewind(0);
                break;

            case 3:                                     // pointer preview
                m_ellipse.Init(m_xs1 + (m_xs2 - m_xs1) * m_preview_value,
                               (m_ys1 + m_ys2) / 2.0,
                               m_Bounds.Top - m_Bounds.Bottom,
                               m_Bounds.Top - m_Bounds.Bottom,
                               32);
                break;

            case 4:                                     // pointer
                NormalizeValue(false);
                m_ellipse.Init(m_xs1 + (m_xs2 - m_xs1) * m_value,
                               (m_ys1 + m_ys2) / 2.0,
                               m_Bounds.Top - m_Bounds.Bottom,
                               m_Bounds.Top - m_Bounds.Bottom,
                               32);
                m_ellipse.Rewind(0);
                break;

            case 5:
                m_storage.RemoveAll();
                if (m_num_steps != 0)
                {
                    uint   i;
                    double d = (m_xs2 - m_xs1) / m_num_steps;
                    if (d > 0.004)
                    {
                        d = 0.004;
                    }
                    for (i = 0; i < m_num_steps + 1; i++)
                    {
                        double x = m_xs1 + (m_xs2 - m_xs1) * i / m_num_steps;
                        m_storage.move_to(x, m_Bounds.Bottom);
                        m_storage.line_to(x - d * (m_Bounds.Right - m_Bounds.Left), m_Bounds.Bottom - m_border_extra);
                        m_storage.line_to(x + d * (m_Bounds.Right - m_Bounds.Left), m_Bounds.Bottom - m_border_extra);
                    }
                }
                break;
            }
        }
Example #3
0
        override public void Rewind(uint idx)
        {
            m_idx = idx;

            double d2;
            double t;

            switch (idx)
            {
            default:
            case 0:                                     // Border
                m_vertex = 0;
                m_vx[0]  = m_Bounds.Left;
                m_vy[0]  = m_Bounds.Bottom;
                m_vx[1]  = m_Bounds.Right;
                m_vy[1]  = m_Bounds.Bottom;
                m_vx[2]  = m_Bounds.Right;
                m_vy[2]  = m_Bounds.Top;
                m_vx[3]  = m_Bounds.Left;
                m_vy[3]  = m_Bounds.Top;
                m_vx[4]  = m_Bounds.Left + m_text_thickness;
                m_vy[4]  = m_Bounds.Bottom + m_text_thickness;
                m_vx[5]  = m_Bounds.Left + m_text_thickness;
                m_vy[5]  = m_Bounds.Top - m_text_thickness;
                m_vx[6]  = m_Bounds.Right - m_text_thickness;
                m_vy[6]  = m_Bounds.Top - m_text_thickness;
                m_vx[7]  = m_Bounds.Right - m_text_thickness;
                m_vy[7]  = m_Bounds.Bottom + m_text_thickness;
                break;

            case 1:
                m_text.Text = m_label;
                m_text.StartPoint(m_Bounds.Left + m_FontSize * 2.0, m_Bounds.Bottom + m_FontSize / 5.0);

                m_text.SetFontSize(m_FontSize);
                m_text_poly.Width(m_text_thickness);
                m_text_poly.LineJoin(MathStroke.ELineJoin.round_join);
                m_text_poly.LineCap(MathStroke.ELineCap.round_cap);
                m_text_poly.Rewind(0);
                break;

            case 2:                                     // Active item
                m_vertex = 0;
                d2       = (m_Bounds.Top - m_Bounds.Bottom) / 2.0;
                t        = m_text_thickness * 1.5;
                m_vx[0]  = m_Bounds.Left + m_text_thickness;
                m_vy[0]  = m_Bounds.Bottom + m_text_thickness;
                m_vx[1]  = m_Bounds.Left + d2;
                m_vy[1]  = m_Bounds.Bottom + d2 - t;
                m_vx[2]  = m_Bounds.Right - m_text_thickness;
                m_vy[2]  = m_Bounds.Bottom + m_text_thickness;
                m_vx[3]  = m_Bounds.Left + d2 + t;
                m_vy[3]  = m_Bounds.Bottom + d2;
                m_vx[4]  = m_Bounds.Right - m_text_thickness;
                m_vy[4]  = m_Bounds.Top - m_text_thickness;
                m_vx[5]  = m_Bounds.Left + d2;
                m_vy[5]  = m_Bounds.Bottom + d2 + t;
                m_vx[6]  = m_Bounds.Left + m_text_thickness;
                m_vy[6]  = m_Bounds.Top - m_text_thickness;
                m_vx[7]  = m_Bounds.Left + d2 - t;
                m_vy[7]  = m_Bounds.Bottom + d2;
                break;
            }
        }