From: <hep...@us...> - 2010-12-20 04:37:46
|
Revision: 1261 http://qterm.svn.sourceforge.net/qterm/?rev=1261&view=rev Author: hephooey Date: 2010-12-20 04:37:40 +0000 (Mon, 20 Dec 2010) Log Message: ----------- Feed the real updated region to update, for translucent styles Modified Paths: -------------- trunk/qterm-qt4/src/qtermscreen.cpp trunk/qterm-qt4/src/qtermscreen.h trunk/qterm-qt4/src/qtermwindow.cpp Modified: trunk/qterm-qt4/src/qtermscreen.cpp =================================================================== --- trunk/qterm-qt4/src/qtermscreen.cpp 2010-12-20 04:37:33 UTC (rev 1260) +++ trunk/qterm-qt4/src/qtermscreen.cpp 2010-12-20 04:37:40 UTC (rev 1261) @@ -163,7 +163,23 @@ if (m_blinkCursor) { m_ePaintState = Cursor; m_bCursor = !m_bCursor; - update(); + QRect cursorRect; + QPoint pt = mapToPixel(QPoint(m_pBuffer->caretX(), m_pBuffer->caretY())); + switch (m_pParam->m_mapParam["cursor"].toInt()) { + case 0: + cursorRect.setRect(pt.x(), pt.y(), m_nCharWidth, m_nCharHeight); + break; + case 1: + cursorRect.setRect(pt.x(), pt.y() + 9*m_nCharHeight / 10, m_nCharWidth, m_nCharHeight / 10); + break; + case 2: + cursorRect.setRect(pt.x(), pt.y(), m_nCharWidth / 9, m_nCharHeight); + break; + default: + qDebug("Unknown cursor type"); + break; + } + update(cursorRect); } } @@ -212,7 +228,7 @@ if (m_hasBlink) { m_blinkScreen = !m_blinkScreen; m_ePaintState = Blink; - update(); + update(m_blinkRegion); } } @@ -498,8 +514,7 @@ for (int i = m_nStart; i <= m_nEnd; i++) m_pBuffer->at(i)->setChanged(-1, -1); - m_ePaintState = NewData; - update(); + updateRegion(); } void Screen::scrollChanged(int value) { @@ -519,9 +534,7 @@ for (int i = m_nStart; i <= m_nEnd; i++) m_pBuffer->at(i)->setChanged(-1, -1); - m_ePaintState = NewData; - update(); - + updateRegion(); } void Screen::updateScrollBar() @@ -694,6 +707,8 @@ int startx, endx; QPainter painter; + QRegion blinkRegion; + painter.begin(this); //qDebug("size: %d, %d", width(),height()); if (m_ePaintState == Show) @@ -715,6 +730,16 @@ if (pTextLine->hasBlink()) { m_hasBlink = true; m_pBlinkLine[index - m_nStart] = true; + uint linelength = pTextLine->getLength(); + QByteArray attr = pTextLine->getAttr(); + for (uint i = 0; i < linelength; ++i) { + if (GETBLINK(attr.at(i))) { + startx = i; + while (i < linelength && GETBLINK(attr.at(i))) + ++i; + blinkRegion += mapToRect(startx, index, i-startx, 1); + } + } } else m_pBlinkLine[index - m_nStart] = false; if (!pTextLine->isChanged(startx, endx)) @@ -730,6 +755,7 @@ pTextLine->clearChange(); } painter.end(); + m_blinkRegion = blinkRegion; updateMicroFocus(); if (m_pWindow->isConnected()) { @@ -1062,6 +1088,25 @@ } } +void Screen::updateRegion() +{ + int startx, endx; + + m_ePaintState = NewData; + QRegion paintRegion; + for (int index = m_nStart; index <= m_nEnd; index++) { + TextLine *pTextLine = m_pBuffer->at(index); + if (!pTextLine->isChanged(startx, endx)) + continue; + if (startx > 0 && pTextLine->isPartial(startx)) { + startx -= 1; + } + + paintRegion += mapToRect(startx, index, -1, 1); + } + update(paintRegion); +} + /* ------------------------------------------------------------------------ */ /* */ /* Auxilluary */ Modified: trunk/qterm-qt4/src/qtermscreen.h =================================================================== --- trunk/qterm-qt4/src/qtermscreen.h 2010-12-20 04:37:33 UTC (rev 1260) +++ trunk/qterm-qt4/src/qtermscreen.h 2010-12-20 04:37:40 UTC (rev 1261) @@ -83,6 +83,7 @@ QRect mapToRect(int, int, int, int); QRect mapToRect(const QRect&); PageViewMessage * osd(); + void updateRegion(); PaintState m_ePaintState; @@ -204,6 +205,8 @@ QTextCodec *m_pCodec; + QRegion m_blinkRegion; + friend class Window; // for test only Modified: trunk/qterm-qt4/src/qtermwindow.cpp =================================================================== --- trunk/qterm-qt4/src/qtermwindow.cpp 2010-12-20 04:37:33 UTC (rev 1260) +++ trunk/qterm-qt4/src/qtermwindow.cpp 2010-12-20 04:37:40 UTC (rev 1261) @@ -525,8 +525,7 @@ // clear the selected before if (m_ptSelStart != m_ptSelEnd) { m_pBuffer->clearSelect(); - m_pScreen->m_ePaintState = Screen::NewData; - m_pScreen->update(); + m_pScreen->updateRegion(); } // set the selecting flag @@ -602,8 +601,7 @@ QPoint point = m_ptSelEnd - m_ptSelStart; if (point.manhattanLength() > 3) { m_pBuffer->setSelect(m_pScreen->mapToChar(m_ptSelStart), m_pScreen->mapToChar(m_ptSelEnd), m_bRectCopy); - m_pScreen->m_ePaintState = Screen::NewData; - m_pScreen->update(); + m_pScreen->updateRegion(); } } @@ -671,8 +669,7 @@ m_ptSelEnd = me->pos(); if (m_ptSelEnd != m_ptSelStart && m_bSelecting) { m_pBuffer->setSelect(m_pScreen->mapToChar(m_ptSelStart), m_pScreen->mapToChar(m_ptSelEnd), m_bRectCopy); - m_pScreen->m_ePaintState = Screen::NewData; - m_pScreen->update(); + m_pScreen->updateRegion(); if (m_bAutoCopy) on_actionCopy_triggered(); m_bSelecting = false; @@ -1437,8 +1434,7 @@ strMsg += "\x1b[17C===========================================\n"; m_pDecode->decode(strMsg.toLatin1(), strMsg.length()); - m_pScreen->m_ePaintState = Screen::NewData; - m_pScreen->update(); + m_pScreen->updateRegion(); } void Window::doAutoLogin() @@ -1842,8 +1838,7 @@ m_pBBS->updateUrlList(); //m_updateTimer->start(100); //refresh screen - m_pScreen->m_ePaintState = Screen::NewData; - m_pScreen->repaint(); + m_pScreen->updateRegion(); m_bMessage = false; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |