From 7429f0c2bf0b5499cdf108aeedcc16a23a4c8c6d Mon Sep 17 00:00:00 2001 From: Stefan Schimanski Date: Mon, 4 Jun 2007 06:21:33 +0000 Subject: [PATCH] * draw cursor in the right shape (L_SHAPE, REVERSED_L_SHAPE or the normal one) git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18645 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/GuiWorkArea.cpp | 36 +++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/src/frontends/qt4/GuiWorkArea.cpp b/src/frontends/qt4/GuiWorkArea.cpp index 79bd048491..5a8bb268e3 100644 --- a/src/frontends/qt4/GuiWorkArea.cpp +++ b/src/frontends/qt4/GuiWorkArea.cpp @@ -127,16 +127,44 @@ public: void draw(QPainter & painter) { - // FIXME: do something depending on the cursor shape. - if (show_ && rect_.isValid()) - painter.fillRect(rect_, color_); + if (show_ && rect_.isValid()) { + switch (shape_) { + case L_SHAPE: + painter.fillRect(rect_.x(), rect_.y(), CursorWidth, rect_.height(), color_); + painter.setPen(color_); + painter.drawLine(rect_.bottomLeft().x() + CursorWidth, rect_.bottomLeft().y(), + rect_.bottomRight().x(), rect_.bottomLeft().y()); + break; + + case REVERSED_L_SHAPE: + painter.fillRect(rect_.x() + rect_.height() / 3, rect_.y(), CursorWidth, rect_.height(), color_); + painter.setPen(color_); + painter.drawLine(rect_.bottomRight().x() - CursorWidth, rect_.bottomLeft().y(), + rect_.bottomLeft().x(), rect_.bottomLeft().y()); + break; + + default: + painter.fillRect(rect_, color_); + break; + } + } } void update(int x, int y, int h, CursorShape shape) { color_ = guiApp->colorCache().get(Color::cursor); - rect_ = QRect(x, y, CursorWidth, h); shape_ = shape; + switch (shape) { + case L_SHAPE: + rect_ = QRect(x, y, CursorWidth + h / 3, h); + break; + case REVERSED_L_SHAPE: + rect_ = QRect(x - h / 3, y, CursorWidth + h / 3, h); + break; + default: + rect_ = QRect(x, y, CursorWidth, h); + break; + } } void show(bool set_show = true) { show_ = set_show; } -- 2.39.2