예제 #1
0
파일: Panner.C 프로젝트: orlammd/non-mixer
Panner::Point *
Panner::event_point ( void )
{
    for ( int i = _ins; i--; )
    {
        int px, py, pw, ph;

        Point *p = &_points[ i ];

        point_bbox( p, &px, &py, &pw, &ph );

//        printf( "%d, %d -- %d %d %d %d\n", Fl::event_x(), Fl::event_y(),  px, py, pw, ph );

        if ( Fl::event_inside( px, py, pw, ph ) )
            return p;
    }

    return NULL;
}
예제 #2
0
파일: Panner.C 프로젝트: orlammd/non-mixer
void
Panner::draw ( void )
{
    draw_box();
//    draw_box( FL_FLAT_BOX, x(), y(), w(), h(), FL_BLACK );
    draw_label();


    if ( _bypassed )
    {
        fl_color( 0 );
        fl_font( FL_HELVETICA, 12 );
        fl_draw( "(bypass)", x(), y(), w(), h(), FL_ALIGN_CENTER );
        return;
    }

    int tw, th, tx, ty;

    bbox( tx, ty, tw, th );

    fl_push_clip( tx, ty, tw, th );

    fl_color( FL_RED );

    const int b = 10;

    tx += b;
    ty += b;
    tw -= b * 2;
    th -= b * 2;

    /* draw perimeter */
    {
        Fl_Color c1, c2;
        int iter;

        if ( Fl::belowmouse() == this )
        {
            iter = 12;
            c1 = fl_darker( FL_RED );
            c2 = FL_GRAY;
        }
        else
        {
            iter = 6;
            c1 = FL_GRAY;
            c2 = FL_BLACK;
        }

        Fl_Color c = c1;

        for ( int i = iter; i--; )
        {
            fl_color( c );

            fl_arc( tx + (i * (tw / iter)) / 2, ty + (i * (th / iter)) / 2, tw - (i * (tw / iter)), th - (i * ( th / iter )), 0, 360 );

            c = fl_color_average( c1, c2, (float)i / iter);
        }
    }

/*     fl_color( FL_WHITE ); */

/*     fl_arc( tx, ty, tw, th, 0, 360 ); */

    if ( _configs[ _outs ][0] >= 0 )
    {
        for ( int i = _outs; i--; )
        {
            int a = _configs[ _outs ][ i ];

            Point p( 1.2f, (float)a );

            float px, py;

            p.axes( &px, &py );

            fl_push_matrix();

            const int bx = tx + ((tw / 2) * px + (tw / 2));
            const int by = ty + ((th / 2) * py + (th / 2));

            fl_translate( bx, by );

            fl_scale( 5, 5 );

            a = 90 - a;

            fl_rotate( a );

            draw_speaker( FL_WHITE );

            fl_rotate( -a );

            fl_pop_matrix();

        }
    }

    /* ensure that points are drawn *inside* the circle */

    for ( int i = _ins; i--; )
    {
        Point *p = &_points[ i ];

        Fl_Color c = (Fl_Color)(10 + i);

        int px, py, pw, ph;
        point_bbox( p, &px, &py, &pw, &ph );

        /* draw point */
        if ( p != drag )
            fl_color( c );
        else
            fl_color( FL_WHITE );

        fl_pie( px, py, pw, ph, 0, 360 );

        /* draw echo */
        fl_color( c = fl_darker( c ) );
        fl_arc( px - 5, py - 5, pw + 10, ph + 10, 0, 360 );
        if ( Fl::belowmouse() == this )
        {
            fl_color( c = fl_darker( c ) );
            fl_arc( px - 10, py - 10, pw + 20, ph + 20, 0, 360 );
            fl_color( c = fl_darker( c ) );
            fl_arc( px - 30, py - 30, pw + 60, ph + 60, 0, 360 );
        }

        /* draw number */
        char pat[4];
        snprintf( pat, 4, "%d", i + 1 );

        fl_color( FL_BLACK );
        fl_font( FL_HELVETICA, ph + 2 );
        fl_draw( pat, px + 1, py + 1, pw - 1, ph - 1, FL_ALIGN_CENTER );

        /* draw line */

/*         fl_color( FL_WHITE ); */
/*         fl_line( bx + pw() / 2, by + ph() / 2, tx + (tw / 2), ty + (th / 2) ); */

    }

    fl_pop_clip();
}
예제 #3
0
파일: Panner.C 프로젝트: 0mk/non
void
Panner::draw ( void )
{
    int tw, th, tx, ty;

    bbox( tx, ty, tw, th );

    fl_push_clip( x(),y(),w(),h() );

    draw_the_box( tx, ty, tw, th );

//    draw_box();
    draw_label();

    /* if ( _bypassed ) */
    /* { */
    /*     draw_box(); */
    /*     fl_color( 0 ); */
    /*     fl_font( FL_HELVETICA, 12 ); */
    /*     fl_draw( "(bypass)", x(), y(), w(), h(), FL_ALIGN_CENTER ); */
    /*     goto done; */
    /* } */
   
    /* tx += b; */
    /* ty += b; */
    /* tw -= b * 2; */
    /* th -= b * 2; */

    fl_line_style( FL_SOLID, 1 );

    fl_color( FL_WHITE );

    for ( unsigned int i = 0; i < _points.size(); i++ )
    {
        Point *p = &_points[i];

        if ( ! p->visible )
            continue;

        Fl_Color c = fl_color_add_alpha( p->color, 100 );

        fl_color(c);

        int px, py, pw, ph;
        point_bbox( p, &px, &py, &pw, &ph );
      
        {
            float po = 5;

            fl_push_clip( px - ( po * 12 ), 
                          py - ( po * 12 ),
                          pw + ( po * 24 ), ph + (po * 24 ));

            fl_pie( px + 5, py + 5, pw - 10, ph - 10, 0, 360 );


            fl_pie( px, py, pw, ph, 0, 360 );

            fl_pop_clip();

            if ( projection() == POLAR )
            {
           
                fl_color( fl_color_average( fl_rgb_color( 127,127,127 ), p->color, 0.50 ) );
                fl_begin_loop();
                fl_circle( tx + tw/2, ty + th/2, tw/2.0f * ( ( p->radius() / range() )));
                fl_end_loop();
            }

        }
    
        const char *s = p->label;

        fl_color( fl_color_add_alpha( fl_rgb_color( 220,255,255 ), 127 ) );
        fl_font( FL_HELVETICA_BOLD_ITALIC, 10 );
        fl_draw( s, px + 20, py + 1, 50, ph - 1, FL_ALIGN_LEFT );

        if ( tw > 100 )
        {
            char pat[50];
            snprintf( pat, sizeof(pat), "%.1f°:%.1f° %.1fm", p->azimuth(), p->elevation(), p->radius() );
            
//        fl_color( fl_color_add_alpha( fl_rgb_color( 220,255,255 ), 127 ) );
            fl_font( FL_COURIER, 9 );

            fl_draw( pat, px + 20, py + 15, 50, ph - 1, FL_ALIGN_LEFT | FL_ALIGN_WRAP );

            /* fl_font( FL_HELVETICA_ITALIC, 9 ); */
            /* snprintf(pat, sizeof(pat), "range: %.1f meters", range() ); */
            /* fl_draw( pat, tx, ty, tw, th, FL_ALIGN_LEFT | FL_ALIGN_BOTTOM | FL_ALIGN_INSIDE ); */
                
            /* if ( _projection == POLAR ) */
            /* { */
            /*     fl_draw( "Polar perspective; azimuth, elevation and radius input. Right click controls radius.", tx, ty, tw, th, FL_ALIGN_BOTTOM | FL_ALIGN_RIGHT | FL_ALIGN_INSIDE ); */
            /* } */
            /* else */
            /* { */
            /*     fl_draw( "Polar orthographic; angle and distance input.", tx, ty, tw, th, FL_ALIGN_BOTTOM | FL_ALIGN_RIGHT | FL_ALIGN_INSIDE ); */
            /* } */
        }

    }
    
    if ( tw > 200 )
        draw_children();

    fl_line_style( FL_SOLID, 0 );

    fl_pop_clip();
}