Example #1
0
void ofxTLPage::removeTrack(ofxTLTrack* track){
    if(track == NULL){
        ofLogError() << "ofxTLPage::removeTrack -- removing null track!" << endl;
        return;
    }
    
	for(int i = 0; i < trackList.size(); i++){
		if(trackList[i] == track){
			trackList.erase(trackList.begin() + i);
			break;
		}
	}
	
	for(int i = 0; i < headers.size(); i++){
        if(headers[i]->getTrack() == track){
            delete headers[i];
            headers.erase(headers.begin()+i);
            tracks.erase(track->getName());
            if(track == focusedTrack){
                focusedTrack->lostFocus();
                focusedTrack = NULL;
            }
            //TODO smart pointers this won't be necessary
            if(track->getCreatedByTimeline()){
                delete track;
            }
            recalculateHeight();
            return;
        }
    }
    ofLogError() << "ofxTLPage::removeTrack -- track named " << track->getName() << " not found!" << endl;
}
Example #2
0
void ofxTLPage::setContainer(ofVec2f offset, float width){
	elementContainerRect.x = offset.x;
	elementContainerRect.y = offset.y;
	//containerOffset = offset;
	//containerWidth = width;
	elementContainerRect.width = width;
	recalculateHeight();
}
Example #3
0
void ofxTLPage::collapseAllTracks(bool excludeFocusTrack){
	for(int i = 0; i < headers.size(); i++){
		if(!excludeFocusTrack || focusedTrack != headers[i]->getTrack()){
			headers[i]->collapseTrack();
		}
	}
	recalculateHeight();
}
Example #4
0
void ofxTLPage::bringTrackToBottom(ofxTLTrack* track){
    for(int i = 0; i < headers.size(); i++){
        if(track == headers[i]->getTrack()){
        	ofxTLTrackHeader* header = headers[i];
            for(int j = i; j < headers.size()-1; j++){
                headers[j] = headers[j+1];
            }
            headers[headers.size()-1] = header;
            recalculateHeight();
            return;
        }
    }
    ofLogError("ofxTLPage::bringTrackToBottom -- track " + track->getName() + " not found");
}
Example #5
0
void ofxTLPage::bringTrackToPos(ofxTLTrack* track, int pos){
	for(int i = 0; i < headers.size(); i++){
		if(track == headers[i]->getTrack()){
			ofxTLTrackHeader* header = headers[i];
			for(int j = i; j > pos; j--){
				headers[j] = headers[j-1];
			}
			headers[pos] = header;
			recalculateHeight();
			return;
		}
	}
	ofLogError("ofxTLPage::bringTrackToPos -- track " + track->getName() + " not found");

}
Example #6
0
void ItemContainer::logic()
{
    if (!isVisible())
        return;

    gcn::Widget::logic();

    setEnabled(mInventory->getNumberOfSlotsUsed() != 0);

    int i = mInventory->getLastUsedSlot();

    if (i != mMaxItems)
    {
        mMaxItems = i;
        recalculateHeight();
    }
}
Example #7
0
void ofxTLPage::evenlyDistributeTrackHeights(){
	float addedHeightPerTrack = 0;
	if(!headersAreMinimal)addedHeightPerTrack += headerHeight;
	if(!footersAreHidden) addedHeightPerTrack += FOOTER_HEIGHT;
	if(heightBeforeCollapse == 0){
		heightBeforeCollapse = trackContainerRect.height - addedHeightPerTrack*headers.size();
	}
	
	float heightPerTrack = heightBeforeCollapse / headers.size();
	
	for(int i = 0; i < headers.size(); i++){
		ofRectangle trackRect = headers[i]->getTrack()->getDrawRect();
		trackRect.height = heightPerTrack;
		headers[i]->getTrack()->setDrawRect(trackRect);
	}
	if(heightBeforeCollapse != 0){
		recalculateHeight();
		heightBeforeCollapse = 0;
	}

	cout << endl;
}
Example #8
0
void ofxTLPage::expandFocusedTrack(){
	if(focusedTrack == NULL){
		return;
	}
	
	float staticSpacePerTrack = 0;
	if(!headersAreMinimal)staticSpacePerTrack += headerHeight;
	if(!footersAreHidden) staticSpacePerTrack += FOOTER_HEIGHT;
	
	float newHeight = trackContainerRect.height - headers.size()*staticSpacePerTrack;
	ofRectangle trackRect = focusedTrack->getDrawRect();
	trackRect.height = newHeight;
	focusedTrack->setDrawRect(trackRect);
	
	for(int i = 0; i < headers.size(); i++){
		if(headers[i]->getTrack() != focusedTrack){
			headers[i]->collapseTrack();
		}
	}
	
	recalculateHeight();
}
Example #9
0
void ofxTLPage::setHeaderHeight(float newHeaderHeight){
	headerHeight = newHeaderHeight;
	recalculateHeight();
}
Example #10
0
void ofxTLPage::collapseAllTracks(){
	for(int i = 0; i < headers.size(); i++){
		headers[i]->collapseTrack();
	}
	recalculateHeight();
}
Example #11
0
void ofxTLPage::hideFooters(bool hide){
	if(hide != footersAreHidden){
		footersAreHidden = hide;
		recalculateHeight();
	}
}
Example #12
0
void ofxTLPage::setMinimalHeaders(bool minimal){
	if(minimal != headersAreMinimal){
		headersAreMinimal = minimal;
		recalculateHeight();
	}
}
Example #13
0
void ItemContainer::widgetResized(const gcn::Event &event)
{
    recalculateHeight();
}
Example #14
0
void ofxTLPage::setContainer(ofVec2f offset, float width) {
    containerOffset = offset;
    containerWidth = width;
    recalculateHeight();
}
Example #15
0
void ofxTLPage::collapseAllElements(){
	for(int i = 0; i < headers.size(); i++){
		headers[i]->collapseElement();
	}
	recalculateHeight();
}