X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fqt4%2FGuiWorkArea.cpp;h=a61d31309a7026098bb4bbae0aeb23c74d7d74f1;hb=50de85396c785a454fe07b77d815c57f3e462282;hp=137de10185877a6aa79f9be44042d94d0f02a939;hpb=1356543c457436fc8130b9c147bd403b7a82c7e9;p=lyx.git diff --git a/src/frontends/qt4/GuiWorkArea.cpp b/src/frontends/qt4/GuiWorkArea.cpp index 137de10185..a61d31309a 100644 --- a/src/frontends/qt4/GuiWorkArea.cpp +++ b/src/frontends/qt4/GuiWorkArea.cpp @@ -14,8 +14,8 @@ #include "GuiWorkArea.h" #include "GuiApplication.h" -#include "QLPainter.h" -#include "QKeySymbol.h" +#include "GuiPainter.h" +#include "GuiKeySymbol.h" #include "qt_helpers.h" #include "frontends/LyXView.h" @@ -25,11 +25,9 @@ #include "debug.h" #include "FuncRequest.h" #include "LyXRC.h" -#include "rowpainter.h" #include "version.h" #include "support/filetools.h" // LibFileSearch -#include "support/convert.h" #include "graphics/GraphicsImage.h" #include "graphics/GraphicsLoader.h" @@ -243,9 +241,22 @@ void GuiWorkArea::setScrollbarParams(int h, int scroll_pos, int scroll_line_step } -void GuiWorkArea::adjustViewWithScrollBar(int) +void GuiWorkArea::adjustViewWithScrollBar(int action) { - scrollBufferView(verticalScrollBar()->sliderPosition()); + stopBlinkingCursor(); + if (action == QAbstractSlider::SliderPageStepAdd) + buffer_view_->scrollDown(viewport()->height()); + else if (action == QAbstractSlider::SliderPageStepSub) + buffer_view_->scrollUp(viewport()->height()); + else + buffer_view_->scrollDocView(verticalScrollBar()->sliderPosition()); + + if (lyxrc.cursor_follows_scrollbar) { + buffer_view_->setCursorFromScrollbar(); + lyx_view_->updateLayoutChoice(); + } + // Show the cursor immediately after any operation. + startBlinkingCursor(); QApplication::syncX(); } @@ -419,15 +430,18 @@ void GuiWorkArea::keyPressEvent(QKeyEvent * e) << " key=" << e->key() << endl; - boost::shared_ptr sym(new QKeySymbol); + boost::shared_ptr sym(new GuiKeySymbol); sym->set(e); processKeySym(sym, q_key_state(e->modifiers())); } -void GuiWorkArea::doubleClickTimeout() { + +void GuiWorkArea::doubleClickTimeout() +{ dc_event_.active = false; } + void GuiWorkArea::mouseDoubleClickEvent(QMouseEvent * e) { dc_event_ = double_click(e); @@ -488,9 +502,9 @@ void GuiWorkArea::expose(int x, int y, int w, int h) void GuiWorkArea::updateScreen() { - QLPainter pain(&screen_); + GuiPainter pain(&screen_); verticalScrollBar()->show(); - paintText(*buffer_view_, pain); + buffer_view_->draw(pain); } @@ -557,9 +571,9 @@ void GuiWorkArea::inputMethodEvent(QInputMethodEvent * e) return; } - QLPainter pain(&screen_); + GuiPainter pain(&screen_); buffer_view_->updateMetrics(false); - paintText(*buffer_view_, pain); + buffer_view_->draw(pain); Font font = buffer_view_->cursor().getFont(); FontMetrics const & fm = theFontMetrics(font); int height = fm.maxHeight();