]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/FindAndReplace.cpp
Revert r32673 and remove the extra redraw and setFocus calls.
[lyx.git] / src / frontends / qt4 / FindAndReplace.cpp
index 4f6f30415ced9bfc60bc1898dd0e648d424d9194..7164aa25db6b20f1e0b6814f5701e54dd80470b8 100644 (file)
@@ -162,6 +162,15 @@ void FindAndReplaceWidget::findAndReplace(
        } else {
                replaceString = from_utf8(LYX_FR_NULL_STRING);
        }
+       FindAndReplaceOptions::SearchScope scope = FindAndReplaceOptions::S_BUFFER;
+       if (CurrentDocument->isChecked())
+               scope = FindAndReplaceOptions::S_BUFFER;
+       else if (MasterDocument->isChecked())
+               scope = FindAndReplaceOptions::S_DOCUMENT;
+       else if (OpenDocuments->isChecked())
+               scope = FindAndReplaceOptions::S_OPEN_BUFFERS;
+       else
+               LASSERT(false, /**/);
        LYXERR(Debug::FIND, "FindAndReplaceOptions: "
               << "searchstring=" << searchString
               << ", casesensitiv=" << casesensitive
@@ -171,9 +180,10 @@ void FindAndReplaceWidget::findAndReplace(
               << ", ignoreformat=" << ignoreformat
               << ", regexp=" << regexp
               << ", replaceString" << replaceString
-              << ", keep_case=" << keep_case);
+              << ", keep_case=" << keep_case
+              << ", scope=" << scope);
        FindAndReplaceOptions opt(searchString, casesensitive, matchword, ! backwards,
-                 expandmacros, ignoreformat, regexp, replaceString, keep_case);
+               expandmacros, ignoreformat, regexp, replaceString, keep_case, scope);
        LYXERR(Debug::FIND, "Dispatching LFUN_WORD_FINDADV");
        std::ostringstream oss;
        oss << opt;
@@ -197,7 +207,6 @@ void FindAndReplaceWidget::findAndReplace(bool backwards, bool replace)
                ignoreFormatCB->isChecked(),
                replace,
                keepCaseCB->isChecked());
-       view_.currentMainWorkArea()->redraw();
 }
 
 
@@ -258,13 +267,10 @@ void FindAndReplaceWidget::on_replaceallPB_clicked()
 
 void FindAndReplaceWidget::showEvent(QShowEvent * /* ev */)
 {
-       replace_work_area_->redraw();
-       find_work_area_->setFocus();
        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_->redraw();
        find_work_area_->installEventFilter(this);
        replace_work_area_->installEventFilter(this);
 }