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

void YView::alignViewVertically ( int  line  ) 

align view vertically on the given screen

  • line

Definition at line 399 of file view.cpp.

References YViewCursor::bufferY(), gotody(), YViewCursor::lineHeight, mLinesVis, YViewCursor::reset(), YViewCursor::screenX(), YViewCursor::screenY(), sendRefreshEvent(), YViewCursor::setBufferY(), YViewCursor::setScreenY(), and workCursor.

Referenced by bottomViewVertically(), and centerViewVertically().

{
    // dbg() << "YView::alignViewVertically " << line << endl;
    int newcurrent = line;
    int screenX = scrollCursor.screenX();
    int old_dCurrentTop = scrollCursor.screenY();
    if ( newcurrent > 0 ) {
        if ( wrap ) {
            initGoto( &scrollCursor );
            gotody( newcurrent );
            // rLineHeight > 1 => our new top is in middle of a wrapped line, move new top to next line
            newcurrent = workCursor.bufferY();
            if ( workCursor.lineHeight > 1 )
                ++newcurrent;
            gotoy( newcurrent );
            gotodx( screenX );
            applyGoto( &scrollCursor, false );
        } else {
            scrollCursor.setBufferY( newcurrent );
            scrollCursor.setScreenY( newcurrent );
        }
    } else {
        scrollCursor.reset();
    }

    if ( old_dCurrentTop == scrollCursor.screenY() ) {
        /* nothing has changed */
        return ;
    } else if ( qAbs(old_dCurrentTop - scrollCursor.screenY()) < mLinesVis ) {
        /* optimization: we can scroll */
        internalScroll( 0, old_dCurrentTop - scrollCursor.screenY() );
    } else {
        sendRefreshEvent();
    }
}


Generated by  Doxygen 1.6.0   Back to index