Esempio n. 1
0
 unsigned polygon_ctrl_impl::vertex(double* x, double* y)
 {
     unsigned cmd = path_cmd_stop;
     double r = m_point_radius;
     if(m_status == 0)
     {
         cmd = m_stroke.vertex(x, y);
         if(!is_stop(cmd)) 
         {
             transform_xy(x, y);
             return cmd;
         }
         if(m_node >= 0 && m_node == int(m_status)) r *= 1.2;
         m_ellipse.init(xn(m_status), yn(m_status), r, r, 32);
         ++m_status;
     }
     cmd = m_ellipse.vertex(x, y);
     if(!is_stop(cmd)) 
     {
         transform_xy(x, y);
         return cmd;
     }
     if(m_status >= m_num_points) return path_cmd_stop;
     if(m_node >= 0 && m_node == int(m_status)) r *= 1.2;
     m_ellipse.init(xn(m_status), yn(m_status), r, r, 32);
     ++m_status;
     cmd = m_ellipse.vertex(x, y);
     if(!is_stop(cmd)) 
     {
         transform_xy(x, y);
     }
     return cmd;
 }
Esempio n. 2
0
    //------------------------------------------------------------------------
    unsigned curve3_ctrl_impl::vertex(double* x, double* y)
    {
        unsigned cmd = path_cmd_stop;
        switch(m_idx)
        {
        case 0:
        case 1:
        case 2:
            cmd = m_stroke.vertex(x, y);
            break;

        case 3:
        case 4:
        case 5:
        case 6:
            cmd = m_ellipse.vertex(x, y);
            break;
        }

        if(!is_stop(cmd))
        {
            transform_xy(x, y);
        }
        return cmd;
    }
Esempio n. 3
0
    //------------------------------------------------------------------------
    unsigned gamma_ctrl_impl::vertex(double* x, double* y)
    {
        unsigned cmd = path_cmd_line_to;
        switch(m_idx)
        {
        case 0:
            if(m_vertex == 0) cmd = path_cmd_move_to;
            if(m_vertex >= 4) cmd = path_cmd_stop;
            *x = m_vx[m_vertex];
            *y = m_vy[m_vertex];
            m_vertex++;
            break;

        case 1:
            if(m_vertex == 0 || m_vertex == 4 || m_vertex == 8) cmd = path_cmd_move_to;
            if(m_vertex >= 12) cmd = path_cmd_stop;
            *x = m_vx[m_vertex];
            *y = m_vy[m_vertex];
            m_vertex++;
            break;

        case 2:
            cmd = m_curve_poly.vertex(x, y);
            break;

        case 3:
            if(m_vertex == 0  || 
               m_vertex == 4  || 
               m_vertex == 8  ||
               m_vertex == 14) cmd = path_cmd_move_to;

            if(m_vertex >= 20) cmd = path_cmd_stop;
            *x = m_vx[m_vertex];
            *y = m_vy[m_vertex];
            m_vertex++;
            break;

        case 4:                 // Point1
        case 5:                 // Point2
            cmd = m_ellipse.vertex(x, y);
            break;

        case 6:
            cmd = m_text_poly.vertex(x, y);
            break;

        default:
            cmd = path_cmd_stop;
            break;
        }

        if(!is_stop(cmd))
        {
            transform_xy(x, y);
        }

        return cmd;
    }
Esempio n. 4
0
void Extension::merge_xy(Canvas* c, Coord l, Coord b, Coord r, Coord t) {
    Coord left = l;
    Coord bottom = b;
    Coord right = r;
    Coord top = t;
    transform_xy(c, left, bottom, right, top);
    x_begin_ = Math::min(x_begin_, left);
    x_end_ = Math::max(x_end_, right);
    y_begin_ = Math::min(y_begin_, bottom);
    y_end_ = Math::max(y_end_, top);
}
Esempio n. 5
0
void Extension::set_xy(Canvas* c, Coord l, Coord b, Coord r, Coord t) {
    Coord left = l;
    Coord bottom = b;
    Coord right = r;
    Coord top = t;
    transform_xy(c, left, bottom, right, top);
    x_begin_ = left;
    x_end_ = right;
    y_begin_ = bottom;
    y_end_ = top;
}
Esempio n. 6
0
    //------------------------------------------------------------------------
    unsigned slider_ctrl_impl::vertex(double* x, double* y)
    {
        unsigned cmd = path_cmd_line_to;
        switch(m_idx)
        {
        case 0:
            if(m_vertex == 0) cmd = path_cmd_move_to;
            if(m_vertex >= 4) cmd = path_cmd_stop;
            *x = m_vx[m_vertex];
            *y = m_vy[m_vertex];
            m_vertex++;
            break;

        case 1:
            if(m_vertex == 0) cmd = path_cmd_move_to;
            if(m_vertex >= 4) cmd = path_cmd_stop;
            *x = m_vx[m_vertex];
            *y = m_vy[m_vertex];
             m_vertex++;
            break;

        case 2:
            cmd = m_text_poly.vertex(x, y);
            break;

        case 3:
        case 4:
            cmd = m_ellipse.vertex(x, y);
            break;

        case 5:
            cmd = m_storage.vertex(x, y);
            break;

        default:
            cmd = path_cmd_stop;
            break;
        }

        if(!is_stop(cmd))
        {
            transform_xy(x, y);
        }

        return cmd;
    }
Esempio n. 7
0
    //------------------------------------------------------------------------
    unsigned cbox_ctrl_impl::vertex(real* x, real* y)
    {
        unsigned cmd = path_cmd_line_to;
        switch(m_idx)
        {
        case 0:
            if(m_vertex == 0 || m_vertex == 4) cmd = path_cmd_move_to;
            if(m_vertex >= 8) cmd = path_cmd_stop;
            *x = m_vx[m_vertex];
            *y = m_vy[m_vertex];
            m_vertex++;
            break;

        case 1:
            cmd = m_text_poly.vertex(x, y);
            break;

        case 2:
            if(m_status)
            {
                if(m_vertex == 0) cmd = path_cmd_move_to;
                if(m_vertex >= 8) cmd = path_cmd_stop;
                *x = m_vx[m_vertex];
                *y = m_vy[m_vertex];
                m_vertex++;
            }
            else
            {
                cmd = path_cmd_stop;
            }
            break;

        default:
            cmd = path_cmd_stop;
            break;
        }

        if(!is_stop(cmd))
        {
            transform_xy(x, y);
        }
        return cmd;
    }
    //------------------------------------------------------------------------
    unsigned rbox_ctrl_impl::vertex(real* x, real* y)
    {
        unsigned cmd = path_cmd_line_to;
        switch(m_idx)
        {
        case 0:
            if(m_vertex == 0) cmd = path_cmd_move_to;
            if(m_vertex >= 4) cmd = path_cmd_stop;
            *x = m_vx[m_vertex];
            *y = m_vy[m_vertex];
            m_vertex++;
            break;

        case 1:
            if(m_vertex == 0 || m_vertex == 4) cmd = path_cmd_move_to;
            if(m_vertex >= 8) cmd = path_cmd_stop;
            *x = m_vx[m_vertex];
            *y = m_vy[m_vertex];
            m_vertex++;
            break;

        case 2:
            cmd = m_text_poly.vertex(x, y);
            if(is_stop(cmd))
            {
                m_draw_item++;
                if(m_draw_item >= m_num_items)
                {
                    break;
                }
                else
                {
                    m_text.text(&m_items[m_draw_item][0]);
                    m_text.start_point(m_xs1 + m_dy * 1.5, 
                                       m_ys1 + m_dy * (m_draw_item + 1) - m_dy / 2.0f);

                    m_text_poly.rewind(0);
                    cmd = m_text_poly.vertex(x, y);
                }
            }
            break;

        case 3:
            cmd = m_ellipse_poly.vertex(x, y);
            if(is_stop(cmd))
            {
                m_draw_item++;
                if(m_draw_item >= m_num_items)
                {
                    break;
                }
                else
                {
                    m_ellipse.init(m_xs1 + m_dy / 1.3, 
                                   m_ys1 + m_dy * m_draw_item + m_dy / 1.3,
                                   m_text_height / 1.5, 
                                   m_text_height / 1.5, 32);
                    m_ellipse_poly.rewind(0);
                    cmd = m_ellipse_poly.vertex(x, y);
                }
            }
            break;


        case 4:
            if(m_cur_item >= 0)
            {
                cmd = m_ellipse.vertex(x, y);
            }
            else
            {
                cmd = path_cmd_stop;
            }
            break;

        default:
            cmd = path_cmd_stop;
            break;
        }

        if(!is_stop(cmd))
        {
            transform_xy(x, y);
        }

        return cmd;
    }