Beispiel #1
0
void
CodeRevision::draw() { 
    //assume we are a scale of 1
    glPushMatrix();
    glPushName(_id);

        UIButton rev;

        switch ( _status ) { 
            case rev_PARSED     : rev.setCols( UI_BASE, Color4D( 1.0,0.85,0.85,1.0 ), Color4D(0,0,0,1.0)); break;
            case rev_TYPED      : rev.setCols( UI_BASE, Color4D( 1.0,0.92,0.85,1.0 ), Color4D(0,0,0,1.0));  break;
            case rev_COMPILED   : rev.setCols( UI_BASE, Color4D( 1.0,1.0,0.85,1.0 ), Color4D(0,0,0,1.0));  break;
            case rev_READY	    :
            case rev_RUNNING    : rev.setCols( UI_BASE, Color4D( 0.85,1.0,0.85,1.0 ), Color4D(0,0,0,1.0));  break;
            case rev_EDITED     : rev.setCols( UI_BASE, Color4D( 0.9,0.9,1.0,1.0 ), Color4D(0,0,0,1.0));  break;
            default             : rev.setCols( UI_BASE, Color4D( 1.0,1.0,1.0,1.0 ), Color4D(0,0,0,1.0));  break;
        }

        rev.seth( 1.0 );
        rev.setLabel( (char*)_buffer->filename().c_str() );
        rev.fitXLabel( 0.75 );
        rev.draw(0.75);

        if ( _selected ) { 
            _killButton->moveto( rev.left()-_killButton->w(), rev.top() - 0.5* ( rev.h()-_killButton->h() )  );
            _killButton->drawNamed(0.75);
            _sporkButton->moveto( rev.right(), rev.top() - 0.5* ( rev.h()-_sporkButton->h() ) );
            _sporkButton->drawNamed( 0.75 );
        }
        

        glTranslated ( 0, -1.0 , 0 );
        rev.seth ( ( size() - 1 )  );
        glColor4d(0.8, 1.0, 0.9, 0.3);
        glBegin(GL_POLYGON);
        rev.roundVerts();
        glEnd();

        glTranslated ( 1.0, 0 , 0 );
        for ( int i=0; i < _shreds.size() ; i++ ) { 
			ShredInstance * s = _shreds[i];
			if ( s->stat == NULL ) { 
				EM_log( CK_LOG_WARNING, "CodeRevision::draw: (%s) shred stat is NULL (%d)!", (char*)_buffer->filename().c_str(), _shreds[i]->procID); 
				s->stat = Chuck_Stats::instance()->get_shred( s->procID );
				if ( !s->stat ) { 
					EM_log( CK_LOG_WARNING, "CodeRevision::draw: adding as dead(%d)!", (char*)_buffer->filename().c_str(), _shreds[i]->procID); 
					s->stat = new Shred_Stat();
					s->stat->state = shred_KILLED;
				}
				if ( s->stat && !s->stat->data )  {
					AudicleFaceShredder::initialize_stat_data ( s->stat );
				}
			} else {
	            s->draw();
	            glTranslated ( 0, -1.0 , 0 );
			}
        }
        glTranslated ( -1.0, 0, 0);

        glPopName();
        glPopMatrix();
}
Beispiel #2
0
void
ShredInstance::draw() { 

    UIButton shredbutton;
    
    char name[32];

    shredbutton.lineCol(Color4D(0,0,0,1.0) );

    switch ( stat->state ) { 
        case 0:
            shredbutton.fillCol(stat->data->color.interp( Color4D (1.0,0.8,0.8,1.0) , 0.25)  );
            break;
        case 1:
            shredbutton.fillCol(stat->data->color.interp( Color4D (0.8,1.0,0.8,1.0) , 0.25)  );
            break;
        case 2:
            shredbutton.fillCol(stat->data->color.interp( Color4D (1.0,1.0,0.8,1.0) , 0.25)  );
            break;
        case 3:
            shredbutton.fillCol(stat->data->color.interp( Color4D (0.5,0.5,0.5,1.0) , 0.7)  );
            break;
    }

    shredbutton.moveto(0,0);
    shredbutton.seth(1.0);
    if ( stat->children.size() ) 
        sprintf(name, "%d (%ld)", procID, stat->children.size() );
    else
        sprintf(name, "%d", procID, stat->children.size() );
    shredbutton.setLabel( (char*)name );
    shredbutton.fitLabel();
    
    glPushName(pickID);
    
    shredbutton.draw(0.75);

    if ( selected ) { 
        _killButton->moveto( 0.5 * ( shredbutton.w() - _killButton->w() ) , \
                             shredbutton.top()  - 0.5 * ( shredbutton.h() - _killButton->h() ) );
        _killButton->drawNamed();
    }

    if ( selected ) { 
        glPushMatrix();
        glTranslated ( shredbutton.w(), 0, 0);
        shredbutton.resize(1.0,1.0);
        int ndead= 0;
        for ( int i = 0; i < stat->children.size(); i++ ) {         
            if ( stat->children[i]->state == 3 )
                ndead++;
            else { 
                sprintf(name, "%ld", stat->children[i]->xid );
                shredbutton.setLabel(name);
                shredbutton.fitLabel();
                switch ( stat->children[i]->state ) { 
                case 0:
                    shredbutton.fillCol(Color4D (1.0,0.4,0.4,1.0) );
                    break;
                case 1:
                case 2:
                    shredbutton.fillCol(Color4D (0.4,1.0,0.4,1.0) );
                    break;
                }
                shredbutton.draw(0.75);
                glTranslated( shredbutton.w(), 0, 0);
            }
        }
        if ( ndead ) { 
            shredbutton.fillCol( Color4D ( 0.5,0.5,0.5, 0.6 ) );
            sprintf ( name, "%d dead", ndead );
            shredbutton.setLabel(name);
            shredbutton.fitLabel();
            shredbutton.draw(0.75);
        }
        glPopMatrix();
    }
    glPopName();

}