mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-28 06:49:43 +00:00
- restore a backing pixmap painting strategy: the pixmap is drawn at expose() time.
- the cursor is still a widget, the width is 2-pixel on Windows and 1-pixel on other platforms. The full screen refresh on blinking cursor bug is now gone. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15695 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
8e54e38c3b
commit
ff3c643f09
@ -39,7 +39,6 @@
|
|||||||
#include <QMimeData>
|
#include <QMimeData>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
#include <QDragEnterEvent>
|
#include <QDragEnterEvent>
|
||||||
#include <QPixmap>
|
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
|
|
||||||
@ -50,8 +49,10 @@
|
|||||||
// On windows-XP the UserGuide PageDown scroll test is faster without event pruning (16 s)
|
// On windows-XP the UserGuide PageDown scroll test is faster without event pruning (16 s)
|
||||||
// than with it (23 s).
|
// than with it (23 s).
|
||||||
#ifdef Q_WS_WIN
|
#ifdef Q_WS_WIN
|
||||||
|
int const CursorWidth = 2;
|
||||||
#define USE_EVENT_PRUNING 0
|
#define USE_EVENT_PRUNING 0
|
||||||
#else
|
#else
|
||||||
|
int const CursorWidth = 1;
|
||||||
#define USE_EVENT_PRUNING 0
|
#define USE_EVENT_PRUNING 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -120,7 +121,7 @@ public:
|
|||||||
CursorWidget(QWidget * parent)
|
CursorWidget(QWidget * parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
{
|
{
|
||||||
resize(2, 20);
|
resize(CursorWidth, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
void paintEvent(QPaintEvent *)
|
void paintEvent(QPaintEvent *)
|
||||||
@ -165,10 +166,16 @@ public:
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
/// shown?
|
|
||||||
bool on_;
|
|
||||||
///
|
///
|
||||||
CursorShape shape_;
|
CursorShape shape_;
|
||||||
|
///
|
||||||
|
bool show_hcursor_;
|
||||||
|
///
|
||||||
|
bool show_vcursor_;
|
||||||
|
///
|
||||||
|
bool lshape_cursor_;
|
||||||
|
///
|
||||||
|
QColor cursor_color_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -496,6 +503,7 @@ void GuiWorkArea::mouseDoubleClickEvent(QMouseEvent * e)
|
|||||||
void GuiWorkArea::resizeEvent(QResizeEvent * ev)
|
void GuiWorkArea::resizeEvent(QResizeEvent * ev)
|
||||||
{
|
{
|
||||||
cursor_->hide();
|
cursor_->hide();
|
||||||
|
screen_ = QPixmap(ev->size().width(), ev->size().height());
|
||||||
verticalScrollBar()->setPageStep(viewport()->height());
|
verticalScrollBar()->setPageStep(viewport()->height());
|
||||||
QAbstractScrollArea::resizeEvent(ev);
|
QAbstractScrollArea::resizeEvent(ev);
|
||||||
resizeBufferView();
|
resizeBufferView();
|
||||||
@ -554,64 +562,45 @@ void GuiWorkArea::doGreyOut(QLPainter & pain)
|
|||||||
|
|
||||||
void GuiWorkArea::paintEvent(QPaintEvent * ev)
|
void GuiWorkArea::paintEvent(QPaintEvent * ev)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
lyxerr[Debug::GUI] << BOOST_CURRENT_FUNCTION
|
|
||||||
<< "\n QWidget width\t" << this->width()
|
|
||||||
<< "\n QWidget height\t" << this->height()
|
|
||||||
<< "\n viewport width\t" << viewport()->width()
|
|
||||||
<< "\n viewport height\t" << viewport()->height()
|
|
||||||
<< "\n QPaintEvent x\t" << e->rect().x()
|
|
||||||
<< "\n QPaintEvent y\t" << e->rect().y()
|
|
||||||
<< "\n QPaintEvent w\t" << e->rect().width()
|
|
||||||
<< "\n QPaintEvent h\t" << e->rect().height()
|
|
||||||
<< endl;
|
|
||||||
*/
|
|
||||||
|
|
||||||
QRect const rc = ev->rect();
|
QRect const rc = ev->rect();
|
||||||
//lyxerr << "paintEvent begin: x: " << rc.x()
|
lyxerr[Debug::PAINTING] << "paintEvent begin: x: " << rc.x()
|
||||||
// << " y: " << rc.y()
|
<< " y: " << rc.y()
|
||||||
// << " w: " << rc.width()
|
<< " w: " << rc.width()
|
||||||
// << " h: " << rc.height() << endl;
|
<< " h: " << rc.height() << endl;
|
||||||
|
|
||||||
if (!buffer_view_) {
|
QPainter pain(viewport());
|
||||||
lyxerr << "no bufferview" << endl;
|
pain.drawPixmap(rc, screen_, rc);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
QLPainter pain(viewport());
|
|
||||||
|
|
||||||
if (rc.width() == 3) { // FIXME HACK
|
|
||||||
// Assume splash screen drawing is requested when
|
|
||||||
// width == 3
|
|
||||||
lyxerr << "splash screen requested" << endl;
|
|
||||||
doGreyOut(pain);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!buffer_view_->buffer()) {
|
|
||||||
lyxerr << "no buffer: " << endl;
|
|
||||||
doGreyOut(pain);
|
|
||||||
updateScrollbar();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//lyxerr << "real drawing" << endl;
|
|
||||||
paintText(*buffer_view_, pain);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void GuiWorkArea::expose(int x, int y, int w, int h)
|
void GuiWorkArea::expose(int x, int y, int w, int h)
|
||||||
{
|
{
|
||||||
|
QLPainter pain(&screen_);
|
||||||
|
|
||||||
|
if (w == 3) { // FIXME HACK
|
||||||
|
// Assume splash screen drawing is requested when
|
||||||
|
// width == 3
|
||||||
|
lyxerr << "splash screen requested" << endl;
|
||||||
|
doGreyOut(pain);
|
||||||
|
}
|
||||||
|
else if (!buffer_view_->buffer()) {
|
||||||
|
lyxerr << "no buffer: " << endl;
|
||||||
|
doGreyOut(pain);
|
||||||
|
updateScrollbar();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
paintText(*buffer_view_, pain);
|
||||||
|
}
|
||||||
|
|
||||||
update(x, y, w, h);
|
update(x, y, w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GuiWorkArea::showCursor(int x, int y, int h, CursorShape shape)
|
void GuiWorkArea::showCursor(int x, int y, int h, CursorShape shape)
|
||||||
{
|
{
|
||||||
cursor_->setGeometry(x, y, 2, h);
|
cursor_->setGeometry(x, y, CursorWidth, h);
|
||||||
cursor_->shape_ = shape;
|
cursor_->shape_ = shape;
|
||||||
cursor_->on_ = true;
|
|
||||||
cursor_->show();
|
cursor_->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#include <QResizeEvent>
|
#include <QResizeEvent>
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
#include <QPixmap>
|
||||||
|
|
||||||
#include <queue>
|
#include <queue>
|
||||||
|
|
||||||
@ -167,18 +168,10 @@ private:
|
|||||||
///
|
///
|
||||||
double_click dc_event_;
|
double_click dc_event_;
|
||||||
|
|
||||||
///
|
|
||||||
bool show_hcursor_;
|
|
||||||
///
|
|
||||||
bool show_vcursor_;
|
|
||||||
///
|
|
||||||
bool lshape_cursor_;
|
|
||||||
///
|
|
||||||
QColor cursor_color_;
|
|
||||||
///
|
|
||||||
CursorShape cursor_shape_;
|
|
||||||
///
|
///
|
||||||
CursorWidget * cursor_;
|
CursorWidget * cursor_;
|
||||||
|
///
|
||||||
|
QPixmap screen_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace frontend
|
} // namespace frontend
|
||||||
|
Loading…
Reference in New Issue
Block a user