void ofxTLInOut::draw(){
    ofPushStyle();
    
	ofRange screenXRange(bounds.getMinX(),bounds.getMaxX());
    if(bounds.height > 2){
        ofSetLineWidth(3);
        int inScreenX = normalizedXtoScreenX( timeline->getInOutRange().min );
        int outScreenX = normalizedXtoScreenX( timeline->getInOutRange().max ); 
        if(screenXRange.contains(inScreenX)){
            if(hoveringIn){
                ofSetColor(timeline->getColors().highlightColor);
            }
            else{
                ofSetColor(timeline->getColors().keyColor);
            }
            ofLine(inScreenX, bounds.y, inScreenX, bounds.y+bounds.height);
        }

        if(screenXRange.contains(outScreenX)){
            if(hoveringOut){
                ofSetColor(timeline->getColors().highlightColor);
            }
            else{
                ofSetColor(timeline->getColors().keyColor);
            }
            ofLine(outScreenX, bounds.y, outScreenX, bounds.y+bounds.height);
        }
    }
    
    //draw inout over the whole thing
    ofFill();
    ofSetLineWidth(1);
	//draw in/out point
	float inPointX = ofClamp(normalizedXtoScreenX(timeline->getInOutRange().min), screenXRange.min, screenXRange.max);
	float outPointX = ofClamp(normalizedXtoScreenX(timeline->getInOutRange().max),screenXRange.min, screenXRange.max);
    
	if(bounds.x < inPointX){
		ofSetColor(timeline->getColors().disabledColor,120);
		ofRect(bounds.x, pageRect.y, inPointX - bounds.x, pageRect.height);
		ofSetColor(timeline->getColors().highlightColor);
		ofLine(inPointX, pageRect.y, inPointX, pageRect.y+pageRect.height);
	}
	
	if(bounds.x+bounds.width > outPointX){
		ofSetColor(timeline->getColors().disabledColor,120);
		ofRect(outPointX, pageRect.y, (bounds.x+bounds.width) - outPointX, pageRect.height);	
		ofSetColor(timeline->getColors().highlightColor);
		ofLine(outPointX, pageRect.y, outPointX, pageRect.y+pageRect.height);
	}
	
	ofPopStyle();

}
void ofxTLInOut::draw(){
    ofPushStyle();
    
    ofSetColor(0);
    ofFill();
    ofRect(bounds);
    
	ofRange screenXRange(bounds.getMinX(),bounds.getMaxX());
    
    if(bounds.height > 2)
    {
        ofSetLineWidth(1);
        int inScreenX = normalizedXtoScreenX( timeline->getInOutRange().min );
        int outScreenX = normalizedXtoScreenX( timeline->getInOutRange().max );
        
        
        // rectangle all over the in-out
        ofSetColor(64);
        ofRect(inScreenX,bounds.y,outScreenX-inScreenX,bounds.height);
        if(inScreenX<0) inScreenX = 0;
        if(outScreenX>timeline->getWidth()) outScreenX = timeline->getWidth()-1;
        
//        if(screenXRange.contains(inScreenX))
//        {
//            if(hoveringIn){
//                ofSetColor(timeline->getColors().highlightColor);
//            }
//            else{
////                ofSetColor(timeline->getColors().keyColor);
//                ofSetColor(255);
//
//            }
            ofSetColor(220);

            ofRect(inScreenX,bounds.y,10,bounds.height);
//            ofLine(inScreenX, bounds.y, inScreenX, bounds.y+bounds.height);
//        }

//        if(screenXRange.contains(outScreenX))
//        {
//            if(hoveringOut){
//                ofSetColor(timeline->getColors().highlightColor);
//            }
//            else{
//                
////                ofSetColor(timeline->getColors().keyColor);
//                ofSetColor(255);
//            }
            ofSetColor(220);
            ofRect(outScreenX,bounds.y,-10,bounds.height);
//
//            ofLine(outScreenX, bounds.y, outScreenX, bounds.y+bounds.height);
//        }
    }
    
    //draw inout over the whole thing
    ofFill();
    ofSetLineWidth(1);
	//draw in/out point
	float inPointX = ofClamp(normalizedXtoScreenX(timeline->getInOutRange().min), screenXRange.min, screenXRange.max);
	float outPointX = ofClamp(normalizedXtoScreenX(timeline->getInOutRange().max),screenXRange.min, screenXRange.max);
    
	if(bounds.x < inPointX){
//		ofSetColor(timeline->getColors().disabledColor,60);
        ofSetColor(0,0,0,64);
		ofRect(bounds.x, pageRect.y, inPointX - bounds.x, pageRect.height);
		ofSetColor(timeline->getColors().highlightColor);
		ofLine(inPointX, pageRect.y, inPointX, pageRect.y+pageRect.height);
	}
	
	if(bounds.x+bounds.width > outPointX){
//		ofSetColor(timeline->getColors().disabledColor,60);
        ofSetColor(0,0,0,64);
		ofRect(outPointX, pageRect.y, (bounds.x+bounds.width) - outPointX, pageRect.height);
		ofSetColor(timeline->getColors().highlightColor);
		ofLine(outPointX, pageRect.y, outPointX, pageRect.y+pageRect.height);
	}
	
	ofPopStyle();

}