Logo Search packages:      
Sourcecode: yzis version File versions  Download package

void YView::gotody ( int  y  )  [private]

gotody when cursor is > nexty seems buggy, use gotoy way, I'll try to find a better solution

Definition at line 500 of file view.cpp.

References YViewCursor::bLineIncrement, YViewCursor::bufferY(), drawMode, drawNextCol(), drawNextLine(), drawPrevLine(), initDraw(), YBuffer::lineCount(), YViewCursor::lineHeight, mBuffer, rCurLineLength, rMinCurLineLength, YViewCursor::screenY(), YViewCursor::setScreenY(), YViewCursor::sLineIncrement, workCursor, YViewCursor::wrapNextLine, and YASSERT.

Referenced by alignViewVertically().

{
    YASSERT( nexty >= 0 );
    YZIS_SAFE_MODE {
        if ( nexty < 0 ) nexty = 0;
    }
    if ( workCursor.bufferY() >= mBuffer->lineCount() ) nexty = qMax( 0, mBuffer->lineCount() - 1 );

    /* some easy case */
    if ( nexty == 0 ) {
        gotoy( 0 );
    } else if ( nexty == scrollCursor.screenY() ) {
        gotoy( scrollCursor.bufferY() );
    } else {
        /** gotody when cursor is > nexty seems buggy, use gotoy way, I'll try to find a better solution */
        bool first = true;
        while ( workCursor.screenY() > nexty ) {
            if ( first && wrap && rCurLineLength > mColumnsVis ) { // move to begin of line
                initDraw( 0, workCursor.bufferY(), 0, workCursor.screenY() - workCursor.lineHeight + 1, drawMode );
                workCursor.lineHeight = workCursor.sLineIncrement = workCursor.bLineIncrement = 1;
                first = false;
            }
            drawPrevLine( );
            if ( wrap && rCurLineLength > mColumnsVis ) {
                /* goto begin of line */
                int wrapLineMinHeight = (int)ceil( rMinCurLineLength / mColumnsVis ) + 1;
                int wrapLineMaxHeight = (int)ceil( rCurLineLength / mColumnsVis ) + 1;
                if ( wrapLineMinHeight == wrapLineMaxHeight ) {
                    workCursor.setScreenY( workCursor.screenY() + 1 - wrapLineMinHeight );
                } else {
                    int cury = workCursor.bufferY();
                    int prevRX = workCursor.screenY();
                    initDraw( 0, cury, 0, 0, drawMode );
                    while ( drawNextCol( ) ) ;
                    while ( workCursor.bufferY() == cury ) {
                        wrapLineMinHeight = workCursor.lineHeight;
                        drawNextLine( );
                        if ( workCursor.bufferY() == cury ) while ( drawNextCol( ) ) ;
                    }
                    initDraw ( 0, cury, 0, prevRX - wrapLineMinHeight + 1, drawMode );
                    workCursor.lineHeight = workCursor.sLineIncrement = workCursor.bLineIncrement = 1;
                }
            }
        }
        while ( workCursor.screenY() < nexty && workCursor.bufferY() < mBuffer->lineCount() - 1 ) {
            if ( wrap && ! workCursor.wrapNextLine && rCurLineLength > mColumnsVis ) // make line wrapping
                while ( drawNextCol( ) ) ;
            drawNextLine( );
            if ( wrap && workCursor.screenY() < nexty && rCurLineLength > mColumnsVis ) // move to end of draw line
                while ( drawNextCol( ) ) ;
        }
    }
}


Generated by  Doxygen 1.6.0   Back to index