Exemplo n.º 1
0
void RDirNode::updateFilePositions() {

    int max_files = 1;
    int diameter  = 1;
    int file_no   = 0;
    float d = 0.0;
    float max_size_during_cycle = 0;

    int files_left = visible_count;

    files.sort(sortBySize);

    for(std::list<RFile*>::iterator it = files.begin(); it!=files.end(); it++) {
        RFile* f = *it;

        if(f->isHidden()) {
            f->setDest(vec2(0.0,0.0));
            f->setDistance(0.0f);
            continue;
        }

        vec2 dest = calcFileDest(max_files, file_no);

        f->setDest(dest);
        f->setDistance(d);

        files_left--;
        file_no++;

        if(max_size_during_cycle < f->size) {
            max_size_during_cycle = f->size;
        }

        if(file_no >= max_files) {
            diameter++;
            d += max_size_during_cycle;
            max_files = (int) std::max(1.0, diameter*PI);

            if(files_left<max_files) {
                max_files = files_left;
            }

            file_no = 0;
            max_size_during_cycle = gGourceFileDiameter;
        }
    }

    file_area  = d + max_size_during_cycle; 


}
Exemplo n.º 2
0
void RDirNode::updateFilePositions() {

    int max_files = 1;
    int diameter  = 1;
    int file_no   = 0;

    int files_left = visible_count;

    for(std::list<RFile*>::iterator it = files.begin(); it!=files.end(); it++) {
        RFile* f = *it;

        if(f->isHidden()) {
            f->setDest(vec2f(0.0,0.0));
            f->setDistance(0.0f);
            continue;
        }

        vec2f dest = calcFileDest(max_files, file_no);

        float d = ((float)(diameter-1)) * gGourceFileDiameter;

        f->setDest(dest);
        f->setDistance(d);

        files_left--;
        file_no++;

        if(file_no>=max_files) {
            diameter++;
            max_files = (int) std::max(1.0f, diameter*PI);

            if(files_left<max_files) {
                max_files = files_left;
            }

            file_no=0;
        }
    }
}