simplify adv search/replace layout

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33867 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Edwin Leuven 2010-03-25 16:57:39 +00:00
parent ce5603d445
commit e7b1808827
3 changed files with 105 additions and 145 deletions

View File

@ -96,22 +96,21 @@ bool FindAndReplaceWidget::eventFilter(QObject * obj, QEvent * event)
break;
case Qt::Key_Enter:
case Qt::Key_Return:
if (e->modifiers() == Qt::ShiftModifier) {
if (obj == find_work_area_)
on_findPrevPB_clicked();
else
on_replacePrevPB_clicked();
return true;
} else if (e->modifiers() == Qt::NoModifier) {
if (obj == find_work_area_)
on_findNextPB_clicked();
else
on_replaceNextPB_clicked();
return true;
}
break;
case Qt::Key_Return: {
// with shift we (temporarily) change search/replace direction
bool const searchback = searchbackCB->isChecked();
if (e->modifiers() == Qt::ShiftModifier && !searchback)
searchbackCB->setChecked(!searchback);
if (obj == find_work_area_)
on_findNextPB_clicked();
else
on_replacePB_clicked();
// back to how it was
searchbackCB->setChecked(searchback);
return true;
break;
}
case Qt::Key_Tab:
if (e->modifiers() == Qt::NoModifier) {
if (obj == find_work_area_){
@ -532,28 +531,16 @@ void FindAndReplaceWidget::hideDialog()
}
void FindAndReplaceWidget::on_findNextPB_clicked() {
findAndReplace(false, false);
void FindAndReplaceWidget::on_findNextPB_clicked()
{
findAndReplace(searchbackCB->isChecked(), false);
find_work_area_->setFocus();
}
void FindAndReplaceWidget::on_findPrevPB_clicked() {
findAndReplace(true, false);
find_work_area_->setFocus();
}
void FindAndReplaceWidget::on_replaceNextPB_clicked()
void FindAndReplaceWidget::on_replacePB_clicked()
{
findAndReplace(false, true);
replace_work_area_->setFocus();
}
void FindAndReplaceWidget::on_replacePrevPB_clicked()
{
findAndReplace(true, true);
findAndReplace(searchbackCB->isChecked(), true);
replace_work_area_->setFocus();
}

View File

@ -67,9 +67,7 @@ private:
protected Q_SLOTS:
void on_findNextPB_clicked();
void on_findPrevPB_clicked();
void on_replaceNextPB_clicked();
void on_replacePrevPB_clicked();
void on_replacePB_clicked();
void on_replaceallPB_clicked();
void insertRegexp(QAction *);
};

View File

@ -5,8 +5,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>288</width>
<height>366</height>
<width>247</width>
<height>341</height>
</rect>
</property>
<property name="windowTitle">
@ -63,7 +63,7 @@
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<item row="1" column="0" colspan="3">
<widget class="lyx::frontend::EmbeddedWorkArea" name="find_work_area_">
<property name="toolTip">
<string>Enter the text to search for in this full-featured LyX editing area</string>
@ -77,39 +77,23 @@
<height>57</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="caseCB">
<property name="toolTip">
<string>Perform a case-sensitive search</string>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="text">
<string>Case &amp;sensitive</string>
<property name="sizeHint" stdset="0">
<size>
<width>52</width>
<height>20</height>
</size>
</property>
</widget>
</spacer>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="wordsCB">
<property name="enabled">
<bool>true</bool>
</property>
<property name="toolTip">
<string>Restrict search to whole words only</string>
</property>
<property name="text">
<string>Whole &amp;words</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<item row="2" column="1" colspan="2">
<widget class="QPushButton" name="regexpInsertPB">
<property name="toolTip">
<string>Choose one of the pre-arranged regular expressions.</string>
@ -119,7 +103,7 @@
</property>
</widget>
</item>
<item row="4" column="0">
<item row="3" column="0" colspan="2">
<widget class="QLabel" name="label_2">
<property name="text">
<string>&amp;Replace with:</string>
@ -129,7 +113,7 @@
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<item row="4" column="0" colspan="3">
<widget class="lyx::frontend::EmbeddedWorkArea" name="replace_work_area_">
<property name="toolTip">
<string>Enter the text to replace in this full-featured LyX editing area</string>
@ -143,89 +127,80 @@
<height>57</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</widget>
</item>
<item row="5" column="0" colspan="2">
<widget class="QCheckBox" name="caseCB">
<property name="toolTip">
<string>Perform a case-sensitive search</string>
</property>
<property name="text">
<string>Case &amp;sensitive</string>
</property>
</widget>
</item>
<item row="5" column="2">
<widget class="QPushButton" name="findNextPB">
<property name="enabled">
<bool>true</bool>
</property>
<property name="toolTip">
<string>Find next occurrence [Enter]</string>
</property>
<property name="text">
<string>Find &amp;Next</string>
</property>
<property name="default">
<bool>true</bool>
</property>
</widget>
</item>
<item row="6" column="0" colspan="2">
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QPushButton" name="findPrevPB">
<property name="enabled">
<bool>true</bool>
</property>
<property name="toolTip">
<string>Find previous occurrence [Shift+Enter]</string>
</property>
<property name="text">
<string>Find &amp;Previous</string>
</property>
<property name="default">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="findNextPB">
<property name="enabled">
<bool>true</bool>
</property>
<property name="toolTip">
<string>Find next occurrence [Enter]</string>
</property>
<property name="text">
<string>Find &amp;Next</string>
</property>
<property name="default">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="replacePrevPB">
<property name="enabled">
<bool>true</bool>
</property>
<property name="toolTip">
<string>Replace and find previous occurrence [Shift+Enter]</string>
</property>
<property name="text">
<string>Replace Pre&amp;vious</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="replaceNextPB">
<property name="enabled">
<bool>true</bool>
</property>
<property name="toolTip">
<string>Replace and find next occurrence [Enter]</string>
</property>
<property name="text">
<string>Replace Ne&amp;xt</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="replaceallPB">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Replace all occurences at once</string>
</property>
<property name="text">
<string>Replace &amp;All</string>
</property>
</widget>
</item>
</layout>
<widget class="QCheckBox" name="wordsCB">
<property name="enabled">
<bool>true</bool>
</property>
<property name="toolTip">
<string>Restrict search to whole words only</string>
</property>
<property name="text">
<string>Whole &amp;words</string>
</property>
</widget>
</item>
<item row="6" column="2">
<widget class="QPushButton" name="replacePB">
<property name="enabled">
<bool>true</bool>
</property>
<property name="toolTip">
<string>Replace and find next occurrence [Enter]</string>
</property>
<property name="text">
<string>&amp;Replace</string>
</property>
</widget>
</item>
<item row="7" column="0" colspan="2">
<widget class="QCheckBox" name="searchbackCB">
<property name="text">
<string>Search backwards</string>
</property>
</widget>
</item>
<item row="7" column="2">
<widget class="QPushButton" name="replaceallPB">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Replace all occurences at once</string>
</property>
<property name="text">
<string>Replace &amp;All</string>
</property>
</widget>
</item>
</layout>
</widget>