[GB.QT4.EXT]
* BUG: Fix the editor internal drawing cache resizing. * BUG: Fix the drawing of editor empty areas. git-svn-id: svn://localhost/gambas/trunk@2838 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
parent
1e2fefee38
commit
0fa5f1651f
@ -667,7 +667,7 @@ END_METHOD
|
||||
BEGIN_METHOD_VOID(CWINDOW_hide)
|
||||
|
||||
THIS->hidden = true;
|
||||
|
||||
|
||||
if (THIS->toplevel && WINDOW->isModal())
|
||||
{
|
||||
do_close(THIS, 0);
|
||||
@ -896,7 +896,6 @@ static void show_window_state(void *_object)
|
||||
|
||||
if (WINDOW)
|
||||
{
|
||||
//qDebug("show_window_state: %d", WINDOW->windowState());
|
||||
if (WINDOW->windowState() & Qt::WindowMinimized)
|
||||
WINDOW->showMinimized();
|
||||
else if (WINDOW->windowState() & Qt::WindowFullScreen)
|
||||
@ -929,13 +928,24 @@ static void manage_window_state(void *_object, void *_param, Qt::WindowState sta
|
||||
else
|
||||
WINDOW->setWindowState(WINDOW->windowState() & ~state);
|
||||
|
||||
if (WINDOW->isVisible() && !THIS->stateChange)
|
||||
if (WINDOW->isVisible())
|
||||
{
|
||||
if (WINDOW->windowState() & Qt::WindowMinimized)
|
||||
WINDOW->showMinimized();
|
||||
else if (WINDOW->windowState() & Qt::WindowFullScreen)
|
||||
WINDOW->showFullScreen();
|
||||
else if (WINDOW->windowState() & Qt::WindowMaximized)
|
||||
WINDOW->showMaximized();
|
||||
else
|
||||
WINDOW->showNormal();
|
||||
}
|
||||
/*if (WINDOW->isVisible() && !THIS->stateChange)
|
||||
{
|
||||
THIS->stateChange = true;
|
||||
//qDebug("post show_window_state %s %p", GB.GetClassName(THIS), THIS);
|
||||
GB.Ref(THIS);
|
||||
GB.Post((GB_POST_FUNC)show_window_state, (intptr_t)THIS);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -217,10 +217,11 @@ int GEditor::getCharWidth() const
|
||||
|
||||
void GEditor::updateCache()
|
||||
{
|
||||
if (cache->width() < _cellw || cache->height() < _cellh)
|
||||
int nw = QMAX(cache->width(), QMIN(visibleWidth(), _cellw));
|
||||
int nh = QMAX(cache->height(), QMIN(visibleHeight(), _cellh));
|
||||
if (nw > 0 && nh > 0 && (nw != cache->width() || nh != cache->height()))
|
||||
{
|
||||
int nw = QMAX(cache->width(), _cellw);
|
||||
int nh = QMAX(cache->height(), _cellh); //QMAX(cache->height(), _cellh);
|
||||
//qDebug("updateCache: %d %d\n", nw, nh);
|
||||
cache->resize(nw, nh);
|
||||
}
|
||||
}
|
||||
@ -622,14 +623,17 @@ void GEditor::paintCell(QPainter *painter, int row, int)
|
||||
contentsToViewport(ur.x(), ur.y(), x1, y1);
|
||||
ur.setRect(-x1, y1, ur.width(), ur.height());
|
||||
|
||||
realRow = viewToReal(row);
|
||||
if (row < 0)
|
||||
realRow = row;
|
||||
else
|
||||
realRow = viewToReal(row);
|
||||
|
||||
if (realRow >= numLines())
|
||||
if (realRow < 0 || realRow >= numLines())
|
||||
{
|
||||
/*QColor color = styles[GLine::Background].color;
|
||||
QColor color = viewport()->paletteBackgroundColor();
|
||||
if (flashed)
|
||||
color = QColor(QRgb(color.rgb() ^ 0x00FFFFFF));
|
||||
painter->fillRect(0, 0, ur.width(), ur.height(), styles[GLine::Background].color);*/
|
||||
painter->fillRect(0, 0, ur.width(), ur.height(), color);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -817,7 +821,7 @@ void GEditor::paintCell(QPainter *painter, int row, int)
|
||||
|
||||
//if (cache->width() < visibleWidth())
|
||||
// qDebug("cache->width() = %d < visibleWidth() = %d", cache->width(), visibleWidth());
|
||||
painter->drawPixmap(ur.left(), 0, *cache, 0, 0, _cellw, _cellh);
|
||||
painter->drawPixmap(ur.left(), 0, *cache, 0, 0, cache->width(), cache->height()); //, _cellw, _cellh);
|
||||
}
|
||||
|
||||
|
||||
@ -1645,6 +1649,7 @@ void GEditor::resizeEvent(QResizeEvent *e)
|
||||
Q3ScrollView::resizeEvent(e);
|
||||
baptizeVisible();
|
||||
updateWidth();
|
||||
updateCache();
|
||||
//updateViewport();
|
||||
}
|
||||
|
||||
@ -2340,10 +2345,10 @@ void GEditor::drawContents(QPainter *p, int cx, int cy, int cw, int ch)
|
||||
int rowfirst = rowAt(cy);
|
||||
int rowlast = rowAt(cy + ch - 1);
|
||||
|
||||
if (rowfirst < 0)
|
||||
/*if (rowfirst < 0)
|
||||
rowfirst = 0;
|
||||
if (rowlast >= _nrows)
|
||||
rowlast = _nrows - 1;
|
||||
rowlast = _nrows - 1;*/
|
||||
|
||||
// Go through the rows
|
||||
for (int r = rowfirst; r <= rowlast; ++r)
|
||||
@ -2356,7 +2361,7 @@ void GEditor::drawContents(QPainter *p, int cx, int cy, int cw, int ch)
|
||||
p->translate(0, -rowp);
|
||||
}
|
||||
|
||||
paintEmptyArea(p, cx, cy, cw, ch);
|
||||
//paintEmptyArea(p, cx, cy, cw, ch);
|
||||
}
|
||||
|
||||
void GEditor::updateViewport()
|
||||
|
Loading…
x
Reference in New Issue
Block a user