Stefan, you won't believe this! On Friday I also wrote a patch for this
--- but I just don't have the time to work on LyX...:( I was going to
just clean it up and send it in any day...
Anyhow, naturally my patch is pretty similar to yours. The only
significant difference is that I saw that in previous versions, the
bottom section was of width h/3, so I guess we could stick with that.
Other than than that, It'd be great to get this committed, it would make
working with bidi that much easier.
BTW, this is http://bugzilla.lyx.org/show_bug.cgi?id=3163.
(I'm attaching my patch just for comparison, if you want; or you can
just forget it and use yours; but as I said, I just got mine working,
but didn't have time to clean it up yet...)
Thanks!
Dov
Stefan Schimanski wrote:
Hi!
Was there any reason to ignore the cursor shape in the Qt frontend?
Here is a patch:
Index: src/frontends/qt4/GuiWorkArea.cpp
===================================================================
--- src/frontends/qt4/GuiWorkArea.cpp (Revision 18626)
+++ src/frontends/qt4/GuiWorkArea.cpp (Arbeitskopie)
@@ -122,16 +122,42 @@
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.drawLine(rect_.bottomLeft().x() + CursorWidth,
rect_.bottomLeft().y(),
+
rect_.bottomRight().x(), rect_.bottomLeft().y());
+ break;
+
+ case REVERSED_L_SHAPE:
+ painter.fillRect(rect_.x() + 4, rect_.y(), CursorWidth,
rect_.height(), 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 + 4, h);
+ break;
+ case REVERSED_L_SHAPE:
+ rect_ = QRect(x - 4, y, CursorWidth + 4, h);
+ break;
+ default:
+ rect_ = QRect(x, y, CursorWidth, h);
+ break;
+ }
}
void show(bool set_show = true) { show_ = set_show; }
Index: lyx-devel/src/frontends/qt4/GuiWorkArea.cpp
===================================================================
--- lyx-devel.orig/src/frontends/qt4/GuiWorkArea.cpp 2007-06-01
04:31:46.000000000 +0300
+++ lyx-devel/src/frontends/qt4/GuiWorkArea.cpp 2007-06-01 05:26:03.000000000
+0300
@@ -123,14 +123,25 @@
void draw(QPainter & painter)
{
// FIXME: do something depending on the cursor shape.
- if (show_ && rect_.isValid())
- painter.fillRect(rect_, color_);
+ if (show_ && rect_.isValid()) {
+ painter.fillRect(side_bar_, color_);
+ switch (shape_) {
+ case L_SHAPE:
+ case REVERSED_L_SHAPE:
+ painter.fillRect(bottom_bar_, color_);
+ break;
+ default:
+ break;
+ }
+ }
}
void update(int x, int y, int h, CursorShape shape)
{
color_ = guiApp->colorCache().get(Color::cursor);
- rect_ = QRect(x, y, CursorWidth, h);
+ rect_ = QRect(x-(shape == REVERSED_L_SHAPE ? h/3 - CursorWidth
: 0), y, h/3, h);
+ side_bar_ = QRect(x, y, CursorWidth, h);
+ bottom_bar_ = QRect(x-(shape == REVERSED_L_SHAPE ? h/3 -
CursorWidth : 0), y+h-CursorWidth, h/3, CursorWidth);
shape_ = shape;
}
@@ -148,6 +159,8 @@
QColor color_;
///
QRect rect_;
+ QRect bottom_bar_;
+ QRect side_bar_;
};