]> git.lyx.org Git - features.git/commitdiff
qt2 find&replace
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 6 Mar 2001 14:23:02 +0000 (14:23 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 6 Mar 2001 14:23:02 +0000 (14:23 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1692 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt2/ChangeLog
src/frontends/qt2/Dialogs.C
src/frontends/qt2/FormSearch.C [new file with mode: 0644]
src/frontends/qt2/FormSearch.h [new file with mode: 0644]
src/frontends/qt2/Makefile.am
src/frontends/qt2/searchdlg.C [new file with mode: 0644]
src/frontends/qt2/searchdlg.h [new file with mode: 0644]
src/frontends/qt2/searchdlg.ui [new file with mode: 0644]
src/frontends/qt2/searchdlgimpl.C [new file with mode: 0644]
src/frontends/qt2/searchdlgimpl.h [new file with mode: 0644]

index f31e4090a21429bbbbaf7ff210b8f1198e2eb4e2..099fcfdbd5793edc50909d316ae4eae4c4f76949 100644 (file)
@@ -1,3 +1,11 @@
+2001-03-06  Edwin Leuven  <leuven@fee.uva.nl>
+
+       * Search dialog added:
+       * FormSearch.[Ch]
+       * searchdlg.ui
+       * searchdlg.[Ch]
+       * searchdlgimpl.[Ch]
+
 2001-02-16  Edwin Leuven  <leuven@fee.uva.nl>
 
        * remove inheritance from noncopyable in Form*.h
index 1f6b9cfb02701cd2b56d0b490185432466546c49..b4ba40154c0ae40febef2c39726ef4d8e5ea11e7 100644 (file)
@@ -23,6 +23,7 @@
 #include "FormPreferences.h"
 #include "FormPrint.h"
 #include "FormRef.h"
+#include "FormSearch.h"
 #include "FormTabular.h"
 #include "FormTabularCreate.h"
 #include "FormToc.h"
@@ -56,6 +57,7 @@ Dialogs::Dialogs(LyXView * lv)
        dialogs_.push_back(new FormPreferences(lv, this));
        dialogs_.push_back(new FormPrint(lv, this));
        dialogs_.push_back(new FormRef(lv, this));
+       dialogs_.push_back(new FormSearch(lv, this));
        dialogs_.push_back(new FormTabular(lv, this));
        dialogs_.push_back(new FormTabularCreate(lv, this));
        dialogs_.push_back(new FormToc(lv, this));
diff --git a/src/frontends/qt2/FormSearch.C b/src/frontends/qt2/FormSearch.C
new file mode 100644 (file)
index 0000000..5d9a3eb
--- /dev/null
@@ -0,0 +1,109 @@
+/**
+ * \file FormSearch.C
+ * Copyright 2001 The LyX Team.
+ * See the file COPYING.
+ *
+ * \author Edwin Leuven
+ */
+
+#include <config.h>
+
+#include "searchdlgimpl.h"
+#include "FormSearch.h"
+#include "Dialogs.h"
+#include "Liason.h"
+#include "QtLyXView.h"
+#include "buffer.h"
+//#include "lyxtext.h"
+#include "lyxfind.h"
+//#include "language.h"
+#include "support/lstrings.h"
+
+#ifdef CXX_WORKING_NAMESPACES
+using Liason::setMinibuffer;
+#endif
+
+FormSearch::FormSearch(LyXView *v, Dialogs *d)
+       : dialog_(0), lv_(v), d_(d), h_(0), u_(0)
+{
+   // let the popup be shown
+   // This is a permanent connection so we won't bother
+   // storing a copy because we won't be disconnecting.
+   d->showSearch.connect(slot(this, &FormSearch::show));
+   // perhaps in the future we'd like a
+   // "search again" button/keybinding
+//    d->searchAgain.connect(slot(this, &FormSearch::FindNext));
+}
+
+
+FormSearch::~FormSearch()
+{
+   delete dialog_;
+}
+
+void FormSearch::show()
+{
+   if (!dialog_) {
+      dialog_ = new SearchDlgImpl(this, 0, _("Find and Replace"), false);
+   }
+
+   if (!dialog_->isVisible()) {
+      h_ = d_->hideBufferDependent.connect(slot(this, &FormSearch::hide));
+      u_ = d_->updateBufferDependent.connect(slot(this, &FormSearch::update));
+   }
+   
+   dialog_->raise();
+   dialog_->setActiveWindow();
+   update();
+   dialog_->show();
+}
+
+void FormSearch::find(string const & searchstr, bool const & casesensitive,
+                     bool const & matchword, bool const & searchback)
+{
+   bool found = LyXFind(lv_->view(), searchstr,        casesensitive, matchword,
+                       searchback);
+   
+   if (!found)
+     setMinibuffer(lv_, _("String not found!"));
+   
+}
+void FormSearch::replace(string const & searchstr, string const & replacestr,
+                        bool const & casesensitive, bool const & matchword, 
+                        bool const & searchback, bool const & replaceall)
+{
+   int replace_count = LyXReplace(lv_->view(), searchstr, replacestr,
+                                 casesensitive, matchword, searchback,
+                                 replaceall);
+                                 
+   if (replace_count == 0) {
+      setMinibuffer(lv_, _("String not found!"));
+   } else {
+      if (replace_count == 1) {
+        setMinibuffer(lv_, _("String has been replaced."));
+      } else {
+        string str = tostr(replace_count);
+        str += _(" strings have been replaced.");
+        setMinibuffer(lv_, str.c_str());
+      }
+   }
+}
+void FormSearch::close()
+{
+   h_.disconnect();
+   u_.disconnect();
+}
+
+void FormSearch::hide()
+{
+   dialog_->hide();
+   close();
+}
+
+void FormSearch::update(bool)
+{
+   if (!lv_->view()->available())
+     return;
+
+   dialog_->setReadOnly(lv_->buffer()->isReadonly());
+}
diff --git a/src/frontends/qt2/FormSearch.h b/src/frontends/qt2/FormSearch.h
new file mode 100644 (file)
index 0000000..3ab63ac
--- /dev/null
@@ -0,0 +1,64 @@
+/** 
+ * \file FormSearch.h
+ * Copyright 2001 The LyX Team.
+ * See the file COPYING.
+ * 
+ * \author Edwin Leuven
+ */
+
+#ifndef FORM_SEARCH_H
+#define FORM_SEARCH_H
+
+#include "DialogBase.h"
+#include "LString.h"
+#include "support/lstrings.h"
+
+class LyXView;
+class Dialogs;
+class SearchDlgImpl;
+
+class FormSearch : public DialogBase {
+public:
+   ///
+   FormSearch(LyXView *, Dialogs *);
+   ///
+   ~FormSearch();
+   
+   /// Close connections.
+   void close();
+   /// find stuff (we need access to lv_).
+   void find(string const &, bool const &, bool const &, bool const &);
+   /// replace stuff (we need access to lv_).
+   void replace(string const &, string const &, 
+               bool const &, bool const &, bool const &, bool const &);
+   
+   
+private:
+       
+   /// Show the dialog.
+   void show();
+   /// Hide the dialog.
+   void hide();
+   /// Update the dialog.
+   void update(bool switched = false);
+       
+   /// Real GUI implementation.
+   SearchDlgImpl * dialog_;
+       
+   /// the LyXView we belong to.
+   LyXView * lv_;
+       
+   /** Which Dialogs do we belong to?
+    *  Used so we can get at the signals we have to connect to.
+    */
+   Dialogs * d_;
+       
+   /// Hide connection.
+   Connection h_;
+
+   /// Update connection.
+   Connection u_;
+   
+};
+
+#endif
index 46e5d6f8522577119db301e577ffc84457fd14a6..f029fbf535db3e5e5746ba3f035c81826ee8f67a 100644 (file)
@@ -17,6 +17,8 @@ BUILTSOURCES =        moc_FormCopyrightDialogBase.C \
               moc_paragraphdlgimpl.C \
               moc_printdlg.C \
               moc_printdlgimpl.C \
+              moc_searchdlg.C \
+              moc_searchdlgimpl.C \
               moc_tabularcreatedlg.C \
               moc_tabularcreatedlgimpl.C \
               moc_emptytable.C
@@ -35,6 +37,7 @@ libqt2_la_OBJADD = \
        ../xforms/FormGraphics.lo \
        ../xforms/FormIndex.lo \
        ../xforms/FormInset.lo \
+       ../xforms/FormPreamble.lo \
        ../xforms/FormPreferences.lo \
        ../xforms/FormRef.lo \
        ../xforms/FormTabular.lo \
@@ -50,13 +53,14 @@ libqt2_la_OBJADD = \
        ../xforms/form_error.lo \
        ../xforms/form_index.lo \
        ../xforms/form_graphics.lo \
+       ../xforms/form_preamble.lo \
        ../xforms/form_preferences.lo \
        ../xforms/form_ref.lo \
        ../xforms/form_tabular.lo \
        ../xforms/form_toc.lo \
        ../xforms/form_url.lo \
        ../xforms/input_validators.lo \
-       ../xforms/xform_helpers.lo
+       ../xforms/xforms_helpers.lo
 
 LIBS=
 LDFLAGS= $(libqt2_la_OBJADD)
@@ -92,6 +96,12 @@ libqt2_la_SOURCES = \
        printdlgimpl.h \
        emptytable.C \
        emptytable.h \
+       FormSearch.C    \
+       FormSearch.h    \
+       searchdlg.C \
+       searchdlg.h \
+       searchdlgimpl.C \
+       searchdlgimpl.h \
        FormTabularCreate.C \
        FormTabularCreate.h \
        tabularcreatedlg.C \
@@ -165,3 +175,13 @@ moc_chardlg.C: chardlg.h
 moc_chardlgimpl.C: chardlgimpl.h
        $(MOC) -o $@ $<
 
+FormSearch.C: searchdlg.h
+searchdlg.h: searchdlg.ui
+       $(UIC) -o $@ $<
+searchdlg.C: searchdlg.ui
+       $(UIC) -impl searchdlg.h -o $@ $<
+moc_searchdlg.C: searchdlg.h
+       $(MOC) -o $@ $<
+moc_searchdlgimpl.C: searchdlgimpl.h
+       $(MOC) -o $@ $<
+
diff --git a/src/frontends/qt2/searchdlg.C b/src/frontends/qt2/searchdlg.C
new file mode 100644 (file)
index 0000000..11d8221
--- /dev/null
@@ -0,0 +1,148 @@
+/****************************************************************************
+** Form implementation generated from reading ui file 'searchdlg.ui'
+**
+** Created: Sun Mar 4 21:52:22 2001
+**      by:  The User Interface Compiler (uic)
+**
+** WARNING! All changes made in this file will be lost!
+****************************************************************************/
+#include "searchdlg.h"
+
+#include <qcheckbox.h>
+#include <qcombobox.h>
+#include <qlabel.h>
+#include <qpushbutton.h>
+#include <qlayout.h>
+#include <qvariant.h>
+#include <qtooltip.h>
+#include <qwhatsthis.h>
+
+/* 
+ *  Constructs a SearchDlg which is a child of 'parent', with the 
+ *  name 'name' and widget flags set to 'f' 
+ *
+ *  The dialog will by default be modeless, unless you set 'modal' to
+ *  TRUE to construct a modal dialog.
+ */
+SearchDlg::SearchDlg( QWidget* parent,  const char* name, bool modal, WFlags fl )
+    : QDialog( parent, name, modal, fl )
+{
+    if ( !name )
+       setName( "SearchDlg" );
+    resize( 379, 168 ); 
+    setCaption( tr( "Form1" ) );
+    setSizeGripEnabled( TRUE );
+    SearchDlgLayout = new QGridLayout( this ); 
+    SearchDlgLayout->setSpacing( 6 );
+    SearchDlgLayout->setMargin( 11 );
+
+    findStrLabel = new QLabel( this, "findStrLabel" );
+    findStrLabel->setText( tr( "Find:" ) );
+
+    SearchDlgLayout->addWidget( findStrLabel, 0, 0 );
+
+    find = new QComboBox( FALSE, this, "find" );
+    find->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, find->sizePolicy().hasHeightForWidth() ) );
+    find->setEditable( TRUE );
+    find->setDuplicatesEnabled( TRUE );
+    find->setFocusPolicy( QComboBox::StrongFocus );
+
+    SearchDlgLayout->addMultiCellWidget( find, 0, 0, 1, 2 );
+
+    replaceLabel = new QLabel( this, "replaceLabel" );
+    replaceLabel->setText( tr( "Replace with:" ) );
+
+    SearchDlgLayout->addWidget( replaceLabel, 1, 0 );
+
+    replace = new QComboBox( FALSE, this, "replace" );
+    replace->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, replace->sizePolicy().hasHeightForWidth() ) );
+    replace->setEditable( TRUE );
+
+    SearchDlgLayout->addMultiCellWidget( replace, 1, 1, 1, 2 );
+
+    caseSensitive = new QCheckBox( this, "caseSensitive" );
+    caseSensitive->setText( tr( "&Case sensitive" ) );
+
+    SearchDlgLayout->addMultiCellWidget( caseSensitive, 2, 2, 0, 1 );
+
+    matchWord = new QCheckBox( this, "matchWord" );
+    matchWord->setText( tr( "Match whole words onl&y" ) );
+
+    SearchDlgLayout->addMultiCellWidget( matchWord, 3, 4, 0, 1 );
+    QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
+    SearchDlgLayout->addItem( spacer, 2, 2 );
+    QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
+    SearchDlgLayout->addMultiCell( spacer_2, 6, 6, 0, 1 );
+    QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
+    SearchDlgLayout->addItem( spacer_3, 6, 3 );
+
+    findPB = new QPushButton( this, "findPB" );
+    findPB->setText( tr( "Find &Next" ) );
+
+    SearchDlgLayout->addWidget( findPB, 0, 3 );
+
+    replacePB = new QPushButton( this, "replacePB" );
+    replacePB->setText( tr( "&Replace" ) );
+
+    SearchDlgLayout->addWidget( replacePB, 1, 3 );
+
+    replaceAllPB = new QPushButton( this, "replaceAllPB" );
+    replaceAllPB->setText( tr( "Replace &All " ) );
+
+    SearchDlgLayout->addMultiCellWidget( replaceAllPB, 2, 3, 3, 3 );
+
+    searchBack = new QCheckBox( this, "searchBack" );
+    searchBack->setText( tr( "Search &backwards" ) );
+
+    SearchDlgLayout->addMultiCellWidget( searchBack, 5, 5, 0, 1 );
+
+    cancelPB = new QPushButton( this, "cancelPB" );
+    cancelPB->setText( tr( "&Cancel" ) );
+
+    SearchDlgLayout->addMultiCellWidget( cancelPB, 4, 5, 3, 3 );
+
+    // signals and slots connections
+    connect( findPB, SIGNAL( clicked() ), this, SLOT( Find() ) );
+    connect( replacePB, SIGNAL( clicked() ), this, SLOT( Replace() ) );
+    connect( replaceAllPB, SIGNAL( clicked() ), this, SLOT( ReplaceAll() ) );
+    connect( cancelPB, SIGNAL( clicked() ), this, SLOT( cancel_adaptor() ) );
+
+    // tab order
+    setTabOrder( find, replace );
+    setTabOrder( replace, caseSensitive );
+    setTabOrder( caseSensitive, matchWord );
+    setTabOrder( matchWord, searchBack );
+    setTabOrder( searchBack, findPB );
+    setTabOrder( findPB, replacePB );
+    setTabOrder( replacePB, replaceAllPB );
+    setTabOrder( replaceAllPB, cancelPB );
+}
+
+/*  
+ *  Destroys the object and frees any allocated resources
+ */
+SearchDlg::~SearchDlg()
+{
+    // no need to delete child widgets, Qt does it all for us
+}
+
+void SearchDlg::Find()
+{
+    qWarning( "SearchDlg::Find(): Not implemented yet!" );
+}
+
+void SearchDlg::Replace()
+{
+    qWarning( "SearchDlg::Replace(): Not implemented yet!" );
+}
+
+void SearchDlg::ReplaceAll()
+{
+    qWarning( "SearchDlg::ReplaceAll(): Not implemented yet!" );
+}
+
+void SearchDlg::cancel_adaptor()
+{
+    qWarning( "SearchDlg::cancel_adaptor(): Not implemented yet!" );
+}
+
diff --git a/src/frontends/qt2/searchdlg.h b/src/frontends/qt2/searchdlg.h
new file mode 100644 (file)
index 0000000..b0df71a
--- /dev/null
@@ -0,0 +1,52 @@
+/****************************************************************************
+** Form interface generated from reading ui file 'searchdlg.ui'
+**
+** Created: Sun Mar 4 21:52:20 2001
+**      by:  The User Interface Compiler (uic)
+**
+** WARNING! All changes made in this file will be lost!
+****************************************************************************/
+#ifndef SEARCHDLG_H
+#define SEARCHDLG_H
+
+#include <qvariant.h>
+#include <qdialog.h>
+class QVBoxLayout; 
+class QHBoxLayout; 
+class QGridLayout; 
+class QCheckBox;
+class QComboBox;
+class QLabel;
+class QPushButton;
+
+class SearchDlg : public QDialog
+{ 
+    Q_OBJECT
+
+public:
+    SearchDlg( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
+    ~SearchDlg();
+
+    QLabel* findStrLabel;
+    QComboBox* find;
+    QLabel* replaceLabel;
+    QComboBox* replace;
+    QCheckBox* caseSensitive;
+    QCheckBox* matchWord;
+    QPushButton* findPB;
+    QPushButton* replacePB;
+    QPushButton* replaceAllPB;
+    QCheckBox* searchBack;
+    QPushButton* cancelPB;
+
+protected slots:
+    virtual void Find();
+    virtual void Replace();
+    virtual void ReplaceAll();
+    virtual void cancel_adaptor();
+
+protected:
+    QGridLayout* SearchDlgLayout;
+};
+
+#endif // SEARCHDLG_H
diff --git a/src/frontends/qt2/searchdlg.ui b/src/frontends/qt2/searchdlg.ui
new file mode 100644 (file)
index 0000000..12d5f34
--- /dev/null
@@ -0,0 +1,290 @@
+<!DOCTYPE UI><UI>
+<class>SearchDlg</class>
+<widget>
+    <class>QDialog</class>
+    <property stdset="1">
+        <name>name</name>
+        <cstring>SearchDlg</cstring>
+    </property>
+    <property stdset="1">
+        <name>geometry</name>
+        <rect>
+            <x>0</x>
+            <y>0</y>
+            <width>379</width>
+            <height>168</height>
+        </rect>
+    </property>
+    <property stdset="1">
+        <name>caption</name>
+        <string>Form1</string>
+    </property>
+    <property stdset="1">
+        <name>sizeGripEnabled</name>
+        <bool>true</bool>
+    </property>
+    <property>
+        <name>layoutMargin</name>
+    </property>
+    <property>
+        <name>layoutSpacing</name>
+    </property>
+    <grid>
+        <property stdset="1">
+            <name>margin</name>
+            <number>11</number>
+        </property>
+        <property stdset="1">
+            <name>spacing</name>
+            <number>6</number>
+        </property>
+        <widget row="0"  column="0" >
+            <class>QLabel</class>
+            <property stdset="1">
+                <name>name</name>
+                <cstring>findStrLabel</cstring>
+            </property>
+            <property stdset="1">
+                <name>text</name>
+                <string>Find:</string>
+            </property>
+        </widget>
+        <widget row="0"  column="1"  rowspan="1"  colspan="2" >
+            <class>QComboBox</class>
+            <property stdset="1">
+                <name>name</name>
+                <cstring>find</cstring>
+            </property>
+            <property stdset="1">
+                <name>sizePolicy</name>
+                <sizepolicy>
+                    <hsizetype>3</hsizetype>
+                    <vsizetype>0</vsizetype>
+                </sizepolicy>
+            </property>
+            <property stdset="1">
+                <name>editable</name>
+                <bool>true</bool>
+            </property>
+            <property stdset="1">
+                <name>duplicatesEnabled</name>
+                <bool>true</bool>
+            </property>
+            <property stdset="1">
+                <name>focusPolicy</name>
+                <enum>StrongFocus</enum>
+            </property>
+        </widget>
+        <widget row="1"  column="0" >
+            <class>QLabel</class>
+            <property stdset="1">
+                <name>name</name>
+                <cstring>replaceLabel</cstring>
+            </property>
+            <property stdset="1">
+                <name>text</name>
+                <string>Replace with:</string>
+            </property>
+        </widget>
+        <widget row="1"  column="1"  rowspan="1"  colspan="2" >
+            <class>QComboBox</class>
+            <property stdset="1">
+                <name>name</name>
+                <cstring>replace</cstring>
+            </property>
+            <property stdset="1">
+                <name>sizePolicy</name>
+                <sizepolicy>
+                    <hsizetype>3</hsizetype>
+                    <vsizetype>0</vsizetype>
+                </sizepolicy>
+            </property>
+            <property stdset="1">
+                <name>editable</name>
+                <bool>true</bool>
+            </property>
+        </widget>
+        <widget row="2"  column="0"  rowspan="1"  colspan="2" >
+            <class>QCheckBox</class>
+            <property stdset="1">
+                <name>name</name>
+                <cstring>caseSensitive</cstring>
+            </property>
+            <property stdset="1">
+                <name>text</name>
+                <string>&amp;Case sensitive</string>
+            </property>
+        </widget>
+        <widget row="3"  column="0"  rowspan="2"  colspan="2" >
+            <class>QCheckBox</class>
+            <property stdset="1">
+                <name>name</name>
+                <cstring>matchWord</cstring>
+            </property>
+            <property stdset="1">
+                <name>text</name>
+                <string>Match whole words onl&amp;y</string>
+            </property>
+        </widget>
+        <spacer row="2"  column="2" >
+            <property>
+                <name>name</name>
+                <cstring>HSpacer1</cstring>
+            </property>
+            <property stdset="1">
+                <name>orientation</name>
+                <enum>Horizontal</enum>
+            </property>
+            <property stdset="1">
+                <name>sizeType</name>
+                <enum>Expanding</enum>
+            </property>
+            <property>
+                <name>sizeHint</name>
+                <size>
+                    <width>20</width>
+                    <height>20</height>
+                </size>
+            </property>
+        </spacer>
+        <spacer row="6"  column="0"  rowspan="1"  colspan="2" >
+            <property>
+                <name>name</name>
+                <cstring>VSpacer1</cstring>
+            </property>
+            <property stdset="1">
+                <name>orientation</name>
+                <enum>Vertical</enum>
+            </property>
+            <property stdset="1">
+                <name>sizeType</name>
+                <enum>Expanding</enum>
+            </property>
+            <property>
+                <name>sizeHint</name>
+                <size>
+                    <width>20</width>
+                    <height>20</height>
+                </size>
+            </property>
+        </spacer>
+        <spacer row="6"  column="3" >
+            <property>
+                <name>name</name>
+                <cstring>VSpacer2</cstring>
+            </property>
+            <property stdset="1">
+                <name>orientation</name>
+                <enum>Vertical</enum>
+            </property>
+            <property stdset="1">
+                <name>sizeType</name>
+                <enum>Expanding</enum>
+            </property>
+            <property>
+                <name>sizeHint</name>
+                <size>
+                    <width>20</width>
+                    <height>20</height>
+                </size>
+            </property>
+        </spacer>
+        <widget row="0"  column="3" >
+            <class>QPushButton</class>
+            <property stdset="1">
+                <name>name</name>
+                <cstring>findPB</cstring>
+            </property>
+            <property stdset="1">
+                <name>text</name>
+                <string>Find &amp;Next</string>
+            </property>
+        </widget>
+        <widget row="1"  column="3" >
+            <class>QPushButton</class>
+            <property stdset="1">
+                <name>name</name>
+                <cstring>replacePB</cstring>
+            </property>
+            <property stdset="1">
+                <name>text</name>
+                <string>&amp;Replace</string>
+            </property>
+        </widget>
+        <widget row="2"  column="3"  rowspan="2"  colspan="1" >
+            <class>QPushButton</class>
+            <property stdset="1">
+                <name>name</name>
+                <cstring>replaceAllPB</cstring>
+            </property>
+            <property stdset="1">
+                <name>text</name>
+                <string>Replace &amp;All </string>
+            </property>
+        </widget>
+        <widget row="5"  column="0"  rowspan="1"  colspan="2" >
+            <class>QCheckBox</class>
+            <property stdset="1">
+                <name>name</name>
+                <cstring>searchBack</cstring>
+            </property>
+            <property stdset="1">
+                <name>text</name>
+                <string>Search &amp;backwards</string>
+            </property>
+        </widget>
+        <widget row="4"  column="3"  rowspan="2"  colspan="1" >
+            <class>QPushButton</class>
+            <property stdset="1">
+                <name>name</name>
+                <cstring>cancelPB</cstring>
+            </property>
+            <property stdset="1">
+                <name>text</name>
+                <string>&amp;Cancel</string>
+            </property>
+        </widget>
+    </grid>
+</widget>
+<connections>
+    <connection>
+        <sender>findPB</sender>
+        <signal>clicked()</signal>
+        <receiver>SearchDlg</receiver>
+        <slot>Find()</slot>
+    </connection>
+    <connection>
+        <sender>replacePB</sender>
+        <signal>clicked()</signal>
+        <receiver>SearchDlg</receiver>
+        <slot>Replace()</slot>
+    </connection>
+    <connection>
+        <sender>replaceAllPB</sender>
+        <signal>clicked()</signal>
+        <receiver>SearchDlg</receiver>
+        <slot>ReplaceAll()</slot>
+    </connection>
+    <connection>
+        <sender>cancelPB</sender>
+        <signal>clicked()</signal>
+        <receiver>SearchDlg</receiver>
+        <slot>cancel_adaptor()</slot>
+    </connection>
+    <slot access="protected">Find()</slot>
+    <slot access="protected">Replace()</slot>
+    <slot access="protected">ReplaceAll()</slot>
+    <slot access="protected">cancel_adaptor()</slot>
+</connections>
+<tabstops>
+    <tabstop>find</tabstop>
+    <tabstop>replace</tabstop>
+    <tabstop>caseSensitive</tabstop>
+    <tabstop>matchWord</tabstop>
+    <tabstop>searchBack</tabstop>
+    <tabstop>findPB</tabstop>
+    <tabstop>replacePB</tabstop>
+    <tabstop>replaceAllPB</tabstop>
+    <tabstop>cancelPB</tabstop>
+</tabstops>
+</UI>
diff --git a/src/frontends/qt2/searchdlgimpl.C b/src/frontends/qt2/searchdlgimpl.C
new file mode 100644 (file)
index 0000000..3bd75d2
--- /dev/null
@@ -0,0 +1,59 @@
+/** 
+ * \file searchdlgimpl.h
+ * Copyright 2001 The LyX Team.
+ * See the file COPYING.
+ * 
+ * \author Edwin Leuven
+ */
+
+#include "searchdlgimpl.h"
+
+#include <qpushbutton.h>
+#include <qcombobox.h>
+#include <qcheckbox.h>
+#include <qlabel.h>
+
+
+SearchDlgImpl::SearchDlgImpl(FormSearch* form, QWidget* parent,  const char* name, bool modal, WFlags fl )
+    : SearchDlg( parent, name, modal, fl ), form_(form)
+{
+   setCaption(name);
+}
+
+SearchDlgImpl::~SearchDlgImpl()
+{
+}
+
+void SearchDlgImpl::closeEvent(QCloseEvent * e)
+{
+   form_->close();
+   e->accept();
+}
+
+void SearchDlgImpl::setReadOnly(bool readonly)
+{
+   replace->setEnabled(!readonly);
+   replaceLabel->setEnabled(!readonly);
+   replacePB->setEnabled(!readonly);
+   replaceAllPB->setEnabled(!readonly);
+}
+
+void SearchDlgImpl::Find()
+{
+   form_->find(tostr(find->currentText()).c_str(),
+              caseSensitive->isChecked(),
+              matchWord->isChecked(),
+              !searchBack->isChecked());
+}
+
+void SearchDlgImpl::Replace(bool replaceall = false)
+{
+   form_->replace(tostr(find->currentText()).c_str(),
+                 tostr(replace->currentText()).c_str(),
+                 caseSensitive->isChecked(),
+                 matchWord->isChecked(),
+                 !searchBack->isChecked(),
+                 replaceall);
+}
+
+
diff --git a/src/frontends/qt2/searchdlgimpl.h b/src/frontends/qt2/searchdlgimpl.h
new file mode 100644 (file)
index 0000000..f99ffac
--- /dev/null
@@ -0,0 +1,51 @@
+#ifndef SEARCHDLGIMPL_H
+#define SEARCHDLGIMPL_H
+
+#include "searchdlg.h"
+#include "FormSearch.h"
+
+class QCloseEvent;
+
+class SearchDlgImpl : public SearchDlg
+{ 
+    Q_OBJECT
+
+
+ public:
+    
+   SearchDlgImpl(FormSearch * form, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
+    
+   ~SearchDlgImpl();
+   
+   void setReadOnly(bool);
+   
+   void Replace(bool);
+ protected:
+   
+   void closeEvent(QCloseEvent * e);
+
+ private:
+   
+   FormSearch * form_;
+
+ protected slots:
+    
+   void Find();
+    
+   void Replace() {
+      Replace(false);
+   };
+    
+   void ReplaceAll() {
+      Replace(true);
+   };
+   
+   void cancel_adaptor() {
+      form_->close();
+      hide();
+   }
+
+};
+
+#endif // SEARCHDLGIMPL_H