Source Code (Use browser search to find items of interest.)

Class Index

klyx'FindReplaceDialog (./klyx/src/FindReplaceDialog.h:16)

class FindReplaceDialog : public QDialog
{
  Q_OBJECT

public:
  FindReplaceDialog ( LyXView* view, QWidget * parent=0, const char * name=0, 
		      WFlags f=0 );

  QString getSearchText() const { return findED->text(); }
  QString getReplaceText() const { return replaceED->text(); }
  void setSearchText( QString _text ) { findED->setText( _text ); }
  bool isCaseSensitive() const { return casesensitiveCB->isChecked(); }
  bool isMatchWord() const { return matchwordCB->isOn(); }
  void setReplaceEnabled( bool _enable );

private slots:
  void replaceClicked();
  void replaceAllClicked();
  void backwardClicked();
  void forwardClicked();

private:
  LyXView* _view;

  QLineEdit* findED;
  QLineEdit* replaceED;
  QPushButton* replacePB;
  QPushButton* replaceAllPB;
  QCheckBox* casesensitiveCB;
  QCheckBox* matchwordCB;
};


#endif

/*
 * $Log: FindReplaceDialog.h,v $
 * Revision 1.4  1999/11/20 17:38:36  kalle
 * Qt changed signal signatures, more Unicode-safe
 *
 * Revision 1.3  1999/01/28 09:57:58  kuepper
 * Daniel Nabers enhancements of the Find&Replace dialog + some tweaks.
 *
 * Revision 1.2  1998/03/15 07:11:13  kalle
 * More Qt-ified
 *
 * Revision 1.1  1998/01/27 20:42:58  kalle
 * Implemented new find and replace dialog
 * 1839 XForms calls left!
 *
 */

klyx'FindReplaceDialog::FindReplaceDialog() (./klyx/src/FindReplaceDialog.C:19)

