GuiSpellchecker: add 'Find Next' and 'Replace All' buttons.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30350 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2009-07-04 17:15:27 +00:00
parent 93ea135eb5
commit c95f44b0b1
3 changed files with 49 additions and 7 deletions

View File

@ -28,6 +28,7 @@
#include "Language.h" #include "Language.h"
#include "LyX.h" #include "LyX.h"
#include "LyXRC.h" #include "LyXRC.h"
#include "lyxfind.h"
#include "Paragraph.h" #include "Paragraph.h"
#include "WordLangTuple.h" #include "WordLangTuple.h"
@ -147,6 +148,15 @@ void GuiSpellchecker::on_ignorePB_clicked()
} }
void GuiSpellchecker::on_findNextPB_clicked()
{
docstring const data = find2string(
qstring_to_ucs4(d->ui.wordED->text()),
true, true, true);
dispatch(FuncRequest(LFUN_WORD_FIND, data));
}
void GuiSpellchecker::on_replacePB_clicked() void GuiSpellchecker::on_replacePB_clicked()
{ {
docstring const replacement = qstring_to_ucs4(d->ui.replaceCO->currentText()); docstring const replacement = qstring_to_ucs4(d->ui.replaceCO->currentText());
@ -163,6 +173,16 @@ void GuiSpellchecker::on_replacePB_clicked()
} }
void GuiSpellchecker::on_replaceAllPB_clicked()
{
docstring const data = replace2string(
qstring_to_ucs4(d->ui.wordED->text()),
qstring_to_ucs4(d->ui.replaceCO->currentText()),
true, true, true, true);
dispatch(FuncRequest(LFUN_WORD_REPLACE, data));
}
void GuiSpellchecker::updateSuggestions(docstring_list & words) void GuiSpellchecker::updateSuggestions(docstring_list & words)
{ {
QString const suggestion = toqstr(d->word_.word()); QString const suggestion = toqstr(d->word_.word());

View File

@ -35,6 +35,8 @@ public:
private Q_SLOTS: private Q_SLOTS:
void on_closePB_clicked(); void on_closePB_clicked();
void on_findNextPB_clicked();
void on_replaceAllPB_clicked();
void on_suggestionsLW_itemChanged(QListWidgetItem *); void on_suggestionsLW_itemChanged(QListWidgetItem *);
void on_replaceCO_highlighted(const QString & str); void on_replaceCO_highlighted(const QString & str);
void on_ignoreAllPB_clicked(); void on_ignoreAllPB_clicked();

View File

@ -6,7 +6,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>259</width> <width>259</width>
<height>536</height> <height>506</height>
</rect> </rect>
</property> </property>
<property name="windowTitle" > <property name="windowTitle" >
@ -31,6 +31,16 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1" >
<widget class="QPushButton" name="findNextPB" >
<property name="toolTip" >
<string>Replace word with current choice</string>
</property>
<property name="text" >
<string>&amp;Find Next</string>
</property>
</widget>
</item>
<item row="2" column="0" > <item row="2" column="0" >
<widget class="QLabel" name="TextLabel1" > <widget class="QLabel" name="TextLabel1" >
<property name="text" > <property name="text" >
@ -89,10 +99,20 @@
</property> </property>
</widget> </widget>
</item> </item>
<item rowspan="4" row="5" column="0" > <item row="4" column="1" >
<widget class="QPushButton" name="replaceAllPB" >
<property name="toolTip" >
<string>Replace word with current choice</string>
</property>
<property name="text" >
<string>Replace &amp;All</string>
</property>
</widget>
</item>
<item rowspan="5" row="5" column="0" >
<widget class="QListWidget" name="suggestionsLW" /> <widget class="QListWidget" name="suggestionsLW" />
</item> </item>
<item row="5" column="1" > <item row="6" column="1" >
<widget class="QPushButton" name="ignorePB" > <widget class="QPushButton" name="ignorePB" >
<property name="toolTip" > <property name="toolTip" >
<string>Ignore this word</string> <string>Ignore this word</string>
@ -102,7 +122,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="6" column="1" > <item row="7" column="1" >
<widget class="QPushButton" name="ignoreAllPB" > <widget class="QPushButton" name="ignoreAllPB" >
<property name="toolTip" > <property name="toolTip" >
<string>Ignore this word throughout this session</string> <string>Ignore this word throughout this session</string>
@ -112,7 +132,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="7" column="1" > <item row="8" column="1" >
<widget class="QPushButton" name="addPB" > <widget class="QPushButton" name="addPB" >
<property name="toolTip" > <property name="toolTip" >
<string>Add the word to your personal dictionary</string> <string>Add the word to your personal dictionary</string>
@ -122,7 +142,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="8" column="1" > <item row="9" column="1" >
<spacer name="spacer" > <spacer name="spacer" >
<property name="orientation" > <property name="orientation" >
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
@ -138,7 +158,7 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="9" column="0" > <item row="10" column="0" >
<widget class="QProgressBar" name="spellcheckPR" > <widget class="QProgressBar" name="spellcheckPR" >
<property name="value" > <property name="value" >
<number>24</number> <number>24</number>