From 0029b4a217121eb4929fc4a2d2705a0813f6b5e2 Mon Sep 17 00:00:00 2001 From: Tommaso Cucinotta Date: Fri, 21 Aug 2009 16:51:07 +0000 Subject: [PATCH] Advanced Search GUI enhancements (tooltips, navigation, shorter labels) git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31179 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/FindAndReplace.cpp | 36 +- src/frontends/qt4/ui/FindAndReplaceUi.ui | 852 ++++++++++++++--------- 2 files changed, 535 insertions(+), 353 deletions(-) diff --git a/src/frontends/qt4/FindAndReplace.cpp b/src/frontends/qt4/FindAndReplace.cpp index 05600feb96..8c0f4ec4ad 100644 --- a/src/frontends/qt4/FindAndReplace.cpp +++ b/src/frontends/qt4/FindAndReplace.cpp @@ -59,7 +59,7 @@ FindAndReplaceWidget::FindAndReplaceWidget(GuiView & view) bool FindAndReplaceWidget::eventFilter(QObject *obj, QEvent *event) { - LYXERR(Debug::FIND, "FindAndReplace::eventFilter()"); + LYXERR(Debug::FIND, "FindAndReplace::eventFilter(): obj=" << obj << ", fwa=" << find_work_area_ << ", rwa=" << replace_work_area_ << "fsa=" << find_scroll_area_ << ", rsa=" << replace_scroll_area_); if (obj == find_work_area_ && event->type() == QEvent::KeyPress) { QKeyEvent *e = static_cast (event); if (e->key() == Qt::Key_Escape && e->modifiers() == Qt::NoModifier) { @@ -73,6 +73,29 @@ bool FindAndReplaceWidget::eventFilter(QObject *obj, QEvent *event) on_findNextPB_clicked(); return true; } + } else if (e->key() == Qt::Key_Tab && e->modifiers() == Qt::NoModifier) { + LYXERR(Debug::FIND, "Focusing replace WA"); + replace_work_area_->setFocus(); + return true; + } + } + if (obj == replace_work_area_ && event->type() == QEvent::KeyPress) { + QKeyEvent *e = static_cast (event); + if (e->key() == Qt::Key_Escape && e->modifiers() == Qt::NoModifier) { + on_closePB_clicked(); + return true; + } else if (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return) { + if (e->modifiers() == Qt::ShiftModifier) { + on_replacePrevPB_clicked(); + return true; + } else if (e->modifiers() == Qt::NoModifier) { + on_replaceNextPB_clicked(); + return true; + } + } else if (e->key() == Qt::Key_Backtab) { + LYXERR(Debug::FIND, "Focusing find WA"); + find_work_area_->setFocus(); + return true; } } // standard event processing @@ -158,7 +181,6 @@ void FindAndReplaceWidget::findAndReplace(bool backwards, bool replace) { // FIXME: create a Dialog::returnFocus() or something instead of this: view_.setCurrentWorkArea(view_.currentMainWorkArea()); - // FIXME: This should be an LFUN. findAndReplace(caseCB->isChecked(), wordsCB->isChecked(), backwards, @@ -167,7 +189,6 @@ void FindAndReplaceWidget::findAndReplace(bool backwards, bool replace) replace, keepCaseCB->isChecked()); view_.currentMainWorkArea()->redraw(); - find_work_area_->setFocus(); } @@ -196,45 +217,51 @@ void FindAndReplaceWidget::on_closePB_clicked() void FindAndReplaceWidget::on_findNextPB_clicked() { findAndReplace(false, false); + find_work_area_->setFocus(); } void FindAndReplaceWidget::on_findPrevPB_clicked() { findAndReplace(true, false); + find_work_area_->setFocus(); } void FindAndReplaceWidget::on_replaceNextPB_clicked() { findAndReplace(false, true); + replace_work_area_->setFocus(); } void FindAndReplaceWidget::on_replacePrevPB_clicked() { findAndReplace(true, true); + replace_work_area_->setFocus(); } void FindAndReplaceWidget::on_replaceallPB_clicked() { + replace_work_area_->setFocus(); } void FindAndReplaceWidget::showEvent(QShowEvent * /* ev */) { - replace_work_area_->setEnabled(true); replace_work_area_->redraw(); find_work_area_->setFocus(); 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); } void FindAndReplaceWidget::hideEvent(QHideEvent *ev) { + replace_work_area_->removeEventFilter(this); find_work_area_->removeEventFilter(this); this->QWidget::hideEvent(ev); } @@ -243,7 +270,6 @@ void FindAndReplaceWidget::hideEvent(QHideEvent *ev) bool FindAndReplaceWidget::initialiseParams(std::string const & /* params */) { find_work_area_->redraw(); - replace_work_area_->setEnabled(true); replace_work_area_->redraw(); find_work_area_->setFocus(); dispatch(FuncRequest(LFUN_BUFFER_BEGIN)); diff --git a/src/frontends/qt4/ui/FindAndReplaceUi.ui b/src/frontends/qt4/ui/FindAndReplaceUi.ui index 2d9ef2b398..c13bde6372 100644 --- a/src/frontends/qt4/ui/FindAndReplaceUi.ui +++ b/src/frontends/qt4/ui/FindAndReplaceUi.ui @@ -6,32 +6,32 @@ 0 0 - 269 - 421 + 303 + 496 - + 0 0 - 220 - 360 + 0 + 0 16777215 - 500 + 496 - 300 - 400 + 0 + 0 @@ -44,11 +44,17 @@ - + 0 0 + + + + + + false @@ -62,374 +68,469 @@ 0 + + + + + + Basic - - - - QLayout::SetNoConstraint + + + + + 0 + 0 + - - - - - 0 - 0 - - - - - 0 - 60 - - - - - 16777215 - 16777215 - - - - - 0 - 128 - - - - Enter the text to search for in this full-featured LyX editing area - - - &Find... - - - - 0 + + + + + QFrame::Box + + + QFrame::Raised + + + + 4 + + + 0 + + + 4 + + + 4 + + + 0 + + + + + + 0 + 0 + - - 4 + + + 0 + 0 + - - 4 + + + 16777215 + 16777215 + - - 4 + + Enter the text to replace in this full-featured LyX editing area - - - - - 0 - 0 - - - - - 0 - 48 - - - - Enter the text to search for in this full-featured LyX editing area - - - true - - - - - 0 - 0 - 211 - 43 - + + &Replace with... + + + + 0 + + + 4 + + + 4 + + + 0 + + + + + + 0 + 0 + + + + + 0 + 0 + + + + Enter the text to replace in this full-featured LyX editing area + + + true + + + + + 0 + 0 + 237 + 79 + + + + + 0 + 0 + + + + + + + + + true - - 0 + + 1 0 - - - - - - - - 0 - 0 - - - - Case &sensitive - - - - - - - true - - - - 0 - 0 - - - + + Find next occurrence and replace it [Enter] + - Match... + Ne&xt + + + + + + + true + + + + 1 + 0 + + + + Find previous occurrence and replace it [Enter] - - - Anything + Pr&ev + + + + + + + false + + + + 0 + 0 + - - - Any non-empty + Replace &All + + + + + + + + 1 + 0 + + + + Keep the case of the replacement first letter as in each matching text first letter - - - Any word + &Keep case + + + + + + + + 1 + 0 + + + + Close this panel - - - Any number + &Close - - - - - - - true - - - - 0 - 0 - - - - &Next - - - true - - - - - - - true - - - - 0 - 0 - - - - &Prev - - - true - - - - - - - false - - - - 0 - 0 - - - - Whole &words - - - - - - - - - - - 0 - 0 - - - - - 0 - 60 - - - - - 16777215 - 16777215 - - - - Enter the text to replace in this full-featured LyX editing area - - - &Replace with... - - - - 0 + + + + + + + + + + + + + 0 + 0 + + + + QFrame::Box + + + QFrame::Raised + + + + 4 + + + 0 + + + 4 + + + 4 + + + + + + 0 + 0 + - - 4 + + + 0 + 0 + - - 4 + + + 16777215 + 16777215 + - - 4 + + + 0 + 0 + - - - - - 0 - 0 - - - - - 0 - 48 - - - - Enter the text to replace in this full-featured LyX editing area - - - true - - - - - 0 - 0 - 211 - 43 - + + Enter the text to search for in this full-featured LyX editing area + + + &Find... + + + + 0 + + + 4 + + + 4 + + + 0 + + + + + + 0 + 0 + + + + + 0 + 0 + + + Enter the text to search for in this full-featured LyX editing area + + + true + + + + + 0 + 0 + 237 + 80 + + + + + 0 + 0 + + + + + + + - + 0 0 + + Perform a case-sensitive search + + + Case &sensitive + - - - - - - true - - - - 1 - 0 - - - - Ne&xt - - - - - - - true - - - - 1 - 0 - - - - P&rev - - - - - - - false - - - - 0 - 0 - - - - Replace &All - - - - - - - - 1 - 0 - - - - Keep the case of the replacement first letter as in each matching text first letter - - - &Keep case - - - - - - - - 1 - 0 - - - - &Close - - - - - - - + + + + + true + + + + 0 + 0 + + + + Choose one of the pre-arranged regular expressions. + + + + Match... + + + + + Anything + + + + + Any non-empty + + + + + Any word + + + + + Any number + + + + + + + + true + + + + 0 + 0 + + + + Find next occurrence [Enter] + + + &Next + + + true + + + + + + + true + + + + 0 + 0 + + + + Find previous occurrence [Shift+Enter] + + + &Prev + + + true + + + + + + + false + + + + 0 + 0 + + + + Restrict search to whole words only + + + Whole &words + + + + + + + + - + 0 0 + + + + + + Advanced @@ -442,7 +543,7 @@ - false + true @@ -453,9 +554,12 @@ 0 - 112 + 0 + + Restrict the search horizon to: + false @@ -473,9 +577,18 @@ 0 - + + + false + + + + 0 + 0 + + - Current paragraph only + Current paragraph Current &Paragraph @@ -486,12 +599,21 @@ - + + + true + + + + 0 + 0 + + - Current buffer only + Document in current file - Buffer + Current Document true @@ -499,22 +621,56 @@ - + + + false + + + + 0 + 0 + + - Current file and all included files + Current file and all other files belonging to the same Master Document - Document + Master Document - + + + false + + + + 0 + 0 + + - All open buffers + All open documents + + + Open Documents + + + + + + + false + + + + 0 + 0 + - Open buffers + All Manuals @@ -563,8 +719,8 @@ - 20 - 40 + 0 + 0 -- 2.39.2