FindReplaceDialog::FindReplaceDialog( LyXView *view, QWidget *parent,
				      const char *name, WFlags f )
    : QDialog( parent, name, false, f ),
      _view( view )
{
    // toplevel layout
    QVBoxLayout *vlayout1 = new QVBoxLayout( this, 10 );
    // the line edits
    QGridLayout *grid  = new QGridLayout( 3, 2, 5 );
    // the replace buttons
    QHBoxLayout *hlayout1 = new QHBoxLayout( 8 );
  
    vlayout1->addStretch( 2 );
    vlayout1->addLayout( grid, 1 );
    vlayout1->addStretch( 2 );
  
    QLabel* findLA = new QLabel( i18n( "&Find" ), this );
    findLA->adjustSize();
    findLA->setMinimumSize( findLA->size() );
    grid->addWidget( findLA, 0, 0 );
    findLA->setAlignment( AlignVCenter | AlignRight );
    findED = new QLineEdit( this );
    findED->adjustSize();
    findED->setFixedHeight( findED->height() );
    findED->setFocus();
    findED->setMinimumWidth( findED->width() );
    grid->addWidget( findED, 0, 1 );
    findLA->setBuddy( findED );

    QLabel* replaceLA = new QLabel( i18n( "Replace &with" ), this );
    replaceLA->adjustSize();
    replaceLA->setMinimumSize(replaceLA->size());
    grid->addWidget(replaceLA, 1, 0);
    replaceLA->setAlignment( AlignVCenter | AlignRight );
    grid->setColStretch(0, 1);
    grid->setColStretch(1, 5);
    replaceED = new QLineEdit( this );
    replaceED->adjustSize();
    replaceED->setFixedHeight( replaceED->height() );
    replaceED->setMinimumWidth( replaceED->width() );
    grid->addWidget( replaceED, 1, 1 );
    replaceLA->setBuddy( replaceED );
    grid->addLayout( hlayout1, 2, 1 );

    KIconLoader* loader = KGlobal::iconLoader();
    QPushButton* backwardPB = new QPushButton( this );
    hlayout1->addWidget( backwardPB );
    backwardPB->setPixmap( loader->loadIcon( "left.xpm" ) );
    backwardPB->adjustSize();
    backwardPB->setFixedSize( backwardPB->size() );
    QObject::connect( backwardPB, SIGNAL( clicked() ), this, SLOT( backwardClicked() ) );

    QPushButton* forwardPB = new QPushButton( this );
    hlayout1->addWidget( forwardPB );
    forwardPB->setPixmap( loader->loadIcon( "right.xpm" ) );
    forwardPB->adjustSize();
    forwardPB->setFixedSize( forwardPB->size() );
    QObject::connect( forwardPB, SIGNAL( clicked() ), this, SLOT( forwardClicked() ) );

    replacePB = new QPushButton( i18n( "&Replace" ), this );
    replacePB->adjustSize();
    replacePB->setFixedHeight( replacePB->height() );
    replacePB->setMinimumWidth( replacePB->width() );
    hlayout1->addWidget( replacePB );
    QObject::connect( replacePB, SIGNAL( clicked() ), this, SLOT( replaceClicked() ) );

    replaceAllPB = new QPushButton( i18n( "Replace &All" ), this );
    replaceAllPB->adjustSize();
    replaceAllPB->setFixedHeight(replaceAllPB->height());
    replaceAllPB->setMinimumWidth(replaceAllPB->width());
    hlayout1->addWidget(replaceAllPB);
    QObject::connect( replaceAllPB, SIGNAL( clicked() ), this, SLOT( replaceAllClicked() ) );

    QGroupBox* optionsGB = new QGroupBox( i18n( "Options" ), this );
    vlayout1->addWidget(optionsGB, 0);
    // the options
    QVBoxLayout *vlayout2 = new QVBoxLayout(optionsGB, 18, 5);
    vlayout2->addStretch(1);

    casesensitiveCB = new QCheckBox( i18n( "Ca&se sensitive" ), optionsGB);
    casesensitiveCB->adjustSize();
    casesensitiveCB->setFixedHeight(casesensitiveCB->height());
    casesensitiveCB->setMinimumWidth(casesensitiveCB->width());
    vlayout2->addWidget(casesensitiveCB, 3, AlignCenter);
    vlayout2->addStretch(1);
    casesensitiveCB->setChecked( false );
  
    matchwordCB = new QCheckBox( i18n( "&Match word" ), optionsGB);
    matchwordCB->adjustSize();
    matchwordCB->setFixedHeight(matchwordCB->height());
    matchwordCB->setMinimumWidth(matchwordCB->width());
    vlayout2->addWidget(matchwordCB, 3);
    vlayout2->addStretch(1);
    vlayout2->activate();
    matchwordCB->setChecked( false );

    QPushButton* closePB = new QPushButton( i18n( "&Close" ), this );
    closePB->adjustSize();
    closePB->setMinimumSize( closePB->size() );
    closePB->setMaximumSize( closePB->width() * 3 / 2, closePB->height() );
  
    vlayout1->addWidget(closePB, 0);
    vlayout1->addStretch(2);
    QObject::connect( closePB, SIGNAL( clicked() ), this, SLOT( hide() ) );
    vlayout1->activate();
    resize(10, 10);

    setCaption( i18n( "Find and Replace" ) );
}



klyx'FindReplaceDialog::replaceClicked() (./klyx/src/FindReplaceDialog.C:130)

void FindReplaceDialog::replaceClicked()
{
    _view->getFR()->SearchReplaceCB();
}



klyx'FindReplaceDialog::replaceAllClicked() (./klyx/src/FindReplaceDialog.C:136)

void FindReplaceDialog::replaceAllClicked()
{
    _view->getFR()->SearchReplaceAllCB();
}



klyx'FindReplaceDialog::backwardClicked() (./klyx/src/FindReplaceDialog.C:142)

void FindReplaceDialog::backwardClicked()
{
    _view->getFR()->SearchCB( false );
}



klyx'FindReplaceDialog::forwardClicked() (./klyx/src/FindReplaceDialog.C:148)

void FindReplaceDialog::forwardClicked()
{
    _view->getFR()->SearchCB( true );
}



klyx'FindReplaceDialog::setReplaceEnabled() (./klyx/src/FindReplaceDialog.C:154)

void FindReplaceDialog::setReplaceEnabled( bool _enable )
{
    replaceED->setEnabled( _enable );
    replacePB->setEnabled( _enable );
}


// Local Variables:
// mode: C++
// c-file-style: "Stroustrup"
// End: