From fcd769c58ce4887d32b859c12580a6f196e6c372 Mon Sep 17 00:00:00 2001 From: Tommaso Cucinotta Date: Wed, 2 Feb 2011 08:55:59 +0000 Subject: [PATCH] Fixed focusing issue when dialog already open on lyx start, and added selection of entire find/replace WAs when switching among them on Tab/Alt+Tab. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37413 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/FindAndReplace.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/frontends/qt4/FindAndReplace.cpp b/src/frontends/qt4/FindAndReplace.cpp index 46e4989fd2..fa79c3fe0d 100644 --- a/src/frontends/qt4/FindAndReplace.cpp +++ b/src/frontends/qt4/FindAndReplace.cpp @@ -79,6 +79,7 @@ FindAndReplaceWidget::FindAndReplaceWidget(GuiView & view) replace_work_area_->setFrameStyle(QFrame::StyledPanel); // We don't want two cursors blinking. + find_work_area_->stopBlinkingCursor(); replace_work_area_->stopBlinkingCursor(); } @@ -119,6 +120,9 @@ bool FindAndReplaceWidget::eventFilter(QObject * obj, QEvent * event) if (obj == find_work_area_){ LYXERR(Debug::FIND, "Focusing replace WA"); replace_work_area_->setFocus(); + LYXERR(Debug::FIND, "Selecting entire replace buffer"); + dispatch(FuncRequest(LFUN_BUFFER_BEGIN)); + dispatch(FuncRequest(LFUN_BUFFER_END_SELECT)); return true; } } @@ -128,6 +132,9 @@ bool FindAndReplaceWidget::eventFilter(QObject * obj, QEvent * event) if (obj == replace_work_area_) { LYXERR(Debug::FIND, "Focusing find WA"); find_work_area_->setFocus(); + LYXERR(Debug::FIND, "Selecting entire find buffer"); + dispatch(FuncRequest(LFUN_BUFFER_BEGIN)); + dispatch(FuncRequest(LFUN_BUFFER_END_SELECT)); return true; } break; @@ -525,6 +532,7 @@ void FindAndReplaceWidget::on_replaceallPB_clicked() void FindAndReplaceWidget::showEvent(QShowEvent * /* ev */) { + LYXERR(Debug::DEBUG, "showEvent()" << endl); BufferView * bv = view_.documentBufferView(); if (bv) { Buffer & doc_buf = bv->buffer(); @@ -541,14 +549,15 @@ void FindAndReplaceWidget::showEvent(QShowEvent * /* ev */) FuncRequest cmd(LFUN_LANGUAGE, lang); find_buf.text().dispatch(find_work_area_->bufferView().cursor(), cmd); replace_buf.text().dispatch(replace_work_area_->bufferView().cursor(), cmd); - - view_.setCurrentWorkArea(find_work_area_); - LYXERR(Debug::FIND, "Selecting entire find buffer"); - dispatch(FuncRequest(LFUN_BUFFER_BEGIN)); - dispatch(FuncRequest(LFUN_BUFFER_END_SELECT)); } + find_work_area_->installEventFilter(this); replace_work_area_->installEventFilter(this); + + view_.setCurrentWorkArea(find_work_area_); + LYXERR(Debug::FIND, "Selecting entire find buffer"); + dispatch(FuncRequest(LFUN_BUFFER_BEGIN)); + dispatch(FuncRequest(LFUN_BUFFER_END_SELECT)); } -- 2.39.2