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

void YView::updateCursor (  ) 

Update the GUI when the cursor position has changed. Updates the status bar and notificates the GUI through guiUpdateCursor, which should update the editor cursor position.

Can't be called until the GUI has been initialized.

Definition at line 257 of file view.cpp.

References YViewCursor::bufferY(), endl(), getCurrentTop(), getLinesVisible(), YViewIface::guiStatusBar(), YViewIface::guiUpdateCursor(), HERE, YBuffer::lineCount(), mainCursor, mBuffer, YStatusBarIface::setLineInfo(), and viewCursor().

Referenced by alignViewBufferVertically(), YSession::createView(), NYView::refreshScreen(), and YBuffer::updateAllViews().

{
    int lasty = -1;
    QString percentage;
    QString lineinfo;

    int y = mainCursor.bufferY();

    if (y != lasty) {
        int nblines = mBuffer->lineCount();
        if (getCurrentTop() < 1)
            if ((getCurrentTop() + getLinesVisible()) >= nblines)
                    percentage = _("All");
            else
                    percentage =  _("Top");

        else if ((getCurrentTop() + getLinesVisible()) >= nblines)
            percentage = _("Bot");

        else
            if(y < 0 || y > nblines)
                err() << HERE() << "Percentage out of range" << endl;
            else
                percentage.setNum((int)(y * 100 / (nblines == 0 ? 1 : nblines)));

    } else {
        percentage = _("All");
    }

    if (guiStatusBar())
        guiStatusBar()->setLineInfo(y + 1, viewCursor().bufferX() + 1,
                                    viewCursor().screenX() + 1, percentage);
    guiUpdateCursor();
}


Generated by  Doxygen 1.6.0   Back to index